/* ============ Yordam / Support widget ============ */
.help { position: fixed; right: clamp(16px, 3vw, 28px); bottom: clamp(16px, 3vw, 28px); z-index: 80; font-family: var(--font, "Plus Jakarta Sans", sans-serif); }
.help-fab { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; border: none; cursor: pointer;
  background: var(--action, #1F6FD0); color: #fff; box-shadow: 0 14px 34px color-mix(in srgb, var(--action, #1F6FD0) 46%, transparent); transition: transform .2s cubic-bezier(.34,1.56,.64,1), background .2s; }
.help-fab:hover { transform: translateY(-2px) scale(1.04); }
.help-fab svg { width: 27px; height: 27px; transition: transform .3s; display: block; }
.help-fab .ic-chat, .help-fab .ic-close { display: grid; place-items: center; grid-area: 1 / 1; }
.help-fab .ic-close { display: none; }
.help.open .help-fab .ic-close { display: grid; }
.help.open .help-fab .ic-chat { display: none; }
.help-fab .fab-dot { position: absolute; top: 3px; right: 3px; width: 13px; height: 13px; border-radius: 50%; background: #22C55E; border: 2.5px solid var(--action, #1F6FD0); }
.help.open .help-fab .fab-dot { display: none; }
.help-fab.has-unread .fab-dot { background: #EF4444; animation: mic-pulse 1.2s infinite; }

/* panel */
.help-panel { position: absolute; right: 0; bottom: 74px; width: min(384px, calc(100vw - 32px)); height: min(580px, calc(100vh - 130px));
  background: var(--surface, #fff); border: 1px solid var(--border, #E4E7F2); border-radius: 22px; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: 0 30px 70px rgba(14,30,64,.28); transform-origin: bottom right;
  animation: help-pop .26s cubic-bezier(.34,1.4,.5,1) both; }
@keyframes help-pop { from { opacity: 0; transform: translateY(16px) scale(.94); } to { opacity: 1; transform: none; } }
.help-panel[hidden] { display: none !important; }
[data-theme="dark"] .help-panel { box-shadow: 0 30px 70px rgba(0,0,0,.55); }

/* tabs */
.help-tabs { display: flex; padding: 6px 10px 0; gap: 4px; border-bottom: 1px solid var(--border, #E4E7F2); background: var(--surface, #fff); flex: 0 0 auto; }
.help-tab { flex: 1; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 15px 8px 14px;
  background: none; border: none; cursor: pointer; font: inherit; font-size: 15px; font-weight: 700; color: var(--ink-3, #8E96AC); transition: color .16s; }
.help-tab svg { width: 18px; height: 18px; }
.help-tab:hover { color: var(--ink-2, #5A6175); }
.help-tab.on { color: var(--action, #1F6FD0); }
.help-tab.on::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2.5px; border-radius: 3px; background: var(--action, #1F6FD0); }
.help-tab .t-dot { width: 8px; height: 8px; border-radius: 50%; background: #22C55E; }
.help-tab.off-dot .t-dot { background: var(--ink-3, #8E96AC); }

/* views */
.help-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.help-view[hidden] { display: none; }

/* messages */
.help-msgs { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 20px 18px; display: flex; flex-direction: column; gap: 4px; background: var(--surface-2, #F7F8FD); scrollbar-width: thin; scrollbar-color: transparent transparent; overscroll-behavior: contain; }
.help-msgs::-webkit-scrollbar { width: 6px; }
.help-msgs::-webkit-scrollbar-track { background: transparent; }
.help-msgs::-webkit-scrollbar-thumb { background: transparent; border-radius: 99px; transition: background .3s; }
.help-msgs:hover, .help-msgs.scrolling { scrollbar-color: rgba(120,130,150,.35) transparent; }
.help-msgs:hover::-webkit-scrollbar-thumb, .help-msgs.scrolling::-webkit-scrollbar-thumb { background: rgba(120,130,150,.32); }
.help-msgs::-webkit-scrollbar-thumb:hover { background: rgba(120,130,150,.55); }
.err-scroll { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.err-scroll::-webkit-scrollbar { width: 6px; }
.err-scroll::-webkit-scrollbar-track { background: transparent; }
.err-scroll::-webkit-scrollbar-thumb { background: transparent; border-radius: 99px; transition: background .3s; }
.err-scroll:hover, .err-scroll.scrolling { scrollbar-color: rgba(120,130,150,.35) transparent; }
.err-scroll:hover::-webkit-scrollbar-thumb, .err-scroll.scrolling::-webkit-scrollbar-thumb { background: rgba(120,130,150,.32); }
.err-scroll::-webkit-scrollbar-thumb:hover { background: rgba(120,130,150,.55); }
.hm-row { display: flex; flex-direction: column; max-width: 82%; margin-bottom: 12px; }
.hm-row.me { align-self: flex-end; align-items: flex-end; }
.hm-row.them { align-self: flex-start; align-items: flex-start; }
.hm-who { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; color: var(--action, #1F6FD0); margin: 0 4px 5px; }
.hm-who svg { width: 13px; height: 13px; }
.hm-bubble { padding: 11px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5; word-break: break-word; }
.hm-row.them .hm-bubble { background: var(--surface, #fff); color: var(--ink, #181C2E); border: 1px solid var(--border, #E4E7F2); border-top-left-radius: 5px; }
.hm-row.me .hm-bubble { background: var(--action, #1F6FD0); color: #fff; border-top-right-radius: 5px; }
.hm-time { font-size: 11px; color: var(--ink-3, #8E96AC); margin: 5px 4px 0; font-weight: 600; }

/* attachments in bubble */
.hm-bubble.att { padding: 6px; }
.hm-img { display: block; max-width: 210px; max-height: 200px; width: auto; border-radius: 11px; }
/* grouped attachments — kept compact */
.hm-grid { display: grid; gap: 3px; border-radius: 10px; overflow: hidden; width: 210px; max-width: 210px; }
.hm-grid.g1 { grid-template-columns: 1fr; }
.hm-grid.g2, .hm-grid.g3, .hm-grid.g4 { grid-template-columns: 1fr 1fr; }
.hm-grid img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1; display: block; }
.hm-grid.g1 img { aspect-ratio: auto; max-height: 180px; object-fit: contain; background: rgba(0,0,0,.06); }
.hm-grid.g3 img:first-child { grid-column: span 2; aspect-ratio: 2.1; }
.hm-bubble.grp .hm-file { margin-top: 3px; }
.hm-bubble.grp .hm-cap { margin-top: 6px; padding: 0 4px 2px; font-size: 13px; line-height: 1.4; }
/* composer tray */
.chat-tray { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px 0; }
.chat-tray[hidden] { display: none; }
.tray-item { position: relative; width: 54px; height: 54px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border, #E4E7F2); background: var(--surface, #fff); flex: 0 0 auto; }
.tray-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tray-item.file, .tray-item.audio { width: auto; max-width: 150px; padding: 0 26px 0 9px; display: flex; align-items: center; }
.tray-file { display: flex; align-items: center; gap: 6px; font-size: 11px; overflow: hidden; }
.tray-file svg { width: 15px; height: 15px; flex: 0 0 15px; }
.tray-file b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tray-rm { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; border: none; background: rgba(0,0,0,.62); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.tray-rm svg { width: 10px; height: 10px; }
.hm-file { display: flex; align-items: center; gap: 10px; padding: 9px 12px 9px 9px; min-width: 170px; }
.hm-row.me .hm-file { color: #fff; }
.hm-file-ic { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--action,#1F6FD0) 14%, transparent); color: var(--action, #1F6FD0); }
.hm-row.me .hm-file-ic { background: rgba(255,255,255,.22); color: #fff; }
.hm-file-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.hm-file-meta b { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.hm-file-meta span { font-size: 11px; opacity: .7; font-weight: 600; }
.hm-audio { width: 220px; max-width: 60vw; height: 40px; }

.help-typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 15px; background: var(--surface, #fff); border: 1px solid var(--border, #E4E7F2); border-radius: 16px; border-top-left-radius: 5px; margin-bottom: 12px; }
.help-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3, #8E96AC); animation: help-blink 1.2s infinite both; }
.help-typing i:nth-child(2) { animation-delay: .2s; } .help-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes help-blink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* input row */
.help-input { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; padding: 13px 14px; border-top: 1px solid var(--border, #E4E7F2); background: var(--surface, #fff); }
.help-attach { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; border: 1px solid var(--border, #E4E7F2); background: var(--surface-2, #F7F8FD); color: var(--ink-2, #5A6175); transition: background .16s, color .16s; }
.help-attach:hover { background: var(--action-tint, #E3EDF9); color: var(--action, #1F6FD0); }
.help-attach svg { width: 20px; height: 20px; }
.help-field { flex: 1; min-width: 0; height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--border, #E4E7F2); background: var(--surface-2, #F7F8FD); font: inherit; font-size: 14px; color: var(--ink, #181C2E); outline: none; transition: border-color .16s, box-shadow .16s; }
.help-field:focus { border-color: var(--action, #1F6FD0); box-shadow: 0 0 0 3px var(--action-tint, #E3EDF9); }
.help-field::placeholder { color: var(--ink-3, #8E96AC); }
.help-send { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; border: none; background: var(--action, #1F6FD0); color: #fff; transition: filter .16s, transform .16s; }
.help-send:hover { filter: brightness(1.06); transform: translateY(-1px); }
.help-send:disabled { opacity: .5; cursor: default; transform: none; filter: none; }
.help-send svg { width: 19px; height: 19px; }

/* header close */
.help-x { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); width: 32px; height: 32px; border-radius: 9px; border: none; background: transparent; color: var(--ink-3, #8E96AC); display: grid; place-items: center; cursor: pointer; transition: background .16s, color .16s; }
.help-x:hover { background: color-mix(in srgb, currentColor 12%, transparent); color: var(--ink, #181C2E); }
.help-x svg { width: 18px; height: 18px; display: block; }
.help-tabs { position: relative; padding-right: 52px; }

/* mic + recording */
.help-mic { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; border: 1px solid var(--border, #E4E7F2); background: var(--surface-2, #F7F8FD); color: var(--ink-2, #5A6175); transition: background .16s, color .16s, box-shadow .16s; }
.help-mic:hover { background: var(--action-tint, #E3EDF9); color: var(--action, #1F6FD0); }
.help-mic svg { width: 20px; height: 20px; }
.help-mic.rec { background: #EF4444; border-color: #EF4444; color: #fff; animation: mic-pulse 1.1s infinite; }
@keyframes mic-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.5); } 50% { box-shadow: 0 0 0 7px rgba(239,68,68,0); } }
.rec-ui { display: none; flex: 1; min-width: 0; align-items: center; gap: 9px; padding: 0 6px; color: #EF4444; font-weight: 700; font-size: 14px; }
.help-input.recording .help-field { display: none; }
.help-input.recording .rec-ui { display: flex; }
.rec-ui .rec-dot { width: 11px; height: 11px; flex: 0 0 11px; border-radius: 50%; background: #EF4444; animation: help-blink 1s infinite; }
.rec-ui .rec-time { font-variant-numeric: tabular-nums; }
.rec-ui .rec-hint { color: var(--ink-3, #8E96AC); font-weight: 600; font-size: 12.5px; }
.rec-wave { display: flex; align-items: center; gap: 3px; height: 24px; flex: 1; min-width: 0; overflow: hidden; }
.rec-wave i { flex: 1; max-width: 4px; min-width: 2px; height: 100%; border-radius: 3px; background: #EF4444; transform-origin: center; animation: rec-eq .9s ease-in-out infinite; }
.rec-wave i:nth-child(odd) { animation-duration: 1.1s; }
.rec-wave i:nth-child(3n) { animation-duration: .7s; }
.rec-wave i:nth-child(1){animation-delay:-.9s}.rec-wave i:nth-child(2){animation-delay:-.2s}.rec-wave i:nth-child(3){animation-delay:-.6s}.rec-wave i:nth-child(4){animation-delay:-.4s}.rec-wave i:nth-child(5){animation-delay:-.8s}.rec-wave i:nth-child(6){animation-delay:-.1s}.rec-wave i:nth-child(7){animation-delay:-.5s}.rec-wave i:nth-child(8){animation-delay:-.3s}.rec-wave i:nth-child(9){animation-delay:-.7s}.rec-wave i:nth-child(10){animation-delay:-.15s}.rec-wave i:nth-child(11){animation-delay:-.55s}.rec-wave i:nth-child(12){animation-delay:-.35s}.rec-wave i:nth-child(13){animation-delay:-.75s}.rec-wave i:nth-child(14){animation-delay:-.25s}
@keyframes rec-eq { 0%, 100% { transform: scaleY(.28); opacity: .55; } 50% { transform: scaleY(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .rec-wave i { animation: none; transform: scaleY(.5); } }
.help-input.recording .help-attach { display: none; }

/* error attachments */
.err-cap { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 12px; border: 1.6px dashed var(--border-strong, #D3D9EA); background: color-mix(in srgb, var(--action,#1F6FD0) 4%, var(--surface,#fff)); color: var(--ink-2, #5A6175); font-size: 13px; font-weight: 600; }
.err-cap[hidden] { display: none; }
.err-cap.failed { border-color: color-mix(in srgb, #EF4444 40%, var(--border)); color: var(--ink-2, #5A6175); }
.cap-spin { width: 18px; height: 18px; flex: 0 0 18px; border-radius: 50%; border: 2.4px solid var(--border-strong, #D3D9EA); border-top-color: var(--action, #1F6FD0); animation: cap-spin .8s linear infinite; }
@keyframes cap-spin { to { transform: rotate(360deg); } }
.err-atts { display: flex; flex-direction: column; gap: 10px; }
.err-att { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--border, #E4E7F2); background: var(--surface, #fff); }
.err-att.shot img { display: block; width: 100%; max-height: 180px; object-fit: cover; }
.err-att.file { display: flex; align-items: center; gap: 10px; padding: 11px 40px 11px 11px; }
.err-att.file .hm-file-ic { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--action,#1F6FD0) 14%, transparent); color: var(--action, #1F6FD0); }
.err-att.file .hm-file-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.err-att.file .hm-file-meta b { font-size: 13px; font-weight: 700; color: var(--ink, #181C2E); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.err-att.file .hm-file-meta span { font-size: 11px; color: var(--ink-3, #8E96AC); font-weight: 600; }
.err-att .shot-badge { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.62); color: #fff; font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 7px; }
.err-att .rm { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; border: none; cursor: pointer; display: grid; place-items: center; transition: background .16s; }
.err-att .rm:hover { background: #EF4444; }
.err-att .rm svg { width: 14px; height: 14px; }

/* error view */
.err-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 16px; background: var(--surface-2, #F7F8FD); display: flex; flex-direction: column; gap: 12px; }
.err-url { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--surface, #fff); border: 1px solid var(--border, #E4E7F2); font-size: 12.5px; font-weight: 600; color: var(--ink-2, #5A6175); word-break: break-all; }
.err-url svg { width: 15px; height: 15px; flex: 0 0 15px; color: var(--ink-3, #8E96AC); }
.err-shot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 128px; padding: 18px; cursor: pointer;
  border: 1.6px dashed var(--border-strong, #D3D9EA); border-radius: 14px; background: color-mix(in srgb, var(--action,#1F6FD0) 4%, var(--surface,#fff)); color: var(--ink-2, #5A6175); font: inherit; font-size: 14px; font-weight: 700; transition: border-color .16s, background .16s, color .16s; }
.err-shot:hover { border-color: var(--action, #1F6FD0); color: var(--action, #1F6FD0); background: var(--action-tint, #E3EDF9); }
.err-shot svg { width: 30px; height: 30px; }
.err-shot .es-hint { font-size: 12px; font-weight: 600; color: var(--ink-3, #8E96AC); }
.err-shot.has { padding: 8px; border-style: solid; }
.err-shotimg { width: 100%; border-radius: 10px; display: block; }
.err-retake { font-size: 12px; font-weight: 700; color: var(--action, #1F6FD0); }
.err-done { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 30px 20px; color: var(--ink-2, #5A6175); }
.err-done .ok-ic { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, #22C55E 16%, transparent); color: #16A34A; }
.err-done .ok-ic svg { width: 30px; height: 30px; }
.err-done b { font-size: 16px; font-weight: 800; color: var(--ink, #181C2E); }

@media (max-width: 520px) {
  .help-panel { bottom: 70px; height: min(74vh, calc(100vh - 110px)); }
  .help-fab { width: 54px; height: 54px; }
}

/* ============ Brand logo rasmi (light/dark variant) ============ */
.brand-mark .brand-logo-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-mark .brand-logo-img.dark { display: none; }
[data-theme="dark"] .brand-mark .brand-logo-img.light { display: none; }
[data-theme="dark"] .brand-mark .brand-logo-img.dark { display: block; }

/* ═══ Media: rasm lightbox + ovoz/video pleyer (Telegram kabi) ═══ */
.hm-img, .hm-grid img { cursor: zoom-in; transition: opacity .15s; }
.hm-img:hover, .hm-grid img:hover { opacity: .88; }

/* Ovozli xabar — mikrofon ikonkasi + pleyer */
.hm-bubble.att.voice { display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 7px; }
.hm-voice-ic { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--action, #1F6FD0) 14%, transparent); color: var(--action, #1F6FD0); }
.hm-voice-ic svg { width: 17px; height: 17px; }
.hm-row.me .hm-voice-ic { background: rgba(255,255,255,.22); color: #fff; }
.hm-audio { height: 34px; width: 200px; max-width: 100%; display: block; }
.hm-video { display: block; max-width: 230px; max-height: 240px; border-radius: 11px; background: #000; }

/* Lightbox — to'liq ekran rasm */
.hm-lb { position: fixed; inset: 0; z-index: 2147483000; display: none; align-items: center; justify-content: center;
  background: rgba(8, 12, 24, .92); backdrop-filter: blur(6px); cursor: zoom-out; padding: 5vh 5vw; }
.hm-lb.open { display: flex; animation: hmLbIn .18s ease; }
@keyframes hmLbIn { from { opacity: 0 } to { opacity: 1 } }
.hm-lb img { max-width: 100%; max-height: 90vh; border-radius: 12px; box-shadow: 0 24px 70px rgba(0,0,0,.6); cursor: default; }
.hm-lb-bar { position: absolute; top: 16px; right: 16px; display: flex; align-items: center; gap: 6px;
  padding: 5px; border-radius: 14px; background: rgba(20,26,42,.62); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.12); cursor: default; }
.hm-lb-btn { width: 38px; height: 38px; border-radius: 10px; border: none; display: grid; place-items: center;
  cursor: pointer; color: #fff; background: transparent; transition: background .15s, transform .12s; text-decoration: none; }
.hm-lb-btn:hover { background: rgba(255,255,255,.18); transform: scale(1.06); }
.hm-lb-btn:active { transform: scale(.96); }
.hm-lb-btn svg { width: 19px; height: 19px; }
.hm-lb-pct { min-width: 48px; text-align: center; font-size: 12.5px; font-weight: 700; color: #dbe3f5;
  font-variant-numeric: tabular-nums; user-select: none; }
@media (max-width: 520px) { .hm-lb { padding: 2vh 2vw } .hm-lb-bar { top: 10px; right: 10px; gap: 2px; padding: 4px } .hm-lb-btn { width: 34px; height: 34px } .hm-lb-pct { min-width: 40px; font-size: 11.5px } }
.hm-lb img { transform-origin: center center; will-change: transform; user-select: none; -webkit-user-drag: none; touch-action: none; }
.hm-lb.zoomed { cursor: default; }
