/* The parent admin owns the blurred layer; these rules affect only its create frames. */
@layer crm-admin-ui {
html body.embedded-create-layer {
  --quick-bg:#181b1d !important; --quick-panel:#242629 !important;
  --quick-input:#2d3134 !important; --quick-text:#f7f5f0 !important;
  --quick-muted:#c1c5c3 !important; --quick-line:#849096 !important;
  --quick-soft-line:#41474a !important; --quick-focus:#e3c876 !important;
  --crm-bg:#181b1d !important; --crm-panel:#242629 !important;
  --crm-subtle:#2d3134 !important; --crm-text:#f7f5f0 !important;
  --crm-muted:#c1c5c3 !important; --crm-line:#849096 !important;
  --crm-soft-line:#41474a !important; --crm-accent:#C9A44C !important;
  --crm-on-accent:#242629 !important; --crm-focus:#e3c876 !important;
  --crm-hover:#34393b !important;
  --bg:#181b1d !important; --fg:#f7f5f0 !important; --card:#242629 !important;
  --mut:#c1c5c3 !important;
  margin:0 !important; min-height:100dvh !important;
  background:var(--quick-bg) !important; color:var(--quick-text) !important;
  color-scheme:dark !important;
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif !important;
}
html.theme-light body.embedded-create-layer {
  --quick-bg:#F7F5F0 !important; --quick-panel:#fff !important;
  --quick-input:#fff !important; --quick-text:#242629 !important;
  --quick-muted:#657076 !important; --quick-line:#829096 !important;
  --quick-soft-line:#e4e3df !important; --quick-focus:#176C70 !important;
  --crm-bg:#F7F5F0 !important; --crm-panel:#fff !important;
  --crm-subtle:#f8f6f1 !important; --crm-text:#242629 !important;
  --crm-muted:#657076 !important; --crm-line:#829096 !important;
  --crm-soft-line:#e4e3df !important; --crm-focus:#176C70 !important;
  --crm-hover:#f8f6f1 !important;
  --bg:#F7F5F0 !important; --fg:#242629 !important;
  --card:#fff !important; --mut:#657076 !important;
  color-scheme:light !important;
}
html body.embedded-create-layer #lexAdminFab,
html body.embedded-create-layer #lexAdminPanel { display:none !important; }
html body.embedded-create-layer :is(input,select,textarea,button):focus-visible {
  outline:3px solid var(--quick-focus) !important; outline-offset:2px !important;
}
html body.embedded-create-layer :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea) {
  min-height:40px !important; background:var(--quick-input) !important;
  color:var(--quick-text) !important; border:1px solid var(--quick-line) !important;
  border-radius:6px !important; box-shadow:none !important;
  font:inherit !important; font-size:14px !important;
}
html body.embedded-create-layer :is(input,textarea)::placeholder { color:var(--quick-muted) !important; opacity:1 !important; }
html body.embedded-create-layer :is(input[type=checkbox],input[type=radio]) { accent-color:#176C70 !important; }
html body.embedded-create-layer :is(label,.mut,.small) { color:var(--quick-text) !important; }
html body.embedded-create-layer :is(button,button.primary,button[type=submit],.crm-button.crm-primary) {
  min-height:38px !important; border:1px solid var(--quick-line) !important;
  border-radius:6px !important; background:var(--quick-panel) !important;
  color:var(--quick-text) !important; box-shadow:none !important;
  font-family:inherit !important; font-size:13px !important;
}
html body.embedded-create-layer :is(button.primary,button[type=submit],.crm-button.crm-primary) {
  background:#C9A44C !important; color:#242629 !important; border-color:#C9A44C !important;
}
html body.embedded-create-layer :is(button,.crm-button):hover { border-color:#C9A44C !important; }

/* The company page's legacy modal is the editor inside the parent layer. */
html body.embedded-create-layer #companyModal.active {
  position:fixed !important; inset:0 !important; z-index:1 !important;
  display:block !important; width:100% !important; height:100dvh !important;
  padding:0 !important; overflow:hidden !important;
  background:transparent !important; backdrop-filter:none !important;
  animation:none !important;
}
html body.embedded-create-layer #companyModal > .modal-content {
  display:flex !important; flex-direction:column !important;
  width:100% !important; max-width:none !important; height:100dvh !important;
  max-height:none !important; margin:0 !important; padding:0 !important;
  border:0 !important; border-radius:0 !important;
  background:var(--quick-panel) !important; background-image:none !important;
  color:var(--quick-text) !important; box-shadow:none !important;
}
html body.embedded-create-layer #companyModal > .modal-content > h3 { display:none !important; }
html body.embedded-create-layer #companyForm {
  display:grid !important; gap:16px !important; flex:1 1 auto !important;
  align-content:start !important; min-height:0 !important;
  margin:0 !important; padding:24px 28px 0 !important;
  overflow:auto !important; background:var(--quick-panel) !important;
}
html body.embedded-create-layer #companyForm label { font-size:13px !important; font-weight:550 !important; color:var(--quick-text) !important; }
html body.embedded-create-layer #companyForm > div:last-child {
  display:flex !important; flex-wrap:wrap !important; align-items:center !important;
  position:sticky !important; bottom:0 !important; z-index:2 !important;
  margin:0 -28px !important; padding:12px 28px max(12px,env(safe-area-inset-bottom)) !important;
  background:var(--quick-panel) !important; border-top:1px solid var(--quick-soft-line) !important;
}

