html, body {
    height: 100%;
    margin: 0;
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
}

.layout {
    display: grid;
    grid-template-columns: 38% 62%;
    height: 100vh;
    overflow: hidden;
}

/* ── Левая колонка (форма) ── */
.form-pane {
    background: #fff;
    border-right: 1px solid #E5E8EC;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.form-pane__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 32px 16px;
    border-bottom: 1px solid #F0F2F5;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
}

.form-pane__logo {
    height: 28px;
    width: auto;
}

.form-pane__title {
    font-size: 15px;
    font-weight: 700;
    color: #0F1419;
    letter-spacing: -0.2px;
}

.form {
    padding: 24px 32px 40px;
    flex: 1;
}

/* ── Правая колонка (превью) ── */
.preview-pane {
    background: #F0F2F5;
    overflow-y: auto;
    padding: 24px;
}

/* ── Группы полей ── */
.field-group {
    margin-bottom: 20px;
}

.field-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #2C3540;
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

.field-group label .required {
    color: #FF4757;
    margin-left: 2px;
}

.field-group input[type="text"],
.field-group input[type="url"],
.field-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #E5E8EC;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    color: #0F1419;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.field-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2398A1B0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

.field-group input[type="text"]:focus,
.field-group input[type="url"]:focus,
.field-group select:focus {
    border-color: #00A3FF;
    box-shadow: 0 0 0 3px rgba(0, 163, 255, 0.12);
}

.field-group input.invalid,
.field-group select.invalid {
    border-color: #FF4757;
    box-shadow: 0 0 0 3px rgba(255, 71, 87, 0.1);
}

.field-hint {
    font-size: 11px;
    color: #98A1B0;
    margin-top: 5px;
    line-height: 1.4;
}

/* ── Радио-карточки (стиль вступления) ── */
.radio-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.radio-card {
    position: relative;
}

.radio-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0; height: 0;
}

.radio-card__label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 14px;
    border: 1.5px solid #E5E8EC;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    background: #fff;
}

.radio-card__label:hover {
    border-color: #00A3FF;
    background: #F0F9FF;
}

.radio-card input[type="radio"]:checked + .radio-card__label {
    border-color: #00A3FF;
    background: #E8F4FC;
}

.radio-card__title {
    font-size: 13px;
    font-weight: 700;
    color: #0F1419;
}

.radio-card__desc {
    font-size: 11px;
    color: #6B7689;
    line-height: 1.4;
}

/* ── Скрытое поле кейса A ── */
.field-group--case-a { display: none; }
.field-group--case-a.visible { display: block; }

/* ── Разделитель секций ── */
.form-section-title {
    font-size: 11px;
    font-weight: 700;
    color: #98A1B0;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    margin: 28px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #F0F2F5;
}

.form-section-title:first-child { margin-top: 0; }

/* ── Кнопка PDF ── */
.btn-pdf {
    width: 100%;
    padding: 16px;
    margin-top: 32px;
    background: #00A3FF;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: -0.2px;
}

.btn-pdf:hover {
    background: #0085D6;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 163, 255, 0.3);
}

.btn-pdf:active { transform: translateY(0); }

/* ── Лайтбокс ── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 25, 0.92);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  cursor: zoom-out;
  animation: lightbox-fade-in 0.15s ease-out;
}
@keyframes lightbox-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.lightbox[hidden] { display: none; }
.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  cursor: default;
}
.lightbox__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.lightbox__close:hover { background: rgba(255, 255, 255, 0.25); }

/* ── Кнопка сброса авто-подбора ── */
.form-reset-link {
  margin-top: 8px;
  background: transparent;
  border: 0;
  padding: 0;
  font-size: 12px;
  color: #00A3FF;
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
  display: block;
}
.form-reset-link:hover { color: #0085D6; }

/* ── Ссылка «Выбрать другой кейс» ── */
.choose-case-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #00A3FF;
    text-decoration: underline;
    cursor: pointer;
}
.choose-case-link:hover { color: #0085D6; }

/* ── Модальное окно ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 25, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.15s ease;
}
.modal-overlay[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
    width: 600px;
    max-width: calc(100vw - 32px);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.18s ease;
}
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid #F0F2F5;
    flex-shrink: 0;
}
.modal-title {
    font-size: 17px;
    font-weight: 800;
    color: #0F1419;
    letter-spacing: -0.3px;
}
.modal-close {
    width: 32px; height: 32px;
    background: #F0F2F5;
    border: none;
    border-radius: 50%;
    font-size: 15px;
    color: #6B7689;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.modal-close:hover { background: #E5E8EC; color: #0F1419; }

.modal-search-wrap {
    padding: 12px 16px;
    border-bottom: 1px solid #F0F2F5;
    flex-shrink: 0;
}
.modal-search {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #E5E8EC;
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    color: #0F1419;
    outline: none;
}
.modal-search:focus { border-color: #00A3FF; }

.modal-list {
    list-style: none;
    overflow-y: auto;
    padding: 8px 0;
    margin: 0;
    flex: 1;
}
.modal-list__item {
    padding: 11px 18px;
    cursor: pointer;
    transition: background 0.1s;
}
.modal-list__item:hover { background: #F0F9FF; }
.modal-list__title {
    font-size: 14px;
    font-weight: 700;
    color: #0F1419;
    margin-bottom: 2px;
}
.modal-list__meta {
    font-size: 11px;
    color: #98A1B0;
    font-weight: 500;
}
.modal-list__empty {
    padding: 24px 18px;
    font-size: 13px;
    color: #98A1B0;
    text-align: center;
}
.modal-list__item--lead {
    display: flex;
    align-items: center;
    gap: 12px;
}
.modal-list__lead-preview {
    width: 80px;
    height: 50px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: #F0F2F5;
}
.modal-list__lead-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Модалка успешного сохранения ── */
.save-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: lightbox-fade-in 0.2s ease-out;
}
.save-modal[hidden] { display: none; }
.save-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 20, 25, 0.7);
}
.save-modal__card {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 36px 32px 28px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
}
.save-modal__icon { font-size: 48px; margin-bottom: 8px; }
.save-modal__title {
  font-size: 22px;
  font-weight: 800;
  color: #0F1419;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}
.save-modal__subtitle {
  font-size: 14px;
  color: #6B7689;
  margin-bottom: 24px;
}
.save-modal__url-box {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: #F7F8FA;
  border-radius: 10px;
  padding: 4px;
}
.save-modal__url-box input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  font-size: 13px;
  color: #0F1419;
  font-family: monospace;
  outline: none;
}
.save-modal__url-box button {
  background: #00A3FF;
  color: #fff;
  border: 0;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.save-modal__url-box button:hover { background: #0085D6; }
.save-modal__url-box button.copied { background: #00C896; }
.save-modal__actions { display: flex; gap: 10px; }
.save-modal__btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  border: 0;
  font-family: inherit;
  transition: all 0.15s;
}
.save-modal__btn--primary { background: #00A3FF; color: #fff; }
.save-modal__btn--primary:hover { background: #0085D6; }
.save-modal__btn--secondary { background: #F7F8FA; color: #0F1419; }
.save-modal__btn--secondary:hover { background: #E5E8EC; }

/* ── Field shake animation ── */
.field-error {
  border-color: #FF4757 !important;
  animation: shake 0.4s;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ── Мобиль (<1024px) ── */
@media (max-width: 1023px) {
    html, body { height: auto; }

    .layout {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }

    .form-pane {
        border-right: none;
        border-bottom: 1px solid #E5E8EC;
        overflow-y: visible;
    }

    .preview-pane {
        overflow-y: visible;
        padding: 16px;
    }
}
