/* Vesper — веб-версия. Базовые токены и кнопки — в site.css. */
body.webapp { height: 100vh; height: 100dvh; overflow: hidden; }
.webapp .aurora i { opacity: .32; }
.wide { width: 100%; }
.small { font-size: 13px; }

/* ───────── вход ───────── */
.auth { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; overflow: auto; }
.auth-home { position: absolute; top: 22px; left: 26px; }
.auth-card { width: min(410px, 100%); text-align: center; animation: rise .7s var(--ease) both; }
.auth-mark { width: 90px; margin: 0 auto; filter: drop-shadow(0 14px 44px rgba(91, 92, 240, .6)); }
.auth-title { margin: 20px 0 8px; font: 400 40px/1.05 var(--serif); }
.auth-sub { margin: 0 0 26px; }
.tabs { display: flex; padding: 4px; margin-bottom: 20px; border-radius: 13px; background: var(--panel); border: 1px solid var(--hair); }
.tab { flex: 1; padding: 9px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: 500 14.5px var(--sans); cursor: pointer; transition: all .2s var(--ease); }
.tab.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--hair-2); }
.auth-form { text-align: left; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13.5px; color: var(--muted); }
.field input, .composer textarea, .ticket textarea, .ticket input, select {
  font: inherit; color: var(--text); background: rgba(0, 0, 0, .3); border: 1px solid var(--hair-2); border-radius: 12px; padding: 12px 14px; outline: 0; min-width: 0;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .ticket textarea:focus, .ticket input:focus, select:focus { border-color: rgba(74, 168, 255, .6); box-shadow: 0 0 0 4px rgba(74, 168, 255, .1); }
.auth-err { min-height: 22px; margin: 0 0 10px; color: var(--err); font-size: 13.5px; }
.auth-card > .small { margin-top: 18px; }

/* ───────── каркас ───────── */
.shell { display: grid; grid-template-columns: 280px 1fr; height: 100%; }
.side { display: flex; flex-direction: column; gap: 6px; padding: 18px 14px 14px; border-right: 1px solid var(--hair); background: rgba(8, 10, 20, .6); backdrop-filter: blur(20px); min-height: 0; }
.side .brand { padding: 4px 8px 14px; }
.new-chat { margin-bottom: 14px; }
.side-label { padding: 0 8px 6px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }
.history { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.history li { position: relative; display: flex; align-items: center; gap: 8px; padding: 9px 34px 9px 10px; border-radius: 10px; cursor: pointer; color: var(--muted); font-size: 14px; transition: background .2s, color .2s; }
.history li span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.history li:hover, .history li.on { background: var(--panel-2); color: var(--text); }
.history li.on { box-shadow: inset 2px 0 0 var(--blue); }
.history .src { flex: none; font-size: 10px; padding: 1px 6px; border-radius: 6px; background: rgba(74, 168, 255, .12); color: var(--blue-2); }
.history .del { position: absolute; right: 6px; width: 24px; height: 24px; border: 0; border-radius: 7px; background: transparent; color: var(--faint); cursor: pointer; opacity: 0; display: grid; place-items: center; }
.history li:hover .del { opacity: 1; }
.history .del:hover { color: var(--err); background: rgba(255, 127, 138, .1); }
.history .empty { cursor: default; font-size: 13px; color: var(--faint); }
.side-foot { display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px solid var(--hair); }
.account { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 10px 14px; margin-bottom: 6px; border-radius: 13px; border: 1px solid var(--hair); background: var(--panel); color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.account:hover { border-color: rgba(74, 168, 255, .4); }
.avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 14px; color: var(--on); background: linear-gradient(140deg, var(--blue-2), var(--blue)); }
.acc-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.acc-text b { font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-text small { font-size: 12px; color: var(--muted); }
.acc-bar { position: absolute; left: 12px; right: 12px; bottom: 6px; height: 2px; border-radius: 2px; background: var(--hair); }
.acc-bar i { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--blue); transition: width .4s var(--ease); }
.account.low small { color: var(--err); } .account.low .acc-bar i { background: var(--err); }
.side-btn { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: 14px var(--sans); cursor: pointer; text-align: left; }
.side-btn:hover { background: var(--panel); color: var(--text); }
.badge { margin-left: auto; min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; font: 600 11px/1 var(--sans); color: var(--on); background: var(--blue); }

.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 24px; }
.topbar select { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
select option { background: #101426; }
.icon-btn { display: none; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--hair-2); background: var(--panel); color: var(--text); place-items: center; cursor: pointer; }
.notice { margin-left: auto; display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--hair); background: var(--panel); color: var(--muted); font-size: 13px; }
.notice svg { width: 16px; height: 16px; color: var(--blue); flex: none; }
.notice a { color: var(--blue-2); }
.notice a:hover { text-decoration: underline; }

.scroll { flex: 1; overflow-y: auto; padding: 10px 0 20px; min-height: 0; }
.hero { max-width: 760px; margin: 9vh auto 0; padding: 0 28px; text-align: center; animation: rise .8s var(--ease) both; }
.hero-mark { width: 74px; margin: 0 auto 22px; filter: drop-shadow(0 12px 40px rgba(91, 92, 240, .6)); }
.eyebrow-text { margin: 0 0 8px; font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--blue); }
.hero h1 { margin: 0; font-size: clamp(36px, 5vw, 54px); line-height: 1.05; }
.suggest { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 38px; text-align: left; }
.suggest button { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--hair); background: var(--panel); color: var(--muted); font: 14.5px/1.4 var(--sans); cursor: pointer; transition: all .25s var(--ease); }
.suggest button:hover { color: var(--text); border-color: rgba(74, 168, 255, .35); transform: translateY(-1px); }
.chatting .hero { display: none; }