/* Contact keeps its field sections and native dialog lifecycle. */
html body.crm-admin-pilot.embedded-create-layer dialog.crm-form-layer {
  inset:0 !important; width:100% !important; height:100dvh !important;
  max-width:none !important; max-height:none !important; margin:0 !important;
  border:0 !important; border-radius:0 !important; box-shadow:none !important;
}
html body.crm-admin-pilot.embedded-create-layer dialog.crm-form-layer::backdrop {
  background:transparent !important; backdrop-filter:none !important;
}
html body.crm-admin-pilot.embedded-create-layer .crm-form-header { display:contents !important; }
html body.crm-admin-pilot.embedded-create-layer .crm-form-header > div:first-child {
  position:absolute !important; width:1px !important; height:1px !important;
  padding:0 !important; margin:0 !important; overflow:hidden !important;
  clip-path:inset(50%) !important; white-space:nowrap !important;
}
html body.crm-admin-pilot.embedded-create-layer .crm-form-header #btnClose { display:none !important; }
html body.crm-admin-pilot.embedded-create-layer .crm-form-actions {
  order:2 !important; flex:0 0 auto !important; width:100% !important;
  justify-content:flex-end !important; gap:8px !important;
  margin:0 !important; padding:12px 28px max(12px,env(safe-area-inset-bottom)) !important;
  background:var(--quick-panel) !important; border-top:1px solid var(--quick-soft-line) !important;
}
html body.crm-admin-pilot.embedded-create-layer .crm-form-actions .crm-primary { flex:0 0 auto !important; }
html body.crm-admin-pilot.embedded-create-layer .crm-form-scroll {
  order:1 !important; flex:1 1 auto !important; min-height:0 !important;
  padding:0 28px 28px !important;
}

/* The event editor retains its original fields and SQL handlers. */
html body.embedded-create-layer > header,
html body.embedded-create-layer main > .card:first-child { display:none !important; }
html body.embedded-create-layer main {
  width:100% !important; max-width:none !important; min-height:100dvh !important;
  margin:0 !important; padding:0 0 74px !important; background:var(--quick-panel) !important;
}
html body.embedded-create-layer main > .card {
  width:100% !important; max-width:none !important; min-height:100dvh !important;
  margin:0 !important; padding:20px 28px !important;
  border:0 !important; border-radius:0 !important;
  background:var(--quick-panel) !important; box-shadow:none !important;
  transform:none !important;
  backdrop-filter:none !important; -webkit-backdrop-filter:none !important;
}
html body.embedded-create-layer #form { max-width:850px !important; margin:auto !important; }
html body.embedded-create-layer #form label { color:var(--quick-text) !important; }
html body.embedded-create-layer #form > .row:last-child {
  position:fixed !important; left:0 !important; right:0 !important; bottom:0 !important; z-index:2 !important;
  margin:0 !important; padding:12px 28px max(12px,env(safe-area-inset-bottom)) !important;
  background:var(--quick-panel) !important; border-top:1px solid var(--quick-soft-line) !important;
}
@media(max-width:700px) {
  html body.embedded-create-layer #companyForm { padding:16px 18px 0 !important; }
  html body.embedded-create-layer #companyForm > div:last-child { margin:0 -18px !important; padding-inline:18px !important; }
  html body.crm-admin-pilot.embedded-create-layer .crm-form-actions { padding-inline:18px !important; }
  html body.crm-admin-pilot.embedded-create-layer .crm-form-scroll { padding:0 18px 24px !important; }
  html body.embedded-create-layer main > .card { padding:16px 18px !important; }
  html body.embedded-create-layer #form > .row:last-child { padding-inline:18px !important; }
}

