/* ============================================
   RokBot Mini App — Modern / Claude-inspired
   ============================================ */

:root {
  /* === DARK THEME (default, как на rokbot.click) === */
  --bg: #161b22;
  --surface: #1f242c;
  --surface-2: #262c35;
  --surface-3: #2d333d;
  --border: #2d333d;
  --border-strong: #3d4451;

  --text: #e8eaee;
  --text-muted: #9aa3b2;
  --text-faint: #6b7280;

  --accent: #06b6d4;          /* cyan */
  --accent-hover: #0891b2;
  --accent-soft: rgba(6, 182, 212, 0.15);

  --checkbox-on: #8b5cf6;     /* фиолетовый чек как на сайте */
  --checkbox-on-soft: rgba(139, 92, 246, 0.15);

  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.15);

  --info: #3b82f6;
  --info-soft: rgba(59, 130, 246, 0.15);

  /* Shape */
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;

  /* Elevation (тени тоньше на тёмном) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);

  /* Type */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: 'SF Mono', Menlo, Consolas, 'Roboto Mono', monospace;

  /* Motion */
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

/* Тёмная схема — всегда по умолчанию. Telegram light не переопределяет. */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overscroll-behavior-y: contain;
}

input, button, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

#app {
  max-width: 540px;
  margin: 0 auto;
  padding: 16px 16px calc(28px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

/* ============================================
   SPLASH SCREEN (анимация загрузки)
   ============================================ */
#splash {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at center, #1a2030 0%, var(--bg) 70%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
  overflow: hidden;
}
#splash.hide {
  opacity: 0;
  transform: scale(1.06);
  pointer-events: none;
}

/* Тонкая сетка (как hud) на фоне */
#splash::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(6, 182, 212, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(6, 182, 212, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at center, rgba(0,0,0,0.9) 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle at center, rgba(0,0,0,0.9) 30%, transparent 70%);
  animation: gridFade 2.4s var(--ease) infinite;
  pointer-events: none;
}
@keyframes gridFade {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* === Сканирующая горизонтальная линия (один прогон) === */
.splash-scan {
  position: absolute;
  left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 18px var(--accent), 0 0 4px #fff;
  top: -10px;
  pointer-events: none;
  animation: splashScan 1.6s var(--ease) forwards;
}
@keyframes splashScan {
  0%   { top: -10px; opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { top: calc(100% + 10px); opacity: 0; }
}

/* === Парящие частицы === */
.splash-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.splash-particle {
  position: absolute;
  width: 4px; height: 4px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent);
  opacity: 0;
  bottom: 0;
  animation: splashParticle 4.5s linear infinite;
}
.splash-particle:nth-child(1) { left: 12%; animation-delay: 0s;   }
.splash-particle:nth-child(2) { left: 26%; animation-delay: 0.6s; }
.splash-particle:nth-child(3) { left: 40%; animation-delay: 1.2s; width: 3px; height: 3px; }
.splash-particle:nth-child(4) { left: 56%; animation-delay: 1.8s; }
.splash-particle:nth-child(5) { left: 70%; animation-delay: 2.4s; width: 3px; height: 3px; }
.splash-particle:nth-child(6) { left: 84%; animation-delay: 3.0s; }
.splash-particle:nth-child(7) { left: 48%; animation-delay: 3.6s; }
.splash-particle:nth-child(8) { left: 18%; animation-delay: 4.2s; width: 3px; height: 3px; }
@keyframes splashParticle {
  0%   { bottom: -5%; opacity: 0; transform: translateX(0) scale(0.4); }
  10%  { opacity: 1; transform: translateX(0) scale(1); }
  50%  { transform: translateX(20px) scale(0.9); }
  90%  { opacity: 1; transform: translateX(-10px) scale(0.6); }
  100% { bottom: 105%; opacity: 0; transform: translateX(0) scale(0.3); }
}

/* === Cyan glow за лого (пульс) === */
.splash-glow {
  position: absolute;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.32) 0%, rgba(6, 182, 212, 0.08) 38%, transparent 65%);
  animation: splashGlow 3s ease-in-out infinite;
  pointer-events: none;
}
@keyframes splashGlow {
  0%, 100% { transform: scale(0.95); opacity: 0.55; }
  50%      { transform: scale(1.2); opacity: 1; }
}

