/* One MAUTO sheet surface. The domain markup and business flow stay intact. */
:root {
  --mauto-sheet-paper: #fcfdff;
  --mauto-sheet-line: #e4edf8;
  --mauto-sheet-ink: #102b4b;
  --mauto-sheet-muted: #657992;
  --mauto-sheet-ease: cubic-bezier(.22, .8, .25, 1);
}

html.mauto-platform-sheet-open { overflow: hidden; }
html body dialog[data-mauto-platform-sheet]:not(.rm-sheet),
html body dialog.mauto-select-sheet {
  position: fixed !important;
  inset: auto 0 0 !important;
  box-sizing: border-box;
  width: min(100%, 640px) !important;
  min-width: 0 !important;
  max-width: 640px !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: min(90dvh, calc(var(--mauto-sheet-viewport, 100dvh) - 12px)) !important;
  margin: 0 auto !important;
  border: 1px solid rgba(222, 233, 247, .85) !important;
  border-bottom: 0 !important;
  border-radius: 28px 28px 0 0 !important;
  background: var(--mauto-sheet-paper) !important;
  color: var(--mauto-sheet-ink);
  box-shadow: 0 -16px 56px rgba(19, 42, 77, .18) !important;
  overflow-x: hidden !important;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #cedaeb transparent;
  scroll-padding-block: 76px 24px;
  -webkit-overflow-scrolling: touch;
}
html body dialog[data-mauto-platform-sheet]:not([open]),
html body dialog.mauto-select-sheet:not([open]) { display: none !important; }
html body dialog[data-mauto-platform-sheet][open]:not(.rm-sheet),
html body dialog.mauto-select-sheet[open] {
  animation: mauto-sheet-rise-v1 .25s var(--mauto-sheet-ease) both !important;
}
html body dialog[data-mauto-platform-sheet]::backdrop,
html body dialog.mauto-select-sheet::backdrop {
  background: rgba(23, 36, 56, .34) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.mauto-platform-sheet__handle,
.mauto-select-sheet__handle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
  height: 28px;
  min-height: 28px;
  margin: 0;
  touch-action: none;
  user-select: none;
  cursor: grab;
}
.mauto-platform-sheet__handle span,
.mauto-select-sheet__handle span {
  display: block; width: 42px; height: 5px;
  border-radius: 6px; background: #c6cfdd;
}
html body dialog[data-mauto-platform-sheet] :is(.cm-sheet-handle, .pm-sheet-handle) {
  position: relative; flex: 0 0 28px; width: 100%; height: 28px; min-height: 28px;
  margin: 0; background: transparent; border-radius: 0;
}
html body dialog[data-mauto-platform-sheet] :is(.cm-sheet-handle, .pm-sheet-handle)::before {
  content: ''; display: block; position: absolute; left: calc(50% - 21px); top: 11px;
  width: 42px; height: 5px; background: #c6cfdd; border-radius: 6px;
}
.mauto-platform-sheet__close,
.mauto-select-sheet__close {
  display: grid; place-items: center;
  flex: 0 0 44px; width: 44px; min-width: 44px; height: 44px; min-height: 44px;
  padding: 0; border: 0; border-radius: 50%;
  background: #eef3f9; color: #304867;
  font: 400 29px/1 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  cursor: pointer;
}
.mauto-platform-sheet__close { position: absolute; top: 14px; right: 14px; z-index: 4; }
.mauto-platform-sheet__close:focus-visible,
.mauto-select-sheet__close:focus-visible {
  outline: 3px solid rgba(0, 112, 255, .3); outline-offset: 2px;
}

