/* =====================================================================
   Модальное окно записи (partials/_modal.html.twig, js/modal.js).
   Лежит вне .page, поэтому не масштабируется zoom'ом — размеры свои.
   ===================================================================== */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal__overlay { position: absolute; inset: 0; background: rgba(12, 14, 17, .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal__panel {
  position: relative; width: 100%; max-width: 980px; max-height: calc(100vh - 48px); overflow: auto;
  padding: 46px 47px 48px; border-radius: 28px; background: var(--white); color: var(--dark);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35); animation: modal-in .25s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.modal__close { position: absolute; right: 22px; top: 22px; width: 44px; height: 44px; border-radius: 50%; background: var(--gray); transition: background .2s; }
.modal__close::before, .modal__close::after { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 2px; background: var(--dark); transform: translate(-50%, -50%) rotate(45deg); }
.modal__close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.modal__close:hover { background: #e8eaeb; }
.modal__back { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px; font-size: 15px; color: rgba(12, 14, 17, .6); transition: color .2s; }
.modal__back::before { content: ""; width: 8px; height: 8px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.modal__back:hover { color: var(--red); }
.modal__back[hidden], .modal__step[hidden], .mchosen[hidden], .mform__error[hidden], .msearch__list[hidden], .msearch__empty[hidden] { display: none; }
.modal__chip { margin-bottom: 22px; }
.modal__title { font-size: 48px; font-weight: 500; line-height: .95; letter-spacing: -0.03em; }
.modal__text { margin-top: 16px; max-width: 620px; font-size: 18px; line-height: 1.2; letter-spacing: -0.02em; color: rgba(12, 14, 17, .65); }
.modal__text a { color: var(--red); }
.modal__done { margin-top: 20px; font-size: 24px; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; }

/* шаг 1: два сценария */
.mopts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 36px; }
.mopt {
  position: relative; display: flex; flex-direction: column; gap: 12px; min-height: 196px; padding: 28px 70px 26px 28px;
  border: 1px solid transparent; border-radius: 20px; background: var(--gray); color: var(--dark); text-align: left; transition: background .2s, transform .2s;
}
.mopt b { font-size: 26px; font-weight: 600; line-height: 1.05; letter-spacing: -0.02em; }
.mopt span { font-size: 15px; line-height: 1.25; opacity: .65; }
.mopt .chev { background-image: url(../img/chevron-dark.svg); }
.mopt .chev { position: absolute; right: 26px; bottom: 26px; margin: 0; }
.mopt:hover { background: #eceeef; transform: translateY(-2px); }
.mopt--red { background: var(--red); color: var(--white); }
.mopt--red .chev { background-image: url(../img/chevron-white.svg); }
.mopt--red span { opacity: .85; }
.mopt--red:hover { background: #d92b30; }
.mopt:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* формы */
.mform { margin-top: 30px; }
.mform__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; }
.mform__col { min-width: 0; }
.mlabel { display: block; margin: 22px 0 12px; font-size: 15px; letter-spacing: -0.02em; color: rgba(12, 14, 17, .6); }
.mform__col > .mlabel:first-child { margin-top: 0; }
.minput {
  display: block; width: 100%; height: 62px; margin-bottom: 12px; padding: 0 24px; border: 0; border-radius: 31px;
  background: var(--gray); color: var(--dark); font: inherit; font-size: 17px; letter-spacing: -0.02em;
}
.minput::placeholder { color: #a4a8af; }
.minput:focus { outline: 0; box-shadow: 0 0 0 2px var(--red); }
.minput--select { -webkit-appearance: none; appearance: none; padding-right: 56px; background: var(--gray) url(../img/chevron-dark.svg) no-repeat right 26px center; cursor: pointer; }
.minput[type="date"] { color-scheme: light; }
.minput[type="date"]:invalid, .minput[type="date"].is-empty { color: #a4a8af; }
.mdays { display: flex; gap: 8px; width: 100%; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.mdays::-webkit-scrollbar { display: none; }
.mdays__hint { font-size: 15px; color: rgba(12, 14, 17, .55); padding: 6px 0; }
.mday { flex: none; display: flex; flex-direction: column; align-items: center; gap: 3px; width: 84px; padding: 12px 6px 10px; border: 1px solid transparent; border-radius: 18px; background: var(--gray); color: var(--dark); transition: background .2s, color .2s; }
.mday:hover { background: #eceeef; }
.mday.is-active { background: var(--dark); color: var(--white); border-color: var(--dark); }
.mday.is-full { opacity: .4; }
.mday__wd { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; opacity: .6; }
.mday__d { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.mday__n { font-size: 12px; opacity: .6; }
.mday.is-active .mday__n { color: #ff8a8d; opacity: 1; }
.mslots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.mslot { height: 46px; border: 1px solid transparent; border-radius: 14px; background: var(--gray); color: var(--dark); font-size: 16px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; transition: background .2s; }
.mslot:hover { background: #eceeef; }
.mslot.is-active { background: var(--red); border-color: var(--red); color: var(--white); }
.mslots__empty { grid-column: 1 / -1; padding: 10px 0; font-size: 15px; color: rgba(12, 14, 17, .55); }
.mchosen { margin-top: 14px; font-size: 15px; color: rgba(12, 14, 17, .75); }
.mreqmode[hidden], .mslotmode[hidden], .mbranches[hidden] { display: none; }
.mbranches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.mbranch { height: 38px; padding: 0 16px; border: 1px solid transparent; border-radius: 19px; background: var(--gray); color: var(--dark); font-size: 14px; letter-spacing: -0.02em; transition: background .2s, color .2s; }
.mbranch:hover { background: #eceeef; }
.mbranch.is-active { background: var(--dark); color: var(--white); }
.mhint { margin-top: 2px; font-size: 14px; line-height: 1.3; color: rgba(12, 14, 17, .55); }
.mchosen b { font-weight: 600; }

/* поиск услуги */
.msearch { position: relative; }
.msearch__list { position: absolute; left: 0; right: 0; top: calc(100% - 4px); z-index: 5; max-height: 250px; overflow: auto; margin: 0; padding: 8px; list-style: none; border-radius: 18px; background: var(--white); color: var(--dark); box-shadow: 0 16px 40px rgba(12, 14, 17, .18); }
.msearch__list li { padding: 12px 16px; border-radius: 12px; font-size: 16px; letter-spacing: -0.02em; cursor: pointer; }
.msearch__list li:hover, .msearch__list li.is-active { background: var(--gray); }
.msearch__list li.msearch__empty { color: #6b7078; cursor: default; }

.mform__error { margin: 4px 0 12px; padding: 12px 18px; border-radius: 12px; background: rgba(237, 50, 55, .1); color: #c8262b; font-size: 15px; line-height: 1.3; }
.mform__submit { display: block; width: 100%; height: 62px; border-radius: 31px; background: var(--red); color: var(--white); font-size: 18px; font-weight: 500; letter-spacing: -0.02em; transition: background .2s; }
.mform__submit:hover { background: #d92b30; }
.mform__submit:disabled { opacity: .6; cursor: default; }
.mform__submit--done { max-width: 320px; margin-top: 30px; }
.mform__agree { margin-top: 14px; font-size: 14px; line-height: 1.2; letter-spacing: -0.02em; color: rgba(12, 14, 17, .6); }
.mform__agree a { color: var(--red); text-decoration: underline; text-underline-position: from-font; }

body.modal-open { overflow: hidden; }

@media (max-width: 767px) {
  .modal { padding: 0; align-items: flex-end; }
  .modal__panel { max-width: none; max-height: 94vh; padding: 26px 20px 32px; border-radius: 24px 24px 0 0; animation-name: modal-up; }
  @keyframes modal-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .modal__close { right: 14px; top: 14px; width: 40px; height: 40px; }
  .modal__chip { margin-bottom: 16px; }
  .modal__title { padding-right: 44px; font-size: 30px; }
  .modal__text { margin-top: 12px; font-size: 15px; }
  .modal__done { font-size: 19px; }
  .mopts { grid-template-columns: 1fr; gap: 10px; margin-top: 24px; }
  .mopt { min-height: 0; padding: 22px 60px 22px 20px; }
  .mopt b { font-size: 21px; }
  .mopt span { font-size: 14px; }
  .mopt .chev { right: 20px; bottom: 24px; }
  .mform { margin-top: 20px; }
  .mform__grid { grid-template-columns: 1fr; gap: 6px; }
  .mlabel { margin: 16px 0 10px; }
  .minput { height: 56px; padding: 0 20px; font-size: 16px; }
  .mday { width: 76px; }
  .mslots { grid-template-columns: repeat(4, 1fr); }
  .mform__submit { height: 56px; font-size: 17px; }
  .mform__submit--done { max-width: none; margin-top: 22px; }
}

/* ---------- ИИ-консультант ---------- */
.mopt--ai { background: var(--dark); color: var(--white); }
.mopt--ai:hover { background: #222327; }
.mopt--ai span { opacity: .7; }
.mopt--ai .chev { background-image: url(../img/chevron-white.svg); }
.mopts:has(.mopt--ai) { grid-template-columns: 1fr 1fr 1fr; }
.mchat { display: flex; flex-direction: column; margin-top: 8px; }
.mchat__head { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid rgba(12, 14, 17, .08); }
.mchat__avatar { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: var(--red); color: var(--white); font-size: 14px; font-weight: 700; letter-spacing: .02em; }
.mchat__head b { display: block; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.mchat__head span { display: block; margin-top: 2px; font-size: 13px; color: rgba(12, 14, 17, .55); }
.mchat__body { display: flex; flex-direction: column; gap: 10px; height: 420px; max-height: 50vh; overflow-y: auto; padding: 18px 4px; scroll-behavior: smooth; }
.mchat__msg { max-width: 78%; padding: 12px 16px; border-radius: 18px; font-size: 15px; line-height: 1.3; letter-spacing: -0.01em; white-space: pre-line; }
.mchat__msg--bot { align-self: flex-start; background: var(--gray); color: var(--dark); border-bottom-left-radius: 6px; }
.mchat__msg--user { align-self: flex-end; background: var(--dark); color: var(--white); border-bottom-right-radius: 6px; }
.mchat__msg--alert { align-self: stretch; max-width: none; background: rgba(237, 50, 55, .1); color: #b3161b; border-radius: 16px; }
.mchat__typing { align-self: flex-start; display: flex; gap: 5px; padding: 14px 16px; border-radius: 18px; background: var(--gray); }
.mchat__typing i { width: 7px; height: 7px; border-radius: 50%; background: rgba(12, 14, 17, .4); animation: mchat-dot 1.2s infinite; }
.mchat__typing i:nth-child(2) { animation-delay: .2s; } .mchat__typing i:nth-child(3) { animation-delay: .4s; }
@keyframes mchat-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }
.mchat__quick { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-start; }
.mchat__quick button { height: 38px; padding: 0 16px; border: 1px solid rgba(12, 14, 17, .12); border-radius: 19px; background: var(--white); font-size: 14px; letter-spacing: -0.02em; transition: background .2s, color .2s; }
.mchat__quick button:hover { background: var(--dark); color: var(--white); border-color: var(--dark); }
.mchat__cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-self: stretch; }
.mcard { display: flex; gap: 12px; padding: 12px; border: 1px solid rgba(12, 14, 17, .08); border-radius: 16px; background: var(--white); }
.mcard__photo { flex: none; width: 56px; height: 56px; border-radius: 12px; background: var(--gray); overflow: hidden; }
.mcard__photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; }
.mcard__body { min-width: 0; flex: 1; }
.mcard__name { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.mcard__role { margin-top: 2px; font-size: 12px; color: rgba(12, 14, 17, .55); }
.mcard__why { margin-top: 6px; font-size: 13px; line-height: 1.25; color: rgba(12, 14, 17, .75); }
.mcard__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.mcard__price { font-size: 13px; font-weight: 600; color: var(--red); }
.mcard__btn { height: 32px; padding: 0 14px; border-radius: 16px; background: var(--dark); color: var(--white); font-size: 13px; letter-spacing: -0.02em; transition: background .2s; }
.mcard__btn:hover { background: var(--red); }
.mcard--svc { flex-direction: column; gap: 6px; }
.mcard--svc .mcard__cat { font-size: 12px; color: rgba(12, 14, 17, .5); }
.mchat__list { margin: 4px 0 0 18px; padding: 0; }
.mchat__list li { margin-bottom: 4px; }
.mchat__form { display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid rgba(12, 14, 17, .08); }
.mchat__input { flex: 1; height: 52px; padding: 0 20px; border: 0; border-radius: 26px; background: var(--gray); font: inherit; font-size: 16px; letter-spacing: -0.02em; }
.mchat__input:focus { outline: 0; box-shadow: 0 0 0 2px var(--red); }
.mchat__input:disabled { opacity: .6; }
.mchat__send { position: relative; flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--red); transition: background .2s; }
.mchat__send::before { content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; border-top: 2px solid var(--white); border-right: 2px solid var(--white); transform: translate(-60%, -50%) rotate(45deg); }
.mchat__send:hover { background: #d92b30; }
.mchat__send:disabled { opacity: .5; }
.mchat__note { margin-top: 10px; font-size: 12px; line-height: 1.3; color: rgba(12, 14, 17, .5); }
@media (max-width: 767px) {
  .mopts:has(.mopt--ai) { grid-template-columns: 1fr; }
  .mchat__body { height: auto; max-height: 52vh; min-height: 260px; padding: 14px 0; }
  .mchat__msg { max-width: 88%; font-size: 14px; }
  .mchat__cards { grid-template-columns: 1fr; }
  .mchat__input { height: 48px; font-size: 15px; }
  .mchat__send { width: 48px; height: 48px; }
}
