:root {
  --bg: #0b0f17;
  --bg2: #111827;
  --card: #151c2c;
  --border: #243047;
  --text: #e8edf7;
  --muted: #8b98b3;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0,0,0,.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 32px;
  padding: 0 8px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-nav a {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: rgba(59,130,246,.12);
  color: var(--text);
}
.sidebar-nav a.active { color: var(--primary); font-weight: 600; }

.sidebar-user {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
}
.user-name { font-weight: 600; font-size: .9rem; }
.user-role { margin: 6px 0 12px; }

.main { flex: 1; padding: 28px 32px; overflow-x: auto; }

.page-header {
  margin-bottom: 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 1.75rem; margin-bottom: 4px; }
.page-header p { color: var(--muted); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.stat-label { color: var(--muted); font-size: .85rem; margin-bottom: 6px; }
.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-hint { font-size: .8rem; margin-top: 4px; }
.stat-card-ok .stat-value { color: var(--success, #22c55e); }
.stat-card-warn .stat-value { color: var(--warning, #f59e0b); }

.date-filter-card { padding: 16px 18px; }
.date-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
}
.date-filter-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.date-filter-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .9rem;
}
.date-filter-field input[type="date"] {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 12px;
}
.input-with-action {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.input-with-action input { flex: 1; min-width: 0; }
.contact-pick-btn,
.contact-share-btn { white-space: nowrap; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 1.1rem; margin-bottom: 16px; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; color: var(--muted); }
.form input, .form select, .select-sm {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: .95rem;
}
.form input:focus, .form select:focus { outline: 2px solid rgba(59,130,246,.4); border-color: var(--primary); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  transition: .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  background: rgba(59,130,246,.15);
  color: #93c5fd;
  text-transform: uppercase;
}
.badge.ok { background: rgba(16,185,129,.15); color: #6ee7b7; }
.badge.err { background: rgba(239,68,68,.15); color: #fca5a5; }

.status-pending { background: rgba(245,158,11,.15); color: #fcd34d; }
.status-processing { background: rgba(59,130,246,.15); color: #93c5fd; }
.status-completed { background: rgba(16,185,129,.15); color: #6ee7b7; }
.status-cancelled, .status-expired { background: rgba(239,68,68,.15); color: #fca5a5; }
.status-rejected { background: rgba(239,68,68,.2); color: #f87171; }

.btn-warning { background: var(--warning); color: #111; }
.btn-warning:hover { filter: brightness(1.05); }

.pay-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at top, #1e293b 0%, var(--bg) 60%);
}
.pay-card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.pay-card-wide { max-width: 620px; }
.pay-limits {
  text-align: center;
  padding: 12px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: .95rem;
}
.pay-note { font-size: .85rem; margin-top: 16px; text-align: center; }
.pay-state { text-align: center; padding: 8px 0; }
.pay-state h2 { margin: 12px 0 8px; font-size: 1.25rem; }
.pay-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pay-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 auto 12px;
}
.pay-icon.success { background: rgba(16,185,129,.2); color: #6ee7b7; }
.pay-icon.error { background: rgba(239,68,68,.2); color: #fca5a5; }
.requisite-box {
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
}
.req-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: .95rem;
}
.req-row:last-child { border-bottom: none; }
.req-row span { color: var(--muted); }
.pay-divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.pay-timer {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(59, 130, 246, .12);
  border: 1px solid rgba(59, 130, 246, .25);
  font-size: .92rem;
}
.pay-timer-urgent {
  background: rgba(239, 68, 68, .12);
  border-color: rgba(239, 68, 68, .3);
  color: #fca5a5;
}
.pay-confirm-form { text-align: left; margin-top: 8px; }
.pay-confirm-form textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  resize: vertical;
}
.proof-message { margin-top: 6px; font-size: .88rem; max-width: 280px; word-break: break-word; }
.proof-time { margin-top: 4px; font-size: .8rem; }

.withdraw-form { max-width: 480px; }

.support-lock { font-size: .85rem; color: var(--muted); }
.support-chat-card { display: flex; flex-direction: column; max-width: 720px; min-height: 420px; }
.chat-messages {
  flex: 1;
  min-height: 280px;
  max-height: 480px;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
}
.chat-bubble {
  max-width: 85%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: .92rem;
}
.chat-bubble-mine {
  margin-left: auto;
  background: rgba(59, 130, 246, .15);
  border: 1px solid rgba(59, 130, 246, .25);
}
.chat-bubble-theirs {
  margin-right: auto;
  background: var(--card);
  border: 1px solid var(--border);
}
.chat-meta { font-size: .75rem; color: var(--muted); margin-bottom: 4px; }
.chat-text { white-space: pre-wrap; word-break: break-word; }
.chat-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-form textarea {
  flex: 1;
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  resize: vertical;
}
.chat-preview { max-width: 320px; font-size: .88rem; color: var(--muted); }
.chat-empty { text-align: center; padding: 40px 12px; }
.link-url { font-size: .8rem; word-break: break-all; }

.method-label {
  font-size: .9rem;
  color: var(--muted);
  margin-bottom: 10px;
  display: block;
}

.pay-methods {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.pay-method-card {
  cursor: pointer;
  display: block;
}

.pay-method-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pay-method-inner {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  transition: .18s ease;
  text-align: center;
}

.pay-method-card input:checked + .pay-method-inner {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .22);
  transform: translateY(-2px);
}

.pay-method-card:hover .pay-method-inner {
  border-color: #64748b;
}

.pay-method-visual {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #0f172a;
}

.pay-method-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
}

.pay-method-caption {
  padding: 10px 12px 12px;
}

.pay-method-title {
  display: block;
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
}

.pay-method-sub {
  display: block;
  font-size: .72rem;
  color: var(--muted);
  line-height: 1.35;
  margin-top: 2px;
}

.pay-method-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .85rem;
}

.pay-method-badge img {
  width: 56px;
  height: 36px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

.pay-method-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
}

.pay-method-mini img {
  width: 52px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

#toast.show { opacity: 1; transform: translateY(0); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: rgba(255,255,255,.02); }
code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: .85em; }

.muted { color: var(--muted); }
.hidden { display: none; }

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 48px;
  padding: 32px 24px;
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(59,130,246,.18) 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(139,92,246,.12) 0%, transparent 50%),
    var(--bg);
}

.auth-hero {
  display: none;
  max-width: 440px;
  flex: 1;
}

.auth-hero__desc {
  margin-top: 20px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.auth-hero__desc strong {
  color: var(--text);
  font-weight: 600;
}

.auth-hero__features {
  margin-top: 24px;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-hero__features li {
  color: var(--text);
  font-size: .95rem;
  padding-left: 28px;
  position: relative;
}

.auth-hero__features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  box-shadow: 0 0 12px rgba(59,130,246,.45);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px;
  box-shadow: var(--shadow);
}

.auth-card__head {
  text-align: center;
  margin-bottom: 24px;
}

.auth-card__head h2 {
  margin-top: 14px;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.brand-logo--lg {
  gap: 18px;
}

.brand-logo--sm {
  gap: 10px;
}

.brand-logo__icon {
  flex-shrink: 0;
  display: block;
  filter: drop-shadow(0 4px 14px rgba(59,130,246,.35));
}

.brand-logo__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-logo__name {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #e8edf7 0%, #93c5fd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-logo--lg .brand-logo__name {
  font-size: 2.4rem;
  letter-spacing: 0.1em;
}

.brand-logo--sm .brand-logo__name {
  font-size: 1rem;
  letter-spacing: 0.06em;
}

.brand-logo__tagline {
  font-size: .82rem;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.02em;
}

.brand-logo--lg .brand-logo__tagline {
  font-size: 1.05rem;
}

.brand-logo--with-tagline .brand-logo__tagline {
  background: linear-gradient(90deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sidebar-brand .brand-logo {
  width: 100%;
}

.logo { text-align: center; margin-bottom: 28px; }
.logo h1 { font-size: 1.75rem; margin: 8px 0 4px; }
.logo p { color: var(--muted); font-size: .9rem; }
.logo-icon {
  display: inline-flex;
  width: 56px; height: 56px;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 14px;
  font-size: 1.75rem;
  font-weight: 700;
}
.logo-icon.sm { width: 32px; height: 32px; font-size: 1rem; border-radius: 8px; }

.auth-footer { text-align: center; margin-top: 20px; color: var(--muted); font-size: .9rem; }
.download-card { max-width: 440px; }
.download-features {
  text-align: left;
  margin: 16px 0 20px;
  padding-left: 20px;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.6;
}
.download-btn { margin-top: 8px; font-size: 1.05rem; padding: 14px; }
.install-hint { font-size: .82rem; margin-top: 12px; }

.register-card { max-width: 460px; }
.register-type-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.register-type-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color .2s, background .2s;
}
.register-type-tab input { display: none; }
.register-type-tab span { font-weight: 600; font-size: .95rem; }
.register-type-tab small { color: var(--muted); font-size: .78rem; }
.register-type-tab:has(input:checked) {
  border-color: var(--primary);
  background: rgba(59,130,246,.1);
}
.legal-check { margin: 8px 0 4px; font-size: .88rem; line-height: 1.45; }
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.stat-value-sm { font-size: 1.1rem; }

.demo-accounts {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: .8rem;
  color: var(--muted);
}
.demo-accounts ul { margin-top: 8px; padding-left: 18px; }
.demo-accounts li { margin-bottom: 4px; }

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: .9rem;
}
.alert-error { background: rgba(239,68,68,.12); color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }
.alert-success { background: rgba(16,185,129,.12); color: #6ee7b7; border: 1px solid rgba(16,185,129,.3); }

.calc-preview { padding: 10px; background: var(--bg); border-radius: 8px; font-size: .9rem; }

.api-key-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  padding: 12px;
  border-radius: 8px;
  margin: 12px 0;
  word-break: break-all;
}

.code-block {
  background: var(--bg);
  padding: 14px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: .82rem;
  line-height: 1.6;
  margin: 12px 0;
  border: 1px solid var(--border);
}

.docs-page { min-height: 100vh; }
.docs-header {
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.logo-inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; }
.docs-main { max-width: 800px; margin: 0 auto; padding: 32px 24px; }
.docs-main h1 { margin-bottom: 12px; }
.docs-main > p { color: var(--muted); margin-bottom: 8px; }
.docs-main section { margin-top: 20px; }

.update-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(90deg, #1d4ed8, #2563eb);
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,.35);
  font-size: .9rem;
}
.update-banner .btn { flex-shrink: 0; background: #fff; color: #1d4ed8; border: none; }
.update-banner .btn:hover { background: #e8edf7; }

.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1200;
}
.admin-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1210;
  width: min(420px, calc(100vw - 32px));
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.admin-modal-header h2 { font-size: 1.1rem; }

#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: .25s;
  z-index: 9999;
  pointer-events: none;
}
.actions-cell { white-space: nowrap; }
.actions-cell .btn { margin-right: 4px; }
.section-hint { margin: -8px 0 16px; font-size: .9rem; }
.checkbox-row {
  flex-direction: row !important;
  align-items: center;
  gap: 10px !important;
  color: var(--text) !important;
}
.checkbox-row input[type="checkbox"] { width: auto; accent-color: var(--primary); }

.subsection-title {
  margin: 20px 0 4px;
  font-size: 1rem;
  grid-column: 1 / -1;
}

.pm-settings-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  grid-column: 1 / -1;
}

.pm-settings-row {
  display: grid;
  grid-template-columns: 1fr auto 110px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.pm-settings-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.pm-settings-icon {
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}

.pm-settings-label { font-weight: 600; }

.pm-settings-toggle { margin: 0; white-space: nowrap; }

.pm-settings-fee {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: .85rem;
  color: var(--muted);
}

.pm-settings-fee input { width: 100%; }

.stat-card-wide { grid-column: span 2; }

.tier-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tier-chip {
  display: inline-block;
  padding: 4px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .82rem;
}

.pm-create-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.pm-admin-list { display: flex; flex-direction: column; gap: 14px; }

.pm-admin-item {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 16px;
  align-items: start;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.pm-admin-icon-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.pm-admin-icon {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
}

.pm-upload-btn { cursor: pointer; text-align: center; }

.pm-admin-fields label { margin-bottom: 8px; }

.pm-admin-meta { margin-bottom: 8px; font-size: .85rem; }

.pm-admin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.pm-admin-row label { margin-bottom: 0; min-width: 100px; }

.pm-admin-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.presence-map-card { padding: 0; overflow: hidden; }
.presence-map {
  width: 100%;
  height: 480px;
  border-radius: var(--radius);
  background: #0f172a;
}
.presence-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

@media (min-width: 960px) {
  .auth-page {
    justify-content: center;
    padding: 48px 64px;
  }
  .auth-hero {
    display: block;
  }
  .auth-card__head .brand-logo {
    display: none;
  }
}

/* Mobile app layout */
.layout-app {
  position: relative;
  min-height: 100vh;
}
.layout-app .sidebar-desktop { display: none; }
.layout-app .page-header-desktop { display: none; }
.app-main {
  flex: 1;
  width: 100%;
  padding: 0 16px 24px;
  min-width: 0;
}
.layout-app.layout-user-wallet .app-main {
  max-width: 480px;
  margin: 0 auto;
}

.app-topbar {
  padding: 12px 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
}
.app-topbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-topbar--with-rules {
  padding-bottom: 10px;
}
.app-topbar-rules {
  margin-top: 8px;
  padding-left: 52px;
}
.app-topbar-rules-link {
  font-size: .82rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.app-topbar-rules-link:hover {
  text-decoration: underline;
}
.rules-card h1 { font-size: 1.2rem; margin-bottom: 8px; }
.rules-section { margin: 18px 0; }
.rules-section h2 { font-size: 1rem; margin-bottom: 8px; }
.rules-section ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text);
  font-size: .92rem;
  line-height: 1.55;
}
.rules-section li + li { margin-top: 6px; }
.rules-updated { font-size: .8rem; margin-top: 20px; }

.admin-password {
  font-size: .85rem;
  word-break: break-all;
  user-select: all;
}

.admin-gear-wrap {
  position: relative;
  display: inline-block;
}
.admin-gear-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.admin-gear-btn:hover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, .08);
}
.admin-gear-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 200;
  min-width: 190px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.admin-gear-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: .88rem;
  cursor: pointer;
}
.admin-gear-item:hover {
  background: rgba(59, 130, 246, .1);
}
.admin-gear-item-danger {
  color: #ef4444;
}
.admin-gear-item-danger:hover {
  background: rgba(239, 68, 68, .12);
}
.app-menu-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.app-menu-btn span {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}
.app-topbar-title {
  font-weight: 700;
  font-size: 1.05rem;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-topbar-spacer { width: 40px; flex-shrink: 0; }
.app-topbar-action { flex-shrink: 0; font-size: .82rem !important; }

.app-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1100;
}
.app-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 86vw);
  z-index: 1110;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  transform: translateX(-105%);
  transition: transform .25s ease;
  box-shadow: 8px 0 32px rgba(0,0,0,.35);
}
.app-drawer.open { transform: translateX(0); }
.app-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}
.app-drawer-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--card);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.app-drawer-user {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.app-drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.app-drawer-nav a {
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.app-drawer-nav a:hover,
.app-drawer-nav a.active {
  background: rgba(59,130,246,.12);
  color: var(--text);
  text-decoration: none;
}
.app-drawer-nav a.active { color: var(--primary); font-weight: 600; }
.app-drawer-logout { margin-top: 8px; color: var(--danger) !important; }
body.drawer-open { overflow: hidden; }

@media (min-width: 960px) {
  .layout-app {
    display: flex;
  }
  .layout-app .sidebar-desktop { display: flex; }
  .layout-app .app-topbar,
  .layout-app .app-drawer,
  .layout-app .app-drawer-backdrop { display: none !important; }
  .layout-app .page-header-desktop { display: flex; }
  .layout-app .app-main {
    padding: 28px 32px;
    max-width: none;
    margin: 0;
  }
}

.wallet-balance-card {
  background: linear-gradient(145deg, #1a2744 0%, #151c2c 55%, #111827 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 24px;
  margin-bottom: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}
.wallet-balance-label {
  color: var(--muted);
  font-size: .9rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
}
.wallet-balance-amount {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 6px;
}
.wallet-balance-currency {
  font-size: 1.1rem;
  color: var(--primary);
  font-weight: 600;
}
.wallet-balance-secondary {
  font-size: 1rem;
  margin-bottom: 14px;
}
.wallet-balance-meta { font-size: .82rem; margin-top: 10px; }

.wallet-currency-switch {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
}
.wallet-currency-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(0,0,0,.2);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
}
.wallet-currency-btn:hover { border-color: var(--primary); color: var(--text); }
.wallet-currency-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.wallet-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.wallet-phone-line,
.wallet-verify-line {
  font-size: .85rem;
  margin: 0 0 12px;
}
.wallet-phone-alert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: .9rem;
}
.alert-warn {
  background: rgba(245, 158, 11, .12);
  border: 1px solid rgba(245, 158, 11, .35);
  color: var(--text);
}
.transfer-confirm-card {
  margin: 12px 0;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(59, 130, 246, .06);
}
.transfer-recipient-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.transfer-confirm-question {
  margin: 10px 0 0;
  font-weight: 600;
}
.transfer-amount-grid { margin-top: 8px; }
.wallet-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
}
.wallet-action-btn:hover { border-color: var(--primary); background: rgba(59,130,246,.08); }
.wallet-action-btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.wallet-action-btn-primary:hover { background: var(--primary-hover); }
.wallet-action-icon {
  font-size: 1.2rem;
  line-height: 1;
  font-weight: 700;
}

.wallet-history { margin-bottom: 16px; }
.wallet-history h2 { font-size: 1rem; margin-bottom: 12px; }
.wallet-history-empty { font-size: .9rem; padding: 8px 0; }
.wallet-ops-list { display: flex; flex-direction: column; gap: 8px; }
.wallet-op-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
}
.wallet-op-item-row { align-items: flex-start; }
.wallet-op-item:hover { border-color: var(--primary); text-decoration: none; }
.wallet-op-main { min-width: 0; flex: 1; }
.wallet-op-title { font-weight: 600; font-size: .95rem; }
.wallet-op-date { font-size: .8rem; margin-top: 2px; }
.wallet-op-sub { font-size: .78rem; margin-top: 2px; word-break: break-all; }
.wallet-op-right { text-align: right; flex-shrink: 0; }
.wallet-op-amount { font-weight: 700; font-size: .9rem; }
.wallet-op-credit { color: var(--success); }
.wallet-op-debit { color: var(--danger); }
.wallet-op-rub { font-size: .78rem; margin-top: 2px; }
.wallet-receipt-btn { margin-top: 6px; padding: 4px 10px !important; font-size: .75rem !important; }
.wallet-op-status .badge { font-size: .7rem; }

.support-chat-card-mobile {
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
}
.support-chat-card-mobile .chat-messages {
  flex: 1;
  min-height: 50vh;
}

.user-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 950;
}
.user-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 960;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -12px 40px rgba(0,0,0,.4);
}
.user-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.user-sheet-header h2 { font-size: 1.15rem; }
.user-sheet-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--card);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
body.sheet-open { overflow: hidden; }
.pay-methods-compact { grid-template-columns: repeat(2, 1fr); }

.withdraw-amount-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.withdraw-amount-grid label { margin-bottom: 0; }

@media (max-width: 768px) {
  .layout:not(.layout-app) { flex-direction: column; }
  .layout:not(.layout-app) .sidebar { width: 100%; height: auto; position: static; }
  .main:not(.app-main) { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .pay-methods { grid-template-columns: 1fr; }
  .pay-methods-compact { grid-template-columns: 1fr 1fr; }
  .pm-settings-row { grid-template-columns: 1fr; }
  .stat-card-wide { grid-column: span 1; }
  .pm-admin-item { grid-template-columns: 1fr; }
  .pm-admin-actions { flex-direction: row; flex-wrap: wrap; }
  .wallet-actions { grid-template-columns: repeat(2, 1fr); }
}
