/* Embedding geometry only. Visual rules come from the unmodified app styles. */
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body.app-content { display: flex; min-height: 0; visibility: visible; opacity: 1; }
body > .ws-app { height: 100%; }
.doc-component { justify-content: center; align-items: center; }
[data-kind="sidebar"] .doc-component > .ws-navigation {
  position: relative; inset: auto; transform: none; width: 364px; max-width: 100%;
  height: 100%; visibility: visible;
}
[data-kind="sidebar"] .ws-panel { width: 304px; min-width: 0; flex: 1; }
[data-kind="sidebar"] .ws-panel > * { min-width: 0; }
[data-kind="sidebar"] .ws-mobile-only { display: none; }
[data-kind="composer"] .ws-composer-wrap.chat-input-container {
  position: relative !important; inset: auto !important; transform: none !important;
  width: calc(100% - 32px) !important;
}
[data-kind="settings"] .doc-component > dialog,
[data-kind="dialog"] .doc-component > dialog {
  position: relative; inset: auto; margin: auto; max-height: calc(100dvh - 24px);
}
[data-kind="settings"] .doc-component > dialog { height: calc(100dvh - 24px); }
[data-kind="models"] .doc-component { align-items: flex-start; min-height: 820px; padding: 8px; }
[data-kind="models"] .ws-model { width: 100%; }
[data-kind="models"] #model-select-container { width: 100%; justify-content: center; }
[data-kind="models"] [data-doc-model-menu] { position: relative !important; inset: auto !important; width: 100% !important; margin-top: 8px; min-width: min(320px, calc(100vw - 16px)) !important; max-height: 760px !important; }
[data-kind="models"] [data-doc-model-menu] > div { max-height: 760px; }
[data-kind="response"] .doc-component { display: block; padding: 24px; overflow-y: auto; }
#doc-dialog-host:empty { display: none; }
#doc-dialog-host > dialog { position: fixed; inset: 0; margin: auto; z-index: 10000; }
#doc-dialog-host:has(> dialog[open])::before { content: ''; position: fixed; inset: 0; background: #10111370; z-index: 9999; }
#doc-status { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 20000; border-radius: 6px; padding: 10px 14px; font: 13px/1.5 system-ui, sans-serif; background: #242526; color: #fff; box-shadow: 0 3px 15px #0003; }
.dark #doc-status { background: #ededee; color: #242526; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }

/* Crop away the surrounding app canvas, preserving the original component. */
body:not([data-kind="app"]) { height: auto; }
body:not([data-kind="app"]) > .doc-component { height: auto; min-height: 0; background: transparent; }
html:has(body:not([data-kind="app"])), body:not([data-kind="app"]) { background: transparent !important; }
[data-kind="sidebar"] .doc-component > .ws-navigation { height: 500px; }
[data-kind="composer"] .doc-component { padding: 8px; }
[data-kind="composer"] .ws-composer-wrap.chat-input-container { width: 100% !important; }
[data-kind="dialog"] .doc-component > dialog,
[data-kind="settings"] .doc-component > dialog { inset: auto; margin: 0; width: 100%; max-width: 100%; max-height: none; }
[data-kind="settings"] .doc-component > dialog { height: 510px; }
[data-kind="dialog"] .doc-component > dialog { height: auto; }
[data-kind="modal"] .doc-component { display: block; }
[data-kind="modal"] .doc-component .ws-modal-overlay { position: relative !important; inset: auto !important; padding: 0; overflow: visible; background: transparent; }
[data-kind="modal"] .doc-component .ws-modal-overlay > .fixed { display: none; }
[data-kind="modal"] .doc-component .ws-modal-position { min-height: 0; }
[data-kind="modal"] .doc-component .ws-modal-card { width: 100% !important; max-height: none !important; margin: 0 !important; }
[data-kind="modal"] .doc-component .ws-modal-card > .overflow-y-auto { overflow: visible; }
[data-kind="response"] .doc-component { padding: 8px; }
/* Leave room for the real hold indicator inside these interactive frames. */
body[data-preview="response"] > .doc-component,
body[data-preview="archive-result"] > .doc-component { min-height: 240px; }
[data-kind="hold"] .doc-component { padding: 12px; }

/* The embedding gets a light shadow instead of the modal's full-screen shadow. */
.doc-component > dialog, [data-kind="modal"] .doc-component .ws-modal-card { box-shadow: 0 3px 10px #0001 !important; }

[data-kind="settings"] .doc-component > dialog,
[data-kind="settings"] .doc-component :is(.ws-settings-layout, .ws-settings-nav, .ws-settings-content) { height: auto; }
[data-kind="settings"] .doc-component .ws-settings-content { overflow: visible; }
/* The app fixes body to the viewport with !important; standalone components
   must opt out so their natural height, including every button, can be used. */
body:not([data-kind="app"]) { height: auto !important; display: block; }

[data-kind="modal"] .doc-component > #modal-container { position: relative !important; inset: auto !important; }

/* Keep the expanded model list inside the exported component's visible canvas. */
body[data-kind="models"] > .doc-component {
  min-height: 820px;
  overflow: visible;
}