/* === SVG-рамка: треугольник с вершинами-точками === */
.splash-frame {
  position: absolute;
  width: 380px; height: 190px;
  max-width: 88%;
  opacity: 0;
  animation:
    frameAppear 0.6s var(--ease) 0.2s forwards,
    frameRotate 18s linear 1.2s infinite;
  pointer-events: none;
}
@keyframes frameAppear {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 0.55; transform: scale(1); }
}
@keyframes frameRotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.splash-frame-path {
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: framePath 1.6s var(--ease) 0.2s forwards;
  filter: drop-shadow(0 0 6px var(--accent));
}
@keyframes framePath {
  to { stroke-dashoffset: 0; }
}
.splash-frame-dot {
  opacity: 0;
  transform-origin: center;
  animation: frameDot 0.4s var(--ease) forwards;
  filter: drop-shadow(0 0 6px var(--accent));
}
.splash-frame-dot:nth-of-type(1) { animation-delay: 0.5s; }
.splash-frame-dot:nth-of-type(2) { animation-delay: 0.8s; }
.splash-frame-dot:nth-of-type(3) { animation-delay: 1.1s; }
.splash-frame-dot:nth-of-type(4) { animation-delay: 1.4s; }
@keyframes frameDot {
  0%   { opacity: 0; r: 0; }
  60%  { opacity: 1; r: 6; }
  100% { opacity: 1; r: 3; }
}

/* === Лого собирается через clip-path slide-in + flash === */
.splash-logo {
  width: 300px;
  max-width: 80%;
  height: auto;
  position: relative;
  z-index: 2;
  clip-path: inset(0 100% 0 0);
  opacity: 0;
  filter: drop-shadow(0 0 24px rgba(6, 182, 212, 0.45));
  animation:
    splashLogoReveal 1.1s var(--ease) 0.7s forwards,
    splashLogoBreath 3.5s ease-in-out 2s infinite;
}
@keyframes splashLogoReveal {
  0%   { clip-path: inset(0 100% 0 0); opacity: 0; transform: scale(0.92); filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.2)) brightness(1.4); }
  60%  { clip-path: inset(0 0 0 0);     opacity: 1; transform: scale(1.06); filter: drop-shadow(0 0 40px rgba(6, 182, 212, 1)) brightness(1.5); }
  100% { clip-path: inset(0 0 0 0);     opacity: 1; transform: scale(1);    filter: drop-shadow(0 0 24px rgba(6, 182, 212, 0.5)) brightness(1); }
}
@keyframes splashLogoBreath {
  0%, 100% { transform: scale(1);    filter: drop-shadow(0 0 18px rgba(6, 182, 212, 0.35)); }
  50%      { transform: scale(1.04); filter: drop-shadow(0 0 38px rgba(6, 182, 212, 0.7)); }
}

/* === Tagline (печатается после лого) === */
.splash-tagline {
  position: relative;
  z-index: 2;
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4em;
  color: var(--accent);
  text-transform: uppercase;
  opacity: 0;
  animation:
    taglineIn 0.6s var(--ease) 1.7s forwards,
    taglineBlink 2.4s ease-in-out 2.4s infinite;
}
@keyframes taglineIn {
  0%   { opacity: 0; letter-spacing: 0.1em; transform: translateY(6px); }
  100% { opacity: 0.85; letter-spacing: 0.4em; transform: translateY(0); }
}
@keyframes taglineBlink {
  0%, 100% { opacity: 0.85; text-shadow: 0 0 4px var(--accent); }
  50%      { opacity: 0.55; text-shadow: 0 0 12px var(--accent); }
}

/* === Бегущие точки внизу === */
.splash-loader {
  position: absolute;
  bottom: 10%;
  display: flex;
  gap: 10px;
  z-index: 2;
  opacity: 0;
  animation: dotsIn 0.4s var(--ease) 2s forwards;
}
@keyframes dotsIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.splash-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: splashBounce 1.4s ease-in-out infinite both;
}
.splash-dot:nth-child(1) { animation-delay: 0s; }
.splash-dot:nth-child(2) { animation-delay: 0.16s; }
.splash-dot:nth-child(3) { animation-delay: 0.32s; }
@keyframes splashBounce {
  0%, 80%, 100% { transform: scale(0.3) translateY(0); opacity: 0.3; }
  40%           { transform: scale(1)   translateY(-8px); opacity: 1; }
}

