/* Вкладка «Тикеты» */
.tk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; }
.tk-nav { display: flex; align-items: center; gap: 8px; }
.tk-arrow { padding: 6px 12px; font-size: 16px; line-height: 1; }
.tk-nav b { min-width: 150px; text-align: center; color: var(--text-hi); font-weight: 600; font-variant-numeric: tabular-nums; }
.tk-nav.off { visibility: hidden; }

/* Лидер в шапке: аватар и ник обычным регистром, без огромного заголовка */
.banner-stats .tk-lead { display: flex; align-items: center; gap: 10px; max-width: 280px; }
.banner-stats .tk-lead p { margin: 0; min-width: 0; }
.banner-stats .tk-lead b { font: 600 15px/1.25 var(--font-body); text-transform: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.banner-stats .tk-lead .tr-avatar { width: 34px; height: 34px; flex: none; }

/* Хотлайнеры — полосой над таблицей, чтобы таблица с полной цепочкой шла во всю ширину */
.tk-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.tk-h { display: flex; align-items: baseline; gap: 8px; margin: 0 0 10px; font: 600 14px var(--font-body); color: var(--text-hi); }
.tk-h small { font-weight: 500; font-size: 12.5px; color: var(--text-mute); }
.tk-h .link-btn { margin-left: auto; }

/* Рейтинг хотлайнеров: строка = место, человек, полоса доли, число */
.tk-rank { list-style: none; margin: 0; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px; }
.tk-rank-row { width: 100%; display: grid; grid-template-columns: 22px 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background var(--dur-fast, .15s); }
.tk-rank-row:hover { background: var(--bg-3); }
.tk-rank-row.active { background: color-mix(in srgb, var(--accent) 14%, var(--bg-2)); box-shadow: inset 2px 0 0 var(--accent); }
.tk-place { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--text-mute); text-align: center; }
.tk-rank li:first-child .tk-place { color: color-mix(in srgb, var(--accent) 55%, #fff); font-weight: 700; }
.tk-rank-who { min-width: 0; display: grid; gap: 2px; }
.tk-rank-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-hi); font-weight: 600; }
.tk-rank-who small { color: var(--text-mute); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-meter { display: block; height: 3px; margin-top: 4px; border-radius: 2px; background: var(--bg-4); }
.tk-meter > i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.tk-count { font: 600 18px var(--font-head); font-variant-numeric: tabular-nums; color: var(--text-hi); min-width: 2ch; text-align: right; }

/* Список тикетов */
.tk-list .norm-table-wrap { border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); }
.tk-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tk-table th, .tk-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tk-table thead th { position: sticky; top: 0; z-index: 1; background: var(--bg-3); font: 600 12px/1.3 var(--font-body); color: var(--text-dim); }
.tk-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tk-table tbody tr:last-child td { border-bottom: 0; }
.tk-table tbody tr:hover td { background: var(--bg-3); }
.tk-no b { font-variant-numeric: tabular-nums; color: var(--text-hi); }
.tk-no small { display: block; color: var(--text-mute); font-size: 11.5px; }
.tk-time { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text); }
.tk-log { width: 1%; text-align: right; padding-left: 4px !important; }
.tk-log-link { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: var(--text-dim); border: 1px solid var(--line); }
.tk-log-link:hover, .tk-log-link:focus-visible { color: var(--accent); border-color: var(--accent); }
.tk-log-link svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.tk-person { display: flex; align-items: center; gap: 9px; min-width: 0; }
.tk-person b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; font-weight: 600; }
.tk-did { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--text-mute); }
.tk-reason { min-width: 120px; color: var(--text); overflow-wrap: anywhere; }
.tk-reason::first-letter { text-transform: uppercase; }
.tk-tickets { min-width: 980px; }
.tk-server { display: inline-flex; align-items: center; white-space: nowrap; font-size: 12.5px; color: var(--text); }
.tk-server .server-logo { width: 14px; height: 14px; margin-right: 6px; vertical-align: 0; }

