@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;900&family=Space+Grotesk:wght@500;700;900&display=swap');

:root {
  --bg:          #000000;
  --bg-card:     rgba(255,255,255,0.03);
  --bg-card-hover: rgba(255,255,255,0.05);
  --border:      rgba(255,255,255,0.08);
  --border-cyan: rgba(34,211,238,0.25);
  --primary:     #22d3ee;
  --primary-dim: rgba(34,211,238,0.12);
  --foreground:  #ffffff;
  --muted:       rgba(255,255,255,0.45);
  --danger:      #f87171;
  --success:     #4ade80;
  --radius:      12px;
  --font:        'Inter', system-ui, sans-serif;
  --font-display:'Space Grotesk', system-ui, sans-serif;
  --header-h:    56px;
  --max-w:       480px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--foreground);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* iOS не зумит инпуты с font-size >= 16px при фокусе */
input, select, textarea, button {
  font-size: 16px;
  font-family: inherit;
}

/* ── Background grid ── */
.lk-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(34,211,238,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34,211,238,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}
.lk-bg::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(34,211,238,0.06), transparent);
}

/* Scan line animation */
.lk-scan {
  position: fixed; left: 0; right: 0; height: 1px; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(34,211,238,0.35), transparent);
  animation: scan 10s linear infinite;
}
@keyframes scan { from { top: 0% } to { top: 100% } }

/* ── Header ── */
.lk-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  display: flex; align-items: center; padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.lk-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.lk-brand-mark { font-size: 20px; }
.lk-brand-text {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.05em;
  color: var(--foreground);
}
.lk-header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.lk-status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot { 0%,100% { opacity:1 } 50% { opacity:0.3 } }

/* ── Wrap ── */
.wrap {
  position: relative; z-index: 10;
  min-height: 100vh;
  padding: calc(var(--header-h) + 24px) 16px 40px;
  display: flex; flex-direction: column; align-items: center;
}

/* ── Card ── */
.card {
  width: 100%; max-width: var(--max-w);
  background: var(--bg-card);
  border: 1px solid var(--border-cyan);
  border-radius: 16px;
  padding: 24px;
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34,211,238,0.5), transparent);
}

/* ── Card header ── */
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.03em;
  text-overflow: ellipsis; overflow: hidden; white-space: nowrap;
}
.card-header-right { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ── Status badge ── */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.05em;
  padding: 4px 10px; border-radius: 20px;
  white-space: nowrap;
}
.status--active {
  color: var(--success);
  background: rgba(74,222,128,0.1);
  border: 1px solid rgba(74,222,128,0.2);
}
.status--expired {
  color: var(--danger);
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.2);
}
.status::before { content: '●'; font-size: 9px; }

/* ── Tier badge ── */
.sub-tier-badge {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 6px;
  margin-bottom: 16px;
}
.tier--standard {
  color: var(--primary);
  background: var(--primary-dim);
  border: 1px solid var(--border-cyan);
}

/* ── KV rows ── */
.kv { display: flex; flex-direction: column; gap: 0; margin-bottom: 20px; }
.kv-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.kv-row:last-child { border-bottom: none; }
.kv-row span:first-child { color: var(--muted); }
.kv-row span:last-child  { font-weight: 600; font-family: monospace; font-size: 12px; color: var(--foreground); }

/* ── Nodes block ── */
.nodes-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); margin: 16px 0 8px;
}
.node-list { display: flex; flex-direction: column; gap: 6px; }
.node-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  background: rgba(34,211,238,0.04);
  border: 1px solid var(--border);
  border-radius: 8px; font-size: 12px;
}
.node-name { color: var(--muted); }
.node-ping { font-family: monospace; color: var(--primary); font-size: 11px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer; border-radius: var(--radius);
  font-family: var(--font); font-size: 14px; font-weight: 700;
  letter-spacing: 0.02em; transition: all 0.15s ease;
  text-decoration: none; width: 100%;
}
.btn-lg { height: 48px; }
.btn-sm { height: 36px; font-size: 12px; padding: 0 14px; width: auto; }

.btn-primary {
  background: var(--primary);
  color: #000;
  box-shadow: 0 0 20px rgba(34,211,238,0.2);
}
.btn-primary:hover { background: #38e8ff; box-shadow: 0 0 30px rgba(34,211,238,0.35); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: rgba(255,255,255,0.2); color: var(--foreground); background: rgba(255,255,255,0.04); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(248,113,113,0.2);
}
.btn-danger:hover { background: rgba(248,113,113,0.08); }

