body.cms-editing {
  padding-top: 52px;
}

@media (max-width: 640px) {
  body.cms-editing {
    padding-top: 88px;
  }
}

.cms-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 18px;
  background: #201620;
  border-bottom: 1px solid #4a3a44;
  color: #f3e9ee;
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .cms-bar .cms-bar-msg {
    display: none;
  }
}

.cms-bar strong { font-weight: 700; }

.cms-bar .cms-bar-msg {
  color: #cbb7c4;
}

.cms-bar .cms-bar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cms-bar button, .cms-bar a.cms-btn {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 7px;
  border: 1px solid #5a4652;
  background: #2c2029;
  color: #f3e9ee;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.cms-bar button:hover, .cms-bar a.cms-btn:hover { border-color: #d8a15c; }

.cms-bar .cms-btn-primary {
  background: #d8a15c;
  border-color: #d8a15c;
  color: #241a10;
}

.cms-save-flash {
  position: fixed;
  top: 62px;
  right: 18px;
  z-index: 9999;
  background: #2c2029;
  border: 1px solid #d8a15c;
  color: #f3e9ee;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}

.cms-save-flash.visible {
  opacity: 1;
  transform: translateY(0);
}

.cms-inline-field {
  cursor: text;
  border-radius: 4px;
  transition: outline-color .15s ease, background .15s ease;
  outline: 1px dashed transparent;
  outline-offset: 3px;
}

.cms-inline-field:hover {
  outline-color: rgba(216, 161, 92, 0.55);
  background: rgba(216, 161, 92, 0.07);
}

.cms-inline-field[contenteditable="true"] {
  outline: 2px solid #d8a15c;
  outline-offset: 3px;
  background: rgba(216, 161, 92, 0.1);
}

.cms-inline-image {
  cursor: pointer;
  outline: 1px dashed transparent;
  outline-offset: 3px;
  transition: outline-color .15s ease;
}

.cms-inline-image:hover {
  outline-color: rgba(216, 161, 92, 0.7);
}

.cms-inline-link {
  outline: 1px dashed transparent;
  outline-offset: 3px;
  border-radius: 6px;
}

.cms-inline-link:hover {
  outline-color: rgba(216, 161, 92, 0.7);
}

.cms-iframe-edit-btn {
  display: block;
  margin: 10px auto 0;
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 7px;
  border: 1px dashed rgba(216, 161, 92, 0.6);
  background: rgba(216, 161, 92, 0.08);
  color: #d8a15c;
  cursor: pointer;
}

.cms-iframe-edit-btn:hover {
  background: rgba(216, 161, 92, 0.16);
}

.cms-collection-item {
  position: relative;
}

body.cms-editing .cms-collection-item {
  outline: 1px dashed rgba(216, 161, 92, 0.35);
  outline-offset: 4px;
  border-radius: 8px;
}

.cms-item-controls {
  display: none;
  position: absolute;
  top: -10px;
  right: -10px;
  z-index: 5;
  gap: 6px;
}

body.cms-editing .cms-item-controls {
  display: flex;
}

.cms-item-controls button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #5a4652;
  background: #241a24;
  color: #f3e9ee;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.cms-item-controls button:hover { border-color: #d8a15c; }
.cms-item-controls .cms-delete-btn:hover { border-color: #e07a6b; color: #e07a6b; }

.cms-add-tile {
  display: none;
}

body.cms-editing .cms-add-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  border: 1px dashed rgba(216, 161, 92, 0.5);
  border-radius: 10px;
  color: #d8a15c;
  background: rgba(216, 161, 92, 0.06);
  cursor: pointer;
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
}

.cms-add-tile:hover { background: rgba(216, 161, 92, 0.12); }

.cms-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 6, 10, 0.72);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cms-modal {
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  background: #201620;
  border: 1px solid #4a3a44;
  border-radius: 12px;
  padding: 24px;
  color: #f3e9ee;
  font-family: 'Manrope', system-ui, sans-serif;
}

.cms-modal h3 {
  margin: 0 0 16px;
  font-size: 1.1rem;
}

.cms-modal label {
  display: block;
  font-size: 0.8rem;
  color: #cbb7c4;
  margin: 14px 0 6px;
}

.cms-modal input[type="text"],
.cms-modal input[type="url"] {
  width: 100%;
  padding: 9px 11px;
  border-radius: 7px;
  border: 1px solid #4a3a44;
  background: #2c2029;
  color: #f3e9ee;
  font-family: inherit;
  font-size: 0.9rem;
  box-sizing: border-box;
}

.cms-modal .cms-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.cms-audio-name {
  font-size: 0.8rem;
  color: #cbb7c4;
}

.cms-btn-danger {
  color: #e07a6b;
}

.cms-modal .cms-file-row img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #4a3a44;
}

.cms-modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
}

.cms-modal-actions .cms-modal-right {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cms-modal button,
.cms-bar button,
.cms-bar a.cms-btn,
.cms-add-tile {
  min-height: 34px;
}

@media (max-width: 480px) {
  .cms-modal {
    padding: 18px;
  }
}
