/* Twipe 2.0: твипы, боты, мини-приложения */

/* ---------- твипы ---------- */
.rd-wallet-cur { display: block; font-size: 12px; opacity: .75; margin-top: 2px; }
.tw-lead { margin: 0 0 14px; font-size: 14px; line-height: 1.45; color: var(--text-secondary, #5b6474); }
.tw-packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tw-pack { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 6px 12px; border-radius: 16px; border: 1.5px solid rgba(120, 130, 160, .22); background: var(--surface, #fff); cursor: pointer; font: inherit; color: inherit; transition: transform .12s, border-color .12s, box-shadow .12s; }
.tw-pack:hover { transform: translateY(-1px); border-color: #7c5cff; box-shadow: 0 6px 18px rgba(124, 92, 255, .16); }
.tw-pack b { font-size: 20px; font-weight: 800; line-height: 1.1; }
.tw-pack small { font-size: 11px; opacity: .7; }
.tw-rub { margin-top: 6px; padding: 3px 10px; border-radius: 999px; background: rgba(124, 92, 255, .1); color: #6a4cf0; font-size: 12.5px; font-weight: 700; }
.tw-pack--hit { border-color: #7c5cff; }
.tw-pack--fit { border-color: #22b07d; box-shadow: 0 0 0 3px rgba(34, 176, 125, .14); }
.tw-badge { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); padding: 1px 8px; border-radius: 999px; background: linear-gradient(90deg, #7c5cff, #d14cff); color: #fff; font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.tw-coin, .tw-ico { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #ffd66b, #ff9f2e); color: #7a3d00; font-weight: 900; font-size: 18px; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12); margin-bottom: 4px; }
.tw-custom { display: flex; gap: 8px; margin-top: 14px; }
.tw-custom .fx-input { flex: 1; margin: 0; }
.tw-note { margin: 10px 0 0; font-size: 12px; opacity: .65; }
@media (max-width: 420px) { .tw-packs { grid-template-columns: repeat(2, 1fr); } }
[data-theme="dark"] .tw-pack{ background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .12); }
[data-theme="dark"] .tw-rub{ color: #b9a8ff; background: rgba(124, 92, 255, .2); }

/* ---------- боты: кнопки под сообщениями ---------- */
.bk-kb { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; min-width: 200px; }
.bk-row { display: flex; gap: 4px; }
.bk-btn { flex: 1 1 0; min-width: 0; position: relative; padding: 9px 14px; border: 0; border-radius: 10px; background: rgba(59, 130, 246, .12); color: var(--accent, #3b82f6); font: inherit; font-size: 13.5px; font-weight: 600; line-height: 1.25; cursor: pointer; white-space: normal; overflow-wrap: anywhere; transition: background .12s, transform .08s; }
.bk-btn:hover { background: rgba(59, 130, 246, .2); }
.bk-btn:active { transform: scale(.98); }
.bk-btn i { position: absolute; top: 3px; right: 6px; font-style: normal; font-size: 10px; opacity: .7; }
.bk-btn--pay { background: linear-gradient(90deg, #7c5cff, #d14cff); color: #fff; }
.bk-btn.is-busy { opacity: .55; pointer-events: none; }
.msg-out .bk-btn, .msg-row--out .bk-btn { background: rgba(255, 255, 255, .2); color: inherit; }
.bk-via { display: block; font-size: 12px; font-weight: 600; color: var(--accent, #3b82f6); margin-bottom: 2px; }
.bk-caption { margin-top: 6px; }

/* счёт */
.bk-bubble-inv { padding: 4px !important; }
.bk-bubble-inv .bk-invoice { margin-top: 0; border: 0; }
.bk-bubble-inv .msg-bubble-footer { padding: 0 8px 4px; }
.bk-invoice { margin-top: 6px; border-radius: 14px; overflow: hidden; background: rgba(124, 92, 255, .08); border: 1px solid rgba(124, 92, 255, .2); min-width: 220px; max-width: 320px; }
.bk-invoice-photo { display: block; width: 100%; max-height: 180px; object-fit: cover; }
.bk-invoice-body { padding: 10px 12px 4px; }
.bk-invoice-body b { display: block; font-size: 15px; }
.bk-invoice-body p { margin: 4px 0; font-size: 13px; opacity: .8; }
.bk-invoice-price { display: inline-block; margin-top: 4px; font-weight: 800; color: #6a4cf0; }
.bk-invoice-pay { display: block; width: calc(100% - 20px); margin: 8px 10px 10px; }
[data-theme="dark"] .bk-invoice-price { color: #b9a8ff; }

/* оплата */
.bk-pay-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; margin-bottom: 12px; }
.bk-pay-head img { width: 72px; height: 72px; border-radius: 16px; object-fit: cover; margin-bottom: 6px; }
.bk-pay-head .tw-ico { width: 52px; height: 52px; font-size: 26px; }
.bk-pay-head b { font-size: 17px; }
.bk-pay-head p { margin: 0; font-size: 14px; opacity: .75; }
.bk-pay-head small { font-size: 12.5px; opacity: .6; }
.bk-pay-sum { display: block; font-size: 26px; font-weight: 800; margin: 6px 0; }
.bk-pay-bal { padding: 10px 12px; border-radius: 12px; background: rgba(120, 130, 160, .1); font-size: 14px; }
.bk-pay-note { font-size: 12px; opacity: .65; margin: 10px 0 0; }
.bk-pay-note--ok { opacity: 1; color: #16a34a; font-weight: 600; }

/* ---------- панель бота над полем ввода ---------- */
.bk-bar { padding: 6px 10px 4px; background: var(--bg-elevated, var(--surface, #fff)); border-top: 1px solid rgba(120, 130, 160, .15); }
.bk-bar.hidden, .bk-menu.hidden, .bk-pop.hidden { display: none !important; }
.bk-reply { display: flex; flex-direction: column; gap: 5px; max-height: 40vh; overflow: auto; }
.bk-key { flex: 1 1 0; min-width: 0; padding: 11px 8px; border: 0; border-radius: 10px; background: rgba(120, 130, 160, .13); color: inherit; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.bk-reply--compact .bk-key { padding: 8px; }
.bk-key:hover { background: rgba(120, 130, 160, .22); }
.bk-intro { text-align: center; padding: 14px 10px 6px; }
.bk-intro-ava { width: 72px; height: 72px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #3b82f6, #8b5cf6); }
.bk-intro b { font-size: 18px; }
.bk-intro p { margin: 6px auto; max-width: 420px; font-size: 14px; opacity: .8; }
.bk-intro small { opacity: .6; }
.bk-check { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 4px; border-radius: 50%; background: #3b82f6; color: #fff; font-size: 10px; font-style: normal; vertical-align: 1px; }
.bk-start { display: block; width: calc(100% - 20px); max-width: 420px; margin: 6px auto 8px; padding: 13px; font-size: 16px; }
#chatComposer.bk-composer-hidden { display: none !important; }
.bk-menu { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; height: 36px; margin: auto 6px auto 0; padding: 0 12px; border: 0; border-radius: 18px; background: var(--accent, #3b82f6); color: #fff; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-menu--app { background: linear-gradient(90deg, #3b82f6, #8b5cf6); }
.bk-menu:not(.bk-menu--app) span:last-child { display: none; }
.bk-menu:not(.bk-menu--app) { width: 36px; padding: 0; justify-content: center; font-size: 16px; }
.bk-menu--app { max-width: 110px; }

/* подсказки команд и inline */
.bk-pop { max-height: 260px; overflow: auto; margin: 0 8px 4px; border-radius: 14px; background: var(--bg-elevated, var(--surface, #fff)); box-shadow: 0 10px 30px -8px rgba(15, 23, 42, .3); padding: 4px; }
.bk-pop-note { padding: 14px; text-align: center; font-size: 14px; opacity: .65; }
.bk-cmd-list { display: flex; flex-direction: column; }
.bk-cmd { display: flex; gap: 10px; align-items: baseline; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.bk-cmd:hover { background: rgba(120, 130, 160, .1); }
.bk-cmd b { color: var(--accent, #3b82f6); font-weight: 600; min-width: 24px; }
.bk-cmd span { font-size: 14px; opacity: .8; }
.bk-cmd--danger b, .bk-cmd--danger span { color: #ef4444; opacity: 1; }
.bk-cmd-app { display: block; width: 100%; margin-top: 10px; }
.bk-inl { display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.bk-inl:hover { background: rgba(120, 130, 160, .1); }
.bk-inl img, .bk-inl-ico { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 8px; object-fit: cover; display: grid; place-items: center; background: rgba(59, 130, 246, .12); color: #3b82f6; }
.bk-inl span { display: flex; flex-direction: column; min-width: 0; }
.bk-inl small { opacity: .6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- каталог «Приложения» ---------- */
.bk-cat-search { width: 100%; margin: 0 0 10px; }
.bk-cat-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; scrollbar-width: none; }
.bk-tab { flex: 0 0 auto; padding: 6px 12px; border-radius: 999px; border: 0; background: rgba(120, 130, 160, .12); color: inherit; font: inherit; font-size: 13px; cursor: pointer; }
.bk-tab.is-on { background: var(--accent, #3b82f6); color: #fff; }
.bk-mine { margin-bottom: 12px; }
.bk-mine-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; opacity: .55; margin: 4px 2px 8px; }
.bk-mine-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.bk-mine-app { position: relative; flex: 0 0 68px; display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.bk-mine-app small { font-size: 11.5px; max-width: 68px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-mine-app i { position: absolute; top: -2px; right: 6px; font-style: normal; font-size: 12px; color: #f59e0b; }
.bk-app-ico { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #3b82f6, #8b5cf6); }
.bk-cat-list { display: flex; flex-direction: column; gap: 2px; }
.bk-card { display: flex; gap: 12px; align-items: center; width: 100%; padding: 10px 8px; border: 0; border-radius: 14px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.bk-card:hover { background: rgba(120, 130, 160, .08); }
.bk-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bk-card-main b { font-size: 15px; }
.bk-card-main small { font-size: 13px; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-card-main em { font-style: normal; font-size: 12px; opacity: .55; }
.bk-card-open { flex: 0 0 auto; padding: 6px 14px; border-radius: 999px; background: rgba(59, 130, 246, .12); color: var(--accent, #3b82f6); font-weight: 700; font-size: 13px; }
.bk-cat-create { display: block; width: 100%; margin-top: 12px; }

/* профиль бота, оценка */
.bk-intro--sheet { padding-top: 0; }
.bk-profile-actions { flex-wrap: wrap; }
.bk-rate { text-align: center; margin: 10px 0; }
.bk-stars { display: inline-flex; gap: 4px; }
.bk-star { border: 0; background: none; font-size: 28px; color: rgba(120, 130, 160, .35); cursor: pointer; padding: 0 2px; }
.bk-star.is-on { color: #f59e0b; }

/* мои боты, редактор */
.bk-token { display: block; padding: 10px 12px; border-radius: 10px; background: rgba(120, 130, 160, .12); font-size: 13px; word-break: break-all; user-select: all; }
.bk-h { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; opacity: .6; }
.bk-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 6px 0 4px; }
.bk-stats span { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; border-radius: 12px; background: rgba(120, 130, 160, .1); font-size: 11.5px; opacity: .9; text-align: center; }
.bk-stats b { font-size: 16px; }
.bk-warn { padding: 8px 12px; border-radius: 10px; background: rgba(239, 68, 68, .1); color: #dc2626; font-size: 13px; }
.bk-editor .fx-input, .bk-editor textarea { width: 100%; margin-bottom: 8px; }
@media (max-width: 420px) { .bk-stats { grid-template-columns: repeat(2, 1fr); } }

/* админка */
.bk-adm { padding: 12px; border-radius: 14px; border: 1px solid rgba(120, 130, 160, .2); margin-bottom: 10px; }
.bk-adm-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.bk-adm-reps { font-size: 13px; color: #dc2626; margin: 4px 0; }
.bk-adm .fx-actions { flex-wrap: wrap; gap: 6px; justify-content: flex-start; }
.bk-adm .btn { padding: 6px 10px; font-size: 12.5px; }

/* ---------- окно мини-приложения ---------- */
.wa-sheet { position: fixed; inset: 0; z-index: 100400; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; }
.wa-scrim { position: absolute; inset: 0; background: rgba(8, 10, 20, .45); opacity: 0; transition: opacity .2s; pointer-events: auto; }
.wa-card { position: relative; display: flex; flex-direction: column; width: 100%; max-width: 480px; height: min(78vh, 720px); background: var(--bg-elevated, var(--surface, #fff)); border-radius: 18px 18px 0 0; overflow: hidden; transform: translateY(100%); transition: transform .24s cubic-bezier(.2, .8, .2, 1), height .2s; pointer-events: auto; box-shadow: 0 -10px 40px rgba(0, 0, 0, .25); }
.wa-sheet.is-open .wa-scrim { opacity: 1; }
.wa-sheet.is-open .wa-card { transform: none; }
.wa-sheet.wa-full .wa-card { height: 100%; max-width: none; border-radius: 0; }
.wa-head { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 12px; border-bottom: 1px solid rgba(120, 130, 160, .15); }
.wa-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.wa-title b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-title small { font-size: 12px; opacity: .6; }
.wa-x { width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(120, 130, 160, .12); color: inherit; font-size: 16px; cursor: pointer; display: grid; place-items: center; }
.wa-x[hidden] { display: none; }
.wa-frame-wrap { position: relative; flex: 1; min-height: 0; }
.wa-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.wa-loading { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; font-size: 14px; opacity: .7; background: var(--bg-elevated, var(--surface, #fff)); }
.wa-loading span { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(59, 130, 246, .25); border-top-color: #3b82f6; animation: wa-spin .8s linear infinite; }
@keyframes wa-spin { to { transform: rotate(360deg); } }
.wa-main { margin: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px)); padding: 14px; border: 0; border-radius: 12px; background: var(--accent, #3b82f6); color: #fff; font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; }
.wa-main[hidden] { display: none; }
.wa-main:disabled { opacity: .5; }
.wa-main.is-progress { color: transparent; position: relative; }
.wa-main.is-progress::after { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: wa-spin .8s linear infinite; }
.wa-popup-text { margin: 0 0 12px; white-space: pre-wrap; }
html.fx-modal-open .wa-sheet { z-index: 100400; }
@media (min-width: 900px) {
  .wa-sheet { align-items: center; }
  .wa-card { border-radius: 18px; height: min(82vh, 760px); }
}
[data-theme="dark"] .wa-frame { background: #0f1115; }
.dock-apps-ico { display: grid; place-items: center; }
html:has(.wa-sheet) .confirm-sheet { z-index: 100620 !important; }
html:has(.wa-sheet) #overlayBackdrop:not(.hidden) { z-index: 100610 !important; }
.tw-custom .fx-input { flex: 1 1 auto; min-width: 0; width: auto; }
.tw-custom .btn { flex: 0 0 auto; width: auto; padding-left: 18px; padding-right: 18px; }
#chatComposer:has(.bk-menu:not(.hidden)) #messageInput::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-menu--app { padding: 0 10px; font-size: 13px; }
