/* VoxiPay Support — Telegram Mini App for the support manager · forked from the client bot's styles */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg, #0B0E13);
  font-family: "Instrument Sans", -apple-system, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* ── App shell ─────────────────────────────────────────── */
.vx-app {
  height: 100%; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font-size: 15px; line-height: 1.45;
  --mono: "Space Mono", "SF Mono", ui-monospace, monospace;
  --display: "Space Grotesk", "Instrument Sans", system-ui, sans-serif;
}
.vx-header {
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 18px 12px;
  display: flex; align-items: center; gap: 12px;
  background: var(--bg2); border-bottom: 1px solid var(--hair);
  position: relative; z-index: 5; flex: none;
}
.vx-body { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.vx-screen { padding: 18px 16px 28px; animation: vxfade .32s ease both; }
@keyframes vxfade { from { transform: translateY(10px); } to { transform: none; } }

.vx-logo-img { height: 30px; width: auto; display: block; object-fit: contain; }
.vx-htitle { font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: -0.2px; flex: 1; text-align: center; }
.vx-iconbtn {
  width: 38px; height: 38px; border-radius: 50%; border: none; flex: none;
  background: var(--surface); color: var(--text); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .15s, background .15s;
}
.vx-iconbtn:active { transform: scale(0.92); }
.vx-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: var(--surface2); border: 1px solid var(--hair); color: var(--text);
  display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 14px;
}

/* ── Cards / lists ─────────────────────────────────────── */
.vx-card { background: var(--surface); border-radius: var(--rcard); border: 1px solid var(--hair); }
.vx-list { overflow: hidden; }
.vx-row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; }
.vx-row-btn { width: 100%; background: none; border: none; cursor: pointer; color: var(--text); }
.vx-row-btn:active { background: var(--hair); }

   

/* search + chips */
.vx-search { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--hair); border-radius: 14px; padding: 11px 14px; }
.vx-search input { border: none; background: none; outline: none; color: var(--text); font-size: 15px; flex: 1; }
.vx-search input::placeholder { color: var(--muted); }
.vx-chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 4px; scrollbar-width: none; }
.vx-chips::-webkit-scrollbar { display: none; }
.vx-chip {
  white-space: nowrap; border: 1px solid var(--hair); background: transparent; color: var(--muted);
  border-radius: 100px; padding: 9px 15px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.vx-chip.is-on { background: var(--accent); border-color: transparent; color: var(--on-accent); }

.vx-empty { text-align: center; color: var(--muted); padding: 60px 0; display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 14px; }

/* buttons */
.vx-btn { width: 100%; border: none; border-radius: 100px; padding: 15px; font-size: 15.5px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 9px; transition: transform .12s, opacity .15s; }
.vx-btn:active { transform: scale(0.985); }
.vx-btn:disabled { opacity: 0.7; cursor: default; }
.vx-btn-primary { background: var(--accent); color: var(--on-accent); }
.vx-btn-ghost { background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid var(--hair); color: var(--text); width: auto; padding: 15px 18px; }

/* spinner */
.vx-spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,0.3); border-top-color: #fff; animation: vxspin .7s linear infinite; flex: none; }
.vx-btn-primary .vx-spin { border-color: color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; }
@keyframes vxspin { to { transform: rotate(360deg); } }

/* ── First-launch email gate ───────────────────────────── */
.vx-gate { height: 100%; display: flex; flex-direction: column; justify-content: center; padding: 32px 26px calc(env(safe-area-inset-bottom, 0px) + 28px); animation: vxfade .4s ease both; }
.vx-gate-logo { height: 36px; width: auto; object-fit: contain; margin: 0 auto 30px; display: block; }
.vx-gate h1 { font-family: var(--display); font-size: 26px; font-weight: 600; letter-spacing: -0.8px; margin: 0 0 9px; text-align: center; }
.vx-gate p { color: var(--muted); font-size: 14.5px; line-height: 1.55; text-align: center; margin: 0 0 26px; }

.vx-gate .vx-btn { margin-top: 18px; }

.vx-loading { height: 100%; display: flex; align-items: center; justify-content: center; }
.vx-loading .vx-spin { width: 26px; height: 26px; border-color: rgba(255,255,255,0.18); border-top-color: var(--accent); }

/* toast */
.vx-toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); transform: translateX(-50%); background: var(--surface2); color: var(--text); border: 1px solid var(--hair); padding: 11px 18px; border-radius: 12px; font-size: 13.5px; font-weight: 600; z-index: 80; box-shadow: 0 12px 30px rgba(0,0,0,0.4); animation: vxfade .25s ease; }

/* ── loading skeletons (shown while backend data is in flight) ───────── */
.vx-skel { display: inline-block; border-radius: 7px; background: linear-gradient(90deg, rgba(255,255,255,0.055) 25%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.055) 75%); background-size: 220px 100%; animation: vxskel 1.15s linear infinite; }
@keyframes vxskel { 0% { background-position: -220px 0; } 100% { background-position: 220px 0; } }

