:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #1a1f36;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --border: #e5e7eb;
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: linear-gradient(180deg, #eef2ff 0%, var(--bg) 40%);
  color: var(--text);
  min-height: 100vh;
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 20px 32px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.header__main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.header__badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: #dbeafe;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.header__title {
  margin: 0;
  font-size: clamp(22px, 2.5vw, 30px);
  line-height: 1.2;
  white-space: nowrap;
}

.header__subtitle {
  margin: 0;
  max-width: 420px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.45;
  text-align: right;
}

.layout {
  display: grid;
  grid-template-columns: minmax(340px, 480px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  flex: 1;
  min-height: 520px;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form-card {
  padding: 28px;
  overflow: visible;
  align-self: start;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form__group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form__group label {
  font-size: 14px;
  font-weight: 600;
}

.form__group input,
.form__group select,
.form__group textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}

.form__group textarea {
  resize: vertical;
  min-height: 88px;
}

.form__group--checkbox {
  gap: 6px;
}

.form-option-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f9fafb;
}

.form-option-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.form-option-card__title {
  font-size: 14px;
  font-weight: 600;
}

.form-option-card .form__hint {
  margin-top: 10px;
}

.form-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
}

.form-switch__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.form-switch__control {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #d1d5db;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.form-switch__control::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
  transition: transform 0.2s ease;
}

.form-switch__input:checked + .form-switch__control {
  background: var(--primary);
}

.form-switch__input:checked + .form-switch__control::after {
  transform: translateX(18px);
}

.form-switch__input:focus-visible + .form-switch__control {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.form-switch__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-switch__input:checked ~ .form-switch__label {
  color: var(--primary);
}

.form-option-card:has(.form-switch__input:checked) {
  border-color: #bfdbfe;
  background: #f8fbff;
}

.form__group input:focus,
.form__group select:focus,
.form__group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.form__group input[readonly] {
  background: #f3f4f6;
  color: var(--text-muted);
  cursor: default;
}

.form__group input[readonly]:focus {
  border-color: var(--border);
  box-shadow: none;
}

.form__group--suggest {
  position: relative;
  z-index: 20;
}

.form__hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
}

.form__hint--top {
  margin-bottom: 4px;
}

.form__field .form__hint {
  margin-top: 4px;
}

.form__group-heading {
  font-size: 14px;
  font-weight: 600;
}

.form__fio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.form__field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form__field label {
  font-size: 14px;
  font-weight: 600;
}

.products-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.product-row__select {
  flex: 1;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  background: #fff;
}

.product-row__select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.product-row__remove {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.product-row__remove:hover:not(:disabled) {
  border-color: #fecaca;
  color: var(--danger);
  background: #fef2f2;
}

.product-row__remove:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn--ghost {
  background: #fff;
  color: var(--primary);
  border: 1px dashed #bfdbfe;
}

.btn--ghost:hover:not(:disabled) {
  background: #eff6ff;
}

.price-block {
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #f9fafb;
}

.price-block--idle .price-block__value {
  color: var(--text-muted);
}

.price-block--loading {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.price-block--success {
  border-color: #a7f3d0;
  background: #ecfdf5;
}

.price-block--warning {
  border-color: #fde68a;
  background: #fffbeb;
}

.price-block--error {
  border-color: #fecaca;
  background: #fef2f2;
}

.price-block__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.price-block__value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
}

.price-block__line {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.4;
}

.price-block__hint {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 15px 20px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, opacity 0.2s;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn--primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.form-message {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
}

.form-message--success {
  background: #ecfdf5;
  color: var(--success);
}

.form-message--error {
  background: #fef2f2;
  color: var(--danger);
}

.info-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 20px;
  align-self: start;
  width: 100%;
  height: min(calc(100vh - 40px), 760px);
  min-height: 420px;
}

.map {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.info-card__note {
  flex: 0 0 auto;
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

@media (max-width: 900px) {
  .form__fio-grid {
    grid-template-columns: 1fr;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .header__main {
    flex-wrap: wrap;
    gap: 10px;
  }

  .header__title {
    white-space: normal;
  }

  .header__subtitle {
    max-width: none;
    text-align: left;
  }

  .layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .info-card {
    position: static;
    height: auto;
    min-height: 0;
  }

  .map {
    flex: none;
    height: 360px;
    min-height: 360px;
  }
}

@media (max-width: 480px) {
  .page {
    padding: 20px 14px 32px;
  }

  .form-card,
  .info-card {
    padding: 20px;
  }
}

.scheduling-section {
  margin-top: 4px;
}

.scheduling-mode {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.scheduling-mode__option {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.scheduling-mode__option input {
  width: auto;
  margin: 0;
}

.slots-picker {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.delivery-picker {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f9fafb;
}

.delivery-picker--complete {
  border-color: #93c5fd;
  background: #f8fbff;
}

.delivery-picker__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 10px;
}

.delivery-picker__title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.delivery-picker__product {
  font-size: 15px;
  font-weight: 700;
  margin-top: 2px;
}

.delivery-picker__clear {
  border: none;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.delivery-picker__summary {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
}

.delivery-picker__summary--complete {
  color: var(--primary);
  border-color: #bfdbfe;
  background: #eff6ff;
  font-weight: 600;
}

.delivery-calendar__times {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.delivery-calendar__time {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 10px 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.delivery-calendar__time--available:hover {
  border-color: #93c5fd;
}

.delivery-calendar__time--selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.delivery-calendar__time--disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.delivery-calendar__month {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}

.delivery-calendar__weekdays,
.delivery-calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.delivery-calendar__weekdays {
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.delivery-calendar__cell {
  min-height: 40px;
  border: none;
  background: transparent;
}

.delivery-calendar__day {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.delivery-calendar__day:not(:disabled):hover {
  transform: translateY(-1px);
  border-color: #93c5fd;
}

.delivery-calendar__cell--available {
  background: #fff;
}

.delivery-calendar__cell--selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.delivery-calendar__cell--disabled,
.delivery-calendar__cell--off {
  opacity: 0.35;
  cursor: not-allowed;
  background: #f3f4f6;
}

@media (max-width: 640px) {
  .delivery-calendar__times {
    grid-template-columns: 1fr;
  }

  .delivery-calendar__day {
    min-height: 36px;
    font-size: 13px;
  }
}
