/* Disputo — дизайн-система «строгий премиальный»: глубокий синевато-тёмный
   фон, графитовые карточки, белая типографика, мятный акцент. Тёмная тема —
   основная (см. :root), светлая — согласованная адаптация для светлой темы
   Telegram (см. [data-scheme="light"]), а не инверсия через фильтр. */

:root {
  --bg: #0b1119;
  --surface: #121c27;
  --surface-raised: #16212e;
  --border: #293747;
  --text: #f4f7fa;
  --text-muted: #97a6ba;
  --text-faint: #5f7186;
  --accent: #a3f2d4;
  --accent-text: #08251b;
  --accent-line: #a3f2d4;
  --accent-wash: rgba(163, 242, 212, 0.08);
  --danger: #ff8a8a;
  --danger-wash: rgba(255, 138, 138, 0.12);
  --warn: #f2c48a;
  --warn-wash: rgba(242, 196, 138, 0.1);
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root[data-scheme="light"] {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-raised: #f0f3f7;
  --border: #e1e7ee;
  --text: #121a24;
  --text-muted: #5b6b80;
  --text-faint: #8695a8;
  --accent: #0e9f75;
  --accent-text: #ffffff;
  --accent-line: #0e9f75;
  --accent-wash: rgba(14, 159, 117, 0.08);
  --danger: #d8453f;
  --danger-wash: rgba(216, 69, 63, 0.08);
  --warn: #b5781f;
  --warn-wash: rgba(181, 120, 31, 0.1);
}

* { 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);
}
body { padding-bottom: 104px; transition: background .2s ease, color .2s ease; }

.app { max-width: 560px; margin: 0 auto; padding: 18px 16px 8px; }

/* ---------- Шапка ---------- */
.brand-row { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--accent); color: var(--accent-text);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.brand-row b { font-size: 17px; letter-spacing: -0.01em; }
.mock-pill {
  margin-left: auto;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--warn-wash);
  color: var(--warn);
  border: 1px solid var(--warn);
  white-space: nowrap;
}

/* ---------- Прогресс ---------- */
.progress-track { height: 3px; background: var(--border); border-radius: 4px; overflow: hidden; margin: 2px 0 6px; }
.progress-bar { height: 100%; background: var(--accent); transition: width .3s ease; }
.progress-label { font-size: 12px; color: var(--text-faint); margin-bottom: 18px; display: flex; justify-content: space-between; }
.progress-label .pl-phase { color: var(--text-muted); }

/* ---------- Черновик ---------- */
.draft-banner {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}
.draft-banner.show { display: block; }
.draft-banner .db-row { display: flex; gap: 8px; margin-top: 8px; }
.draft-banner .db-row button { flex: 1; padding: 8px; font-size: 12.5px; }

/* ---------- Шаги ---------- */
.step { display: none; }
.step.active { display: block; animation: fadein .18s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h2.step-title { font-size: 21px; margin: 2px 0 6px; font-weight: 700; letter-spacing: -0.01em; }
.step-sub { font-size: 13.5px; color: var(--text-muted); margin: 0 0 18px; line-height: 1.4; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text);
  font-size: 15.5px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s ease;
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-faint); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent-line); }
.field textarea { min-height: 96px; resize: vertical; }
.field-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); margin-top: 8px; cursor: pointer; }
.field-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.field-error { color: var(--danger); font-size: 12.5px; margin-top: 6px; display: none; }
.field-error.show { display: block; }

/* ---------- Плитки выбора (категория) — сетка 3×, как на главном экране
   телефона: крупная иконка сверху, короткое название под ней. ---------- */
.option-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 16px 6px 12px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1.5px solid var(--border);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s ease, background .15s ease;
}
.option-card .oc-icon {
  width: 52px; height: 52px; flex-shrink: 0;
  border-radius: 16px;
  background: var(--surface-raised);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
}
.option-card .oc-body { width: 100%; min-width: 0; }
.option-card b {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
}
.option-card .oc-desc, .option-card .oc-chevron { display: none; }
.option-card.selected { border-color: var(--accent-line); background: var(--accent-wash); }
.option-card.selected .oc-icon { color: var(--accent); }

.dunno-link {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px; padding: 12px 14px;
  border-radius: var(--radius-md); border: 1px dashed var(--border);
  color: var(--text-muted); font-size: 13.5px; cursor: pointer;
}
.dunno-link svg { color: var(--accent); flex-shrink: 0; }
.dunno-panel { display: none; margin-top: 12px; }
.dunno-panel.show { display: block; }
.dunno-result {
  margin-top: 10px; padding: 12px 14px; border-radius: var(--radius-md);
  background: var(--accent-wash); border: 1px solid var(--accent-line); font-size: 13.5px;
}
.dunno-empty { margin-top: 10px; font-size: 13px; color: var(--text-muted); }

/* ---------- Загрузка файлов ---------- */
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 16px;
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--border);
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
}
.upload-zone .uz-icon { color: var(--text-faint); margin-bottom: 2px; }
.upload-zone .uz-title { color: var(--text); font-size: 14px; font-weight: 500; }
.upload-zone .uz-hint { font-size: 11.5px; color: var(--text-faint); }
.upload-zone.drag { border-color: var(--accent-line); background: var(--accent-wash); }