.btn-logout { color: var(--danger); }
.btn-logout:hover { border-color: rgba(248,113,113,0.3); }

.btn-row {
  display: flex; flex-direction: column; gap: 10px; margin-top: 4px;
}

/* ── Lang button ── */
.btn-lang {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px; padding: 4px 10px;
  font-size: 12px; cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-lang:hover { border-color: var(--border-cyan); color: var(--primary); }

/* ── Muted text ── */
.muted { color: var(--muted); font-size: 12px; text-align: center; margin-top: 12px; }
.muted a { color: var(--primary); text-decoration: none; }

/* ── Loading / Error ── */
.loading-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  color: var(--muted); font-size: 14px; padding: 60px 0;
}
.spinner {
  width: 32px; height: 32px; border: 2px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

.error-card {
  width: 100%; max-width: var(--max-w);
  text-align: center; padding: 32px 24px;
  background: var(--bg-card);
  border: 1px solid rgba(248,113,113,0.2);
  border-radius: 16px; color: var(--danger);
}
.error-card h3 { margin-bottom: 8px; font-size: 16px; }
.error-card p  { font-size: 13px; color: var(--muted); }

/* ── Login page ── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-cyan);
  border-radius: 20px; padding: 36px 28px;
  position: relative;
}
.login-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34,211,238,0.6), transparent);
}
.login-logo {
  text-align: center; margin-bottom: 28px;
}
.login-logo-icon {
  font-size: 40px; display: block; margin-bottom: 8px;
}
.login-logo-name {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 900;
  letter-spacing: 0.05em;
}
.login-subtitle {
  font-size: 12px; color: var(--muted); letter-spacing: 0.08em;
  text-transform: uppercase; margin-top: 4px;
}
.form-group { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.form-input {
  width: 100%; height: 48px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--foreground);
  font-family: var(--font); font-size: 14px;
  padding: 0 16px;
  outline: none; transition: border-color 0.15s;
}
.form-input::placeholder { color: rgba(255,255,255,0.25); }
.form-input:focus { border-color: var(--border-cyan); box-shadow: 0 0 0 3px rgba(34,211,238,0.08); }
.login-hint {
  font-size: 12px; color: var(--muted); text-align: center; margin-top: 14px; line-height: 1.5;
}
.login-error {
  font-size: 13px; color: var(--danger); text-align: center;
  margin-top: 10px; min-height: 20px;
}
.login-back {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-top: 20px;
  font-size: 13px; color: var(--muted); text-decoration: none;
}
.login-back:hover { color: var(--primary); }

/* ── Connect page ── */
.page-title {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 900;
  letter-spacing: -0.01em; margin-bottom: 4px;
}
.page-sub { font-size: 13px; color: var(--muted); margin-bottom: 24px; }
.step-block {
  background: rgba(34,211,238,0.04);
  border: 1px solid var(--border-cyan);
  border-radius: 12px; padding: 20px;
  margin-bottom: 16px;
}
.step-num {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--primary); margin-bottom: 10px;
}
.step-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.platform-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px;
}
.platform-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--muted);
  text-decoration: none; transition: all 0.15s;
}
.platform-btn:hover { border-color: var(--border-cyan); color: var(--primary); background: var(--primary-dim); }
.platform-btn.detected { border-color: var(--border-cyan); color: var(--primary); background: var(--primary-dim); }
.platform-icon { font-size: 24px; }

/* ── Devices page ── */
.device-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.device-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 10px; gap: 12px;
}
.device-info { flex: 1; min-width: 0; }
.device-model { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.device-meta  { font-size: 11px; color: var(--muted); font-family: monospace; }

/* ── Settings page ── */
.settings-section { margin-bottom: 20px; }
.settings-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 10px;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 8px;
  font-size: 13px;
}
.settings-row > span:first-child {
  flex-shrink: 0;
  color: var(--muted);
}
.settings-val {
  font-family: monospace; font-size: 12px; color: var(--primary);
  text-align: right;
  word-break: break-all;
  overflow-wrap: anywhere;
  min-width: 0;
}

/* ── Back button ── */
.btn-back {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 13px; font-weight: 600;
  cursor: pointer; background: none; border: none;
  margin-bottom: 20px; padding: 0;
  transition: color 0.15s;
}
.btn-back:hover { color: var(--foreground); }
.btn-back::before { content: '←'; }

