:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #f0f0f3);
  --section-bg: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #0b0b0d);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --link: var(--tg-theme-link-color, #2481cc);
  --button: var(--tg-theme-button-color, #2481cc);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --separator: color-mix(in srgb, var(--hint) 22%, transparent);

  /* Единственный "фирменный" акцент — диагностический бирюзовый,
     используется только в степпере статуса заказа и статус-точках. */
  --accent: #12b7a6;
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --warn: #e0a010;
  --danger: #e05353;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--secondary-bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overscroll-behavior-y: none;
}

#app { display: flex; flex-direction: column; height: 100vh; }

.topbar {
  flex: none;
  padding: 14px 16px 10px;
  background: var(--secondary-bg);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.view {
  flex: 1;
  overflow-y: auto;
  padding: 4px 16px 24px;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Групповые карточки в стиле iOS-настроек ---------- */

.card {
  background: var(--section-bg);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 16px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--separator);
  cursor: pointer;
  transition: background 0.12s ease;
}
.row:last-child { border-bottom: none; }
.row:active { background: var(--secondary-bg); }
.row.static { cursor: default; }
.row.static:active { background: var(--section-bg); }

.row-title { font-size: 15px; font-weight: 500; }
.row-subtitle { font-size: 13px; color: var(--hint); margin-top: 2px; }
.row-chevron { color: var(--hint); font-size: 18px; flex: none; }

.section-label {
  font-size: 12px;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 18px 4px 8px;
}
.section-label:first-child { margin-top: 4px; }

/* ---------- Статус-бейджи ---------- */

.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  flex: none;
}
.badge.new { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.badge.progress { color: var(--accent); background: var(--accent-soft); }
.badge.finish { color: #2fb35c; background: rgba(47,179,92,0.14); }
.badge.declined { color: var(--danger); background: rgba(224,83,83,0.14); }

/* ---------- Фирменный элемент: степпер статуса заказа ---------- */

.stepper {
  display: flex;
  align-items: flex-start;
  padding: 20px 8px 16px;
  background: var(--section-bg);
  border-radius: 14px;
  margin-bottom: 16px;
}
.step { flex: 1; text-align: center; position: relative; }
.step-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--separator);
  margin: 0 auto 8px;
  position: relative; z-index: 1;
  transition: background 0.2s ease;
}
.step.done .step-dot, .step.active .step-dot { background: var(--accent); }
.step-line {
  position: absolute; top: 5px; left: -50%; width: 100%; height: 2px;
  background: var(--separator); z-index: 0;
}
.step:first-child .step-line { display: none; }
.step.done .step-line { background: var(--accent); }
.step-label { font-size: 11px; color: var(--hint); }
.step.active .step-label, .step.done .step-label { color: var(--text); font-weight: 600; }

/* ---------- Кнопки ---------- */

.btn-primary {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--button);
  color: var(--button-text);
  font-size: 16px;
  font-weight: 600;
  margin-top: 8px;
}
.btn-primary:active { opacity: 0.85; }

textarea, input[type="text"], input[type="tel"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--separator);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.15s ease;
}
textarea:focus, input[type="text"]:focus, input[type="tel"]:focus {
  border-color: var(--accent);
}
textarea::placeholder, input::placeholder { color: var(--hint); }

.phone-input-group {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--separator);
  border-radius: 12px;
  background: var(--bg);
  padding: 0 14px;
  transition: border-color 0.15s ease;
}
.phone-input-group:focus-within { border-color: var(--accent); }
.phone-prefix {
  color: var(--hint);
  font-size: 15px;
  font-weight: 600;
  padding-right: 8px;
  margin-right: 8px;
  border-right: 1.5px solid var(--separator);
}
.phone-input-group input[type="tel"] {
  border: none;
  padding: 12px 0;
  background: transparent;
}

.btn-secondary {
  display: block;
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  background: transparent;
  border: 1.5px solid var(--separator);
  color: var(--link);
  font-size: 15px;
  font-weight: 600;
  margin-top: 8px;
}
.btn-secondary:active { background: var(--secondary-bg); }

/* ---------- Пустые/ошибочные состояния ---------- */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--hint);
}
.empty-state .empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

/* ---------- Таб-бар ---------- */

.tabbar {
  flex: none;
  display: flex;
  background: var(--section-bg);
  border-top: 1px solid var(--separator);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0 6px;
  background: none;
  border: none;
  color: var(--hint);
  font-family: inherit;
  font-size: 10.5px;
}
.tab svg { width: 23px; height: 23px; }
.tab.active { color: var(--link); }

/* ---------- Прогресс шагов анкеты ---------- */

.wizard-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 18px;
}
.wizard-dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--separator);
}
.wizard-dots span.done { background: var(--accent); }

.estimate-box {
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
}

.response-box {
  background: var(--section-bg);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
  margin-bottom: 16px;
}
.response-box.declined { border-left-color: var(--danger); }
.response-box .response-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--hint);
  margin-bottom: 6px;
}
.success-box {
  background: rgba(47,179,92,0.12);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  line-height: 1.6;
  white-space: pre-line;
}

.status-banner {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 16px;
}
.status-banner.warning { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.status-banner.success { background: rgba(47,179,92,0.14); color: #2fb35c; font-weight: 600; }
