.layout-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 29.3vw, 440px);
  height: calc(100dvh - 60px);
  min-height: 420px;
  background: #f1f2f4;
  color: #33333b;
}
.layout-work,
.layout-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.layout-work {
  position: relative;
}
.layout-scroll {
  position: relative;
  overflow: auto;
  flex: 1;
  min-height: 0;
  padding: 26px 16px 64px;
}
.layout-sheet {
  margin: 0 auto 8px;
  background: white;
  box-shadow: 0 1px 4px #0002;
  position: relative;
  touch-action: pan-y;
}
.crop-view .layout-sheet,
.forms-view:has([data-mode='edit'][aria-pressed='true']) .layout-sheet {
  touch-action: none;
}
.layout-sheet > img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.layout-sheet > img:not([src]) {
  visibility: hidden;
}
.layout-overlay {
  position: absolute;
  inset: 0;
}
.crop-view .layout-overlay {
  cursor: crosshair;
  overflow: hidden;
}
.crop-selection {
  position: absolute;
  border: 1.5px solid #2596d3;
  box-shadow: 0 0 0 150vmax #17192755;
  cursor: move;
}
.crop-selection.draft {
  pointer-events: none;
}
.layout-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: white;
  border: 1px solid #2685bc;
  transform: translate(-50%, -50%);
  z-index: 2;
}
.layout-handle.nw,
.layout-handle.w,
.layout-handle.sw {
  left: 0;
}
.layout-handle.ne,
.layout-handle.e,
.layout-handle.se {
  left: 100%;
}
.layout-handle.n,
.layout-handle.s {
  left: 50%;
}
.layout-handle.nw,
.layout-handle.ne,
.layout-handle.n {
  top: 0;
}
.layout-handle.s,
.layout-handle.se,
.layout-handle.sw {
  top: 100%;
}
.layout-handle.w,
.layout-handle.e {
  top: 50%;
  cursor: ew-resize;
}
.layout-handle.n,
.layout-handle.s {
  cursor: ns-resize;
}
.layout-handle.nw,
.layout-handle.se {
  cursor: nwse-resize;
}
.layout-handle.ne,
.layout-handle.sw {
  cursor: nesw-resize;
}
.layout-nav {
  position: absolute;
  z-index: 4;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  background: #46464f;
  color: white;
  padding: 5px 8px;
  border-radius: 5px;
  white-space: nowrap;
  font-size: 13px;
}
.layout-nav :is(input, button, select) {
  background: #5c5c67;
  border: 0;
  border-radius: 3px;
  color: white;
  font: inherit;
  padding: 4px;
}
.layout-nav input {
  width: 4em;
  text-align: center;
}
.layout-nav button {
  min-width: 24px;
}
.layout-thumbs {
  position: absolute;
  z-index: 4;
  left: 0;
  top: 0;
  bottom: 0;
  width: 108px;
  overflow: auto;
  background: #fff;
  padding: 6px;
  border-right: 1px solid #ccc;
}
.layout-thumbs button {
  width: 100%;
  padding: 5px;
  border: 0;
  background: #f6f6fa;
}
.layout-thumbs img {
  width: 100%;
  min-height: 70px;
  object-fit: contain;
}
.layout-side {
  background: #fff;
  border-left: 1px solid #d4d4db;
}
.layout-side h1 {
  margin: 0;
  text-align: center;
  font-size: 22px;
  padding: 17px;
  border-bottom: 1px solid #d4d4db;
}
.layout-options {
  padding: 18px;
  flex: 1;
  overflow: auto;
  min-height: 0;
}
.layout-options fieldset {
  border: 0;
  padding: 0;
  margin: 14px 0;
}
.layout-options legend {
  margin-bottom: 10px;
}
.layout-options fieldset > label {
  margin-right: 14px;
}
.layout-options input[type='radio'],
.layout-options input[type='checkbox'] {
  accent-color: #37a668;
}
.layout-reset {
  display: block;
  margin: 16px 0 16px auto;
  background: none;
  border: 0;
  color: #bc2d29;
  text-decoration: underline;
}
.layout-export {
  margin: 16px;
  min-height: 64px;
  font-size: 21px;
}
.layout-export:disabled {
  opacity: 0.5;
  cursor: default;
}
.layout-export span {
  border: 2px solid currentColor;
  border-radius: 100%;
  font-size: 15px;
  padding: 0 3px;
  margin-left: 8px;
}
.layout-message {
  margin: 8px 18px;
}
.layout-wait {
  text-align: center;
  margin: 20vh auto;
}
.form-bar,
.form-tools,
.form-commands {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.form-bar,
.form-tools {
  min-height: 44px;
  background: white;
  border-bottom: 1px solid #ddd;
  padding: 5px 10px;
}
.form-bar button,
.form-tools button,
.form-index-row button,
.form-commands button {
  font: inherit;
  color: inherit;
  background: white;
  border: 1px solid #dedee5;
  border-radius: 4px;
  padding: 6px 9px;
}
.form-bar [aria-pressed='true'],
.form-tools [aria-pressed='true'] {
  border-color: #e5322d;
  color: #ae2521;
  background: #fff3f2;
}
.form-tools[hidden] {
  display: none;
}
.form-widget {
  position: absolute;
  box-sizing: border-box;
}
.form-widget > input,
.form-widget > select,
.form-widget > button,
.form-widget > textarea {
  font: inherit;
  font-size: clamp(10px, 1.2vw, 18px);
  width: 100%;
  height: 100%;
  padding: 0 2px;
  border: 1px solid #a3b8dd;
  background: #deebffcc;
  color: #20242d;
  box-sizing: border-box;
  resize: none;
}
.form-widget > input:is([type='checkbox'], [type='radio']) {
  padding: 0;
  accent-color: #365e9d;
}
.form-widget > button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.form-widget.editing {
  background: #d9e9fdad;
  border: 1px solid #569ad7;
  cursor: move;
  line-height: 1.2;
  overflow: visible;
  font-size: 12px;
}
.form-widget.active,
.form-widget.draft {
  outline: 2px solid #216fae;
}
.form-widget.draft {
  pointer-events: none;
}
.layout-options h3 {
  font-size: 16px;
  margin: 0 0 14px;
}
.layout-options h4 {
  margin: 14px 0 6px;
  font-size: 13px;
}
.form-index-row {
  display: flex;
  border-bottom: 1px solid #ddd;
}
.form-index-row button {
  border: 0;
  text-align: left;
}
.form-index-row button:first-child {
  flex: 1;
  overflow-wrap: anywhere;
}
.form-properties label:not(.form-flag) {
  display: block;
  margin: 10px 0;
}
.form-properties label input:not([type='checkbox']),
.form-properties textarea {
  width: 100%;
  border: 1px solid #bfc1ca;
  border-radius: 4px;
  padding: 7px;
  font: inherit;
  color: inherit;
  display: block;
  margin-top: 4px;
}
.form-flag {
  display: block;
  margin: 6px 0;
}
.form-properties details {
  margin-top: 12px;
}
.layout-shell button {
  cursor: pointer;
}
.layout-shell button:disabled {
  opacity: 0.5;
}
.layout-shell [hidden] {
  display: none !important;
}
@media (max-width: 760px) {
  .layout-shell {
    display: flex;
    flex-direction: column;
    height: auto;
  }
  .layout-work {
    height: 62dvh;
    min-height: 260px;
  }
  .layout-side {
    min-height: 180px;
  }
  .layout-options {
    max-height: 42dvh;
  }
  .layout-nav {
    font-size: 11px;
    max-width: 98%;
    bottom: 6px;
  }
  .form-tools {
    gap: 2px;
  }
  .layout-scroll {
    padding: 12px 8px 48px;
  }
  .layout-side h1 {
    padding: 9px;
    font-size: 18px;
  }
  .layout-export {
    min-height: 48px;
  }
}
.layout-scroll:is([data-spread='double'], [data-spread='cover']) {
  display: grid;
  grid-template-columns: repeat(2, minmax(max-content, 1fr));
  align-items: start;
  align-content: start;
  gap: 6px;
}
.layout-scroll[data-spread='cover'] > .layout-sheet:first-child {
  grid-column: 1 / -1;
}
.layout-spreads {
  position: absolute;
  bottom: 100%;
  right: 0;
  background: #46464f;
  display: grid;
  padding: 5px;
  gap: 4px;
  border-radius: 5px;
}
.layout-nav input[data-zoom] {
  width: 4.8em;
}
.form-caption {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.form-caption svg {
  display: block;
  width: 100%;
  max-height: 18px;
}
.layout-options .info-box {
  border: 1px solid #32a6d7;
  border-radius: 6px;
  color: #252735;
}
.layout-options .info-box:before {
  content: 'i';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  border: 1px solid currentColor;
  color: #1b8ed2;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  font-size: 10px;
  font-weight: 600;
}
.form-indicator {
  position: absolute;
  bottom: 100%;
  left: 0;
  display: block;
  width: max-content;
  max-width: 240px;
  padding: 3px 6px;
  background: #304663;
  color: white;
  font-size: 11px;
  line-height: 1.2;
  pointer-events: none;
  z-index: 1;
}