/* ── Subscription URL ── */
.sub-url-box {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 12px;
  font-family: monospace; font-size: 11px;
  color: var(--muted); word-break: break-all;
  margin-bottom: 12px; line-height: 1.5;
}

/* ── Copy notification ── */
.copy-toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #000;
  font-size: 13px; font-weight: 700;
  padding: 10px 24px; border-radius: 100px;
  z-index: 999; opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  white-space: nowrap;
}
.copy-toast.show { opacity: 1; }

/* ── No subscription ── */
.no-sub {
  text-align: center; padding: 48px 24px;
}
.no-sub-icon { font-size: 48px; margin-bottom: 16px; }
.no-sub h3 { font-size: 18px; margin-bottom: 8px; }
.no-sub p { color: var(--muted); font-size: 14px; line-height: 1.6; }

/* ── Connect Wizard ── */
.connect-wizard .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.connect-wizard .card-header .card-title {
  margin: 0;
}
.connect-wizard .card-header .btn-back {
  /* override default btn-back positioning */
  position: static;
  margin: 0;
}

.wizard-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 0 24px;
  gap: 10px;
}
.happ-icon {
  width: 80px; height: 80px;
  border-radius: 18px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}
.wizard-q {
  font-size: 20px;
  font-weight: 700;
  color: var(--foreground);
}
.wizard-hint {
  font-size: 13px;
  color: var(--muted);
}

.btn-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.ios-links {
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: rgba(34,211,238,0.05);
  border: 1px solid rgba(34,211,238,0.15);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.ios-link {
  display: block;
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  transition: background 0.15s;
}
.ios-link:hover { background: rgba(255,255,255,0.08); }

.wizard-status {
  font-size: 13px;
  color: var(--danger);
  text-align: center;
  min-height: 18px;
  margin-top: 4px;
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 6px 0;
  width: 100%;
  text-align: center;
  transition: color 0.15s;
}
.btn-ghost:hover { color: var(--foreground); }

/* QR block on ask step */
.ask-qr-section {
  margin-top: 24px;
  text-align: center;
}
.ask-qr-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
  margin-bottom: 12px;
}
.ask-qr-wrap {
  display: inline-flex;
  padding: 12px;
  background: #fff;
  border-radius: 14px;
  opacity: 0.7;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .card { padding: 18px 14px; }
  .login-card { padding: 28px 18px; }
  .platform-grid { grid-template-columns: 1fr 1fr; }
  .settings-row { padding: 12px 14px; font-size: 13px; }
  .settings-val { font-size: 11px; }
  .kv-row { gap: 10px; }
  .kv-row > span { word-break: break-all; overflow-wrap: anywhere; min-width: 0; }
  .plan-item { padding: 14px 14px; }
  .plan-name { font-size: 14px; }
  .plan-price { font-size: 16px; margin-left: 8px; }
}

/* Универсальная защита от вылезания текста за края контейнера */
.card, .login-card { word-wrap: break-word; overflow-wrap: anywhere; }

