/* Initial AI guide builder, aligned with the TrailTrack AI reference.  The
   result view keeps its existing workspace styling; these rules apply only
   before a trip has been opened. */
.ai-guide:not(.is-result-view) {
    width: min(1380px, calc(100% - 48px));
    padding: 32px 0 72px;
    color: #13243a;
}

.ai-guide:not(.is-result-view) .ai-guide__intro {
    position: relative;
    min-height: 218px;
    overflow: hidden;
    align-items: center;
    padding: 36px 42px;
    border: 0;
    border-radius: 27px;
    background-image:
        linear-gradient(90deg, rgba(4, 50, 43, .98) 0%, rgba(8, 73, 61, .91) 43%, rgba(20, 92, 74, .44) 67%, rgba(230, 103, 52, .7) 100%),
        url('/static/img/home-plus-expedition.webp');
    background-position: center;
    background-size: cover;
    box-shadow: 0 18px 42px rgba(18, 49, 45, .18);
}

.ai-guide:not(.is-result-view) .ai-guide__intro::after {
    content: 'Путешествия\A начинаются здесь';
    position: absolute;
    right: 82px;
    bottom: 24px;
    z-index: 1;
    color: rgba(255, 255, 255, .73);
    font-family: Georgia, serif;
    font-size: 19px;
    font-style: italic;
    line-height: 1.05;
    white-space: pre;
    transform: rotate(-7deg);
}

.ai-guide:not(.is-result-view) .ai-guide__intro > div:first-child {
    position: relative;
    z-index: 2;
    max-width: 760px;
}

.ai-guide:not(.is-result-view) .ai-guide__intro .ai-guide__eyebrow {
    color: #ffad77;
    font-size: 13px;
    letter-spacing: .14em;
}

.ai-guide:not(.is-result-view) .ai-guide__intro h1 {
    margin: 11px 0 12px;
    color: #fff;
    font-size: clamp(40px, 5vw, 66px);
    line-height: .98;
    letter-spacing: -.055em;
}

.ai-guide:not(.is-result-view) .ai-guide__intro p {
    max-width: 700px;
    color: rgba(255, 255, 255, .86);
    font-size: 17px;
    line-height: 1.48;
}

.ai-guide:not(.is-result-view) .ai-guide__intro-mark {
    position: relative;
    z-index: 2;
    flex: 0 0 154px;
    width: 154px;
    height: 76px;
    padding: 0 13px;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 20px;
    color: #ff9d68;
    background: rgba(16, 73, 61, .24);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    font-size: 54px;
    line-height: 1;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

.ai-guide:not(.is-result-view) .ai-guide__intro-mark::after {
    content: 'БОЛЬШЕ\A ОТКРЫТИЙ\A ВМЕСТЕ';
    margin-left: 0;
    color: rgba(255,255,255,.78);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .05em;
    line-height: 1.25;
    text-align: left;
    white-space: pre;
}

.ai-guide:not(.is-result-view) .ai-guide__how-button {
    position: absolute;
    right: 36px;
    top: 18px;
    z-index: 3;
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,.42);
    border-radius: 999px;
    color: rgba(255,255,255,.9);
    background: rgba(6, 54, 46, .3);
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}

.ai-guide:not(.is-result-view) .ai-guide__layout {
    grid-template-columns: minmax(0, 2fr) minmax(340px, .86fr);
    gap: 20px;
    margin-top: 20px;
}

.ai-guide:not(.is-result-view) .ai-guide__builder,
.ai-guide:not(.is-result-view) .ai-guide__history {
    min-width: 0;
    padding: 32px 34px;
    border: 1px solid #e0e6ee;
    border-radius: 26px;
    box-shadow: 0 15px 38px rgba(34, 55, 73, .07);
}

.ai-guide:not(.is-result-view) .ai-guide__section-head {
    align-items: center;
    margin-bottom: 25px;
}

.ai-guide:not(.is-result-view) .ai-guide__section-head > div:first-child {
    position: relative;
    padding-left: 56px;
}

.ai-guide:not(.is-result-view) .ai-guide__section-head > div:first-child::before,
.ai-guide:not(.is-result-view) .ai-guide__history .ai-guide__section-head > div:first-child::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 13px;
    color: #f36c3a;
    background: #fff1e9;
    background-image: url('/static/img/icons/route.svg');
    background-position: center;
    background-repeat: no-repeat;
    background-size: 22px;
}

