.layout-editor[hidden], .layout-editor-outline[hidden] { display: none; }
.layout-editor {
  position: fixed;
  z-index: 210;
  display: flex;
  flex-direction: column;
  inset: auto max(14px, env(safe-area-inset-right)) max(84px, calc(env(safe-area-inset-bottom) + 74px)) auto;
  width: min(350px, calc(100vw - 24px));
  max-height: min(620px, calc(100dvh - 115px));
  overflow: hidden;
  border: 1px solid #516185;
  border-radius: 17px;
  background: #131c2d;
  box-shadow: 0 15px 55px #02040ab3;
  color: #f1f6ff;
  color-scheme: dark;
  font: 14px/1.4 system-ui, sans-serif;
}
.layout-editor-header {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #34435e;
  cursor: move;
  touch-action: none;
}
.layout-editor-header strong { flex: 1; }
#layout-editor-device { color: #aabbd6; font-size: 11px; white-space: nowrap; }
.layout-editor-body { display: grid; gap: 9px; min-height: 0; padding: 11px 12px; overflow: auto; overscroll-behavior: contain; }
.layout-editor-footer { display: grid; flex: none; gap: 7px; padding: 9px 12px 12px; border-top: 1px solid #34435e; }
.layout-editor-selects, #layout-editor-fields, .layout-editor-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.layout-editor label { display: grid; gap: 3px; min-width: 0; color: #ccdaef; font-size: 12px; }
.layout-editor :is(button, input, select) {
  min-height: 35px;
  min-width: 0;
  border: 1px solid #475976;
  border-radius: 8px;
  background: #1b2941;
  color: #f1f6ff;
  font: inherit;
}
.layout-editor :is(input, select) { width: 100%; padding: 5px 7px; font-size: 12px; }
.layout-editor button { padding: 5px 8px; cursor: pointer; font-size: 12px; }
.layout-editor button:disabled { opacity: .55; cursor: default; }
.layout-editor :is(button, input, select):focus-visible, .layout-editor-outline button:focus-visible { outline: 2px solid #83f4eb; outline-offset: 2px; }
.layout-editor #layout-editor-close { width: 32px; min-height: 32px; padding: 0; font-size: 20px; line-height: 1; }
.layout-editor #layout-editor-pick[aria-pressed="true"] { background: #253d53; border-color: #67c5c0; }
#layout-editor-fields { min-width: 0; padding: 0; margin: 0; border: 0; }
#layout-editor-feedback { margin: 0; font-size: 12px; color: #bdd7ec; }
#layout-editor-feedback:empty { display: none; }
#layout-editor-feedback[data-error="true"] { color: #ffc1c5; }
#layout-editor-save { background: #295e63; border-color: #6cbcb8; font-weight: 700; }
.layout-editor-outline {
  position: fixed;
  z-index: 209;
  pointer-events: none;
  inset: 0 auto auto 0;
  border: 1px solid #6cf3e8;
  box-shadow: 0 0 0 2px #133a48b3;
  box-sizing: border-box;
}
.layout-editor-outline span {
  position: absolute;
  left: 0;
  bottom: 100%;
  padding: 2px 5px;
  max-width: 200px;
  background: #123746;
  color: #c5fffa;
  font: 11px/1.2 system-ui, sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.layout-editor-outline button {
  position: absolute;
  pointer-events: auto;
  touch-action: none;
  width: 27px;
  height: 27px;
  padding: 0;
  border: 1px solid #75ddd6;
  border-radius: 6px;
  background: #123746;
  color: #d8fffd;
  font: 700 16px/1 system-ui, sans-serif;
}
.layout-editor-outline [data-layout-drag="move"] { top: -14px; left: 50%; margin-left: -13px; cursor: move; }
.layout-editor-outline [data-layout-drag="size"] { bottom: -14px; right: -14px; cursor: nwse-resize; }
@media (max-width: 700px) {
  .layout-editor { max-height: min(48dvh, 470px); }
  .layout-editor-outline button { width: 33px; height: 33px; }
  .layout-editor input { font-size: 16px; }
}
