.editor-page {
  background: #f3f1ee;
  min-height: 100vh;
}

.editor-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  background: #111;
}

.editor-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.template-chip {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(340px, 440px);
  grid-template-areas: "preview form";
  min-height: calc(100vh - 62px);
}

.preview-pane {
  grid-area: preview;
  position: sticky;
  top: 62px;
  height: calc(100vh - 62px);
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(circle at top, rgba(210, 75, 58, 0.12), transparent 45%),
    linear-gradient(180deg, #ebe7e1, #d9d3cb);
}

.phone-frame {
  width: min(360px, 90%);
  height: min(720px, calc(100vh - 120px));
  border-radius: 36px;
  padding: 12px;
  background: #111;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.phone-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 26px;
  background: #fff;
}

.form-pane {
  grid-area: form;
  background: #fff;
  border-left: 1px solid #e6e1da;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 62px);
  position: sticky;
  top: 62px;
}

.form-scroll {
  flex: 1 1 auto;
  overflow: auto;
  padding: 24px 20px 16px;
  min-height: 0;
}

.form-pane h1 {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

.form-lead {
  margin: 0 0 18px;
  color: #6b6b6b;
  line-height: 1.5;
  font-size: 0.92rem;
}

#inviteForm {
  display: grid;
  gap: 14px;
}

fieldset {
  margin: 0;
  border: 1px solid #ebe6df;
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

legend {
  padding: 0 6px;
  font-weight: 700;
  color: #d24b3a;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #333;
}

label.check {
  grid-template-columns: auto 1fr;
  align-items: center;
  font-weight: 500;
}

.field-hint {
  margin: 0;
  font-size: 0.8rem;
  color: #7a726a;
  line-height: 1.45;
}

.field-error {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #a8352a;
}

.field-error[hidden],
label[hidden] {
  display: none;
}

.lang-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lang-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid #ddd5cb;
  border-radius: 999px;
  background: #faf8f5;
  cursor: pointer;
}

.lang-check:has(input:checked) {
  border-color: #d24b3a;
  background: #fde8e4;
}

.content-lang {
  position: sticky;
  top: -24px;
  z-index: 3;
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #111;
  color: #fff;
}

.content-lang .field-hint {
  color: rgba(255, 255, 255, 0.7);
}

.content-lang-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.lang-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.lang-tabs button {
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.lang-tabs button[aria-selected="true"] {
  background: #d24b3a;
}

.event-list {
  display: grid;
  gap: 10px;
}

.event-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: #faf8f5;
  border: 1px solid #ebe6df;
}

.event-item input {
  background: #fff;
}

.event-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.event-item-tools {
  display: flex;
  gap: 4px;
}

.event-item-tools button,
.add-event-btn {
  border: 1px solid #ddd5cb;
  border-radius: 999px;
  padding: 5px 10px;
  background: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.event-item-tools button:disabled {
  opacity: 0.35;
  cursor: default;
}

.event-item-tools .danger {
  color: #a8352a;
  border-color: #f0c9c2;
}

.add-event-btn {
  justify-self: start;
  padding: 9px 16px;
  background: #111;
  border-color: #111;
  color: #fff;
}

.add-event-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#noEvents[hidden] {
  display: none;
}

.generate-links {
  display: grid;
  gap: 6px;
}

.images-lead {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 400;
  color: #6b6b6b;
  line-height: 1.45;
}

.image-slot {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: #faf8f5;
  border: 1px solid #ebe6df;
}

.image-slot[hidden] {
  display: none;
}

.image-slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.image-slot-label {
  font-size: 0.9rem;
  color: #333;
}

.image-size-hint {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #a8352a;
  background: #fde8e4;
  border-radius: 999px;
  padding: 4px 10px;
}

.image-slot-note {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 400;
  color: #7a726a;
}

.image-preview {
  width: 100%;
  height: 96px;
  border-radius: 10px;
  background: #e8e0d8 center/cover no-repeat;
  border: 1px dashed #d5cdc2;
}

.image-preview.has-image {
  border-style: solid;
}

.image-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  width: fit-content;
}

.upload-btn:hover {
  background: #333;
}

.upload-status {
  font-size: 0.78rem;
  font-weight: 500;
  color: #6b6b6b;
}

.upload-status.is-error {
  color: #a8352a;
}

.upload-status.is-ok {
  color: #1d6b3a;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #ddd5cb;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 400;
  background: #faf8f5;
}

input[type="checkbox"] {
  width: auto;
}

.generate-bar {
  border-top: 1px solid #ebe6df;
  background: #fff;
  padding: 14px 20px 18px;
  display: grid;
  gap: 10px;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.04);
}

.generate-btn {
  border: 0;
  border-radius: 12px;
  padding: 14px 18px;
  background: #d24b3a;
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  width: 100%;
}

.generate-btn:hover {
  background: #b63b2c;
}

.generate-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.generate-status {
  margin: 0;
  color: #6b6b6b;
  font-size: 0.9rem;
}

.generate-result {
  border-radius: 14px;
  background: #f4faf4;
  border: 1px solid #cfe8cf;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.generate-result[hidden],
.generate-status[hidden] {
  display: none;
}

.generate-result a {
  color: #1d6b3a;
  font-weight: 700;
  word-break: break-all;
}

.generate-result button {
  justify-self: start;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: #1d6b3a;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 760px) {
  .editor-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "form"
      "preview";
  }

  .preview-pane,
  .form-pane {
    position: static;
    height: auto;
  }

  .form-pane {
    border-left: 0;
    border-bottom: 1px solid #e6e1da;
    display: block;
    height: auto;
    max-height: none;
  }

  .form-scroll {
    overflow: visible;
    max-height: none;
  }

  .preview-pane {
    padding: 18px 12px;
  }

  .phone-frame {
    height: 560px;
  }

  .generate-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
  }

  .template-chip {
    display: none;
  }
}

.save-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 17, 17, 0.55);
  animation: save-modal-fade 0.2s ease;
}

.save-modal[hidden] {
  display: none;
}

.save-modal-card {
  width: min(440px, 100%);
  padding: 28px 24px 22px;
  text-align: center;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  animation: save-modal-pop 0.25s ease;
}

.save-modal-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  color: #fff;
  font-size: 1.8rem;
  font-weight: 700;
  background: #2f9e62;
  border-radius: 50%;
}

.save-modal-card h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.save-modal-text {
  margin: 0 0 10px;
  color: #555;
  line-height: 1.45;
}

.save-modal-link {
  display: block;
  margin-bottom: 20px;
  padding: 10px 12px;
  color: #111;
  font-size: 0.85rem;
  word-break: break-all;
  background: #f3f1ee;
  border-radius: 10px;
}

.save-modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.save-modal-btn {
  padding: 10px 16px;
  color: #111;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 999px;
}

.save-modal-btn:hover {
  background: #f3f1ee;
}

.save-modal-btn.primary {
  color: #fff;
  background: #111;
  border-color: #111;
}

.save-modal-btn.primary:hover {
  background: #333;
}

@keyframes save-modal-fade {
  from { opacity: 0; }
}

@keyframes save-modal-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
}