/* === Screens === */
.screen { display: none; animation: fadeUp 0.32s var(--ease); }
.screen.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUpFade {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ============================================
   LANG PICKER (login)
   ============================================ */
.lang-picker {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  box-shadow: var(--shadow-sm);
}
.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
}
.lang-btn:active { transform: scale(0.96); }
.lang-btn.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.lang-btn-flag { font-size: 15px; }

/* ============================================
   LOGIN
   ============================================ */
.login-wrap {
  min-height: 100vh;
  padding: 24px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand {
  text-align: center;
  margin-bottom: 32px;
}
.brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
}
.brand-name {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}
.brand-tag {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.input-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  padding-left: 2px;
}
.input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  font-size: 15px;
  outline: none;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
  color: var(--text);
}
.input::placeholder { color: var(--text-faint); }
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-pass {
  position: relative;
}
.input-suffix {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.input-suffix:active { background: var(--surface-2); }

.auth-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 4px 2px 6px;
}
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
.checkbox input {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.checkbox input:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox input:checked::after {
  content: '';
  position: absolute;
  left: 5px; top: 1px;
  width: 5px; height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.divider {
  text-align: center;
  margin: 8px 0;
  position: relative;
  color: var(--text-faint);
  font-size: 13px;
}
.divider::before,
.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 28px);
  height: 1px;
  background: var(--border);
}
.divider::before { left: 0; }
.divider::after { right: 0; }
.divider span { background: var(--bg); padding: 0 12px; }

.auth-footer {
  text-align: center;
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--text-muted);
}

.link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.link:active { opacity: 0.7; }
.link-strong { font-weight: 600; }

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 4px 18px;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-titles { flex: 1; text-align: center; }
.topbar-detail { padding: 4px 0 18px; }
.topbar-greet {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}
.topbar-name {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  transition: transform 0.18s var(--ease), box-shadow 0.2s;
  position: relative;
}
.avatar:hover { box-shadow: 0 0 0 3px var(--accent-soft); }
.avatar:active { transform: scale(0.92); box-shadow: 0 0 0 5px var(--accent-soft); }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-xl {
  width: 96px; height: 96px;
  font-size: 36px;
  margin: 0 auto 14px;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* ============================================
   PROFILE SCREEN
   ============================================ */
.profile-hero {
  position: relative;
  text-align: center;
  padding: 28px 20px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  animation: scaleIn 0.4s var(--ease);
}
.profile-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top, var(--accent-soft) 0%, transparent 60%);
  opacity: 0.6;
  pointer-events: none;
}
.profile-hero > * { position: relative; z-index: 1; }

.profile-name {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.profile-email {
  margin: 4px 0 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.profile-tg-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--info-soft);
  color: var(--info);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.profile-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  animation: slideUpFade 0.4s var(--ease) backwards;
}
.profile-stat:nth-child(1) { animation-delay: 0.10s; }
.profile-stat:nth-child(2) { animation-delay: 0.18s; }
.profile-stat:nth-child(3) { animation-delay: 0.26s; }
.profile-stat-num {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.profile-stat-label {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--text-muted);
}

.profile-section-title {
  margin: 8px 4px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.profile-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 16px;
}
.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.profile-row:last-child { border-bottom: none; }
.profile-row-label {
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.profile-row-value {
  font-size: 14px;
  font-weight: 500;
  text-align: right;
  word-break: break-word;
  color: var(--text);
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.profile-action {
  background: var(--surface);
  border: 1px solid var(--border);
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  transition: background 0.18s var(--ease), border-color 0.15s, transform 0.1s;
}
.profile-action:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.profile-action:active { transform: scale(0.99); }

.profile-action-icon {
  width: 40px; height: 40px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.profile-action-icon-danger {
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.3);
}
.profile-action-body { flex: 1; min-width: 0; }
.profile-action-title {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.profile-action-danger { color: var(--danger); }
.profile-action-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}
.profile-action-chev {
  font-size: 20px;
  color: var(--text-faint);
  flex-shrink: 0;
  transition: transform 0.2s var(--ease), color 0.18s;
}
.profile-action:hover .profile-action-chev {
  transform: translateX(3px);
  color: var(--accent);
}

.profile-logout {
  margin-top: 4px;
  color: var(--danger) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
}
.profile-logout:hover {
  background: var(--danger-soft) !important;
  border-color: var(--danger) !important;
}

.icon-btn {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: background 0.18s var(--ease), border-color 0.15s, transform 0.12s var(--ease), color 0.15s;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-3); border-color: var(--accent); color: var(--accent); }
.icon-btn:active { transform: scale(0.92); background: var(--surface-3); }

/* ============================================
   SUMMARY
   ============================================ */
.summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 8px;
  display: flex;
  align-items: center;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.summary-item {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.summary-num {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.summary-label {
  font-size: 12px;
  color: var(--text-muted);
}
.summary-divider {
  width: 1px;
  height: 32px;
  background: var(--border);
}

/* ============================================
   SECTION HEAD
   ============================================ */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 4px 12px;
}
.section-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

/* ============================================
   KEY CARDS
   ============================================ */
.keys-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ============================================
   KEY CARD (v2 — детальная карточка как на сайте)
   ============================================ */
.key-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s var(--ease), box-shadow 0.2s, transform 0.12s;
  animation: slideUpFade 0.4s var(--ease) backwards;
}
.key-card:nth-child(1) { animation-delay: 0.05s; }
.key-card:nth-child(2) { animation-delay: 0.10s; }
.key-card:nth-child(3) { animation-delay: 0.15s; }
.key-card:nth-child(4) { animation-delay: 0.20s; }
.key-card:nth-child(5) { animation-delay: 0.25s; }
.key-card:nth-child(n+6) { animation-delay: 0.30s; }
.key-card:hover { border-color: var(--border-strong); }

/* Title + index number */
.key-card-title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.key-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px; height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 1px;
}
.key-name {
  flex: 1;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
  color: var(--text);
  word-break: break-word;
}

