/* Dynamic viewport excludes Safari's address and navigation bars. */
html body dialog{box-sizing:border-box;max-width:calc(100vw - 24px);max-height:calc(100vh - 32px);max-height:calc(100dvh - 32px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));margin:auto;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scroll-padding-top:64px}
html body dialog .sm-dialog-toolbar{position:sticky;top:0;z-index:100;display:flex;align-items:center;justify-content:flex-end;min-height:56px;background:inherit;isolation:isolate;flex-shrink:0;clear:both}
html body dialog .sm-dialog-toolbar>.dialog-close{position:static!important;float:none!important;margin:6px 10px!important;inset:auto!important;display:grid;place-items:center;width:44px;height:44px;min-width:44px;padding:0;border:1px solid #697583;border-radius:50%;background:#24272d;color:#f4f5f7;box-shadow:0 2px 8px #0001;font:400 30px/1 Arial,sans-serif;cursor:pointer;z-index:auto}
html body dialog .sm-dialog-toolbar>.dialog-close:focus-visible{outline:3px solid #ed7a2b;outline-offset:2px}
html body .sm-chat-head,html body .parked-dialog>header{position:sticky;top:0;z-index:100;background:inherit}
html body .sm-chat-head .sm-chat-close,html body .parked-dialog>header>button{width:44px;height:44px;min-width:44px}
.vehicle,.auction-card{cursor:pointer}
@media(max-width:600px){html body dialog{max-width:calc(100vw - 16px);max-height:calc(100dvh - 20px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px))}}

/* Anchor detail dialogs inside the currently visible Safari viewport. */
html body dialog#auctionDialog,html body dialog.vehicle-detail-dialog{position:fixed;top:calc(var(--sm-viewport-top,0px) + 12px);bottom:auto;left:0;right:0;margin:0 auto;max-height:calc(var(--sm-viewport-height,100dvh) - 24px);transform:none;scroll-padding-top:66px}
html body dialog#auctionDialog>.sm-dialog-toolbar,html body dialog.vehicle-detail-dialog>.sm-dialog-toolbar{position:sticky;top:0;min-height:60px;background:#24272d;color:#f4f5f7;border-bottom:1px solid #454c56;z-index:1000;overflow:visible}
html body dialog#auctionDialog>.sm-dialog-toolbar>.dialog-close,html body dialog.vehicle-detail-dialog>.sm-dialog-toolbar>.dialog-close{position:static!important;margin:8px 12px!important;width:44px;height:44px;pointer-events:auto;touch-action:manipulation}
html body dialog.vehicle-image-viewer{position:fixed;top:var(--sm-viewport-top,0px);bottom:auto;left:0;right:0;margin:0;width:100vw;max-width:100vw;height:var(--sm-viewport-height,100dvh);max-height:var(--sm-viewport-height,100dvh)}

/* Every dialog, including support and account forms, fits the visible viewport. */
html body dialog[open]:not(.vehicle-image-viewer){position:fixed;inset:calc(var(--sm-viewport-top,0px) + 12px) 0 auto;margin:0 auto;max-height:calc(var(--sm-viewport-height,100dvh) - 24px);transform:none;scroll-behavior:auto;overflow-y:auto;overflow-x:hidden}
html body dialog[open] .sm-dialog-toolbar{background:#24272d;color:#f4f5f7;top:0;position:sticky;z-index:1000}
html body dialog[open]>header:has(button){position:sticky;top:0;z-index:1000;background:#24272d}
html body dialog[open]>.discovery-head{position:sticky;top:0;z-index:1000;background:#24272d}
html body dialog[open] button[aria-label="Schließen"],html body dialog[open] button[data-close]{min-width:44px;min-height:44px;touch-action:manipulation}
/* The dark parking list needs its own header rather than the generic white toolbar. */
html body dialog.parked-dialog[open]>header{background:var(--ink2,#24272d);color:var(--orange,#f47621);border-bottom:1px solid #414852;gap:16px}
html body dialog.parked-dialog[open]>header h2{color:var(--orange,#f47621);opacity:1;margin:0}
html body dialog.parked-dialog[open]>header>button{background:#343b44;color:#fff;border:1px solid #59616b;flex-shrink:0}
html body dialog.parked-dialog[open]>header>button:focus-visible{outline:3px solid var(--orange,#f47621);outline-offset:3px}

/* First-open geometry is identical to reopen geometry, including the image viewer. */
:root{--sm-dialog-edge-top:max(16px,env(safe-area-inset-top,0px));--sm-dialog-edge-bottom:max(16px,env(safe-area-inset-bottom,0px))}
html body dialog[open]:not(.vehicle-image-viewer){top:calc(var(--sm-viewport-top,0px) + var(--sm-dialog-edge-top));bottom:auto;max-height:calc(var(--sm-viewport-height,100dvh) - var(--sm-dialog-edge-top) - var(--sm-dialog-edge-bottom));scroll-padding-top:72px}
html body dialog.vehicle-image-viewer[open]{top:calc(var(--sm-viewport-top,0px) + var(--sm-dialog-edge-top));bottom:auto;margin:0;height:calc(var(--sm-viewport-height,100dvh) - var(--sm-dialog-edge-top) - var(--sm-dialog-edge-bottom));max-height:calc(var(--sm-viewport-height,100dvh) - var(--sm-dialog-edge-top) - var(--sm-dialog-edge-bottom));border-radius:16px;overflow:hidden}
html body dialog.vehicle-image-viewer[open]>header{box-sizing:border-box;position:absolute;top:0;min-height:64px;padding:10px 16px;background:#181b1f;color:#f4f5f7;align-items:center;gap:12px}
html body dialog.vehicle-image-viewer[open]>header button{position:static;inset:auto;flex-shrink:0;width:44px;height:44px;margin:0;touch-action:manipulation}
html body dialog.offer-report-dialog[open]>.offer-report-head{position:sticky;top:0;display:flex;justify-content:space-between;align-items:center;gap:16px;padding:12px 0;background:#24272d;z-index:1000}
html body dialog.offer-report-dialog .offer-report-head h2{font-family:inherit;font-size:clamp(21px,4vw,28px);text-transform:none;margin:0;color:#f4f5f7}
html body dialog.offer-report-dialog .offer-report-head .dialog-close{position:static;inset:auto;float:none;flex-shrink:0;width:auto;height:auto;min-height:44px;padding:10px 16px;margin:0;border:1px solid #48515d;border-radius:14px;background:#30363f;color:#f4f5f7;font:inherit;line-height:1.2}

/* Hidden views never take part in layout, even when their component uses flex/grid. */
html body [hidden]:not([hidden="until-found"]){display:none!important}

/* Shared close/back chrome: no text truncation, left back and right close. */
html body dialog .sm-dialog-controls{display:flex;align-items:center;gap:12px;min-width:0;box-sizing:border-box;isolation:isolate}
html body dialog .sm-dialog-controls>:is(h1,h2,h3){flex:1;min-width:0;margin:0;overflow-wrap:anywhere;white-space:normal;order:1}
html body dialog .sm-dialog-controls>:is(.sm-uniform-close,.sm-uniform-back){box-sizing:border-box;display:grid;place-items:center;flex:0 0 44px;min-width:44px;max-width:44px;width:44px;height:44px;min-height:44px;padding:0!important;border:1px solid #697583;border-radius:50%;background:#30353d;color:#f4f5f7;-webkit-text-fill-color:currentColor;font:400 30px/1 system-ui;letter-spacing:0;text-decoration:none;white-space:nowrap;cursor:pointer;position:static!important;inset:auto!important}
html body dialog .sm-dialog-controls>.sm-uniform-close{order:2;margin:4px 0 4px auto!important}
html body dialog .sm-dialog-controls>.sm-uniform-back{order:0;margin:4px auto 4px 0!important}
html body #profileDialog:has(.sm-uniform-back:not([hidden])) .sm-settings-bar>button{display:none}
html body dialog .sm-dialog-controls>[hidden]{display:none!important}

/* Safari can return focus to the dialog itself after a nested view closes. */
html body dialog[open]:focus {outline:none}
html body dialog[open] :is(button,a,summary,[tabindex]):focus:not(:focus-visible) {outline:none}
html body dialog[open] :is(button,a,summary,input,select,textarea,[tabindex]):focus-visible {
  outline-color:var(--orange,#f47621);
}

/* Consistent window controls with a compact icon and a 44px touch target. */
html body dialog[open] :is(.sm-uniform-close,.sm-uniform-back,[data-chat-back],.sm-settings-bar > button) {
  box-sizing: border-box;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  flex: 0 0 44px;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: transparent !important;
  color: #dbe0e7 !important;
  box-shadow: none !important;
  font-size: 0 !important;
  place-items: center;
}
html body dialog[open] :is(.sm-uniform-close,.sm-uniform-back,[data-chat-back],.sm-settings-bar > button):is(:hover,:active) {
  background: #30353d !important;
}
html body dialog[open] :is(.sm-uniform-close,.sm-uniform-back,[data-chat-back],.sm-settings-bar > button):focus-visible {
  outline: none !important;
}
html body dialog[open] :is(.sm-uniform-close,.sm-uniform-back,[data-chat-back],.sm-settings-bar > button)::after {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  margin: auto;
  background: center / contain no-repeat var(--sm-window-icon);
}
.sm-uniform-close {
  --sm-window-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dbe0e7' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='m6 6 12 12M18 6 6 18'/%3E%3C/svg%3E");
}
:is(.sm-uniform-back,[data-chat-back],.sm-settings-bar > button) {
  --sm-window-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dbe0e7' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 5-7 7 7 7'/%3E%3C/svg%3E");
}

/* Replace legacy artwork with one centered icon for each window control. */
html body dialog[open] :is(.sm-uniform-close,.sm-uniform-back,[data-chat-back],.sm-settings-bar > button) {
  display: grid !important;
  position: relative !important;
  border: 0 !important;
  border-image: none !important;
  outline: none !important;
  line-height: 0 !important;
  text-indent: 0 !important;
}
html body dialog[open] :is(.sm-uniform-close,.sm-uniform-back,[data-chat-back],.sm-settings-bar > button) > *,
html body dialog[open] :is(.sm-uniform-close,.sm-uniform-back,[data-chat-back],.sm-settings-bar > button)::before {
  display: none !important;
}
html body dialog[open] :is(.sm-uniform-close,.sm-uniform-back,[data-chat-back],.sm-settings-bar > button)::after {
  position: absolute !important;
  inset: 0 !important;
  transform: none !important;
  margin: auto !important;
  pointer-events: none;
}
html body dialog[open] .sm-uniform-close::after {
  width: 20px;
  height: 20px;
}
html body dialog[open] :is(.sm-uniform-close,.sm-uniform-back,[data-chat-back],.sm-settings-bar > button):focus-visible {
  background: #3a414b !important;
}

/* Keep the group thread inside the visible viewport when the keyboard pans it. */
html body dialog.group-dialog.group-thread[open] {
  top: calc(var(--sm-viewport-top, 0px) + var(--sm-dialog-edge-top));
  bottom: auto;
  height: min(850px, calc(var(--sm-viewport-height, 100dvh) - var(--sm-dialog-edge-top) - var(--sm-dialog-edge-bottom)));
  overflow: hidden;
}
html body dialog.group-dialog.group-thread .msg-chat-body { gap: 8px; }
html body dialog.group-dialog.group-thread .msg-bubble { padding: 5px 9px; }
html body dialog.group-dialog.group-thread .msg-bubble time { margin-top: 2px; }

@media (max-width: 700px) {
  html body dialog.group-dialog.group-thread[open] {
    top: var(--sm-viewport-top, 0px);
    height: var(--sm-viewport-height, 100dvh);
    max-height: var(--sm-viewport-height, 100dvh);
  }
  html body dialog.group-dialog.group-thread[open]::backdrop { background: #1b1f24; }
}

@media (max-width: 700px) {
  html body dialog[open]:is(.messages-dialog,.group-dialog.group-thread):not(.vehicle-image-viewer) {
    inset: var(--sm-viewport-top, 0px) 0 auto;
    margin: 0;
    box-sizing: border-box;
    height: var(--sm-viewport-height, 100dvh);
    max-height: var(--sm-viewport-height, 100dvh);
    overflow: clip;
  }
  html body dialog[open]:is(.messages-dialog,.group-dialog.group-thread)::backdrop {
    background: #1b1f24;
  }
}