.ai-guide:not(.is-result-view) .ai-guide__history .ai-guide__section-head > div:first-child::before {
    content: '';
    background-image: url('/static/img/icons/time.svg');
    background-size: 21px;
}

.ai-guide:not(.is-result-view) .ai-guide__kicker {
    color: #f06435;
    font-size: 12px;
    letter-spacing: .03em;
}

.ai-guide:not(.is-result-view) .ai-guide__section-head h2 {
    margin-top: 7px;
    color: #152238;
    font-size: 29px;
    letter-spacing: -.045em;
}

.ai-guide:not(.is-result-view) .ai-guide__admin-pill {
    padding: 10px 14px;
    color: #e66436;
    background: #fff0e8;
    font-size: 12px;
}

.ai-guide:not(.is-result-view) .ai-guide__form {
    gap: 18px;
}

.ai-guide:not(.is-result-view) .ai-guide__field-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #526278;
    font-size: 14px;
    font-weight: 700;
}

.ai-guide:not(.is-result-view) .ai-guide__field-label img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    opacity: .82;
}

.ai-guide:not(.is-result-view) .ai-guide__field-label b {
    font-weight: 700;
}

.ai-guide:not(.is-result-view) .ai-guide__field input,
.ai-guide:not(.is-result-view) .ai-guide__field select {
    min-height: 49px;
    padding: 0 15px;
    border-color: #d6dfea;
    border-radius: 12px;
    color: #18283e;
    background: #fff;
}

.ai-guide:not(.is-result-view) .ai-guide__field input::placeholder {
    color: #a0adbd;
}

.ai-guide:not(.is-result-view) .ai-guide__date-grid {
    gap: 18px;
}

.ai-guide:not(.is-result-view) .ai-guide__budget-row {
    grid-template-columns: minmax(0, 1.35fr) minmax(170px, .7fr);
    gap: 18px;
}

.ai-guide:not(.is-result-view) .ai-guide__hint,
.ai-guide:not(.is-result-view) .ai-guide__field small {
    color: #91a0b3;
    font-size: 12px;
}

.ai-guide:not(.is-result-view) .ai-guide__submit {
    min-height: 62px;
    margin-top: 4px;
    justify-content: center;
    gap: 18px;
    border-radius: 13px;
    background: linear-gradient(100deg, #ff6330, #ff7138);
    font-size: 19px;
    box-shadow: 0 12px 24px rgba(238, 101, 56, .22);
}

.ai-guide:not(.is-result-view) .ai-guide__submit::before {
    content: '✦';
    font-size: 23px;
}

.ai-guide:not(.is-result-view) .ai-guide__submit span:last-child {
    position: absolute;
    right: 25px;
    font-size: 27px;
    font-weight: 400;
}

.ai-guide:not(.is-result-view) .ai-guide__status {
    color: #d5482d;
    font-size: 13px;
}

.ai-guide:not(.is-result-view) .ai-guide__history {
    display: flex;
    flex-direction: column;
}

.ai-guide:not(.is-result-view) .ai-guide__history-list {
    flex: 1;
}

.ai-guide:not(.is-result-view) .ai-guide__history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 510px;
    padding: 15px 0 0;
    color: #6f7e92;
    text-align: center;
}

.ai-guide:not(.is-result-view) .ai-guide__history-art {
    position: relative;
    display: grid;
    place-items: center;
    width: 190px;
    height: 185px;
    margin: 6px auto 17px;
    color: #ff7945;
}

.ai-guide:not(.is-result-view) .ai-guide__history-art::before,
.ai-guide:not(.is-result-view) .ai-guide__history-art::after {
    content: '';
    position: absolute;
    width: 102px;
    height: 125px;
    border: 10px solid #eaf0f6;
    border-radius: 9px;
    background: #f8fafc;
    transform: rotate(9deg);
}

.ai-guide:not(.is-result-view) .ai-guide__history-art::before { left: 25px; top: 29px; transform: rotate(-9deg); }
.ai-guide:not(.is-result-view) .ai-guide__history-art::after { right: 22px; top: 11px; }

.ai-guide:not(.is-result-view) .ai-guide__history-art > div {
    position: relative;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 94px;
    height: 116px;
    border: 8px solid #eef3f8;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(41, 67, 92, .08);
    transform: rotate(8deg);
}

