* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --error: #ef4444;
  --success: #22c55e;
  --gray-100: #f0f2f5;
  --gray-200: #e0e0e0;
  --gray-300: #e2e8f0;
  --gray-600: #666;
  --gray-800: #333;
  --dark: #1a1a1a;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-100);
  min-height: 100vh;
  padding: 40px 20px;
}

.container {
  max-width: 700px;
  margin: 0 auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 40px;
}

h1 { font-size: 26px; color: var(--dark); margin-bottom: 8px; }
.subtitle { color: var(--gray-600); font-size: 14px; margin-bottom: 32px; }
.required { color: var(--error); }

/* Progress Bar */
.progress-bar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 40px;
  position: relative;
  overflow-x: auto;
  padding-bottom: 10px;
}

.progress-bar::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 0; right: 0;
  height: 2px;
  background: var(--gray-200);
  z-index: 0;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 80px;
}

.step-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gray-200);
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s;
  margin-bottom: 8px;
}

.step-label {
  font-size: 11px;
  color: #999;
  text-align: center;
  transition: color 0.3s;
  line-height: 1.2;
}

.progress-step.active .step-circle { background: var(--primary); color: #fff; }
.progress-step.active .step-label { color: var(--primary); font-weight: 600; }
.progress-step.completed .step-circle { background: var(--success); color: #fff; }
.progress-step.completed .step-label { color: var(--success); }

/* Form Steps */
.form-step { display: none; }
.form-step.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Form Elements */
.form-group { margin-bottom: 20px; }

label {
  display: block;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 6px;
  font-size: 14px;
}

.field-hint {
  font-size: 13px;
  color: var(--gray-600);
  margin-top: 4px;
  margin-bottom: 8px;
  line-height: 1.4;
  font-weight: 400;
}

input[type="text"], input[type="email"], input[type="tel"], input[type="url"], select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-size: 15px;
  transition: border-color 0.2s;
  outline: none;
  font-family: inherit;
}

input:focus, select:focus { border-color: var(--primary); }
input.error, select.error { border-color: var(--error); }
input.success { border-color: var(--success); }

input[type="radio"], input[type="checkbox"] {
  accent-color: var(--primary);
  width: 18px;
  height: 18px;
  margin-right: 8px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
}

.checkbox-label a { color: var(--primary); text-decoration: underline; }

/* Error Messages */
.error-text {
  color: var(--error);
  font-size: 13px;
  margin-top: 4px;
  display: none;
  font-weight: 400;
}

.error-text.show { display: block; }

/* Buttons */
button {
  padding: 14px 32px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-secondary { background: var(--gray-200); color: var(--gray-800); }
.btn-secondary:hover { background: #d0d0d0; }

/* Radio Group */
.radio-group { display: flex; gap: 20px; margin-top: 8px; }
.radio-option {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
}

/* Company Card */
.company-card {
  background: #f8fafc;
  border: 1px solid var(--gray-300);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.company-card h3 {
  font-size: 16px;
  color: var(--dark);
  margin-bottom: 16px;
  font-weight: 600;
}

.company-card .field {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-300);
  font-size: 14px;
}

.company-card .field:last-child { border-bottom: none; }
.company-card .field-label { color: var(--gray-600); font-weight: 500; }
.company-card .field-value {
  color: var(--dark);
  font-weight: 600;
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}

/* Button Group */
.button-group {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  align-items: stretch;
}

.button-group button { flex: 1; min-height: 52px; }

/* Spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Thanks Page */
.thanks-container {
  max-width: 600px;
  width: 100%;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 40px;
  text-align: center;
  margin: 0 auto;
}

.thanks-container h1 { margin-bottom: 8px; }
.thanks-container h2 { font-size: 18px; color: var(--gray-600); font-weight: 500; margin-bottom: 24px; }

.checkmark {
  width: 72px;
  height: 72px;
  background: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 36px;
  color: #fff;
}

pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 24px;
  border-radius: 12px;
  text-align: left;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: auto;
  font-family: 'Fira Code', 'Consolas', monospace;
}

.back-link {
  display: inline-block;
  margin-top: 24px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}

.back-link:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 768px) {
  .container { padding: 24px; }
  h1 { font-size: 22px; }
  .step-label { font-size: 10px; }
  .radio-group { flex-direction: column; gap: 12px; }
  .button-group { flex-direction: column; }
}

/* Блок выбора адреса из DaData */
.address-selection {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
}

.address-selection-title {
    color: #92400e;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.address-selection-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.address-selection-item {
    padding: 12px 16px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    transition: all 0.2s;
}

.address-selection-item:hover {
    border-color: #4f46e5;
    background: #eef2ff;
}

/* Кнопка "Использовать адрес из ЕГРЮЛ/ЕГРИП" */
.btn-egrul {
    display: inline-block;
    margin-top: 8px;
    margin-bottom: 12px;
    padding: 10px 16px;
    background: #f0f9ff;
    color: #0369a1;
    border: 1px solid #7dd3fc;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-egrul:hover {
    background: #e0f2fe;
    border-color: #38bdf8;
}

/* Combobox для выбора адреса */
.address-combobox {
    margin-top: 8px;
    margin-bottom: 12px;
    background: #fff;
    border: 2px solid #4f46e5;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.combobox-label {
    font-size: 13px;
    font-weight: 600;
    color: #4f46e5;
    margin-bottom: 8px;
}

.address-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.address-item {
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.address-item:hover {
    background: #eef2ff;
    border-color: #4f46e5;
    transform: translateX(4px);
}

.address-item:active {
    background: #4f46e5;
    color: #fff;
}