/* Support: ticket history, a new ticket and a ticket thread. Every rule sits under `.support`. */
.support { --bubble-user: #2a2a2a; --bubble-support: #161616; --danger: #ff8585; }
.support button, .support textarea { font: inherit; }
.support textarea:focus-visible { outline: none; }
.support .visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.support { max-width: 680px; margin: 16px auto 0; }
.support.is-entering > * { animation: support-content-in .38s cubic-bezier(.16, 1, .3, 1) both; }
.support.is-entering > :nth-child(2) { animation-delay: .04s; }
.support.is-entering > :nth-child(3) { animation-delay: .08s; }
@keyframes support-content-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* History */
.support .support-head h1, .support .page-title { font-size: 36px; font-weight: 650; line-height: 1.15; letter-spacing: -.035em; }
.support .page-copy { margin-top: 10px; color: var(--muted); font-size: 17px; line-height: 1.5; }

.support .support-create { display: flex; align-items: center; justify-content: center; margin-top: 28px; padding: 22px; border-radius: 24px; background: var(--surface-card); color: #fff; font-size: 25.76px; font-weight: 750; line-height: 1.2; letter-spacing: -.025em; text-align: center; transition: background-color .2s, transform .2s; }
.support .support-create:hover { background: var(--surface-card-hover); transform: translateY(-1px); }

.support .tickets { margin-top: 44px; }
.support .section-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; font-size: 22px; font-weight: 600; letter-spacing: -.025em; }
.support .section-title span { color: var(--muted); font-size: 16px; font-weight: 500; }
.support .ticket-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.support .ticket-row { display: grid; gap: 10px; padding: 22px 24px; border-radius: 28px; background: var(--surface-card); transition: background-color .15s ease; }
.support .ticket-row:hover { background: var(--surface-card-hover); }
.support .ticket-row-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.support .ticket-row-top time { flex: none; color: #8c8c8c; font-size: 14px; }
.support .ticket-title { display: -webkit-box; overflow: hidden; font-size: 20px; font-weight: 620; line-height: 1.3; letter-spacing: -.015em; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.support .ticket-row.is-resolved { background: #111; }
.support .ticket-row.is-resolved:hover { background: #161616; }
.support .ticket-row.is-resolved .ticket-title { color: #a6a6a6; }
.support .tickets-empty { padding: 28px 24px; border-radius: 28px; background: #111; color: var(--muted); font-size: 16px; line-height: 1.5; }

.support .ticket-status { color: #b5b5b5; font-size: 14px; font-weight: 600; white-space: nowrap; }
.support .ticket-status[data-tone="answer"] { color: var(--accent); }
.support .ticket-status[data-tone="resolved"] { color: #888; }

/* Way back: the small pill from login. */
.support .back-pill { display: inline-flex; height: 36px; align-items: center; gap: 2px; margin: 0 0 22px -4px; padding: 0 14px 0 8px; border-radius: 999px; background: #1b1b1b; color: #999; font-size: 15px; font-weight: 600; transition: background-color .15s ease, color .15s ease; }
.support .back-pill svg { width: 20px; height: 20px; stroke-width: 2.2; }
.support .back-pill:hover { background: #242424; color: #fff; }

/* New ticket */
.support .new-form { display: grid; gap: 28px; margin-top: 32px; }
.support .topic-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.support .topic-field legend { margin-bottom: 12px; padding: 0; color: #aaa; font-size: 14px; }
.support .topic-list { display: flex; flex-wrap: wrap; gap: 10px; }
.support .topic-chip { position: relative; cursor: pointer; }
.support .topic-chip input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.support .topic-chip span { display: inline-flex; min-height: 48px; align-items: center; padding: 0 18px; border-radius: 999px; background: #202020; color: #aaa; font-size: 16px; font-weight: 600; transition: background-color .15s ease, color .15s ease; }
.support .topic-chip:hover span { background: #2a2a2a; color: #fff; }
.support .topic-chip input:checked + span { background: #e9e9e9; color: #080808; }
.support .topic-chip input:focus-visible + span { outline: 2px solid #fff; outline-offset: 2px; }

.support .message-box { border: 1px solid #484848; border-radius: 32px; background: #111; transition: border-color .2s, background-color .2s; }
.support .message-box:hover { border-color: #5d5d5d; }
.support .message-box:focus-within { border-color: #7a7a7a; background: #141414; }
.support .message-box textarea { display: block; width: 100%; min-height: 168px; max-height: 50vh; padding: 24px 28px 8px; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); font-size: 19px; line-height: 1.5; }
.support .message-box textarea::placeholder { color: #676767; }
.support .message-box textarea[aria-invalid="true"]::placeholder { color: #a86b6b; }
.support .message-box-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 14px 14px; }
.support .attach-button { display: inline-flex; height: 40px; align-items: center; gap: 6px; padding: 0 14px 0 10px; border: 0; border-radius: 999px; background: #202020; color: #aaa; font-size: 14px; font-weight: 600; transition: background-color .15s ease, color .15s ease; }
.support .attach-button svg { width: 18px; height: 18px; }
.support .attach-button:hover { background: #2a2a2a; color: #fff; }
.support .field-error { margin-top: 10px; color: var(--danger); font-size: 14px; line-height: 1.4; }

.support .pending-files { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.support .file-chip { display: inline-flex; max-width: 100%; height: 40px; align-items: center; gap: 8px; padding: 0 6px; border-radius: 14px; background: #202020; color: #ccc; font-size: 14px; }
.support .file-chip img { width: 28px; height: 28px; flex: none; border-radius: 8px; object-fit: cover; }
.support .file-chip > svg { width: 18px; height: 18px; flex: none; margin-left: 4px; color: #8a8a8a; }
.support .file-chip span { overflow: hidden; max-width: 180px; text-overflow: ellipsis; white-space: nowrap; }
.support .file-chip button { display: grid; width: 28px; height: 28px; flex: none; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #888; }
.support .file-chip button svg { width: 16px; height: 16px; stroke-width: 2.2; }
.support .file-chip button:hover { background: #303030; color: #fff; }

/* The calm primary pill from login: #353535 with accent text. */
.support .action { display: inline-flex; min-height: 60px; align-items: center; justify-content: center; justify-self: end; padding: 0 40px; border: 0; border-radius: 999px; background: #353535; color: var(--accent); font-size: 18px; font-weight: 650; transition: background-color .2s ease, color .2s ease; }
.support .action:hover { background: #414141; color: #ffdc85; }

/* Thread */
.support .thread { display: flex; min-height: calc(100dvh - 16px); flex-direction: column; }
/* Back and «Вопрос решён» stay reachable in a long thread: the bar sticks to the top. */
.support .thread-bar { position: sticky; z-index: 6; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -16px 0 2px; padding: 16px 0 20px; background: linear-gradient(to bottom, var(--bg) 72%, transparent); }
.support .thread-bar .back-pill { margin: 0 0 0 -4px; }
.support .thread-title { font-size: 30px; font-weight: 650; line-height: 1.2; letter-spacing: -.03em; overflow-wrap: anywhere; }
.support .thread-meta { margin-top: 12px; color: #8c8c8c; font-size: 15px; }
.support .resolve-button { display: inline-flex; flex: none; height: 40px; align-items: center; gap: 6px; padding: 0 16px 0 12px; border: 0; border-radius: 999px; background: #1b1b1b; color: #c6c6c6; font-size: 14px; font-weight: 600; transition: background-color .15s ease, color .15s ease; }
.support .resolve-button svg { width: 18px; height: 18px; color: var(--green); stroke-width: 2.2; }
.support .resolve-button:hover { background: #242424; color: #fff; }
.support .resolved-mark { display: inline-flex; flex: none; align-items: center; gap: 6px; padding-right: 4px; color: #888; font-size: 14px; font-weight: 600; }
.support .resolved-mark svg { width: 18px; height: 18px; color: var(--green); stroke-width: 2.2; }

.support .messages { display: flex; flex: 1; flex-direction: column; margin: 0; padding: 20px 0 12px; list-style: none; }
.support .day-divider { align-self: center; margin: 20px 0 6px; }
.support .day-divider span { display: inline-block; padding: 6px 12px; border-radius: 999px; background: #111; color: #7a7a7a; font-size: 13px; font-weight: 600; }
.support .system-message { align-self: center; max-width: 80%; margin: 12px 0 2px; color: #6f6f6f; font-size: 13px; line-height: 1.45; text-align: center; }
.support .message { display: flex; max-width: min(78%, 520px); flex-direction: column; margin-top: 14px; }
.support .message.is-continued { margin-top: 4px; }
.support .message.is-user { align-self: flex-end; align-items: flex-end; }
.support .message.is-support { align-self: flex-start; align-items: flex-start; }
.support .bubble { max-width: 100%; padding: 12px 16px 8px; font-size: 16.5px; line-height: 1.45; }
.support .bubble p { white-space: pre-wrap; overflow-wrap: anywhere; }
.support .bubble time { display: block; margin-top: 4px; color: #7c7c7c; font-size: 12px; text-align: right; }
.support .is-user .bubble { border-radius: 22px 22px 8px 22px; background: var(--bubble-user); color: #f0f0f0; }
.support .is-user .bubble time { color: #969696; }
.support .is-user.is-continued .bubble { border-top-right-radius: 8px; }
.support .is-support .bubble { border-radius: 22px 22px 22px 8px; background: var(--bubble-support); }
.support .is-support.is-continued .bubble { border-top-left-radius: 8px; }
.support .message-files { display: grid; gap: 6px; margin: 0 0 8px; padding: 0; list-style: none; }
.support .message-files .file-chip { padding-right: 12px; background: #ffffff10; }
.support .message-image img { display: block; max-width: 100%; max-height: 260px; border-radius: 14px; }

/* Composer sticks to the bottom so the reply box is always one tap away. */
.support .composer { position: sticky; z-index: 5; bottom: 0; display: grid; gap: 8px; padding: 14px 0 calc(20px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 75%, transparent); }
.support .composer-box { display: flex; align-items: flex-end; gap: 6px; padding: 6px; border-radius: 28px; background: #1e1e1e; transition: background-color .2s; }
.support .composer-box:focus-within { background: #232323; }
.support .composer-box textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 180px; padding: 11px 6px; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); font-size: 16px; line-height: 22px; }
.support .composer-box textarea::placeholder { color: #6a6a6a; }
.support .composer-icon, .support .composer-send { display: grid; width: 44px; height: 44px; flex: none; place-items: center; padding: 0; border: 0; border-radius: 50%; transition: background-color .15s ease, color .15s ease; }
.support .composer-icon { background: transparent; color: #8a8a8a; }
.support .composer-icon:hover { background: #2c2c2c; color: #fff; }
.support .composer-send { background: #353535; color: var(--accent); }
.support .composer-send svg { stroke-width: 2.4; }
.support .composer-send:hover:not(:disabled) { background: #414141; color: #ffdc85; }
.support .composer-send:disabled { background: #2a2a2a; color: #555; cursor: default; }

/* Live states the prototype did not need. */
.support .page-state { padding: 28px 0; color: var(--muted); }
.support .page-state button { margin-top: 12px; }
.support .history-more { align-self: center; margin: 4px 0 8px; color: #6f6f6f; font-size: 13px; }
.support .message-file-link { display: inline-flex; max-width: 100%; height: 40px; align-items: center; gap: 8px; padding: 0 12px 0 6px; border-radius: 14px; background: #ffffff10; color: #ddd; font-size: 14px; }
.support .message-file-link > svg { width: 18px; height: 18px; flex: none; margin-left: 4px; color: #8a8a8a; }
.support .message-file-link span { overflow: hidden; max-width: 220px; text-overflow: ellipsis; white-space: nowrap; }
.support .message-file-link:hover { background: #ffffff1a; color: #fff; }
.support .message-image a { display: block; }
.support .file-chip.is-uploading { opacity: .6; }
.support .file-chip.is-failed { box-shadow: inset 0 0 0 1px #ff858566; color: var(--danger); }
.support .composer-error { margin: 0 8px; color: var(--danger); font-size: 14px; }
.support .action:disabled, .support .composer-send[aria-busy="true"], .support .resolve-button:disabled { opacity: .6; cursor: progress; }

@media (max-width: 820px) {
  /* Inside a ticket the dock gives way to the composer, like any messenger. */
  body:is([data-support-view="thread"], [data-support-view="new"]) .main-nav { display: none; }
  body:is([data-support-view="thread"], [data-support-view="new"]) .app { padding-bottom: 0; }
  .support { margin-top: 32px; }
  .support .support-head h1, .support .page-title { font-size: 30px; }
  .support .page-copy { font-size: 16px; }
  .support .support-create { padding: 20px; font-size: 21px; }
  .support .tickets { margin-top: 36px; }
  .support .section-title { font-size: 20px; }
  .support .ticket-row { padding: 18px 20px; border-radius: 24px; }
  .support .ticket-title { font-size: 18px; }
  .support .new-form { gap: 24px; margin-top: 28px; padding-bottom: 24px; }
  .support .topic-chip span { min-height: 44px; padding: 0 16px; font-size: 15px; }
  .support .message-box { border-radius: 28px; }
  .support .message-box textarea { min-height: 150px; padding: 20px 22px 8px; font-size: 17px; }
  .support .action { width: 100%; min-height: 56px; }
  .support .thread { min-height: 100dvh; padding-top: 0; }
  .support .thread-bar { padding-top: calc(12px + env(safe-area-inset-top)); }
  .support .thread-title { font-size: 24px; }
  .support .thread-meta { font-size: 14px; }
  .support .message { max-width: 86%; }
  .support .bubble { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) { .support *, .support.is-entering > * { transition: none !important; animation: none !important; } }