.ai-guide:not(.is-result-view) .ai-guide__history-art img { width: 39px; height: 39px; opacity: .82; }
.ai-guide:not(.is-result-view) .ai-guide__history-art > span { position: absolute; z-index: 3; top: 18px; right: 20px; color: #ff7040; font-size: 31px; }
.ai-guide:not(.is-result-view) .ai-guide__history-empty > strong { color: #63748a; font-size: 18px; line-height: 1.25; }
.ai-guide:not(.is-result-view) .ai-guide__history-empty > p { margin: 12px 0 25px; color: #9aa8b9; font-size: 14px; line-height: 1.55; }

.ai-guide:not(.is-result-view) .ai-guide__history-skeletons {
    display: grid;
    gap: 12px;
    width: 100%;
    margin-top: auto;
}

.ai-guide:not(.is-result-view) .ai-guide__history-skeleton {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-guide:not(.is-result-view) .ai-guide__history-skeleton::before {
    content: '';
    flex: 0 0 55px;
    height: 46px;
    border-radius: 11px;
    background: #e7edf5;
}

.ai-guide:not(.is-result-view) .ai-guide__history-skeleton span {
    display: block;
    width: 100%;
    height: 11px;
    border-radius: 99px;
    background: linear-gradient(90deg, #e2e9f1 55%, #edf2f7 55%);
}

.ai-guide:not(.is-result-view) .ai-guide__history-promo {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    margin-top: 22px;
    padding: 15px 16px;
    border-radius: 16px;
    color: #62748a;
    background: #fff7f2;
    text-align: left;
}

.ai-guide:not(.is-result-view) .ai-guide__history-promo img { width: 28px; height: 28px; padding: 6px; border-radius: 50%; background: #ff713c; filter: brightness(0) invert(1); }
.ai-guide:not(.is-result-view) .ai-guide__history-promo span:nth-child(2) { display: grid; gap: 2px; flex: 1; font-size: 12px; }
.ai-guide:not(.is-result-view) .ai-guide__history-promo span:last-child { color: #ed6638; font-size: 24px; }

@media (max-width: 900px) {
    .ai-guide:not(.is-result-view) .ai-guide__layout { grid-template-columns: minmax(0, 1fr); }
    .ai-guide:not(.is-result-view) .ai-guide__history-empty { min-height: 380px; }
}

@media (max-width: 640px) {
    .ai-guide:not(.is-result-view) { width: min(100% - 20px, 640px); padding-top: 16px; }
    .ai-guide:not(.is-result-view) .ai-guide__intro { min-height: 300px; padding: 28px 24px; align-items: flex-start; }
    .ai-guide:not(.is-result-view) .ai-guide__intro h1 { font-size: 42px; }
    .ai-guide:not(.is-result-view) .ai-guide__intro p { font-size: 15px; }
    .ai-guide:not(.is-result-view) .ai-guide__intro-mark { position: absolute; right: 20px; bottom: 20px; transform: scale(.82); transform-origin: right bottom; }
    .ai-guide:not(.is-result-view) .ai-guide__intro::after { right: 28px; bottom: 104px; font-size: 15px; }
    .ai-guide:not(.is-result-view) .ai-guide__builder,
    .ai-guide:not(.is-result-view) .ai-guide__history { padding: 24px 20px; }
    .ai-guide:not(.is-result-view) .ai-guide__section-head h2 { font-size: 25px; }
    .ai-guide:not(.is-result-view) .ai-guide__date-grid,
    .ai-guide:not(.is-result-view) .ai-guide__budget-row { grid-template-columns: 1fr; }
}

.ai-guide.is-shared-shell .ai-guide__layout { display: none; }
.ai-guide.is-shared-shell .ai-guide__intro { margin-bottom: 20px; }
.ai-guide.is-shared-view .ai-guide__result { margin-top: 0; }
.ai-guide.is-shared-view .ai-guide__result-actions > [data-guide-edit],
.ai-guide.is-shared-view .ai-guide__result-actions > [data-guide-delete],
.ai-guide.is-shared-view .ai-guide__result-actions > [data-guide-reset],
.ai-guide.is-shared-view .ai-guide__result-actions > [data-guide-pdf],
.ai-guide.is-shared-view .ai-guide__result-actions > [data-guide-share] { display: none; }

.ai-guide__result.is-locked {
    position: relative;
    min-height: 760px;
    overflow: hidden;
}

.ai-guide__result.is-locked > *:not(.ai-guide__invite-gate) {
    filter: blur(7px);
    pointer-events: none;
    user-select: none;
}

.ai-guide__invite-gate {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(430px, calc(100% - 36px));
    padding: 30px 32px 28px;
    border: 1px solid #f2d2c4;
    border-radius: 24px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 20px 48px rgba(43,44,49,.18);
    text-align: center;
    transform: translate(-50%, -50%);
}

/* The author rule above intentionally uses flex; keep the native hidden
   attribute authoritative after a successful invite-code exchange. */
.ai-guide__invite-gate[hidden] { display: none !important; }

.ai-guide__invite-lock-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    margin-bottom: 14px;
    border-radius: 16px;
    background: #fff0e8;
}

.ai-guide__invite-lock-icon img { width: 28px; height: 28px; filter: invert(47%) sepia(87%) saturate(1843%) hue-rotate(340deg) brightness(101%) contrast(101%); }
.ai-guide__invite-gate .ai-guide__kicker { color: #ee6538; }
.ai-guide__invite-gate h3 { margin: 7px 0 8px; color: #17253a; font-size: 27px; letter-spacing: -.035em; }
.ai-guide__invite-gate > p { max-width: 340px; margin: 0 0 18px; color: #748398; font-size: 13px; line-height: 1.5; }
.ai-guide__invite-gate form { display: flex; width: 100%; gap: 8px; }
.ai-guide__invite-gate form label { flex: 1; }
.ai-guide__invite-gate input { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid #d8e0e8; border-radius: 11px; color: #1c2a3d; font: inherit; font-size: 12px; outline: 0; }
.ai-guide__invite-gate input:focus { border-color: #ed7042; box-shadow: 0 0 0 4px rgba(237,112,66,.13); }
.ai-guide__invite-gate form button,
.ai-guide__how-action { min-height: 46px; padding: 0 15px; border: 0; border-radius: 11px; color: #fff; background: #ee6538; font: inherit; font-weight: 700; cursor: pointer; }
.ai-guide__invite-gate form button span { margin-left: 6px; font-size: 17px; }
.ai-guide__invite-status { min-height: 18px; margin: 10px 0 -2px !important; color: #c54f32 !important; font-size: 12px !important; }

.ai-guide__shared-placeholder-line { width: 100%; height: 44px; margin-bottom: 9px; border-radius: 13px; background: #f0f4f7; }
.ai-guide__shared-placeholder-block { width: 100%; height: 130px; margin-bottom: 14px; border-radius: 18px; background: #f0f4f7; }
.ai-guide__shared-placeholder-tab { display: inline-block; width: 90px; height: 35px; margin-right: 8px; border-radius: 999px; background: #edf2f6; }
.ai-guide__shared-placeholder-map { width: 100%; height: 260px; margin-bottom: 14px; border-radius: 18px; background: #edf2f5; }
.ai-guide__shared-placeholder-card { width: 100%; height: 120px; margin-bottom: 12px; border-radius: 17px; background: #f0f4f7; }

.ai-guide__how-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; background: rgba(17,29,42,.42); }
.ai-guide__how-modal[hidden] { display: none; }
.ai-guide__how-dialog { position: relative; width: min(520px, 100%); padding: 32px; border: 1px solid #e2e8ee; border-radius: 24px; background: #fff; box-shadow: 0 24px 70px rgba(20,35,53,.24); }
.ai-guide__how-close { position: absolute; top: 13px; right: 15px; width: 34px; height: 34px; border: 0; border-radius: 50%; color: #6f7d8c; background: #f2f5f8; font-size: 24px; line-height: 1; cursor: pointer; }
.ai-guide__how-dialog h2 { margin: 8px 0 9px; color: #16253a; font-size: 30px; letter-spacing: -.04em; }
.ai-guide__how-lead { margin: 0 0 21px; color: #748398; line-height: 1.55; }
.ai-guide__how-steps { display: grid; gap: 12px; }
.ai-guide__how-steps article { display: flex; gap: 12px; padding: 12px; border-radius: 14px; background: #f7faf8; }
.ai-guide__how-steps article > span { display: grid; place-items: center; flex: 0 0 29px; width: 29px; height: 29px; border-radius: 50%; color: #fff; background: #ee7042; font-weight: 800; }
.ai-guide__how-steps strong { color: #26384a; font-size: 14px; }
.ai-guide__how-steps p { margin: 3px 0 0; color: #78899b; font-size: 12px; line-height: 1.45; }
.ai-guide__how-action { width: 100%; margin-top: 23px; }

/* The generator is visible to every signed-in user, but the guide header,
   form and history stay behind the invitation gate until an unlimited code
   is accepted. Keep the dialog itself outside this blur layer. */
.ai-guide.is-builder-locked > .ai-guide__intro,
.ai-guide.is-builder-locked .ai-guide__layout > * {
    filter: blur(14px);
    pointer-events: none;
    user-select: none;
}

.ai-guide__builder-invite-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(17, 29, 42, .52);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.ai-guide__builder-invite-modal[hidden] { display: none; }

.ai-guide__builder-invite-dialog {
    width: min(460px, 100%);
    padding: 31px 32px 28px;
    border: 1px solid #f2d2c4;
    border-radius: 24px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 24px 70px rgba(20, 35, 53, .25);
    text-align: center;
}

.ai-guide__builder-invite-dialog .ai-guide__invite-lock-icon { margin: 0 auto 14px; }
.ai-guide__builder-invite-dialog .ai-guide__kicker { color: #ee6538; }
.ai-guide__builder-invite-dialog h3 { margin: 7px 0 8px; color: #17253a; font-size: 28px; letter-spacing: -.035em; }
.ai-guide__builder-invite-dialog > p { max-width: 350px; margin: 0 auto 18px; color: #748398; font-size: 13px; line-height: 1.5; }
.ai-guide__builder-invite-dialog form { display: flex; width: 100%; gap: 8px; }
.ai-guide__builder-invite-dialog form label { flex: 1; }
.ai-guide__builder-invite-dialog input { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid #d8e0e8; border-radius: 11px; color: #1c2a3d; font: inherit; font-size: 12px; outline: 0; }
.ai-guide__builder-invite-dialog input:focus { border-color: #ed7042; box-shadow: 0 0 0 4px rgba(237, 112, 66, .13); }
.ai-guide__builder-invite-dialog form button { min-height: 46px; padding: 0 15px; border: 0; border-radius: 11px; color: #fff; background: #ee6538; font: inherit; font-weight: 700; cursor: pointer; }
.ai-guide__builder-invite-dialog form button:disabled { opacity: .65; cursor: wait; }
.ai-guide__builder-invite-dialog form button span { margin-left: 6px; font-size: 17px; }
.ai-guide__builder-invite-dialog .ai-guide__invite-status { min-height: 18px; margin: 10px 0 -2px !important; color: #c54f32 !important; font-size: 12px !important; }

.ai-guide__hotel-widget {
    margin: 22px 0 0;
    padding: 19px;
    border: 1px solid #dfe9e3;
    border-radius: 17px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(36, 57, 71, .05);
}

.ai-guide__hotel-widget[hidden] { display: none; }
.ai-guide__hotel-widget-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.ai-guide__hotel-widget-head::before { content: '⌂'; display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; border-radius: 11px; color: #138b65; background: #e8f6ee; font-size: 23px; }
.ai-guide__hotel-widget-head > div { display: grid; gap: 3px; }
.ai-guide__hotel-widget-head strong { color: #193047; font-size: 17px; }
.ai-guide__hotel-widget-head span { color: #80909e; font-size: 12px; }
.ai-guide__hotel-widget [data-yandex-travel-widget-container] { min-height: 126px; }

@media (max-width: 640px) {
    .ai-guide:not(.is-result-view) .ai-guide__how-button { right: 20px; top: 18px; }
    .ai-guide:not(.is-result-view) .ai-guide__intro-mark { right: 20px; top: 74px; bottom: auto; transform: scale(.76); transform-origin: right top; }
    .ai-guide:not(.is-result-view) .ai-guide__intro::after { top: 91px; right: 183px; bottom: auto; max-width: 115px; font-size: 13px; line-height: 1.08; }
    .ai-guide__invite-gate form { display: grid; }
    .ai-guide__how-dialog { padding: 28px 22px 23px; }
    .ai-guide__builder-invite-dialog { padding: 27px 20px 24px; }
    .ai-guide__builder-invite-dialog form { display: grid; }
}