/* ── language switcher (globe + bottom sheet) ───────────────────────── */
.vx-lang-btn { margin-left: auto; }
.vx-gate-lang {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 14px); right: 16px;
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--hair);
  background: var(--surface); color: var(--muted); border-radius: 99px; padding: 7px 12px;
  font-size: 12.5px; font-weight: 700; cursor: pointer; transition: transform .15s;
}
.vx-gate-lang:active { transform: scale(0.94); }
.vx-sheet-backdrop {
  position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; justify-content: center; animation: vxfade .2s ease;
}
.vx-sheet {
  width: 100%; max-width: 520px; background: var(--surface); border-radius: 18px 18px 0 0; border: 1px solid var(--hair); border-bottom: none;
  padding: 10px 12px calc(env(safe-area-inset-bottom, 0px) + 16px);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.45); animation: vxsheetup .26s cubic-bezier(.2,.8,.2,1);
}
@keyframes vxsheetup { from { transform: translateY(100%); } to { transform: none; } }
.vx-sheet-title { text-align: center; font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; padding: 10px 0 6px; }
.vx-sheet-row {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: none; border: none; color: var(--text); font-size: 16px; font-weight: 600;
  padding: 15px 14px; border-radius: 14px; cursor: pointer; text-align: left;
}
.vx-sheet-row.is-on { color: var(--accent); }
.vx-sheet-row:active { background: var(--hair); }