/* Status pill */
.key-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.badge-running { background: var(--success-soft); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.35); }
.badge-stopped { background: var(--warning-soft); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.35); }
.badge-expired { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.35); }
.badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.badge-running .badge-dot { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

/* Code box */
.key-code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.key-code-box code {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.key-code-copy {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 28px; height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.key-code-copy:hover { background: var(--surface-3); color: var(--accent); }
.key-code-copy:active { transform: scale(0.92); }

/* 4 stats grid */
.key-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
  padding: 2px 0;
}
.key-stat-label {
  margin: 0 0 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  text-transform: uppercase;
}
.key-stat-value {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

/* Action buttons */
.key-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.key-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.18s var(--ease), border-color 0.15s, transform 0.1s;
}
.key-btn:active { transform: scale(0.97); }
.key-btn-manage {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(6, 182, 212, 0.35);
}
.key-btn-manage:hover { background: rgba(6, 182, 212, 0.22); border-color: var(--accent); }
.key-btn-extend {
  background: var(--checkbox-on-soft);
  color: var(--checkbox-on);
  border-color: rgba(139, 92, 246, 0.35);
}
.key-btn-extend:hover { background: rgba(139, 92, 246, 0.22); border-color: var(--checkbox-on); }

/* ============================================
   STATUS BAR (prominent, как на rokbot.click)
   ============================================ */
.status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
  animation: slideUpFade 0.35s var(--ease);
  transition: background 0.3s, border-color 0.3s, color 0.3s;
}
.status-bar-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  box-shadow: 0 0 0 0 transparent;
}
.status-bar.running {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--success);
}
.status-bar.running .status-bar-dot {
  background: var(--success);
  animation: pulse-status 1.6s infinite;
}
@keyframes pulse-status {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}
.status-bar.stopped {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--warning);
}
.status-bar.stopped .status-bar-dot { background: var(--warning); }
.status-bar.expired {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--danger);
}
.status-bar.expired .status-bar-dot { background: var(--danger); }

/* ============================================
   HERO CARD (KEY DETAIL)
   ============================================ */
.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 28px 20px 20px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.hero-card {
  animation: scaleIn 0.4s var(--ease);
}
.hero-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top, var(--accent-soft) 0%, transparent 60%);
  opacity: 0.7;
  pointer-events: none;
  transition: opacity 0.4s;
}
.hero-card:hover::before { opacity: 1; }
.hero-card > * { position: relative; z-index: 1; }

.hero-icon,
.hero-media {
  width: 88px;
  height: 88px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
}
.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.hero-status.running { background: var(--success-soft); color: var(--success); }
.hero-status.stopped { background: var(--warning-soft); color: var(--warning); }
.hero-status.expired { background: var(--danger-soft); color: var(--danger); }
.hero-status::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.hero-status.running::before { animation: pulse 1.6s ease-in-out infinite; }

.hero-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 18px;
  letter-spacing: -0.02em;
}