.file-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.file-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  font-size: 13px;
}
.file-chip .fc-icon { color: var(--accent); flex-shrink: 0; }
.file-chip .fc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip .fc-size { color: var(--text-faint); font-size: 11.5px; flex-shrink: 0; }
.file-chip .fc-remove { color: var(--text-faint); cursor: pointer; flex-shrink: 0; display: flex; }
.file-chip .fc-remove:hover { color: var(--danger); }

.skip-link { display: block; text-align: center; margin-top: 12px; font-size: 13.5px; color: var(--text-muted); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Анализ ---------- */
.analyze-list { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
.analyze-item { display: flex; align-items: center; gap: 11px; font-size: 14.5px; color: var(--text-faint); }
.analyze-item .ai-dot {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid var(--border); position: relative;
}
.analyze-item.active .ai-dot { border-color: var(--accent-line); }
.analyze-item.active .ai-dot::after {
  content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }
.analyze-item.active { color: var(--text); }
.analyze-item.done .ai-dot { border-color: var(--accent-line); background: var(--accent); color: var(--accent-text); }
.analyze-item.done .ai-dot::after { content: none; }
.analyze-item.done { color: var(--text); }
.analyze-error { display: none; margin-top: 18px; padding: 14px; border-radius: var(--radius-md); background: var(--danger-wash); border: 1px solid var(--danger); font-size: 13.5px; }
.analyze-error.show { display: block; }

/* ---------- Вердикт ---------- */
.verdict-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; margin-bottom: 14px; }
.verdict-box .vb-icon { color: var(--accent); margin-bottom: 8px; }
.verdict-box h3 { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.verdict-box p { margin: 0; font-size: 13.5px; color: var(--text-muted); line-height: 1.4; }

.vcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 15px; margin-bottom: 10px; }
.vcard h4 { margin: 0 0 8px; font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.vcard p, .vcard ul { margin: 0; font-size: 14px; line-height: 1.45; }
.vcard ul { padding-left: 18px; }
.vcard li { margin-bottom: 4px; }
.vcard.assumption { background: var(--surface-raised); font-style: italic; color: var(--text-muted); }
.vcard.missing { background: var(--warn-wash); border-color: var(--warn); }
.vcard.missing h4 { color: var(--warn); }

.verify-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; padding: 3px 9px; border-radius: 20px; margin-top: 8px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.verify-badge.ok { background: var(--accent-wash); color: var(--accent); border: 1px solid var(--accent-line); }
.verify-badge.unverified { background: var(--warn-wash); color: var(--warn); border: 1px solid var(--warn); }

.cta-box { text-align: center; padding: 20px 6px 6px; }
.cta-box h3 { margin: 0 0 4px; font-size: 16.5px; }
.cta-box .cta-sub { color: var(--text-muted); font-size: 13px; margin: 0; }
.cta-price { font-size: 28px; font-weight: 700; margin: 12px 0 2px; }
.cta-price span { font-size: 13px; font-weight: 400; color: var(--text-muted); }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 18px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s ease, transform .1s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-text); width: 100%; }
.btn-outline { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 18px; }
.btn-shake { animation: shake .3s ease; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* ---------- Нижняя навигация (вне Telegram) ---------- */
#custom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 560px;
  margin: 0 auto;
}
.nav-trust { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-faint); justify-content: center; }
.nav-trust svg { flex-shrink: 0; }
#custom-nav .nav-buttons { display: flex; gap: 10px; }
#custom-nav .btn-outline { flex: 0 0 92px; }
#custom-nav .btn-primary { flex: 1; }

/* ---------- Модалка оплаты ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(5, 8, 12, .6);
  display: none; align-items: flex-end; justify-content: center; z-index: 50;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 560px;
}
.modal-box h3 { margin: 0 0 2px; font-size: 18px; }
.modal-sub { color: var(--text-muted); font-size: 13px; margin: 0 0 14px; }
.mock-banner {
  background: var(--warn-wash);
  color: var(--warn);
  border: 1px solid var(--warn);
  font-size: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  line-height: 1.4;
}

/* ---------- Документ (предпросмотр / печать) — бумага всегда светлая ---------- */
.doc-preview {
  background: #fff;
  color: #111;
  border-radius: var(--radius-md);
  padding: 22px 18px;
  font-family: "Times New Roman", Georgia, serif;
  font-size: 13.5px;
  line-height: 1.5;
}
.doc-header-block { text-align: right; margin-bottom: 14px; }
.doc-header-gap { height: 10px; }
.doc-title-main { text-align: center; font-weight: 700; margin: 10px 0 2px; text-transform: uppercase; }
.doc-title-sub { text-align: center; font-size: 12.5px; margin-bottom: 14px; }
.doc-body p { text-align: justify; margin: 0 0 10px; }
.doc-prosba { text-align: center; font-weight: 700; margin: 14px 0 8px; }
.doc-list { margin: 0 0 12px; padding-left: 22px; }
.doc-list li { margin-bottom: 6px; text-align: justify; }
.doc-enclosures { font-size: 12.5px; color: #444; }
.doc-closing { display: flex; justify-content: space-between; margin-top: 22px; font-size: 13px; }
.doc-note { margin-top: 14px; font-size: 12px; color: var(--text-faint); text-align: center; }

@media print {
  .no-print { display: none !important; }
  body { padding-bottom: 0; background: #fff; }
  .doc-preview { padding: 0; }
}

@media (max-width: 360px) {
  .app { padding-left: 14px; padding-right: 14px; }
  h2.step-title { font-size: 19px; }
}
