.cms-editor-toolbar,
.cms-edit-button,
.cms-section-toggle,
.cms-modal,
.cms-toast {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.cms-editor-toolbar {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20000;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px 10px 16px;
  border: 1px solid rgba(234, 234, 234, .16);
  border-radius: 999px;
  background: linear-gradient(145deg, rgba(234, 234, 234, .11), rgba(105, 110, 123, .08)), rgba(43, 43, 43, .84);
  box-shadow: 0 18px 55px rgba(43, 43, 43, .32);
  color: #eaeaea;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.cms-editor-toolbar strong {
  font-size: 13px;
  letter-spacing: .02em;
}

.cms-editor-toolbar button,
.cms-modal button,
.cms-modal label.cms-upload-control {
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.cms-editor-toolbar button {
  min-height: 34px;
  padding: 0 13px;
  background: #3272b1;
  color: #eaeaea;
}

.cms-edit-button {
  position: absolute;
  z-index: 19990;
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(50, 114, 177, .72);
  border-radius: 999px;
  background: rgba(43, 43, 43, .86);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .26);
  color: #eaeaea;
  cursor: pointer;
  opacity: .88;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: box-shadow 180ms ease, opacity 180ms ease, transform 180ms ease;
}

.cms-edit-button::before {
  content: "\270E";
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.cms-edit-button[data-cms-kind="placeholder"]::before {
  content: "...";
  transform: translateY(-2px);
}

.cms-edit-button[data-cms-kind="options"]::before {
  content: "\25BE";
  font-size: 16px;
}

.cms-edit-button[data-cms-kind="legalcode"]::before {
  content: "</>";
  font-size: 11px;
}

.cms-edit-button:hover,
.cms-edit-button:focus-visible {
  box-shadow: 0 0 0 5px rgba(50, 114, 177, .18), 0 14px 34px rgba(43, 43, 43, .28);
  opacity: 1;
  outline: none;
  transform: translateY(-1px);
}

.cms-edit-button[data-cms-kind="image"],
.cms-edit-button[data-cms-kind="background"],
.cms-edit-button[data-cms-kind="placeholder"],
.cms-edit-button[data-cms-kind="options"],
.cms-edit-button[data-cms-kind="legalcode"] {
  background: #3272b1;
  color: #eaeaea;
}

.cms-section-toggle {
  position: absolute;
  z-index: 19992;
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(234, 234, 234, .18);
  border-radius: 999px;
  background: rgba(43, 43, 43, .88);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .28);
  color: #eaeaea;
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.cms-section-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.cms-section-toggle circle {
  fill: currentColor;
  stroke: none;
}

.cms-section-toggle:hover,
.cms-section-toggle:focus-visible {
  border-color: rgba(50, 114, 177, .72);
  box-shadow: 0 0 0 5px rgba(50, 114, 177, .18), 0 18px 42px rgba(43, 43, 43, .32);
  outline: none;
  transform: translateY(-1px);
}

.cms-section-toggle[data-cms-visible="false"] {
  border-color: rgba(50, 114, 177, .78);
  background: #3272b1;
}

.cms-edit-mode [data-cms-section-hidden="true"] {
  outline: 2px dashed rgba(50, 114, 177, .58);
  outline-offset: -12px;
}

.cms-edit-mode [data-cms-section-hidden="true"] > * {
  opacity: .46;
}

@media (max-width: 980px) {
  body:not(.is-mobile-menu-open) .cms-menu-edit-button {
    display: none !important;
  }
}

.cms-edit-mode [data-cms-editable="text"],
.cms-edit-mode [data-cms-editable="image"],
.cms-edit-mode [data-cms-editable="background"] {
  outline: 1px dashed rgba(50, 114, 177, .48);
  outline-offset: 3px;
}

.cms-edit-mode .cms-editable-direct {
  cursor: pointer;
}

.cms-modal {
  position: fixed;
  inset: 0;
  z-index: 30000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(18, 18, 18, .72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

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

.cms-modal-panel {
  width: min(100%, 760px);
  max-height: min(760px, calc(100vh - 44px));
  overflow: auto;
  border: 1px solid rgba(234, 234, 234, .16);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(234, 234, 234, .12), rgba(105, 110, 123, .08)), rgba(43, 43, 43, .92);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .36);
  color: #eaeaea;
}

.cms-modal-head {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  border-bottom: 1px solid rgba(234, 234, 234, .12);
}

.cms-modal-head h2 {
  margin: 0;
  font-size: clamp(22px, 4vw, 30px);
  line-height: 1.15;
}

.cms-modal-close {
  width: 38px;
  height: 38px;
  background: rgba(234, 234, 234, .1);
  color: #eaeaea;
}

.cms-modal-body {
  padding: 24px;
}

.cms-field {
  display: grid;
  gap: 10px;
}

.cms-field label {
  color: #bbbbbb;
  font-size: 13px;
  font-weight: 850;
}

.cms-field textarea {
  width: 100%;
  min-height: 170px;
  resize: vertical;
  border: 1px solid rgba(234, 234, 234, .16);
  border-radius: 12px;
  padding: 14px 15px;
  background: rgba(234, 234, 234, .08);
  color: #eaeaea;
  font: inherit;
  line-height: 1.55;
}

.cms-field-help {
  margin: 0;
  color: #bbbbbb;
  font-size: 13px;
  line-height: 1.55;
}

.cms-field textarea:focus {
  border-color: #3272b1;
  box-shadow: 0 0 0 4px rgba(50, 114, 177, .16);
  outline: none;
}

.cms-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

.cms-action-primary {
  min-height: 44px;
  padding: 0 18px;
  background: #3272b1;
  color: #eaeaea;
}

.cms-action-secondary {
  min-height: 44px;
  padding: 0 18px;
  background: rgba(234, 234, 234, .1);
  color: #eaeaea;
}

.cms-gallery-top {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.cms-gallery-top p {
  width: min(100%, 420px);
  margin: 0;
  color: #bbbbbb;
  line-height: 1.55;
}

.cms-upload-control {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 0 18px;
  background: #3272b1;
  color: #eaeaea;
}

.cms-upload-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.cms-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 14px;
}

.cms-gallery-item {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(234, 234, 234, .12);
  border-radius: 12px;
  background: rgba(234, 234, 234, .08);
}

.cms-gallery-select {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}

.cms-gallery-select img {
  width: 100%;
  aspect-ratio: 1.28;
  object-fit: cover;
}

.cms-gallery-name {
  display: block;
  overflow: hidden;
  padding: 9px 10px 10px;
  color: #bbbbbb;
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cms-gallery-delete {
  z-index: 2;
  min-height: 30px;
  align-items: center;
  border-radius: 999px;
}

.cms-gallery-delete {
  display: inline-flex;
  width: calc(100% - 20px);
  justify-content: center;
  gap: 5px;
  margin: 0 10px 10px;
  padding: 0 10px;
  background: rgba(43, 43, 43, .9);
  box-shadow: 0 8px 22px rgba(43, 43, 43, .16);
  color: #eaeaea;
  font-size: 11px;
}

.cms-gallery-delete:hover {
  background: #3272b1;
}

.cms-gallery-empty,
.cms-gallery-loading {
  grid-column: 1 / -1;
  margin: 0;
  padding: 18px;
  border-radius: 12px;
  background: rgba(234, 234, 234, .08);
  color: #bbbbbb;
}

.cms-reference-tools {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin: -6px 0 18px;
}

.cms-reference-tools button,
.cms-reference-delete {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  padding: 0 13px;
  background: rgba(234, 234, 234, .1);
  color: #eaeaea;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.cms-reference-tools button {
  background: #3272b1;
}

.cms-reference-card-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 6;
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 4px;
  border: 1px solid rgba(234, 234, 234, .16);
  border-radius: 999px;
  background: rgba(43, 43, 43, .84);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .24);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.cms-reference-card-controls button {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(234, 234, 234, .09);
  color: #eaeaea;
  font: inherit;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.cms-reference-card-controls button:hover,
.cms-reference-card-controls button:focus-visible {
  background: #3272b1;
  outline: none;
}

.cms-reference-card-controls button:disabled {
  cursor: default;
  opacity: .35;
}

.cms-reference-card-controls button:disabled:hover {
  background: rgba(234, 234, 234, .09);
}

.cms-references-editor {
  display: grid;
  gap: 18px;
}

.cms-reference-editor-top {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.cms-reference-editor-top p {
  width: min(100%, 430px);
  margin: 0;
  color: #bbbbbb;
  line-height: 1.55;
}

.cms-reference-list {
  display: grid;
  gap: 14px;
}

.cms-reference-row {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(234, 234, 234, .12);
  border-radius: 14px;
  background: rgba(234, 234, 234, .06);
}

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

.cms-reference-row-head strong {
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cms-reference-delete {
  flex: 0 0 auto;
  background: rgba(234, 234, 234, .1);
}

.cms-reference-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.cms-reference-fields label {
  display: grid;
  gap: 7px;
  color: #bbbbbb;
  font-size: 12px;
  font-weight: 850;
}

.cms-reference-fields input,
.cms-reference-fields select,
.cms-reference-fields textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(234, 234, 234, .16);
  border-radius: 10px;
  padding: 0 12px;
  background: rgba(234, 234, 234, .08);
  color: #eaeaea;
  font: inherit;
  outline: none;
}

.cms-reference-fields select option {
  background: #2b2b2b;
  color: #eaeaea;
}

.cms-reference-fields textarea {
  min-height: 88px;
  padding-block: 10px;
  resize: vertical;
  line-height: 1.5;
}

.cms-reference-fields input:focus,
.cms-reference-fields select:focus,
.cms-reference-fields textarea:focus {
  border-color: #3272b1;
  box-shadow: 0 0 0 4px rgba(50, 114, 177, .16);
}

.cms-reference-field-wide {
  grid-column: 1 / -1;
}

.cms-reference-actions {
  margin: 0;
  padding-top: 4px;
  background: none;
}

.cms-toast {
  position: fixed;
  right: 18px;
  bottom: 84px;
  z-index: 31000;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 15px;
  border-radius: 14px;
  background: #2b2b2b;
  box-shadow: 0 18px 55px rgba(43, 43, 43, .3);
  color: #eaeaea;
  font-size: 14px;
  font-weight: 800;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.cms-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .cms-editor-toolbar {
    right: 12px;
    bottom: 12px;
    left: 12px;
    justify-content: space-between;
    border-radius: 18px;
  }

  .cms-edit-button[data-cms-kind="text"] {
    display: none !important;
  }

  .cms-edit-button[data-cms-kind="image"],
  .cms-edit-button[data-cms-kind="background"] {
    width: 30px;
    height: 30px;
  }

  .cms-modal {
    padding: 12px;
  }

  .cms-modal-panel {
    max-height: calc(100vh - 24px);
    border-radius: 20px;
  }

  .cms-modal-head,
  .cms-modal-body {
    padding: 18px;
  }

  .cms-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cms-reference-editor-top,
  .cms-reference-fields {
    grid-template-columns: 1fr;
  }

  .cms-reference-editor-top .cms-upload-control,
  .cms-reference-actions button {
    width: 100%;
    justify-content: center;
  }
}
