/* Adapters for live MUI portals; prototype styles are loaded only by capital_v2. */
body.capital-v2-body { --capital-muted: #4d4d4d; }
/* The prototype's captured baseline is 14px; form and page sizes stay explicit. */
body.capital-body.capital-v2-body { font-size: 14px; }

/* Keep the office's own gutter: the shared container rule otherwise adds 40px. */
body.capital-body.capital-v2-body #mainPageContent .capital-office .container { padding: 0; }
/* Preserve page-specific spacing that the prototype's unprefixed rules inherit. */
body.capital-body.capital-v2-body .capital-office-actions .buttons > .btn { padding: 10px 20px; }
body.capital-v2-body #extraSearchForm .nw-extra-date input { text-align: left; }
body.capital-v2-body #extraSearchForm .nw-extra-date > .date-group { padding-left: 0; }
body.capital-v2-body .capital-currency-panel .capital-rate-values { gap: 5px; }
body.capital-v2-body .capital-drawer .capital-rate-date { margin-bottom: 5px; line-height: 16px; }
body.capital-v2-body .capital-drawer .capital-rate-values { font-weight: 700; line-height: 16px; }
@media (max-width: 767px) {
    body.capital-body.capital-v2-body .capital-office-actions .buttons > .btn { padding: 10px; }
}
/* The prototype has one flight class. With two real classes its fixed widths
   total 1228px and leave zero for Tour. Keep all columns inside 1224px. */
body.capital-body.capital-v2-body .capital-tour-search .tp-view-table .tp-search-table:has(th.tp-search-result-cell-flight-economy):has(th.tp-search-result-cell-flight-business) th.tp-search-result-cell-hotel { width: 146px; }
body.capital-body.capital-v2-body .capital-tour-search .tp-view-table .tp-search-table:has(th.tp-search-result-cell-flight-economy):has(th.tp-search-result-cell-flight-business) th.tp-search-result-cell-hotel-category { width: 120px; }
body.capital-body.capital-v2-body .capital-tour-search .tp-view-table .tp-search-table:has(th.tp-search-result-cell-flight-economy):has(th.tp-search-result-cell-flight-business) th.tp-search-result-cell-accomodation { width: 92px; }
body.capital-body.capital-v2-body .capital-tour-search .tp-view-table .tp-search-table:has(th.tp-search-result-cell-flight-economy):has(th.tp-search-result-cell-flight-business) th.tp-search-result-cell-meal { width: 86px; }
body.capital-body.capital-v2-body .capital-tour-search .tp-view-table .tp-search-table:has(th.tp-search-result-cell-flight-economy):has(th.tp-search-result-cell-flight-business) th.tp-search-result-cell-flight-economy { width: 128px; }
body.capital-body.capital-v2-body .capital-tour-search .tp-view-table .tp-search-table:has(th.tp-search-result-cell-flight-economy):has(th.tp-search-result-cell-flight-business) th.tp-search-result-cell-flight-business { width: 128px; }
body.capital-body.capital-v2-body .capital-tour-search .tp-view-table .tp-search-table:has(th.tp-search-result-cell-flight-economy):has(th.tp-search-result-cell-flight-business) th.tp-search-result-cell-tour { width: 140px; }

/* Tour replacement and flight search can share the legacy flight bundle. */
body.capital-v2-body .capital-air-search #flight-search-ui,
body.capital-v2-body .capital-air-search .flight-search-additional-filters { font-family: var(--capital-font) !important; }
body.capital-v2-body .capital-air-search #flight-search-ui .capital-air-fare .flight-price-primary {
    background: none; background-clip: border-box; -webkit-background-clip: border-box;
    -webkit-text-fill-color: currentColor; color: var(--capital-text, #000);
    font: 800 16px/1.4 var(--capital-font);
}
.capital-v2-body .capital-popper > .MuiPaper-root { border-radius: 16px; box-shadow: 0 8px 28px rgba(0, 0, 0, .16); }
.capital-v2-body .capital-multiselect-heading .MuiListItemText-primary,
.capital-v2-body .capital-multiselect-heading .MuiInputBase-input { font-size: 14px; }
.capital-v2-body .capital-multiselect-heading { flex-basis: 48px; }
.capital-v2-body .capital-multiselect-heading .MuiListSubheader-root { height: 48px; min-height: 48px; max-height: 48px; padding: 10px 16px; }
.capital-v2-body .capital-search-extra-fields .capital-checkbox-icon,
.capital-v2-body .capital-multiselect-list .capital-checkbox-icon { width: 18px; height: 18px; flex-basis: 18px; }
.capital-v2-body .capital-search-extra-fields .capital-checkbox-icon img,
.capital-v2-body .capital-multiselect-list .capital-checkbox-icon img { width: 18px; height: 18px; }

.capital-v2-body .configured-calendar { --calendar-font-family: var(--capital-font); --calendar-range-surface: #eceefc; font-size: 15px; }
.capital-v2-body .nw-calendar-popper .configured-calendar .rmdp-calendar { padding: 0; }
.capital-v2-body .nw-calendar-popper .rmdp-day span.sd { font-size: 15px; }
.capital-v2-body .nw-calendar-popper .rmdp-day.rmdp-disabled span { text-decoration: none; }
.capital-v2-body .nw-calendar-popper .rmdp-day.rmdp-range { background: #eceefc; color: var(--color-primary); }
.capital-v2-body .nw-calendar-popper .rmdp-day.rmdp-range.start,
.capital-v2-body .nw-calendar-popper .rmdp-day.rmdp-range.end,
.capital-v2-body .nw-calendar-popper .rmdp-day.rmdp-selected { background: var(--color-primary); color: #fff; border-radius: 10px; }
.capital-v2-body .nw-calendar-popper .rmdp-week .rmdp-range:first-child { border-top-left-radius: 10px; border-bottom-left-radius: 10px; }
.capital-v2-body .nw-calendar-popper .rmdp-week .rmdp-range:last-child { border-top-right-radius: 10px; border-bottom-right-radius: 10px; }

@media (min-width: 768px) and (max-width: 1023px) {
    .capital-v2-body .capital-drawer { display: block; }
    .capital-v2-body .capital-drawer[hidden], .capital-v2-body .capital-drawer-backdrop[hidden] { display: none; }
}
@media (max-width: 767px) {
    .capital-v2-body .nw-sheet .nw-sheet-head { color: #000; }
    body.capital-v2-body .nw-select-menu.nw-sheet .nw-sheet-head { font-size: 17px; font-weight: 700; color: #000; }
    .capital-v2-body .nw-select-menu.nw-sheet--full > .MuiList-root { overflow-y: auto; }
    .capital-v2-body .nw-select-menu.nw-sheet--full > .MuiList-root > .nw-sheet-head { position: sticky; top: 0; z-index: 2; background: #fff; }
    .capital-v2-body .nw-select-menu.nw-sheet--full > .MuiList-root > .nw-select-search { position: sticky; top: 64px; z-index: 2; background: #fff; }
    .capital-v2-body .capital-v2-sheet-dialog .MuiDialog-container { align-items: flex-end; }
    .capital-v2-body .capital-v2-sheet-dialog .MuiBackdrop-root { background: rgba(0,0,0,.45); }
    .capital-v2-body .capital-v2-sheet-dialog .MuiDialog-paper {
        box-shadow: none;
        position: relative !important; inset: auto !important; transform: none !important;
        width: 100% !important; max-width: 100%; max-height: 85vh; max-height: 85dvh;
        margin: 0; padding: 0 0 env(safe-area-inset-bottom); border-radius: 20px 20px 0 0;
        background: #fff; overflow: auto; font-family: var(--capital-font);
    }
    body.capital-v2-body .capital-v2-sheet-dialog .capital-v2-sheet.nw-sheet--full {
        position: fixed !important; top: calc(var(--nw-vvtop, 0px) + 12px) !important;
        bottom: auto !important; left: 0 !important; right: 0 !important;
        height: calc(var(--nw-vvh, 100dvh) - 12px); max-height: calc(var(--nw-vvh, 100dvh) - 12px);
    }
    .capital-v2-body .capital-v2-sheet .nw-sheet-head { position: sticky; top: 0; z-index: 2; background: #fff; }
    .capital-v2-body .capital-v2-sheet > .MuiPaper-root { max-width: none; max-height: none; width: 100%; border-radius: 0; box-shadow: none; }
    .capital-v2-body .capital-v2-sheet .MuiList-root[role="menu"] { max-height: none !important; }
    .capital-v2-body .capital-v2-sheet .MuiMenuItem-root { min-height: 48px; }
    .capital-v2-body .capital-v2-sheet.nw-calendar-popper { padding: 0 12px 16px; }
    .capital-v2-body .capital-v2-sheet.nw-calendar-popper .nw-sheet-head { margin: 0 -12px; }
    .capital-v2-body .capital-v2-sheet .configured-calendar-surface { max-width: none !important; }
    .capital-v2-body .nw-calendar-popper .configured-calendar .rmdp-day-picker { flex-direction: column; gap: 12px; }
    .capital-v2-body .nw-calendar-popper .configured-calendar .rmdp-day,
    .capital-v2-body .nw-calendar-popper .configured-calendar .rmdp-week-day { width: calc((100vw - 32px) / 7); }
    /* Keep the library's live month labels beside their own months when stacked. */
    .capital-v2-body .nw-calendar-popper [data-months="2"] .rmdp-calendar { display: grid; grid-template-columns: 40px minmax(0,1fr) 40px; }
    .capital-v2-body .nw-calendar-popper [data-months="2"] .rmdp-header,
    .capital-v2-body .nw-calendar-popper [data-months="2"] .rmdp-header > div,
    .capital-v2-body .nw-calendar-popper [data-months="2"] .rmdp-day-picker { display: contents !important; }
    .capital-v2-body .nw-calendar-popper [data-months="2"] .rmdp-left { grid-area: 1 / 1; }
    .capital-v2-body .nw-calendar-popper [data-months="2"] .rmdp-right { grid-area: 1 / 3; }
    .capital-v2-body .nw-calendar-popper [data-months="2"] .rmdp-header-values { display: block; grid-area: 1 / 2; align-self: center; }
    .capital-v2-body .nw-calendar-popper [data-months="2"] .rmdp-header-values:nth-of-type(2) { display: block; grid-area: 3 / 1 / auto / -1; padding: 18px 0 8px; }
    .capital-v2-body .nw-calendar-popper [data-months="2"] .rmdp-day-picker > div { grid-area: 2 / 1 / auto / -1; margin-right: 0 !important; }
    .capital-v2-body .nw-calendar-popper [data-months="2"] .rmdp-day-picker > div + div { grid-row: 4; }
}
@media (prefers-reduced-motion: reduce) {
    .capital-v2-body .nw-sheet { animation: none; }
}

/* Each cabin keeps independent outward/return quota badges, just like the
   prototype's single-cabin cells. Only the selected cabin gets a light tint. */
body.capital-body.capital-v2-body .capital-v2-flight-cabins { display: grid; gap: 8px; min-width: 0; }
body.capital-body.capital-v2-body .capital-v2-flight-cabin {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px;
    align-content: center; justify-items: center; min-width: 0; padding: 4px;
    border-radius: 10px; background: transparent; color: var(--capital-text, #000);
    font-style: normal;
}
body.capital-body.capital-v2-body .capital-v2-flight-cabin.is-selected { background: rgba(0, 154, 144, .08); }
body.capital-body.capital-v2-body .capital-v2-flight-cabin[role="button"] { cursor: pointer; }
body.capital-body.capital-v2-body .capital-v2-flight-cabin[aria-disabled="true"] { cursor: default; opacity: .5; }
body.capital-body.capital-v2-body .capital-v2-flight-cabin:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
body.capital-body.capital-v2-body .capital-v2-flight-cabin .capital-v2-flight-leg { display: flex; flex-direction: column; align-items: center; min-width: 0; }
body.capital-body.capital-v2-body .capital-v2-flight-quota {
    display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
    min-height: 32px; min-width: 40px; max-width: 100%; padding: 0 8px;
    border-radius: 10px; font-size: 13px; font-weight: 700; line-height: 16px;
    font-style: normal; white-space: nowrap; text-align: center; margin: 0;
    background: var(--color-secondary); color: #fff;
}
body.capital-body.capital-v2-body .capital-v2-flight-quota.has-count { white-space: normal; }
body.capital-body.capital-v2-body .capital-v2-flight-quota.few { background: var(--capital-warning, #dda743); }
body.capital-body.capital-v2-body .capital-v2-flight-quota.stop,
body.capital-body.capital-v2-body .capital-v2-flight-quota.no-quota { background: var(--capital-error, #dd4343); }
body.capital-body.capital-v2-body .capital-v2-flight-quota.request { background: color-mix(in srgb, var(--color-secondary) 10%, #fff); color: var(--capital-text, #000); }
body.capital-body.capital-v2-body .capital-v2-flight-cabin .flight-tariff-diff { grid-column: 1 / -1; font-size: 10px; line-height: 14px; text-align: center; }
body.capital-body.capital-v2-body .capital-v2-flight-cabin-label,
body.capital-body.capital-v2-body .capital-v2-flight-leg-label { display: none; }
body.capital-body.capital-v2-body .tp-view-cards .capital-v2-flight-tariffs { grid-area: f-start / f-start / r-end / r-end; }
body.capital-body.capital-v2-body .tp-view-cards .capital-v2-flight-cabins { grid-template-columns: minmax(0, 1fr) !important; }
body.capital-body.capital-v2-body .tp-view-cards .capital-v2-flight-cabin-label,
body.capital-body.capital-v2-body .tp-view-cards .capital-v2-flight-leg-label { display: block; color: var(--nw-grey-2); font-size: 12px; font-weight: 600; line-height: 16px; }
body.capital-body.capital-v2-body .tp-view-cards .capital-v2-flight-cabin-label { grid-column: 1 / -1; }