/* ============================================
   METRICS
   ============================================ */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  animation: slideUpFade 0.4s var(--ease) backwards;
  transition: border-color 0.2s, transform 0.18s var(--ease);
}
.metric:nth-child(1) { animation-delay: 0.10s; }
.metric:nth-child(2) { animation-delay: 0.18s; }
.metric:nth-child(3) { animation-delay: 0.26s; }
.metric:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.metric-icon { font-size: 20px; }
.metric-label {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.metric-value {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   TABS
   ============================================ */
.tabs {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 4px;
  margin-bottom: 16px;
  gap: 4px;
}
.tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 8px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s var(--ease);
}
.tab.active {
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--accent-soft);
}
.tab:hover:not(.active) { color: var(--text); }

.tab-content { display: none; animation: fadeUp 0.22s var(--ease); }
.tab-content.active { display: block; }

/* ============================================
   CONFIG TOOLBAR (search + collapse all)
   ============================================ */
.config-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.config-search-wrap {
  position: relative;
}
.config-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.config-search {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px 10px 38px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.config-search:focus { border-color: var(--accent); }
.config-search::placeholder { color: var(--text-faint); }
.config-search::-webkit-search-cancel-button { -webkit-appearance: none; }

.config-toolbar-actions {
  display: flex;
  gap: 8px;
}
.btn-pill {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 7px 12px;
  border-radius: var(--r-md);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.15s, color 0.15s, transform 0.1s;
}
.btn-pill:hover {
  background: var(--surface-3);
  border-color: var(--accent);
  color: var(--accent);
}
.btn-pill:active { transform: scale(0.97); background: var(--surface-3); }

/* ============================================
   SCREENSHOT CARD
   ============================================ */
.shot-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 14px 12px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.shot-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.shot-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.shot-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}
.shot-stamp-label {
  color: var(--text-muted);
}
.shot-stamp-time {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
}
.shot-refresh {
  width: 36px; height: 36px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--accent);
}
.shot-refresh:hover { background: var(--accent-soft); }
.shot-refresh.refreshing svg { animation: spin 0.8s linear infinite; }
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.shot-body {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-2);
  height: 140px;            /* компактный thumbnail */
}
.shot-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.2s var(--ease);
}
.shot-img:active { transform: scale(0.985); }

.shot-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  text-align: center;
  padding: 12px;
}
.shot-placeholder-icon { font-size: 32px; opacity: 0.7; }
.shot-placeholder-title { font-size: 14px; font-weight: 500; }
.shot-placeholder-sub { font-size: 12px; color: var(--text-faint); }

.shot-spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.shot-overlay-label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(22, 27, 34, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
}
.shot-overlay-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #6FBF7D;
  box-shadow: 0 0 0 0 rgba(111,191,125, 0.7);
  animation: ping 2s infinite;
}
@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(111,191,125, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(111,191,125, 0); }
  100% { box-shadow: 0 0 0 0 rgba(111,191,125, 0); }
}

/* ============================================
   SELECT FIELD + PICKER
   ============================================ */
.field-select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid transparent;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: border-color 0.15s;
}
.field-select:active { transform: scale(0.99); }
.field-select:hover { border-color: var(--accent); }
.field-select-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.field-select-flag { font-size: 18px; flex-shrink: 0; }
.field-select-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.field-select-placeholder { color: var(--text-faint); }
.field-select-chev {
  color: var(--text-faint);
  font-size: 18px;
  flex-shrink: 0;
}

.picker-sheet {
  padding: 8px 0 calc(20px + env(safe-area-inset-bottom));
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.picker-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.picker-search-wrap {
  padding: 10px 16px 8px;
}
.picker-search {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid transparent;
  color: var(--text);
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.picker-search:focus { border-color: var(--accent); }
.picker-list {
  overflow-y: auto;
  padding: 4px 8px 4px;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}
.picker-item {
  background: transparent;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.15s, transform 0.12s;
  color: var(--text);
}
.picker-item:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.picker-item:active { background: var(--surface-3); transform: scale(0.99); }
.picker-item.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.picker-item-flag {
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 18px;
  flex-shrink: 0;
}
.picker-item-body { flex: 1; min-width: 0; }
.picker-item-name {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.picker-item-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}
.picker-item-check {
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  opacity: 0;
}
.picker-item.selected .picker-item-check { opacity: 1; }

.picker-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-faint);
  font-size: 13px;
}

