:root {
  --bg: #ffffff;
  --soft: #f6f8f7;
  --fg: #14171a;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #0f766e;
  --accent-hover: #0c5d56;
  --accent-soft: #e6f4f1;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #b45309;
  --radius: 10px;
  --maxw: 960px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.5;
  font-size: 16px;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

img { max-width: 100%; height: auto; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ── Header ── */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { display: flex; flex-direction: column; justify-content: center; line-height: 1; gap: 3px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-text { font-size: 25px; font-weight: 800; letter-spacing: -.5px; }
.brand-1 { color: var(--fg); }
.brand-2 { color: var(--accent); }
.brand-desc { font-size: 9.5px; color: var(--muted); letter-spacing: 1.4px; text-transform: uppercase; font-weight: 600; }

/* Десктоп nav */
.nav-desktop { display: flex; align-items: center; gap: 24px; }
.nav-desktop a { color: var(--muted); font-size: 15px; font-weight: 500; transition: color .15s; }
.nav-desktop a:hover { color: var(--fg); text-decoration: none; }
.nav-desktop a.active { color: var(--fg); font-weight: 700; }

/* Бургер */
.burger {
  display: none; flex-direction: column; justify-content: center;
  gap: 5px; padding: 6px; background: none; border: none; cursor: pointer;
  width: 40px; height: 40px; border-radius: 8px; transition: background .15s;
}
.burger:hover { background: var(--soft); }
.burger span {
  display: block; height: 2px; background: var(--fg);
  border-radius: 2px; transition: transform .3s, opacity .3s, width .3s;
  transform-origin: center;
}
.burger span:nth-child(1) { width: 24px; }
.burger span:nth-child(2) { width: 18px; }
.burger span:nth-child(3) { width: 24px; }
.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); width: 24px; }
.burger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); width: 24px; }

/* Мобильное меню */
.nav-mobile {
  display: none; overflow: hidden;
  max-height: 0; transition: max-height .35s ease, padding .35s ease;
  background: var(--bg); border-top: 1px solid var(--line);
}
.nav-mobile.open { max-height: 400px; }
.nav-mobile nav {
  display: flex; flex-direction: column;
  padding: 8px 0 12px;
}
.nav-mobile nav a {
  padding: 13px 20px; color: var(--fg); font-size: 16px; font-weight: 500;
  border-bottom: 1px solid var(--line); transition: background .15s;
  text-decoration: none;
}
.nav-mobile nav a:last-child { border-bottom: none; }
.nav-mobile nav a:hover { background: var(--soft); text-decoration: none; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 2px solid var(--accent); border-radius: var(--radius);
  padding: 11px 22px; font-size: 15px; font-weight: 700; cursor: pointer;
  background: var(--accent); color: #ffffff; transition: background .15s, color .15s, border-color .15s;
  letter-spacing: .2px;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--accent); border-color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.btn-outline { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-outline:hover { background: var(--accent); color: #fff; }

/* ── Hero / sections ── */
.hero { text-align: center; padding: 56px 0 28px; }
.hero h1 { font-size: 34px; margin: 0 0 12px; letter-spacing: -.5px; }
.hero p { color: var(--muted); font-size: 17px; max-width: 620px; margin: 0 auto; }

.section { padding: 28px 0; }
.section h2 { font-size: 22px; margin: 0 0 16px; }

.card {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; background: var(--bg);
}
.soft { background: var(--soft); }

/* ── Process widget (ключевой элемент — выделен) ── */
.process-box {
  display: flex; gap: 10px; max-width: 760px; margin: 28px auto 0;
  background: #fff; padding: 8px; border-radius: 14px;
  box-shadow: 0 8px 30px rgba(15,118,110,.18); border: 2px solid var(--accent);
}
.process-box input[type=text] {
  flex: 1; padding: 15px 18px; font-size: 16px;
  border: none; border-radius: 10px; outline: none; background: transparent;
}
.process-box input[type=text]::placeholder { color: #9ca3af; }
.process-box .btn { padding: 15px 28px; font-size: 16px; border-radius: 10px; }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 8px; }
.step { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); }
.step .num {
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); font-weight: 700; display: flex; align-items: center;
  justify-content: center; margin-bottom: 8px;
}
.step p { margin: 0; font-size: 14px; color: var(--muted); }

