:root {
  --bg: #0d1117;
  --bg2: #161c26;
  --card: #1a2230;
  --card2: #202a3c;
  --border: #2c3a52;
  --text: #e8edf5;
  --muted: #8b98ad;
  --accent: #2ea6ff;
  --accent2: #22c993;
  --danger: #ff5d6c;
  --warn: #f0b429;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* Шапка */
header.site {
  background: rgba(13, 17, 23, 0.92);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(8px);
}
header.site .inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 62px;
}
.logo { font-size: 20px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 9px; }
.logo:hover { text-decoration: none; }
.logo .dot { width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
nav.main { display: flex; align-items: center; gap: 16px; }
nav.main a { color: var(--muted); font-size: 15px; }
nav.main a:hover { color: var(--text); text-decoration: none; }
nav.main a.active { color: var(--text); font-weight: 600; }

/* Кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card2); color: var(--text); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.15); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #1877cc); border-color: transparent; }
.btn.success { background: linear-gradient(135deg, var(--accent2), #159a70); border-color: transparent; }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Карточки */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px;
}
.section { margin: 40px 0; }
h1 { font-size: 34px; line-height: 1.25; }
h2 { font-size: 24px; margin-bottom: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Hero */
.hero { padding: 56px 0 8px; }
.hero h1 span { background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { max-width: 640px; margin-top: 12px; color: var(--muted); font-size: 17px; }

/* Сетка курсов */
.rates-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.rate-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; cursor: pointer; transition: border-color .15s; }
.rate-card:hover { border-color: var(--accent); }
.rate-card .pair { font-weight: 700; font-size: 16px; }
.rate-card .value { font-size: 20px; font-weight: 700; color: var(--accent2); margin-top: 6px; }
.rate-card .note { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

/* Формы */
label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; font-size: 13.5px; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg2); color: var(--text); font-size: 15px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }

.msg { padding: 10px 14px; border-radius: 10px; font-size: 14px; margin: 10px 0; display: none; }
.msg.error { display: block; background: rgba(255, 93, 108, .12); color: var(--danger); border: 1px solid rgba(255, 93, 108, .35); }
.msg.ok { display: block; background: rgba(34, 201, 147, .12); color: var(--accent2); border: 1px solid rgba(34, 201, 147, .35); }

/* Калькулятор */
.calc { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 800px) { .calc { grid-template-columns: 1fr; } }
.calc .result {
  font-size: 28px; font-weight: 800; color: var(--accent2);
  padding: 14px 0 4px;
}
.calc .rate-line { color: var(--muted); font-size: 14px; }

/* Таблицы */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }

/* Статусы */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.badge.new { background: rgba(46, 166, 255, .15); color: var(--accent); }
.badge.processing { background: rgba(240, 180, 41, .15); color: var(--warn); }
.badge.awaiting_payment { background: rgba(240, 180, 41, .2); color: var(--warn); }
.badge.done { background: rgba(34, 201, 147, .15); color: var(--accent2); }
.badge.cancelled { background: rgba(255, 93, 108, .15); color: var(--danger); }

/* Шаги */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.step { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.step .num {
  width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); font-weight: 700; margin-bottom: 10px; font-size: 14px;
}

/* Вкладки админки */
.tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.tabs button {
  padding: 9px 18px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); font-size: 15px; font-weight: 600; cursor: pointer;
}
.tabs button.active { background: var(--card2); color: var(--text); border-color: var(--accent); }

.auth-box { max-width: 420px; margin: 60px auto; }

/* Чат */
.chat-box {
  height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
  padding: 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
}
.bubble {
  max-width: 75%; padding: 9px 13px; border-radius: 14px; font-size: 14.5px;
  white-space: pre-wrap; word-break: break-word;
}
.bubble.me { align-self: flex-end; background: linear-gradient(135deg, #1877cc, #145fa3); border-bottom-right-radius: 4px; }
.bubble.them { align-self: flex-start; background: var(--card2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble.failed { opacity: .6; font-style: italic; }
.bubble .time { font-size: 11px; color: rgba(255,255,255,.55); margin-top: 4px; text-align: right; }
.thread-item {
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
  margin-bottom: 8px; background: var(--card);
}
.thread-item:hover, .thread-item.active { border-color: var(--accent); }
.chat-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; }
@media (max-width: 800px) { .chat-layout { grid-template-columns: 1fr; } }

/* Верификация */
.upload-box {
  margin-top: 8px; min-height: 180px; border: 2px dashed var(--border); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--muted); font-size: 14px; overflow: hidden; background: var(--bg2); text-align: center; padding: 8px;
}
.upload-box:hover { border-color: var(--accent); }
.upload-box img, .upload-box video { max-width: 100%; max-height: 260px; border-radius: 8px; }
.verify-doc { max-width: 100%; max-height: 300px; border-radius: 10px; border: 1px solid var(--border); cursor: zoom-in; }

/* Карточки направлений в админке */
.dir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.dir-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.dir-card.off { opacity: .55; }
.dir-card .cur-rate { color: var(--accent2); font-size: 14px; white-space: nowrap; }
.dir-card .base-rate { padding: 11px 13px; border-radius: 10px; border: 1px dashed var(--border); color: var(--muted); font-size: 15px; }
.mode-row { display: flex; gap: 8px; }
.mode {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border);
  font-size: 13.5px; color: var(--muted); cursor: pointer; user-select: none;
}
.mode.active { border-color: var(--accent); color: var(--text); background: rgba(46, 166, 255, .08); }
.mode input { width: auto; accent-color: var(--accent); }

/* Переключатель вкл/выкл */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 999px; background: var(--bg2);
  border: 1px solid var(--border); transition: background .15s; cursor: pointer;
}
.switch .slider::before {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  left: 3px; top: 3px; background: var(--muted); transition: transform .15s, background .15s;
}
.switch input:checked + .slider { background: rgba(34, 201, 147, .25); border-color: var(--accent2); }
.switch input:checked + .slider::before { transform: translateX(20px); background: var(--accent2); }

footer.site { border-top: 1px solid var(--border); margin-top: 60px; padding: 26px 0; color: var(--muted); font-size: 14px; }

.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.mt { margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } h1 { font-size: 26px; } }