/* === Multi-select === */
.field-select-multi {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.field-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.field-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  max-width: 100%;
}
.field-chip-num {
  font-weight: 700;
  opacity: 0.7;
}
.field-chip-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.picker-multi-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px 10px;
  font-size: 12px;
  color: var(--text-muted);
}

/* В multi-режиме selected-чип содержит порядковый номер */
.picker-item-order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.picker-item-reorder {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.picker-item-reorder button {
  background: var(--surface);
  border: 1px solid var(--border);
  width: 26px; height: 26px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.picker-item-reorder button:active { background: var(--surface-2); }
.picker-item-reorder button:disabled { opacity: 0.3; }

.picker-footer {
  border-top: 1px solid var(--border);
  padding: 12px 16px 4px;
}
.picker-footer .btn { width: 100%; }

/* ============================================
   LIGHTBOX
   ============================================ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 16px;
  cursor: zoom-out;
}
.lightbox.open { display: flex; animation: fadeUp 0.18s var(--ease); }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.lightbox-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.18s var(--ease), transform 0.12s;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.2); }
.lightbox-close:active { transform: scale(0.9); }

/* ============================================
   CONFIG FORM
   ============================================ */
.config-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  transition: border-color 0.15s;
}
.field:focus-within { border-color: var(--accent); }
.field[data-level="2"] { margin-left: 14px; }
.field[data-level="3"] { margin-left: 28px; }

/* ============================================
   MARCH DIVIDER (разделитель марша)
   ============================================ */
.march-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 4px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.march-divider::before,
.march-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.march-divider-num {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

/* ============================================
   SYNC BANNER (статус listHero / data-полей)
   ============================================ */
.sync-banner {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  margin-bottom: 4px;
  border: 1px solid transparent;
  animation: slideUpFade 0.35s var(--ease);
  transition: background 0.3s;
}
.sync-banner-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  font-size: 14px;
  flex-shrink: 0;
}
.sync-banner-warn {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: var(--warning-soft);
}
.sync-banner-ok {
  background: var(--success-soft);
  color: var(--success);
  border-color: var(--success-soft);
}

/* ============================================
   INLINE CHIP GRIDS (multi-select без picker)
   ============================================ */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: background 0.18s var(--ease), border-color 0.18s, color 0.15s, transform 0.1s;
  color: var(--text);
}
.chip:hover {
  background: var(--surface-2);
  border-color: var(--checkbox-on);
}
.chip:active { transform: scale(0.94); }
.chip-box {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  position: relative;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s;
}
.chip.checked {
  background: var(--checkbox-on-soft);
  border-color: var(--checkbox-on);
  color: var(--checkbox-on);
  font-weight: 500;
}
.chip.checked .chip-box {
  background: var(--checkbox-on);
  border-color: var(--checkbox-on);
}
.chip.checked .chip-box::after {
  content: '';
  position: absolute;
  left: 4px; top: 0px;
  width: 5px; height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.chip-flag { font-size: 14px; }
.chip-empty {
  font-size: 12px;
  color: var(--text-faint);
  padding: 6px 4px;
}

/* Special: 4-битная маска Troop type (Infantry/Cavalry/Archer/Siege) */
.troop-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-top: 6px;
}
.troop-grid .chip { justify-content: flex-start; padding: 8px 10px; }

/* ============================================
   COLLAPSIBLE SECTIONS (раскрывающиеся секции)
   ============================================ */
.config-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 0.2s var(--ease), box-shadow 0.25s var(--ease);
}
.config-section:hover { border-color: var(--border-strong); }
.config-section.open {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
}
.section-head:active { background: var(--surface-2); }

.section-chev {
  width: 22px; height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: transform 0.25s var(--ease), color 0.18s;
  flex-shrink: 0;
}
.config-section.open .section-chev {
  transform: rotate(90deg);
  color: var(--accent);
}

.section-head-body {
  flex: 1;
  min-width: 0;
}

.section-parent {
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-parent-checkbox {
  width: 22px; height: 22px;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.section-parent-checkbox.on {
  background: var(--checkbox-on);
  border-color: var(--checkbox-on);
}
.section-parent-checkbox.on::after {
  content: '';
  position: absolute;
  left: 6px; top: 1px;
  width: 6px; height: 13px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.section-parent-text { flex: 1; min-width: 0; }
.section-parent-label {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.section-parent-hint {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-muted);
}
.section-head-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}
.section-head-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin: 2px 0 0;
}
.section-head-count {
  font-size: 11px;
  color: var(--text-faint);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
}

.section-children {
  display: none;
  padding: 4px 8px 10px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  animation: slideUpFade 0.3s var(--ease);
}
.config-section.open .section-children { display: block; }

/* Секция с выключенным parent: дети остаются доступны, но слегка приглушены */
.config-section.inactive .section-children {
  opacity: 0.85;
}
.config-section.inactive .section-children::before {
  content: '';
  display: block;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--border) 40%, var(--border) 60%, transparent);
  margin: 0 0 8px;
}