/* The events list uses the same layer without inheriting dashboard page layout. */
html body.crm-quick-create-host .dashboard-layer {
  display:none !important; position:fixed !important; inset:0 !important;
  z-index:20000 !important; padding:28px !important; align-items:center !important;
  justify-content:center !important; background:#10131575 !important;
  backdrop-filter:blur(6px) !important;
}
html body.crm-quick-create-host .dashboard-layer.active { display:flex !important; }
html body.crm-quick-create-host .dashboard-layer-shell {
  display:flex !important; flex-direction:column !important; width:min(1100px,100%) !important;
  height:min(900px,calc(100dvh - 56px)) !important; overflow:hidden !important;
  border:1px solid #41474a !important; border-radius:12px !important;
  background:#242629 !important; box-shadow:0 25px 90px #00000035 !important;
}
html body.crm-quick-create-host .dashboard-layer-bar {
  display:flex !important; flex:0 0 auto !important; align-items:center !important;
  justify-content:space-between !important; gap:12px !important; padding:12px 16px !important;
  border-bottom:1px solid #41474a !important; background:#242629 !important;
}
html body.crm-quick-create-host .dashboard-layer-title { font-size:14px !important; font-weight:600 !important; color:#f7f5f0 !important; }
html body.crm-quick-create-host .dashboard-layer-sub { font-size:11px !important; color:#c1c5c3 !important; }
html body.crm-quick-create-host .dashboard-layer-close {
  min-height:36px !important; padding:7px 12px !important; border:1px solid #849096 !important;
  border-radius:5px !important; background:#242629 !important; color:#f7f5f0 !important;
}
html body.crm-quick-create-host .dashboard-layer-frame { width:100% !important; flex:1 1 auto !important; min-height:0 !important; border:0 !important; background:#242629 !important; }
html body.crm-quick-create-host.dashboard-layer-open { overflow:hidden !important; }
html.theme-light body.crm-quick-create-host .dashboard-layer-shell,
html.theme-light body.crm-quick-create-host .dashboard-layer-bar,
html.theme-light body.crm-quick-create-host .dashboard-layer-close,
html.theme-light body.crm-quick-create-host .dashboard-layer-frame { background:#fff !important; }
html.theme-light body.crm-quick-create-host .dashboard-layer-title,
html.theme-light body.crm-quick-create-host .dashboard-layer-close { color:#242629 !important; }
html.theme-light body.crm-quick-create-host .dashboard-layer-sub { color:#657076 !important; }
@media(max-width:700px) {
  html body.crm-quick-create-host .dashboard-layer { padding:10px !important; }
  html body.crm-quick-create-host .dashboard-layer-shell { height:calc(100dvh - 20px) !important; }
  html body.crm-quick-create-host .dashboard-layer-sub { display:none !important; }
}

/* Direct event links keep every existing field and handler with the CRM palette. */
html body.event-edit-page:not(.embedded-create-layer) {
  --quick-bg:#181b1d; --quick-panel:#242629; --quick-input:#2d3134;
  --quick-text:#f7f5f0; --quick-muted:#c1c5c3; --quick-line:#849096;
  --quick-soft-line:#41474a; --quick-focus:#e3c876;
  background:var(--quick-bg) !important; color:var(--quick-text) !important;
  color-scheme:dark !important;
}
html.theme-light body.event-edit-page:not(.embedded-create-layer) {
  --quick-bg:#F7F5F0; --quick-panel:#fff; --quick-input:#fff;
  --quick-text:#242629; --quick-muted:#657076; --quick-line:#829096;
  --quick-soft-line:#e4e3df; --quick-focus:#176C70;
  color-scheme:light !important;
}
html body.event-edit-page:not(.embedded-create-layer) > header {
  background:var(--quick-panel) !important; border-bottom:1px solid var(--quick-soft-line) !important;
}
html body.event-edit-page:not(.embedded-create-layer) main { width:min(100%,960px) !important; max-width:none !important; margin:0 auto !important; }
html body.event-edit-page:not(.embedded-create-layer) .card {
  background:var(--quick-panel) !important; border:1px solid var(--quick-soft-line) !important;
  color:var(--quick-text) !important; box-shadow:none !important; transform:none !important;
}
html body.event-edit-page:not(.embedded-create-layer) :is(label,.mut,.small) { color:var(--quick-muted) !important; }
html body.event-edit-page:not(.embedded-create-layer) :is(input:not([type=checkbox]),select,textarea) {
  min-height:40px !important; background:var(--quick-input) !important;
  color:var(--quick-text) !important; border:1px solid var(--quick-line) !important;
  border-radius:6px !important; font:inherit !important; font-size:14px !important;
}
html body.event-edit-page:not(.embedded-create-layer) :is(input,textarea)::placeholder { color:var(--quick-muted) !important; opacity:1 !important; }
html body.event-edit-page:not(.embedded-create-layer) input[type=checkbox] { accent-color:#176C70 !important; }
html body.event-edit-page:not(.embedded-create-layer) button {
  min-height:38px !important; border:1px solid var(--quick-line) !important;
  border-radius:6px !important; background:var(--quick-panel) !important;
  color:var(--quick-text) !important; box-shadow:none !important;
}
html body.event-edit-page:not(.embedded-create-layer) button.primary {
  background:#C9A44C !important; border-color:#C9A44C !important; color:#242629 !important;
}
html body.event-edit-page:not(.embedded-create-layer) :is(input,select,textarea,button):focus-visible {
  outline:3px solid var(--quick-focus) !important; outline-offset:2px !important;
}
}