/* ── Email banner ── */
.email-banner {
  background: linear-gradient(135deg, rgba(34,211,238,0.12), rgba(99,102,241,0.10));
  border: 1px solid rgba(34,211,238,0.3);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.email-banner-text {
  font-size: 13px; line-height: 1.5;
  color: rgba(255,255,255,0.85);
}
.email-banner-actions { display: flex; gap: 8px; }
.email-banner-actions .btn { flex: 1; }

/* ── iOS App Store hint card (dismissible, fade-out) ── */
.ios-hint-card {
  display: flex; gap: 12px;
  background: linear-gradient(135deg, rgba(34,211,238,0.12), rgba(99,102,241,0.10));
  border: 1px solid rgba(34,211,238,0.3);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 16px;
  overflow: hidden;
  transition: opacity .4s ease, max-height .4s ease, margin .4s ease, padding .4s ease, border-color .4s ease;
  opacity: 1; max-height: 320px;
}
.ios-hint-card.ios-hint-out {
  opacity: 0; max-height: 0;
  margin: 0; padding-top: 0; padding-bottom: 0;
  border-color: transparent;
}
.ios-hint-icon { font-size: 22px; line-height: 1.2; flex-shrink: 0; }
.ios-hint-content { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ios-hint-title { font-size: 14px; font-weight: 700; color: #22d3ee; }
.ios-hint-body { font-size: 13px; line-height: 1.5; color: rgba(255,255,255,0.85); }
.ios-hint-body b { color: rgba(255,255,255,0.95); font-weight: 600; }
.ios-hint-ok {
  align-self: flex-start;
  margin-top: 2px;
  background: rgba(34,211,238,0.18);
  border: 1px solid rgba(34,211,238,0.45);
  color: #e6feff;
  font-size: 13px; font-weight: 600;
  padding: 7px 18px; border-radius: 9px;
  cursor: pointer;
  transition: background .15s ease;
}
.ios-hint-ok:hover { background: rgba(34,211,238,0.30); }

/* ── Chat (новый, full-screen, мессенджер-стиль) ── */
body.chat-fullscreen { overflow: hidden; }
/* Не скрываем .wrap/#card — там внутри сам чат живёт. Чат поверх через z-index. */

.lk-chat {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  background: #050505;
  z-index: 200;
}

.lk-chat-header {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(10,10,10,0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.lk-chat-back {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; border: none; background: transparent;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.lk-chat-back:hover { background: rgba(255,255,255,0.06); }
.lk-chat-back:active { background: rgba(255,255,255,0.12); }
.lk-chat-title-wrap { flex: 1; min-width: 0; }
.lk-chat-title {
  font-size: 16px; font-weight: 700; color: #fff;
  letter-spacing: 0.01em;
}
.lk-chat-subtitle {
  font-size: 12px; color: #4ade80;
  margin-top: 1px;
  display: flex; align-items: center; gap: 6px;
}
.lk-chat-subtitle::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px #4ade80;
}

.lk-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px 12px;
  display: flex; flex-direction: column; gap: 10px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.lk-chat-day {
  align-self: center;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.04);
  padding: 4px 12px;
  border-radius: 12px;
  margin: 14px 0 10px;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.lk-chat-empty {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  color: rgba(255,255,255,0.4);
  padding: 40px 20px;
  font-size: 14px;
  line-height: 1.6;
}
.lk-chat-empty-icon { font-size: 48px; margin-bottom: 14px; opacity: 0.5; }

/* Group of consecutive bubbles from one sender — single timestamp at the end */
.lk-msg-grp {
  display: flex; flex-direction: column; gap: 2px;
  max-width: 78%;
  animation: lk-msg-in 0.2s ease-out;
}
.lk-msg-grp-mine { align-self: flex-end; align-items: flex-end }
.lk-msg-grp-them { align-self: flex-start; align-items: flex-start }

.lk-msg {
  padding: 8px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: anywhere;
  position: relative;
  max-width: 100%;
}
@keyframes lk-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.lk-msg-mine {
  background: linear-gradient(135deg, #22d3ee, #0ea5e9);
  color: #001318;
}
.lk-msg-them {
  background: rgba(255,255,255,0.07);
  color: #fff;
}
.lk-msg-sys {
  align-self: center;
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.55);
  font-size: 12px; font-style: italic;
  border-radius: 12px;
  padding: 6px 12px;
  max-width: 90%;
}
.lk-msg-pending { opacity: 0.65; }

/* Telegram-style corners by group position */
.lk-msg-grp-mine .lk-msg.mg-only  { border-radius: 18px 18px 6px 18px }
.lk-msg-grp-mine .lk-msg.mg-first { border-radius: 18px 18px 18px 18px }
.lk-msg-grp-mine .lk-msg.mg-mid   { border-radius: 18px 8px 8px 18px }
.lk-msg-grp-mine .lk-msg.mg-last  { border-radius: 18px 8px 6px 18px }

.lk-msg-grp-them .lk-msg.mg-only  { border-radius: 18px 18px 18px 6px }
.lk-msg-grp-them .lk-msg.mg-first { border-radius: 18px 18px 18px 18px }
.lk-msg-grp-them .lk-msg.mg-mid   { border-radius: 8px 18px 18px 8px }
.lk-msg-grp-them .lk-msg.mg-last  { border-radius: 8px 18px 18px 6px }

.lk-msg-meta {
  display: flex; align-items: center; gap: 4px;
  font-size: 10.5px;
  margin-top: 3px;
  padding: 0 6px;
  opacity: 0.65;
  user-select: none;
}
.lk-msg-grp-mine .lk-msg-meta { color: rgba(255,255,255,0.55); justify-content: flex-end }
.lk-msg-grp-them .lk-msg-meta { color: rgba(255,255,255,0.45); justify-content: flex-start }
.lk-msg-status { font-size: 11px }
.lk-msg-err { color: #f87171; opacity: 1 }

.lk-chat-input-bar {
  flex-shrink: 0;
  display: flex; align-items: flex-end; gap: 10px;
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: rgba(10,10,10,0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255,255,255,0.06);
}
.lk-chat-input-bar textarea {
  flex: 1;
  resize: none;
  min-height: 42px;
  max-height: 140px;
  padding: 10px 16px;
  font-size: 16px;
  line-height: 1.4;
  font-family: inherit;
  color: #fff;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 21px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.lk-chat-input-bar textarea:focus {
  border-color: rgba(34,211,238,0.5);
  background: rgba(255,255,255,0.07);
}
.lk-chat-input-bar textarea:disabled { opacity: 0.5; }

.lk-chat-send {
  flex-shrink: 0;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%;
  background: linear-gradient(135deg, #22d3ee, #0ea5e9);
  color: #001318;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(34,211,238,0.35);
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s;
}
.lk-chat-send svg { transform: translate(1px, 0); }
.lk-chat-send:hover:not(:disabled) {
  transform: scale(1.06);
  box-shadow: 0 4px 16px rgba(34,211,238,0.55);
}
.lk-chat-send:active:not(:disabled) { transform: scale(0.92); }
.lk-chat-send:disabled {
  opacity: 0.45; cursor: not-allowed; box-shadow: none;
}
.lk-chat-send.sending svg { animation: lk-send-spin 0.7s linear infinite; }
@keyframes lk-send-spin {
  from { transform: translate(1px, 0) rotate(0); }
  to   { transform: translate(1px, 0) rotate(360deg); }
}

/* Attach button (paperclip) */
.lk-chat-attach{
  flex-shrink:0;
  width:42px; height:42px;
  display:flex; align-items:center; justify-content:center;
  border:none; border-radius:50%;
  background:rgba(255,255,255,0.06);
  color:rgba(255,255,255,0.75);
  cursor:pointer;
  transition:background .15s, color .15s, transform .12s;
}
.lk-chat-attach:hover:not(:disabled){ background:rgba(255,255,255,0.10); color:#fff }
.lk-chat-attach:active:not(:disabled){ transform:scale(.92) }
.lk-chat-attach:disabled{ opacity:.5; cursor:not-allowed }

/* File preview strip above input */
.lk-file-preview{
  flex-shrink:0;
  display:flex; gap:8px; flex-wrap:wrap;
  padding:10px 12px;
  background:rgba(10,10,10,0.95);
  border-top:1px solid rgba(255,255,255,0.06);
}
.lk-fp-item{
  position:relative; width:64px; height:64px;
  border-radius:10px; overflow:hidden;
  border:1px solid rgba(255,255,255,0.1);
}
.lk-fp-item img{ width:100%; height:100%; object-fit:cover; display:block }
.lk-fp-item button{
  position:absolute; top:3px; right:3px;
  width:22px; height:22px; padding:0;
  background:rgba(0,0,0,0.7); color:#fff;
  border:none; border-radius:50%;
  font-size:14px; line-height:1;
  cursor:pointer;
}
.lk-fp-item button:hover{ background:#7f1d1d }

/* Attachments inside message bubbles */
.lk-msg-atts{
  display:flex; gap:4px; flex-wrap:wrap;
  margin-bottom:6px;
  max-width:100%;
}
.lk-msg-atts img,
.lk-msg-atts a{
  display:block; flex-shrink:0;
  width:140px; height:140px;
  border-radius:10px; overflow:hidden;
  background:rgba(0,0,0,0.2);
  object-fit:cover;
}
.lk-msg-atts a img{ width:100%; height:100%; object-fit:cover; display:block }
.lk-msg-atts:has(:nth-child(2)) img,
.lk-msg-atts:has(:nth-child(2)) a{ width:120px; height:120px }
.lk-msg-atts:has(:nth-child(3)) img,
.lk-msg-atts:has(:nth-child(3)) a{ width:96px; height:96px }
.lk-msg-atts:has(:nth-child(5)) img,
.lk-msg-atts:has(:nth-child(5)) a{ width:80px; height:80px }
.lk-msg-mine .lk-msg-atts a img{ background:rgba(0,0,0,0.1) }

@media (max-width: 480px) {
  .lk-msg { max-width: 84%; font-size: 14.5px; }
  .lk-msg-mine { margin-left: 16%; }
  .lk-msg-them { margin-right: 16%; }
  .lk-chat-body { padding: 12px 10px 10px; }
}

/* ── Payment plans ── */
.plan-list {
  display: flex; flex-direction: column; gap: 10px; margin-top: 4px;
}
.plan-item {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 16px 18px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer; text-align: left;
  transition: border-color .15s, background .15s;
}
.plan-item:hover:not(:disabled) {
  border-color: rgba(34,211,238,0.35);
  background: rgba(34,211,238,0.04);
}
.plan-item:disabled { opacity: 0.5; cursor: not-allowed; }
.plan-left { display: flex; flex-direction: column; gap: 3px; }
.plan-name {
  font-size: 15px; font-weight: 700; color: #fff;
  display: flex; align-items: center; gap: 8px;
}
.plan-desc { font-size: 12px; color: var(--muted); }
.plan-price {
  font-size: 18px; font-weight: 900; color: var(--primary);
  white-space: nowrap; margin-left: 12px;
}
.plan-badge {
  font-size: 10px; font-weight: 700;
  background: rgba(34,211,238,0.15);
  color: var(--primary);
  border: 1px solid rgba(34,211,238,0.3);
  border-radius: 6px; padding: 2px 7px;
  letter-spacing: .04em;
}

/* ── Promo code ── */
.promo-row { display: flex; flex-direction: column; gap: 6px; }
.promo-input-wrap { display: flex; gap: 8px; }
.promo-input { flex: 1; text-transform: uppercase; letter-spacing: .08em; font-size: 14px; }
.btn-promo-apply {
  flex-shrink: 0; padding: 0 16px; height: 48px;
  background: rgba(34,211,238,0.1);
  border: 1px solid rgba(34,211,238,0.3);
  border-radius: var(--radius); color: var(--primary);
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.btn-promo-apply:hover:not(:disabled) { background: rgba(34,211,238,0.18); }
.btn-promo-apply:disabled { opacity: .5; cursor: not-allowed; }
.promo-msg { font-size: 13px; min-height: 18px; }
.promo-ok  { color: #4ade80; }
.promo-err { color: #f87171; }

/* Plan price with promo */
.plan-price-col { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; margin-left: 12px; }
.plan-orig { font-size: 12px; color: var(--muted); text-decoration: line-through; }
.plan-price--promo { color: var(--success); }

/* Plan selected state */
.plan-item--active {
  border-color: var(--border-cyan) !important;
  background: var(--primary-dim) !important;
}

/* ── Device row ── */
.pay-dev-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.pay-dev-left { display: flex; flex-direction: column; gap: 3px; }
.pay-dev-label { font-size: 14px; font-weight: 600; }
.pay-dev-sub { font-size: 11px; color: var(--muted); }
.pay-dev-controls { display: flex; align-items: center; gap: 10px; }
.pay-dev-num { font-size: 17px; font-weight: 800; min-width: 22px; text-align: center; }

/* ── Dev +/− buttons ── */
.dev-btn {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff; font-size: 18px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.dev-btn:hover:not(:disabled) { background: var(--primary-dim); border-color: var(--border-cyan); color: var(--primary); }
.dev-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ── Promo block ── */
.promo-block {
  margin-top: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.promo-toggle {
  padding: 12px 16px; cursor: pointer;
  font-size: 13px; color: var(--muted);
  display: flex; align-items: center; gap: 6px;
  transition: color .15s; user-select: none;
}
.promo-toggle:hover { color: var(--foreground); }
.promo-remove {
  margin-left: auto; background: none; border: none; color: rgba(255,255,255,0.3);
  font-size: 13px; cursor: pointer; padding: 0 4px; line-height: 1; transition: color .15s;
}
.promo-remove:hover { color: var(--danger); }
.promo-input-row { display: flex; gap: 8px; padding: 0 12px 12px; }
.promo-input { flex: 1; text-transform: uppercase; letter-spacing: .06em; font-size: 14px; height: 44px; }
.btn-promo-apply {
  flex-shrink: 0; padding: 0 14px; height: 44px;
  background: var(--primary-dim);
  border: 1px solid var(--border-cyan);
  border-radius: var(--radius); color: var(--primary);
  font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: background .15s;
}
.btn-promo-apply:hover:not(:disabled) { background: rgba(34,211,238,0.18); }
.btn-promo-apply:disabled { opacity: .5; cursor: not-allowed; }
.promo-msg { font-size: 13px; min-height: 16px; padding: 0 12px 10px; }
.promo-ok  { color: var(--success); }
.promo-err { color: var(--danger); }

/* ── Payment summary ── */
#pay-summary {
  margin-top: 14px;
  background: rgba(34,211,238,0.04);
  border: 1px solid var(--border-cyan);
  border-radius: var(--radius);
  padding: 16px;
}
.psum-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); padding: 3px 0; }
.psum-promo { color: var(--success); }
.psum-total {
  display: flex; justify-content: space-between;
  font-size: 15px; font-weight: 800; color: var(--foreground);
  border-top: 1px solid var(--border);
  margin-top: 8px; padding-top: 10px;
}
.btn-pay {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 50px; margin-top: 14px;
  background: var(--primary); color: #000;
  border: none; border-radius: var(--radius);
  font-size: 15px; font-weight: 900; cursor: pointer;
  box-shadow: 0 0 20px rgba(34,211,238,0.25);
  transition: transform .15s, box-shadow .15s;
}
.btn-pay:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 0 28px rgba(34,211,238,0.4); }
.btn-pay:active { transform: translateY(0); }
.btn-pay:disabled { opacity: .6; cursor: not-allowed; }
.pay-error-msg { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 18px; }

/* ── Pre-payment redirect banner ── */
@keyframes pay-banner-in  { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
@keyframes pay-banner-out { from{opacity:1;transform:scale(1)}         to{opacity:0;transform:scale(0.94)} }

.pay-banner-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.pay-banner-box {
  background: #070707;
  border: 1px solid rgba(34,211,238,0.2);
  border-radius: 20px;
  width: 100%; max-width: 400px;
  padding: 36px 28px;
  text-align: center;
  animation: pay-banner-in .35s cubic-bezier(.32,1,.23,1);
  position: relative; overflow: hidden;
}
.pay-banner-box::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34,211,238,0.6), transparent);
}
.pay-banner-box.pay-banner-out {
  animation: pay-banner-out 1.4s ease forwards;
  pointer-events: none;
}
.pay-banner-icon  { font-size: 52px; display: block; margin-bottom: 20px; }
.pay-banner-title {
  font-family: var(--font-display);
  font-size: 21px; font-weight: 900; letter-spacing: -0.01em;
  color: var(--foreground); margin-bottom: 14px;
}
.pay-banner-body {
  font-size: 14px; color: var(--muted);
  line-height: 1.75; margin-bottom: 28px;
}
.pay-banner-body b { color: var(--primary); font-weight: 700; }
.pay-banner-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 52px;
  background: var(--primary); color: #000;
  border: none; border-radius: var(--radius);
  font-size: 16px; font-weight: 900; cursor: pointer;
  box-shadow: 0 0 24px rgba(34,211,238,0.3);
  transition: transform .15s, box-shadow .15s;
}
.pay-banner-btn:hover { transform: translateY(-1px); box-shadow: 0 0 32px rgba(34,211,238,0.45); }
.pay-banner-btn:active { transform: translateY(0); }

/* ── Addon warning ── */
.addon-warn {
  background: rgba(251,146,60,0.07);
  border: 1px solid rgba(251,146,60,0.2);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px; color: rgba(255,200,120,0.9);
  line-height: 1.5; margin-bottom: 8px;
}
.addon-warn b { color: #fb923c; }

/* ── Connect: share-link card (вход на новом устройстве) ── */
.ask-share-section {
  margin-top: 18px;
  background: #141414;
  border: 1px solid rgba(34,211,238,0.28);
  border-radius: 14px;
  overflow: hidden;
}
.ask-share-head {
  background: linear-gradient(135deg, rgba(34,211,238,0.16), rgba(99,102,241,0.10));
  color: #e6feff;
  font-size: 15px; font-weight: 700; text-align: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(34,211,238,0.18);
}
.ask-share-body { padding: 16px; }
.ask-share-hint {
  font-size: 13px; color: rgba(255,255,255,0.6);
  line-height: 1.55; margin-bottom: 14px;
}
#ask-share-btn { width: 100%; }
.ask-share-id {
  margin-top: 14px; font-size: 12px;
  color: rgba(255,255,255,0.3);
}