.thread { max-width: 800px; margin: 0 auto; padding: 0 28px; display: flex; flex-direction: column; gap: 26px; }
.msg { animation: rise .45s var(--ease) both; }
.msg.user { align-self: flex-end; max-width: 80%; padding: 11px 16px; border-radius: 18px 18px 6px 18px; background: rgba(255, 255, 255, .07); border: 1px solid var(--hair); white-space: pre-wrap; word-break: break-word; }
.msg.bot { display: grid; grid-template-columns: 30px 1fr; gap: 14px; }
.msg.bot > img { width: 28px; margin-top: 2px; }
.msg.bot.busy > img { animation: breathe 1.6s ease-in-out infinite; }
.content { min-width: 0; line-height: 1.65; word-break: break-word; }
.content > :first-child { margin-top: 0; } .content > :last-child { margin-bottom: 0; }
.content p { margin: 0 0 .75em; }
.content h1, .content h2, .content h3 { font: 400 24px/1.25 var(--serif); margin: 1em 0 .4em; color: var(--blue-2); }
.content strong { color: #fff; }
.content ul, .content ol { margin: 0 0 .8em; padding-left: 1.3em; }
.content li { margin: .25em 0; }
.content li::marker { color: var(--blue); }
.content code { font: 13px/1.5 "Cascadia Code", Consolas, monospace; padding: 1px 6px; border-radius: 6px; background: var(--panel-2); }
.content pre { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--hair); background: var(--ink-2); overflow-x: auto; }
.content pre code { background: none; padding: 0; }
.content blockquote { margin: 0 0 .8em; padding: 2px 14px; border-left: 2px solid var(--blue); color: var(--muted); }
.content a { color: var(--blue-2); text-decoration: underline; }
.content.streaming > :last-child::after { content: ""; display: inline-block; width: 7px; height: 15px; margin-left: 3px; vertical-align: -2px; border-radius: 2px; background: var(--blue); animation: blink 1s steps(2) infinite; }
.dots { display: flex; gap: 5px; padding: 8px 0; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); opacity: .35; animation: pulse 1.2s ease-in-out infinite; }
.dots span:nth-child(2) { animation-delay: .15s; } .dots span:nth-child(3) { animation-delay: .3s; }
.err-box { margin-top: 6px; padding: 10px 14px; border-radius: 12px; color: var(--err); background: rgba(255, 127, 138, .07); border: 1px solid rgba(255, 127, 138, .2); }
.err-box a { color: var(--blue-2); text-decoration: underline; cursor: pointer; }