/* ─── Открытые тикеты ─── */
.tk-open { display: grid; gap: 10px; margin-bottom: 18px; }
.tk-open-empty { padding: 14px 16px; border: 1px dashed var(--line-2); border-radius: 12px; color: var(--text-mute); font-size: 13px; }
.tk-open-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.tk-open-card { display: grid; gap: 10px; padding: 14px 16px; border: 1px solid color-mix(in srgb, #3ecf8e 30%, var(--line)); border-radius: 14px; background: linear-gradient(135deg, rgba(62, 207, 142, .07), var(--bg-2) 55%); color: var(--text); text-align: left; cursor: pointer; transition: border-color var(--transition-fast), transform var(--transition-fast); }
.tk-open-card:hover { border-color: #3ecf8e; transform: translateY(-1px); }
.tk-open-top { display: flex; align-items: center; gap: 10px; }
.tk-open-top b { color: var(--text-hi); font: 700 16px var(--font-mono); }
.tk-live, .tk-closed { margin-left: auto; padding: 2px 9px; border-radius: 999px; font: 700 11px var(--font-body); font-style: normal; text-transform: uppercase; letter-spacing: .05em; }
.tk-live { background: rgba(62, 207, 142, .15); color: #5fe0aa; }
.tk-live::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: #5fe0aa; vertical-align: 1px; animation: tkPulse 1.6s ease-in-out infinite; }
@keyframes tkPulse { 50% { opacity: .3; } }
.tk-closed { background: var(--bg-3); color: var(--text-mute); }
.tk-open-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--text-mute); font-size: 12px; }
.tk-open-meta span { display: inline-flex; align-items: center; gap: 4px; }
.tk-open-meta svg, .tk-open-go svg, .tk-chat-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tk-open-go { display: inline-flex; align-items: center; gap: 6px; justify-self: start; padding: 5px 10px; border-radius: 8px; background: rgba(62, 207, 142, .12); color: #5fe0aa; font: 600 12.5px var(--font-body); }

/* Кнопка переписки в таблице закрытых */
.tk-log { white-space: nowrap; }
.tk-chat-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: 4px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg-2); color: var(--text-dim); cursor: pointer; vertical-align: middle; }
.tk-chat-btn:hover { border-color: var(--accent); color: var(--accent-light); }

/* ─── Окно переписки ─── */
.tk-chat-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: -6px 0 12px; color: var(--text-dim); font-size: 13px; }
.tk-chat-head .tk-live, .tk-chat-head .tk-closed { margin-left: 0; }
.tk-chat-people { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; color: var(--text-mute); font-size: 12.5px; }
.tk-chat-people span { padding: 2px 8px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--text); }
.tk-chat-search { margin-bottom: 10px; max-width: none; }
.tk-chat { display: grid; gap: 2px; max-height: min(62vh, 720px); overflow-y: auto; padding: 10px 6px; border: 1px solid var(--line); border-radius: 12px; background: #16171b; }
.tk-msg { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 6px 10px; border-radius: 8px; }
.tk-msg:not(.cont) { margin-top: 10px; }
.tk-msg:hover { background: rgba(255, 255, 255, .025); }
.tk-msg-ava { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.tk-msg-ava.ph { display: grid; place-items: center; background: var(--bg-3); color: var(--text-dim); font-weight: 700; }
.tk-msg-ava-gap { width: 40px; }
.tk-msg-body { min-width: 0; }
.tk-msg-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.tk-msg-head b { color: var(--text-hi); font-size: 14px; }
.tk-msg-head time { color: var(--text-mute); font-size: 11.5px; }
.tk-msg-head .muted { font-size: 12px; }
.tk-bot { padding: 0 5px; border-radius: 4px; background: #5865f2; color: #fff; font: 700 10px/16px var(--font-body); font-style: normal; text-transform: uppercase; }
.tk-msg-text { color: var(--text); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.tk-msg-text a, .tk-msg-embed a { color: #00a8fc; }
.tk-msg-embed { margin-top: 6px; padding: 8px 12px; border-left: 4px solid var(--accent); border-radius: 4px; background: #1e1f24; font-size: 13px; }
.tk-msg-embed b { display: block; color: var(--text-hi); margin-bottom: 2px; }
.tk-msg-embed p { margin: 0; color: var(--text-dim); line-height: 1.45; }
.tk-msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tk-msg-img img { display: block; max-width: 320px; max-height: 240px; border-radius: 8px; border: 1px solid var(--line); }
.tk-msg-file { padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg-2); color: #00a8fc; font-size: 13px; }
.tk-msg.bot .tk-msg-text { color: var(--text-dim); }