.section-children > .field {
  background: var(--surface);
  margin-bottom: 6px;
}
.section-children > .field:last-child { margin-bottom: 0; }

/* ============================================
   COMPACT CHECKBOX (для подробных boolean-настроек)
   ============================================ */
.field-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  margin-bottom: 6px;
  transition: background 0.18s var(--ease), border-color 0.18s, transform 0.1s;
}
.field-checkbox:hover { border-color: var(--border-strong); background: var(--surface-2); }
.field-checkbox:active { transform: scale(0.99); }
.field-checkbox:last-child { margin-bottom: 0; }
.field-checkbox:active { background: var(--surface-2); }
.field-checkbox.checked {
  border-color: var(--checkbox-on);
  background: var(--checkbox-on-soft);
}

.checkbox-box {
  width: 20px; height: 20px;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  position: relative;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s;
}
.field-checkbox.checked .checkbox-box {
  background: var(--checkbox-on);
  border-color: var(--checkbox-on);
}
.field-checkbox.checked .checkbox-box::after {
  content: '';
  position: absolute;
  left: 6px; top: 2px;
  width: 5px; height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-label {
  flex: 1;
  font-size: 14px;
  line-height: 1.3;
  color: var(--text);
}
.checkbox-hint {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.field-checkbox.disabled { opacity: 0.4; pointer-events: none; }

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.field-hint {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 6px;
  line-height: 1.4;
}

.field-input,
.field-number {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid transparent;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}
.field-input:focus,
.field-number:focus { border-color: var(--accent); }
.field-input:disabled,
.field-number:disabled { opacity: 0.5; }

.field-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.field-toggle-text { flex: 1; }
.field-toggle-text .field-label { margin-bottom: 0; }

.toggle-switch {
  position: relative;
  width: 48px; height: 28px;
  background: var(--border-strong);
  border-radius: 14px;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.2s var(--ease);
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  background: #e8eaee;
  border-radius: 50%;
  transition: transform 0.2s var(--ease);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.toggle-switch.on { background: var(--accent); }
.toggle-switch.on::after { transform: translateX(20px); }

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 14px;
  z-index: 5;
  box-shadow: var(--shadow-md);
}
.form-actions .btn { flex: 0 0 auto; }
.form-actions-status {
  flex: 1;
  font-size: 12px;
  color: var(--success);
  line-height: 1.3;
}
.form-actions.dirty .form-actions-status {
  color: var(--warning);
}

.bot-hint {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--info-soft);
  color: var(--info);
  border-radius: var(--r-md);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}
.bot-hint .link { color: var(--info); text-decoration: underline; }

/* ============================================
   LOGS
   ============================================ */
.logs-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px 8px;
}
.logs-count {
  font-size: 12px;
  color: var(--text-muted);
}
.logs-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 8px;
  max-height: 420px;
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}
.log-entry {
  display: flex;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  font-family: var(--font-mono);
}
.log-entry:hover { background: var(--surface-2); }
.log-time {
  color: var(--text-faint);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 1px;
}
.log-message { color: var(--text); flex: 1; word-break: break-word; }
.log-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-faint);
  font-size: 13px;
}

/* ============================================
   INFO TAB
   ============================================ */
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.info-row:last-child { border-bottom: none; }
.info-label {
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.info-row > span:not(.info-label) {
  font-size: 14px;
  font-weight: 500;
  text-align: right;
}
.info-code-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.info-code-wrap code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  background: var(--surface-2);
  padding: 4px 8px;
  border-radius: 6px;
}

/* ============================================
   BUY / OFFERS
   ============================================ */