/* ── Launch splash — the landing's preloader, ported ────────────────── */
.vx-splash {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px;
  background: #08080a;
  transition: transform 1s cubic-bezier(0.76, 0, 0.24, 1);
  will-change: transform;
}
.vx-splash.is-leaving { transform: translateY(-101%); pointer-events: none; }
.vx-splash-logo {
  width: 176px; aspect-ratio: 1222 / 702;
  background-position: center; background-size: contain; background-repeat: no-repeat;
  opacity: 0.96;
}
.vx-splash-bar {
  width: 210px; height: 2px; border-radius: 8px; overflow: hidden;
  background: rgba(255,255,255,0.12);
}
.vx-splash-bar span { display: block; height: 100%; width: 0; background: #f4f3f0; }
.vx-splash-pct {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.12em; color: #82828c;
}
@media (prefers-reduced-motion: reduce) {
  .vx-splash { transition: opacity .3s; }
  .vx-splash.is-leaving { transform: none; opacity: 0; }
  .vx-splash-bar span { width: 100%; }
}

/* ── pull-to-refresh indicator (Home / History) ─────────────────────── */
.vx-ptr { height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.vx-ptr .vx-spin { width: 22px; height: 22px; border-color: rgba(255,255,255,0.18); border-top-color: var(--accent); animation: none; }
.vx-ptr.is-spin .vx-spin { animation: vxspin .7s linear infinite; }
.vx-ptr.is-ready .vx-spin { border-top-color: var(--ok); }

/* ── common error state (backend load failed; no mock fallback) ──────── */
.vx-error { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 56px 24px; }
.vx-error-title { font-size: 17px; font-weight: 700; }
.vx-error-desc { font-size: 14px; color: var(--muted); line-height: 1.5; max-width: 280px; }
.vx-error .vx-btn { width: auto; padding-left: 28px; padding-right: 28px; }

.vx-btn[disabled] { opacity: 0.45; pointer-events: none; }

/* ── Support app: header without a title keeps the globe on the right ── */
.vx-header .vx-lang-btn { margin-left: auto; }

/* ── Support app: chats list ────────────────────────────────────────── */
.vx-chatrow { min-width: 0; }
.vx-chatrow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.vx-chatrow-name { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vx-chatrow-preview { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.vx-chatrow-preview svg { vertical-align: -2px; margin-right: 3px; }
.vx-chatrow-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.vx-chatrow-time { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
/* the one accent dot in the list: the client spoke last */
.vx-chatrow-dot { width: 8px; height: 8px; border-radius: 8px; background: var(--accent); }
.vx-more { display: block; margin: 14px auto 0; }
.vx-search input[type="search"]::-webkit-search-decoration, .vx-search input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ── Support app: chat thread ───────────────────────────────────────── */
.vx-body.is-chat { overflow: hidden; display: flex; flex-direction: column; }
.vx-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.vx-chat-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 6px; }
.vx-older { display: block; margin: 0 auto 10px; padding: 11px 16px; font-size: 13px; }
.vx-daysep { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; color: var(--muted); font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.vx-daysep::before, .vx-daysep::after { content: ""; flex: 1; height: 1px; background: var(--hair); }
/* the client speaks from the left on the surface; the manager answers from the right on
   the cabinet's light plate — the same signature as the balance card in the client bot */
.vx-msg { align-self: flex-start; max-width: 82%; min-width: 64px; background: var(--surface); border: 1px solid var(--hair); border-radius: 16px 16px 16px 6px; padding: 9px 12px 7px; font-size: 14.5px; line-height: 1.4; overflow-wrap: anywhere; word-break: break-word; animation: vxfade .2s ease both; }
.vx-msg.is-mine { align-self: flex-end; background: var(--hero-bg); color: var(--hero-fg); border-color: transparent; border-radius: 16px 16px 6px 16px; }
.vx-msg-time { font-family: var(--mono); font-size: 10.5px; color: var(--muted); text-align: right; margin-top: 4px; }
.vx-msg.is-mine .vx-msg-time { color: color-mix(in srgb, var(--hero-fg) 55%, transparent); }
.vx-msg-skel { width: 60%; }
.vx-msg-skel .vx-skel { display: block; }
.vx-att-img { display: block; margin: -4px -7px 6px; border-radius: 12px; overflow: hidden; max-width: 260px; }
.vx-att-img img { display: block; width: 100%; height: auto; }
.vx-att-file { display: flex; align-items: center; gap: 8px; margin: 2px 0 6px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, currentColor 7%, transparent); color: inherit; text-decoration: none; font-size: 13px; }
.vx-att-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.vx-att-size { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.vx-msg.is-mine .vx-att-size { color: inherit; opacity: .6; }
.vx-newbelow { position: sticky; bottom: 6px; align-self: center; flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--hair); background: var(--surface2); color: var(--text); border-radius: 99px; padding: 8px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; box-shadow: 0 10px 26px rgba(0,0,0,0.4); z-index: 6; }
.vx-newbelow[hidden] { display: none; }
.vx-composer { flex: none; display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px calc(env(safe-area-inset-bottom, 0px) + 10px); background: var(--bg2); border-top: 1px solid var(--hair); }
.vx-composer textarea { flex: 1; min-width: 0; resize: none; outline: none; background: var(--surface); border: 1px solid var(--hair); border-radius: 18px; padding: 11px 14px; color: var(--text); font: inherit; font-size: 15px; line-height: 22px; max-height: 134px; }
.vx-composer textarea:focus { border-color: var(--accent); }
.vx-composer textarea::placeholder { color: var(--muted); }
.vx-send { flex: none; width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform .15s, opacity .15s; }
.vx-send:active { transform: scale(0.92); }
.vx-send:disabled { opacity: .35; cursor: default; }

/* ── Support app: header subtitle, full-screen gates, message text ─── */
.vx-hsub { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-top: 2px; }
.vx-block, .vx-denied { min-height: 100%; }
.vx-msg-text { white-space: pre-wrap; }

/* ── Support app: manager attachments in the composer ───────────────── */
.vx-composer-wrap { flex: none; background: var(--bg2); border-top: 1px solid var(--hair); }
.vx-composer-wrap .vx-composer { border-top: none; }
.vx-attach { flex: none; width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--surface); color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform .15s; }
.vx-attach:active { transform: scale(0.92); }
.vx-att-chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 12px 0; scrollbar-width: none; }
.vx-att-chips::-webkit-scrollbar { display: none; }
.vx-att-chip { flex: none; display: inline-flex; align-items: center; gap: 7px; max-width: 220px; background: var(--surface); border: 1px solid var(--hair); border-radius: 12px; padding: 5px 6px 5px 5px; font-size: 12.5px; }
.vx-att-chip-thumb { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; flex: none; }
.vx-att-chip-ico { width: 28px; height: 28px; border-radius: 8px; background: var(--hair); display: flex; align-items: center; justify-content: center; flex: none; color: var(--muted); }
.vx-att-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.vx-att-chip-size { font-family: var(--mono); font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.vx-att-chip-x { flex: none; width: 22px; height: 22px; border-radius: 50%; border: none; background: var(--hair); color: var(--text); font-size: 15px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* ── Support app: PIN gate ──────────────────────────────────────────── */
.vx-gate-input { width: 100%; background: var(--surface); border: 1px solid var(--hair); border-radius: 14px; padding: 15px 16px; color: var(--text); font-size: 16px; outline: none; transition: border-color .15s; }
.vx-gate-input::placeholder { color: var(--muted); letter-spacing: 0; }
.vx-gate-input:focus { border-color: var(--accent); }
.vx-pin-input { font-family: var(--mono); font-size: 22px; letter-spacing: 8px; text-align: center; }
.vx-gate-err { color: var(--danger); font-size: 13px; text-align: center; margin-top: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.vx-gate .vx-btn:disabled { opacity: .4; cursor: default; }

/* ── diagnostics page (?diag=1) ── */
.vx-diag { font-family: var(--mono); font-size: 11px; line-height: 1.5; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; text-align: left; background: var(--surface); border: 1px solid var(--hair); border-radius: 12px; padding: 12px; user-select: text; -webkit-user-select: text; }
