/* Maker editor (full-screen overlay). All classes are prefixed spk- */
body.spk-open { overflow: hidden; }
.spk-overlay {
  position: fixed; inset: 0; z-index: 2147483000; background: #EEF0F5;
  display: grid; grid-template-rows: auto auto 1fr auto; grid-template-columns: minmax(0, 1fr);
  color: #121317; height: 100vh; height: 100dvh;
}
.spk-overlay[hidden], .spk-overlay [hidden] { display: none !important; }

.spk-bar { grid-row: 1; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #fff; border-bottom: 1px solid #E4E6EE; }
.spk-bar__title { display: flex; flex-direction: column; min-width: 0; margin-right: auto; line-height: 1.25; }
.spk-bar__title strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spk-bar__title span { font-size: 12px; color: #5F6472; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.spk-btn, .spk-icon, .spk-primary {
  font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; border-radius: 10px;
  border: 1px solid #D8DBE5; background: #fff; color: #121317; min-height: 40px; padding: 0 14px;
}
.spk-btn:hover, .spk-icon:hover { background: #F4F6FF; }
.spk-btn:disabled, .spk-icon:disabled, .spk-primary:disabled { opacity: .4; cursor: default; }
.spk-icon { min-width: 40px; padding: 0 8px; font-size: 18px; line-height: 1; }
.spk-primary { background: #1B2EE7; border-color: #1B2EE7; color: #fff; padding: 0 18px; white-space: nowrap; }
.spk-primary:hover { background: #1220A8; }
.spk-btn--quiet { border-color: transparent; background: transparent; color: #5F6472; }
.spk-btn--add { width: 100%; border-style: dashed; color: #1B2EE7; }

.spk-warning { grid-row: 2; background: #FEF3C7; color: #78350F; font-size: 13px; padding: 8px 14px; }

.spk-body { grid-row: 3; min-height: 0; display: grid; grid-template-columns: 380px minmax(0, 1fr) 270px; }
.spk-panel { background: #fff; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.spk-panel--edit { border-right: 1px solid #E4E6EE; }
.spk-panel--design { border-left: 1px solid #E4E6EE; padding: 16px; }
.spk-quick { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid #E4E6EE; }
.spk-quick .spk-btn { min-height: 36px; font-size: 12.5px; padding: 0 11px; }

.spk-section { border-bottom: 1px solid #E4E6EE; }
.spk-section > summary { cursor: pointer; padding: 15px 16px; font-weight: 700; font-size: 14px; list-style: none; display: flex; justify-content: space-between; }
.spk-section > summary::after { content: "+"; color: #5F6472; font-size: 18px; line-height: 1; }
.spk-section[open] > summary::after { content: "\2212"; }
.spk-section > .spk-grid { padding: 0 16px 16px; }

.spk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.spk-grid > * { grid-column: 1 / -1; min-width: 0; }
.spk-grid > .spk-field--half { grid-column: auto; }
.spk-field { display: flex; flex-direction: column; gap: 4px; }
.spk-field label { font-size: 12px; font-weight: 600; color: #5F6472; }
.spk-field input, .spk-field textarea, .spk-field select, .spk-select {
  font: inherit; font-size: 14px; width: 100%; min-height: 40px; padding: 8px 10px;
  border: 1px solid #D8DBE5; border-radius: 9px; background: #fff; color: #121317;
}
.spk-field textarea { resize: vertical; }
.spk-field input:focus, .spk-field textarea:focus, .spk-field select:focus { border-color: #1B2EE7; outline: 2px solid #DDE1FF; outline-offset: 0; }
.spk-toggle { display: flex; align-items: center; gap: 10px; font-size: 13.5px; min-height: 40px; cursor: pointer; }
.spk-toggle input { width: 18px; height: 18px; accent-color: #1B2EE7; }

.spk-file { display: none; }
.spk-image { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; }
.spk-image__thumb { width: 48px; height: 48px; object-fit: contain; border: 1px solid #E4E6EE; border-radius: 8px; }

.spk-list { display: flex; flex-direction: column; gap: 10px; }
.spk-item { border: 1px solid #E4E6EE; border-radius: 12px; padding: 10px; background: #FAFBFE; }
.spk-item__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 12.5px; font-weight: 700; }
.spk-item__tools { display: flex; gap: 4px; flex: none; }
.spk-item__toggle { font: inherit; flex: 1; min-width: 0; min-height: 40px; display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; color: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.spk-item__toggle::before { content: "\25B8"; color: #5F6472; }
.spk-item__toggle[aria-expanded="true"]::before { content: "\25BE"; }
.spk-item__toggle span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spk-item__tools .spk-icon { min-height: 32px; min-width: 32px; font-size: 15px; }

.spk-stage { position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.spk-scroll { flex: 1; overflow: auto; padding: 24px 16px 70px; }
.spk-pages { display: flex; flex-direction: column; align-items: center; align-items: safe center; gap: 18px; }
.spk-page { flex: none; height: auto; background: #fff; box-shadow: 0 8px 30px rgba(18, 19, 23, .14); }
.spk-zoom { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; background: #fff; border: 1px solid #E4E6EE; border-radius: 999px; padding: 3px; box-shadow: 0 4px 14px rgba(18, 19, 23, .1); }
.spk-zoom .spk-icon { border: 0; border-radius: 999px; min-height: 34px; min-width: 34px; }
.spk-zoom span { font-size: 12.5px; font-weight: 700; min-width: 46px; text-align: center; }

.spk-block { cursor: move; touch-action: none; outline: none; }
.spk-block:hover, .spk-block:focus-visible, .spk-block.is-selected { filter: drop-shadow(0 0 2px #EC4899); }
.spk-blockbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; background: #fff; border: 1px solid #E4E6EE; border-radius: 12px; padding: 6px; box-shadow: 0 4px 14px rgba(18, 19, 23, .12); white-space: nowrap; z-index: 2; }
.spk-blockbar .spk-btn { min-height: 36px; }

.spk-label { display: block; font-size: 12px; font-weight: 700; color: #5F6472; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 8px; }
.spk-templates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 20px; }
.spk-tpl { font: inherit; cursor: pointer; border: 2px solid #E4E6EE; border-radius: 12px; background: #F4F6FF; padding: 6px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: #121317; }
.spk-tpl img { width: 100%; height: auto; max-height: 190px; object-fit: contain; }
.spk-tpl.is-active { border-color: #1B2EE7; }
.spk-colors { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 20px; align-items: center; }
.spk-swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #D8DBE5; cursor: pointer; padding: 0; }
.spk-swatch.is-active { box-shadow: 0 0 0 3px #121317; }
.spk-color { width: 36px; height: 34px; padding: 0; border: 0; background: none; cursor: pointer; }
.spk-select { margin-bottom: 20px; }
.spk-note { font-size: 12.5px; color: #5F6472; margin: 6px 0 0; }

.spk-tabs { grid-row: 4; display: none; background: #fff; border-top: 1px solid #E4E6EE; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); gap: 6px; }
.spk-tabs button { flex: 1; font: inherit; font-size: 13.5px; font-weight: 700; min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: #5F6472; cursor: pointer; }
.spk-tabs button.is-active { background: #EEF0FE; color: #1B2EE7; }

.spk-toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 10px); background: #121317; color: #fff; font-size: 13.5px; padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .18s ease; max-width: calc(100vw - 32px); width: max-content; text-align: center; }
.spk-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1180px) {
  .spk-body { grid-template-columns: 340px minmax(0, 1fr) 220px; }
}
@media (max-width: 900px) {
  .spk-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .spk-panel--edit, .spk-panel--design { border: 0; }
  .spk-panel--edit, .spk-panel--design, .spk-stage { display: none; }
  .spk-overlay[data-tab="edit"] .spk-panel--edit { display: block; }
  .spk-overlay[data-tab="design"] .spk-panel--design { display: block; }
  .spk-overlay[data-tab="preview"] .spk-stage { display: flex; }
  .spk-tabs { display: flex; }
  .spk-templates { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  /* 16px stops iOS from zooming the page on focus */
  .spk-field input, .spk-field textarea, .spk-field select, .spk-select { font-size: 16px; }
}
@media (max-width: 560px) {
  .spk-bar { gap: 6px; padding: 8px; }
  .spk-bar__title span { display: none; }
  .spk-primary { padding: 0 12px; }
  .spk-bar .spk-icon { min-width: 36px; padding: 0 4px; }
  .spk-bar__title strong { font-size: 12.5px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}

.spk-label--drafts { margin-top: 20px; }
.spk-draft { display: flex; gap: 6px; margin-bottom: 8px; }
.spk-draft__open { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.spk-draft .spk-icon.is-armed { background: #FEE2E2; border-color: #B91C1C; color: #B91C1C; }