.composer-wrap { padding: 8px 28px 16px; }
.composer { max-width: 800px; margin: 0 auto; display: flex; align-items: flex-end; gap: 10px; padding: 10px 10px 10px 18px; border-radius: 20px; border: 1px solid var(--hair-2); background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .03)); backdrop-filter: blur(20px); box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .9); transition: border-color .3s, box-shadow .3s; }
.composer:focus-within { border-color: rgba(74, 168, 255, .45); box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .9), 0 0 0 4px rgba(74, 168, 255, .07); }
.composer textarea { flex: 1; resize: none; border: 0; background: transparent; padding: 8px 0; max-height: 220px; line-height: 1.5; box-shadow: none; }
.composer textarea:focus { box-shadow: none; }
.send { flex: none; width: 40px; height: 40px; border: 0; border-radius: 12px; display: grid; place-items: center; cursor: pointer; color: var(--on); background: linear-gradient(135deg, #e6f3ff, var(--blue)); box-shadow: 0 8px 22px -8px rgba(74, 168, 255, .7); }
.send svg { stroke-width: 2.2; }
.send .i-stop { display: none; fill: currentColor; stroke: none; }
.busy .send .i-send { display: none; } .busy .send .i-stop { display: block; }
.hint { max-width: 800px; margin: 8px auto 0; text-align: center; font-size: 12px; color: var(--faint); }

/* ───────── модальные окна ───────── */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(3, 4, 9, .66); backdrop-filter: blur(10px); animation: fade .25s var(--ease); }
.sheet { width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; border-radius: 24px; border: 1px solid var(--hair-2); background: linear-gradient(180deg, #11152a, #0b0e1c); box-shadow: 0 50px 120px -30px rgba(0, 0, 0, .9); animation: pop .35s var(--ease); }
.sheet.wide { width: min(940px, 100%); }
.sheet.support { width: min(980px, 100%); height: min(680px, calc(100vh - 40px)); }
.sheet header { display: flex; align-items: center; justify-content: space-between; padding: 22px 26px 8px; }
.sheet h2 { margin: 0; font-size: 32px; }
.x { border: 0; background: none; color: var(--muted); font-size: 28px; line-height: 1; cursor: pointer; }
.x:hover { color: var(--text); }
.sheet-body { padding: 10px 26px 26px; overflow-y: auto; }
.balance { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-radius: 16px; border: 1px solid var(--hair); background: var(--panel); flex-wrap: wrap; }
.balance b { font-size: 18px; color: var(--blue-2); }
.usage-row { display: flex; align-items: center; gap: 14px; margin: 14px 2px 22px; font-size: 13.5px; }
.usage { flex: 1; height: 5px; border-radius: 5px; background: var(--hair); overflow: hidden; }
.usage i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--indigo), var(--blue)); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; padding-top: 6px; }
.plan-grid .plan { padding: 24px 22px; }
.plan-grid .plan.current { box-shadow: 0 0 0 2px rgba(74, 168, 255, .6); }
.plan-grid .plan h3 { font-size: 26px; }
.plan-grid .plan .price b { font-size: 30px; }

.support-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 300px 1fr; margin-top: 10px; border-top: 1px solid var(--hair); }
.tickets { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-right: 1px solid var(--hair); min-height: 0; }
.tickets ul { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.tickets li { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 12px; cursor: pointer; }
.tickets li:hover, .tickets li.on { background: var(--panel-2); }
.tickets li b { font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tickets li.unread b::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--blue); vertical-align: 1px; }
.tickets .last { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tickets .meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--faint); }
.st.answered { color: var(--blue); }
.ticket { display: flex; flex-direction: column; min-height: 0; }
.ticket .empty { margin: auto; padding: 24px; text-align: center; }
.ticket-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--hair); }
.ticket-head b { flex: 1; font-weight: 500; }
.ticket-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.tmsg { max-width: 78%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; word-break: break-word; font-size: 14.5px; }
.tmsg.user { align-self: flex-end; border-bottom-right-radius: 6px; background: rgba(74, 168, 255, .16); }
.tmsg.support { align-self: flex-start; border-bottom-left-radius: 6px; background: var(--panel-2); border: 1px solid var(--hair); }
.tmsg small { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.ticket-reply { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--hair); }
.ticket-reply textarea { flex: 1; resize: none; }
.ticket-reply .btn { align-self: flex-end; }
.ticket-new { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.ticket-new h3 { margin: 0; font: 400 26px/1.1 var(--serif); }
.ticket-new textarea { min-height: 160px; resize: vertical; }
.ticket-new .btn { align-self: flex-end; }
.ticket-closed { margin: 0; padding: 14px 18px; border-top: 1px solid var(--hair); }

.toast { position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%); z-index: 60; padding: 11px 18px; border-radius: 12px; border: 1px solid var(--hair-2); background: #151a2d; box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .7); animation: rise .35s var(--ease); max-width: calc(100% - 32px); }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(8px); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes breathe { 50% { transform: scale(1.1); } }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 290px; z-index: 30; transform: translateX(-100%); transition: transform .35s var(--ease); background: #0a0c18; }
  .side.open { transform: none; box-shadow: 30px 0 80px rgba(0, 0, 0, .7); }
  .icon-btn { display: grid; }
  .notice span { display: none; }
  .suggest { grid-template-columns: 1fr; }
  .support-body { grid-template-columns: 1fr; }
  .tickets { border-right: 0; border-bottom: 1px solid var(--hair); max-height: 40%; }
  .thread, .hero { padding: 0 16px; } .composer-wrap { padding: 8px 12px 12px; } .topbar { padding: 12px 14px; }
}

/* iPhone: вырезы экрана и «домашняя» полоска в режиме приложения */
.composer-wrap { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.topbar { padding-top: max(14px, env(safe-area-inset-top)); }
.side { padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: max(14px, env(safe-area-inset-bottom)); }