/* ── Result ── */
.result { margin: 22px auto 0; max-width: 720px; }
.result .preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.result .preview img { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* ── Alerts ── */
.alert { padding: 12px 14px; border-radius: var(--radius); font-size: 14px; margin: 12px 0; }
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-ok { background: #f0fdf4; color: var(--ok); border: 1px solid #bbf7d0; }
.alert-info { background: var(--accent-soft); color: var(--accent); border: 1px solid #bfe3dd; }
.hidden { display: none !important; }

/* ── Forms ── */
.form { max-width: 380px; margin: 40px auto; }
.form h1 { font-size: 24px; margin: 0 0 20px; text-align: center; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; font-size: 15px;
  border: 1px solid var(--line); border-radius: var(--radius); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.form .btn { width: 100%; }
.form-foot { text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); }

/* ── Tariffs ── */
.tariffs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.tariff { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; text-align: center; }
.tariff.featured { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tariff h3 { margin: 0 0 6px; font-size: 18px; }
.tariff .price { font-size: 30px; font-weight: 700; margin: 10px 0; }
.tariff .price span { font-size: 14px; color: var(--muted); font-weight: 400; }
.tariff p { color: var(--muted); font-size: 14px; min-height: 40px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 500px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td:nth-child(2) { white-space: normal; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
tbody tr:hover { background: var(--soft); cursor: default; }

/* ── Badges ── */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-done { background: #f0fdf4; color: var(--ok); }
.badge-error { background: #fef2f2; color: var(--danger); }
.badge-processing, .badge-pending { background: var(--accent-soft); color: var(--accent); }
.badge-off { background: #f3f4f6; color: var(--muted); }

/* ── Admin layout ── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tab { padding: 10px 20px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; font-size: 15px; }
.tab.active { color: var(--fg); border-bottom-color: var(--accent); }
.toolbar { display: flex; gap: 8px; margin-bottom: 14px; align-items: center; }
.toolbar input { flex: 1; padding: 10px 13px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; }
.toolbar .btn { flex-shrink: 0; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 10px; }
.comment { padding: 10px 12px; background: var(--soft); border-radius: 8px; font-size: 14px; margin-bottom: 8px; }
.comment .meta { font-size: 12px; color: var(--muted); margin-bottom: 3px; }

/* Список пользователей (карточки) */
.user-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.user-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; transition: background .12s, border-color .12s; gap: 10px;
}
.user-card:hover { background: var(--soft); }
.user-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.user-card-info { min-width: 0; flex: 1; }
.user-card-info .email { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card-info .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.user-card-right { text-align: right; flex-shrink: 0; }
.user-card-right .remaining { font-weight: 700; font-size: 16px; }

/* Список тарифов (карточки) */
.tariff-list { display: flex; flex-direction: column; gap: 6px; }
.tariff-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; transition: background .12s; gap: 10px;
}
.tariff-card:hover { background: var(--soft); }
.tariff-card .name { font-weight: 600; font-size: 14px; }
.tariff-card .details { font-size: 12px; color: var(--muted); }

/* Tariff form fields */
.tariff-fields { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.tariff-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Info tabs (кнопки-секции на главной) ── */
.info-tabs { display: flex; flex-direction: column; gap: 10px; }
.info-tab { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.info-tab-btn {
  width: 100%; padding: 16px 22px; border: none; background: var(--bg);
  font: inherit; font-size: 16px; font-weight: 600; color: var(--fg);
  text-align: left; cursor: pointer; display: flex; align-items: center;
  justify-content: space-between; transition: background .15s, color .15s;
}
.info-tab-btn:hover { background: var(--soft); }
.info-tab-btn::after {
  content: "+"; font-size: 22px; color: var(--accent); font-weight: 400;
  width: 24px; height: 24px; display: inline-flex; align-items: center;
  justify-content: center; transition: transform .25s;
}
.info-tab.open .info-tab-btn { background: var(--accent); color: #fff; }
.info-tab.open .info-tab-btn::after { content: "−"; color: #fff; transform: rotate(180deg); }
.info-tab-content {
  max-height: 0; overflow: hidden; transition: max-height .35s ease;
  border-top: 0 solid var(--line);
}
.info-tab.open .info-tab-content { max-height: 2200px; padding: 22px; border-top-width: 1px; }
.info-tab-content h3 { margin: 0 0 12px; font-size: 16px; color: var(--accent); letter-spacing: .3px; }
.info-tab-content h4 { margin: 18px 0 6px; font-size: 15px; color: var(--fg); }
.info-tab-content p { margin: 0 0 10px; color: var(--muted); line-height: 1.65; }
.info-tab-content ol, .info-tab-content ul { margin: 0 0 12px 20px; color: var(--muted); line-height: 1.75; }
.info-tab-content ol li, .info-tab-content ul li { margin-bottom: 4px; }
.info-tab-content a { color: var(--accent); font-weight: 500; }
.info-tab-content .btn { color: #fff; }

/* ── Code / pre ── */
pre { background: #1e1e2e; color: #cdd6f4; border-radius: var(--radius); padding: 16px 18px;
      overflow-x: auto; font-size: 13px; line-height: 1.6; margin: 10px 0; }
code { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .92em; }
p code, td code, li code { background: var(--soft); padding: 2px 6px; border-radius: 5px; color: var(--fg); }

/* ── Демо-фото с мигающим watermark ── */
.demo { text-align: center; }
.demo-photo {
  position: relative; max-width: 720px; margin: 0 auto; border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--line); line-height: 0;
}
.demo-photo img { width: 100%; display: block; }
.demo-wm {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 6px 40px; pointer-events: none; transform: rotate(-18deg) scale(1.25);
}
.demo-wm span {
  font-size: clamp(28px, 6vw, 56px); font-weight: 900; color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,.55); letter-spacing: 2px;
  animation: wm-blink 1.3s ease-in-out infinite; opacity: .85;
}
.demo-wm span:nth-child(2) { animation-delay: .25s; }
.demo-wm span:nth-child(3) { animation-delay: .5s; }
.demo-wm span:nth-child(4) { animation-delay: .75s; }
.demo-wm span:nth-child(5) { animation-delay: 1s; }
@keyframes wm-blink { 0%, 100% { opacity: .12; } 50% { opacity: .9; } }
.demo-caption { color: var(--muted); font-size: 14px; margin-top: 14px; }

/* ── Контакт-кнопки ── */
.contact-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.contact-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px;
  border-radius: 10px; font-weight: 600; color: #fff; font-size: 15px;
  text-decoration: none; transition: opacity .15s;
}
.contact-btn:hover { opacity: .88; text-decoration: none; color: #fff; }
.contact-btn svg { width: 20px; height: 20px; fill: currentColor; }
.contact-btn.tg { background: #229ED9; }
.contact-btn.wa { background: #25D366; }
.contact-btn.phone { background: var(--accent); }
.contact-phone { font-size: 20px; font-weight: 700; color: var(--fg); margin: 6px 0; }

/* ── Модалка ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 14px; padding: 26px; max-width: 420px; width: 100%;
  position: relative; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal h3 { margin: 0 0 6px; font-size: 20px; }
.modal-close {
  position: absolute; top: 12px; right: 14px; background: none; border: none;
  font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer;
}
.modal-close:hover { color: var(--fg); }
.modal .btn { width: 100%; margin-top: 6px; }

/* ── Карточки заявок (админка) ── */
.req-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px;
}
.req-card.new { border-color: var(--accent); background: var(--accent-soft); }
.req-card .info { min-width: 0; }
.req-card .info .top { font-weight: 600; font-size: 14px; }
.req-card .info .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.req-card .actions { display: flex; gap: 6px; flex-shrink: 0; }
.tab .tab-badge {
  display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px;
  background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px;
  line-height: 18px; text-align: center; font-weight: 700;
}

/* ── Footer ── */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 24px 0; color: var(--muted); font-size: 13px; text-align: center; }

/* ══════════════════════════════════════════════════════════
   МОБИЛЬНАЯ АДАПТАЦИЯ — ПОЛНАЯ
   ══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* ── Layout ── */
  .container { padding: 0 16px; }

  /* ── Header + burger ── */
  .site-header .container { height: 56px; }
  .brand-logo { height: 32px; width: auto; }
  .nav-desktop { display: none; }
  .burger { display: flex; }
  .nav-mobile { display: block; }

  /* ── Hero ── */
  .hero { padding: 32px 0 20px; }
  .hero h1 { font-size: 22px; letter-spacing: 0; line-height: 1.3; }
  .hero p { font-size: 14px; padding: 0 4px; }

  /* ── Поле ввода (главная + дашборд) ── */
  .process-box { flex-direction: column; margin: 16px auto 0; }
  .process-box input[type=text] { font-size: 14px; padding: 12px; width: 100%; }
  .process-box .btn { width: 100%; }

  /* ── Все гриды → одна колонка ── */
  .steps { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tariffs { grid-template-columns: 1fr; gap: 14px; }
  .admin-grid { grid-template-columns: 1fr; gap: 16px; }

  /* ── Тарифы ── */
  .tariff { padding: 18px; }
  .tariff .price { font-size: 24px; }
  .tariff p { min-height: auto; }

  /* ── Таблицы — скролл вместо сжатия ── */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
  table { min-width: 480px; }
  th, td { padding: 8px 10px; font-size: 13px; }

  /* ── Dashboard ── */
  [data-me-card] .row { flex-direction: column; text-align: center; gap: 12px; }
  [data-me-card] [style*="text-align:right"] { text-align: center !important; }
  [data-me-remaining] { font-size: 20px !important; }

  /* ── Админка ── */
  .tabs { overflow-x: auto; gap: 0; }
  .tab { padding: 10px 16px; font-size: 14px; white-space: nowrap; }

  /* Тарифы форма */
  .tariff-fields { grid-template-columns: 1fr 1fr; }
  .tariff-actions { flex-direction: column; }
  .tariff-actions .btn { width: 100%; }

  /* Детали пользователя */
  [data-user-detail] .row { flex-direction: column; align-items: stretch; gap: 8px; }
  [data-user-detail] .field { margin-bottom: 8px; }
  [data-user-detail] .field input,
  [data-user-detail] .field select { width: 100%; }
  [data-user-detail] hr { margin: 12px 0 !important; }

  /* ── Формы (логин/регистрация) ── */
  .form { max-width: 100%; margin: 24px auto; padding: 0 4px; }
  .form h1 { font-size: 22px; }

  /* ── Карточки ── */
  .card { padding: 16px; }

  /* ── Info tabs ── */
  .info-tab-btn { padding: 14px 16px; font-size: 15px; }
  .info-tab.open .info-tab-content { padding: 16px; }

  /* ── Алерты ── */
  .alert { font-size: 13px; padding: 10px 12px; word-break: break-word; }

  /* ── API docs ── */
  pre { font-size: 11px; padding: 12px; margin: 8px -4px; border-radius: 8px; }
  .section h1 { font-size: 22px; }

  /* ── Кнопки ── */
  .btn-sm { padding: 6px 12px; font-size: 12px; }

  /* ── Секции ── */
  .section { padding: 20px 0; }
  .section h2 { font-size: 18px; }

  /* ── Footer ── */
  .site-footer { padding: 18px 0; font-size: 12px; }

  /* ── Утилиты ── */
  .row { flex-wrap: wrap; }
  .result { margin: 16px auto 0; }
  .result .preview img { width: 80px; height: 60px; }
  .comment { font-size: 13px; padding: 10px; }
  .comment .meta { font-size: 11px; }
}

/* ── Маленький телефон (≤ 400px) ── */
@media (max-width: 400px) {
  .container { padding: 0 10px; }
  .site-header .container { height: 50px; }
  .brand-logo { height: 26px; width: auto; }
  .hero h1 { font-size: 19px; }
  .hero p { font-size: 13px; }
  .steps { grid-template-columns: 1fr; }
  .tariff-fields { grid-template-columns: 1fr; }
  .info-tab-btn { padding: 12px 12px; font-size: 14px; }
  pre { font-size: 10px; padding: 10px; }
  .field input, .field select, .field textarea { font-size: 14px; padding: 10px; }
  th, td { padding: 6px 8px; font-size: 12px; }
  .tab { padding: 8px 10px; font-size: 13px; }
}