/* Selects use the original select element underneath: the sheet is a picker. */
html body dialog.mauto-select-sheet {
  display: flex; flex-direction: column; padding: 0 !important;
  max-height: min(76dvh, calc(var(--mauto-sheet-viewport, 100dvh) - 12px)) !important;
  overflow: hidden !important;
}
.mauto-select-sheet__header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex: 0 0 auto; padding: 0 16px 12px;
  border-bottom: 1px solid var(--mauto-sheet-line); background: var(--mauto-sheet-paper);
}
.mauto-select-sheet__header h2 {
  margin: 0; padding: 0; min-width: 0; color: var(--mauto-sheet-ink);
  font: 750 22px/1.2 Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: -.5px; overflow-wrap: anywhere;
}
.mauto-select-sheet__options {
  display: grid; gap: 7px; min-height: 0; padding: 12px 16px max(18px, env(safe-area-inset-bottom));
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
html body .mauto-select-sheet .mauto-premium-select__option {
  min-height: 50px; padding: 12px 14px; border: 1px solid transparent;
  border-radius: 15px; background: #f1f5fb; color: #183858;
  font-size: 16px; line-height: 1.3; text-align: left;
}
html body .mauto-select-sheet .mauto-premium-select__option[aria-selected="true"] {
  border-color: #c5dfff; background: #e9f3ff; color:var(--mauto-ds-color-primary,#3c78da);
}
html body .mauto-select-sheet .mauto-premium-select__option:focus-visible {
  outline: 3px solid rgba(0, 112, 255, .25); outline-offset: -1px;
}

/* Existing action/filter dialogs share the same header and safe bottom edge. */
html body dialog[data-mauto-platform-sheet]:not(.rm-sheet):not(.mauto-select-sheet) {
  padding-bottom: max(18px, env(safe-area-inset-bottom)) !important;
}
html body dialog[data-mauto-platform-sheet] :is(.cm-sheet-head, .pm-sheet-header),
html body dialog[data-mauto-platform-sheet] > header {
  background: var(--mauto-sheet-paper);
  border-bottom-color: var(--mauto-sheet-line);
}
html body dialog[data-mauto-platform-sheet] :is(.cm-sheet-head, .pm-sheet-header) h2 {
  color: var(--mauto-sheet-ink); font-size: 23px; line-height: 1.2; letter-spacing: -.5px;
}
html body :is(dialog.cm-sheet, dialog.pm-sheet)[data-mauto-platform-sheet][open] {
  display: flex !important; flex-direction: column; overflow: hidden !important;
}
html body :is(dialog.cm-sheet, dialog.pm-sheet)[data-mauto-platform-sheet] :is(.cm-sheet-body, .pm-sheet-body) {
  min-height: 0; flex: 1 1 auto; max-height: none !important;
  overflow: auto; overscroll-behavior: contain; padding-bottom: var(--mauto-sheet-actions-space, 12px);
  scroll-padding-bottom: var(--mauto-sheet-actions-space, 12px);
}
html body dialog[data-mauto-platform-sheet] :is(.cm-sheet-actions, .pm-sheet-actions) {
  background: var(--mauto-sheet-paper); border-top-color: var(--mauto-sheet-line);
}

/* FA03 previously used a full-screen transparent dialog with an absolutely
   positioned panel. The shared dialog now owns the height and scroll area. */
html body .fa03-category-switcher[data-mauto-platform-sheet] .fa03-switcher-surface {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  overflow: visible !important;
  transform: none !important;
  animation: none !important;
}

@media (max-width: 767px) {
  html body dialog[data-mauto-platform-sheet]:not(.rm-sheet) { max-width: 100% !important; }
  html body #mauto-insurance-dialog:not([hidden]) { align-items: flex-end !important; }
  html body #mauto-insurance-dialog [data-mauto-sheet-surface] {
    align-self: flex-end !important; width: 100% !important; max-width: 100% !important;
    max-height: min(90dvh, calc(var(--mauto-sheet-viewport, 100dvh) - 12px)) !important;
    margin: auto 0 0 !important; border-radius: 28px 28px 0 0 !important;
    padding-bottom: max(18px, env(safe-area-inset-bottom)) !important;
    overflow: auto; overscroll-behavior: contain;
    background: var(--mauto-sheet-paper) !important;
    animation: mauto-sheet-rise-v1 .25s var(--mauto-sheet-ease) both;
  }
}
@keyframes mauto-sheet-rise-v1 {
  from { opacity: .55; transform: translateY(42px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  html body dialog[data-mauto-platform-sheet][open],
  html body dialog.mauto-select-sheet[open],
  html body #mauto-insurance-dialog [data-mauto-sheet-surface] { animation: none !important; scroll-behavior: auto !important; }
}

/* Opt-in framed sheets: header/actions stay outside one scrolling content body.
   Original fields, form ownership and handlers remain unchanged. */
html body dialog[data-mauto-framed-sheet][data-mauto-platform-sheet][data-mauto-motion][data-mauto-sheet-surface][data-mauto-motion-surface] {
  box-sizing:border-box!important;padding:0!important;overflow:hidden!important;
  width:100%!important;max-width:100%!important;min-height:0!important;
  max-height:min(75dvh,calc(var(--mauto-sheet-viewport,100dvh)*.75))!important;
  scroll-padding:0!important;
}
html body dialog[data-mauto-framed-sheet][data-mauto-platform-sheet][data-mauto-motion][data-mauto-sheet-surface][data-mauto-motion-surface][open] {display:flex!important;flex-direction:column!important}
html body dialog[data-mauto-framed-sheet][data-mauto-platform-sheet][data-mauto-motion][data-mauto-sheet-surface][data-mauto-motion-surface] > form:not([hidden]) {
  display:flex!important;flex-direction:column!important;flex:1 1 auto!important;
  min-width:0!important;min-height:0!important;max-height:none!important;overflow:hidden!important;padding:0!important;margin:0!important;
}
html body dialog[data-mauto-framed-sheet][data-mauto-platform-sheet][data-mauto-motion][data-mauto-sheet-surface][data-mauto-motion-surface] > header,
html body dialog[data-mauto-framed-sheet][data-mauto-platform-sheet][data-mauto-motion][data-mauto-sheet-surface][data-mauto-motion-surface] > form > header {
  position:relative!important;inset:auto!important;flex:0 0 auto!important;margin:0!important;
}
html body dialog[data-mauto-framed-sheet][data-mauto-platform-sheet][data-mauto-motion][data-mauto-sheet-surface][data-mauto-motion-surface] > [data-mauto-sheet-body],
html body dialog[data-mauto-framed-sheet][data-mauto-platform-sheet][data-mauto-motion][data-mauto-sheet-surface][data-mauto-motion-surface] > form > [data-mauto-sheet-body] {
  min-width:0!important;min-height:0!important;flex:1 1 auto!important;
  overflow:auto!important;overscroll-behavior:contain!important;padding:5px 12px!important;
  scroll-padding-block:5px!important;
}
html body dialog[data-mauto-framed-sheet][data-mauto-platform-sheet][data-mauto-motion][data-mauto-sheet-surface][data-mauto-motion-surface] > form > footer {
  position:relative!important;inset:auto!important;flex:0 0 auto!important;
  margin:0!important;padding:5px 12px max(8px,env(safe-area-inset-bottom))!important;
  box-shadow:none!important;border-top:1px solid var(--mauto-sheet-line);
}
html body dialog[data-mauto-framed-sheet][data-mauto-platform-sheet][data-mauto-motion][data-mauto-sheet-surface][data-mauto-motion-surface] > form > footer [data-form-status]:empty {display:none}
html body dialog[data-mauto-framed-sheet][data-mauto-platform-sheet][data-mauto-motion][data-mauto-sheet-surface][data-mauto-motion-surface] > .tun227-success:not([hidden]) {min-height:0;overflow:auto;flex:1 1 auto}
@media(min-width:768px){
  html body dialog[data-mauto-framed-sheet][data-mauto-platform-sheet][data-mauto-motion][data-mauto-sheet-surface][data-mauto-motion-surface] {
    width:440px!important;max-width:440px!important;inset:0 0 0 auto!important;margin:auto 0!important;
    max-height:calc(var(--mauto-sheet-viewport,100dvh) - 24px)!important;border-radius:24px 0 0 24px!important;
  }
}