.region-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.offers-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.offer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  box-shadow: var(--shadow-sm);
}
.offer-card:active { transform: scale(0.985); }
.offer-thumb {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  overflow: hidden;
}
.offer-thumb img { width: 100%; height: 100%; object-fit: cover; }
.offer-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.offer-radio {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.15s;
}
.offer-card.selected .offer-radio {
  border-color: var(--accent);
}
.offer-card.selected .offer-radio::after {
  content: '';
  position: absolute;
  inset: 3px;
  background: var(--accent);
  border-radius: 50%;
}
.offer-info { flex: 1; min-width: 0; }
.offer-name {
  font-weight: 600;
  font-size: 15px;
  margin: 0;
  letter-spacing: -0.01em;
}
.offer-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin: 3px 0 0;
}
.offer-price {
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.buy-cta-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

/* ============================================
   PAY OPTIONS (две плашки оплаты)
   ============================================ */
.pay-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}
.pay-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), transform 0.12s, box-shadow 0.2s;
  box-shadow: var(--shadow-sm);
}
.pay-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.pay-card:active { transform: scale(0.99); }

.pay-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.pay-card-flag {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.pay-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.pay-card-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}
.pay-card-url {
  margin: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}
.buy-cta-text {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.buy-cta-sub {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--text-faint);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.15s, transform 0.12s var(--ease), opacity 0.15s, box-shadow 0.2s;
  letter-spacing: -0.005em;
  position: relative;
  overflow: hidden;
}
.btn:hover:not(:disabled):not(:active) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 22px; font-size: 16px; border-radius: 14px; }

/* Ripple-эффект (CSS-only) при клике */
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.25) 0%, transparent 60%);
  opacity: 0;
  transform: scale(0);
  pointer-events: none;
  transition: transform 0.4s var(--ease), opacity 0.4s;
}
.btn:active::after {
  opacity: 1;
  transform: scale(1.5);
  transition: transform 0s, opacity 0s;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:active) { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-hover); box-shadow: 0 0 0 4px var(--accent-soft); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:active) { background: var(--surface-3); border-color: var(--text-muted); }
.btn-secondary:active { background: var(--surface-3); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:active) { background: #f87171; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:active) { background: #34d399; }

.toggle-btn.running {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
}
.toggle-btn.running:hover:not(:active) { background: #f87171; }
.toggle-btn.running:active { background: #dc2626; }
.toggle-btn.stopped {
  background: var(--success);
  color: #fff;
  border-color: transparent;
}
.toggle-btn.stopped:hover:not(:active) { background: #34d399; }
.toggle-btn.stopped:active { background: #059669; }
.toggle-btn.expired { background: var(--accent); color: #fff; }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: 48px 16px;
}
.empty-illu {
  font-size: 56px;
  margin-bottom: 12px;
  opacity: 0.6;
}
.empty-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 4px;
}
.empty-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 20px;
}

/* ============================================
   BOTTOM SHEET (PROFILE)
   ============================================ */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 90;
}
.sheet-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-radius: 22px 22px 0 0;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.28s var(--ease);
  z-index: 100;
  box-shadow: var(--shadow-lg);
  max-width: 540px;
  margin: 0 auto;
}
.sheet.open { transform: translateY(0); }

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.sheet-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 4px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.sheet-name {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.sheet-email {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.sheet-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sheet-item {
  background: transparent;
  border: none;
  padding: 12px 8px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  border-radius: 10px;
  text-align: left;
  transition: background 0.18s var(--ease), transform 0.12s;
}
.sheet-item:hover { background: var(--surface-2); }
.sheet-item:hover .sheet-item-chev { transform: translateX(3px); color: var(--accent); }
.sheet-item:active { background: var(--surface-2); transform: scale(0.99); }
.sheet-item-chev { transition: transform 0.2s var(--ease), color 0.18s; }
.sheet-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}
.sheet-item-body { flex: 1; min-width: 0; }
.sheet-item-title {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.sheet-item-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}
.sheet-item-chev {
  color: var(--text-faint);
  font-size: 22px;
  font-weight: 300;
}
.sheet-item-danger .sheet-item-title { color: var(--danger); }
.sheet-item-danger .sheet-item-icon {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}

/* ============================================
   TOAST (тёмная плашка, в тон темы)
   ============================================ */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.25s var(--ease);
  z-index: 200;
  box-shadow: var(--shadow-lg);
  max-width: 90%;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.show {
  animation: toastIn 0.4s var(--ease);
}
@keyframes toastIn {
  0% { opacity: 0; transform: translateX(-50%) translateY(40px) scale(0.95); }
  60% { opacity: 1; transform: translateX(-50%) translateY(-2px) scale(1.02); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.hidden { display: none !important; }
