.cms-account-item { display: flex; align-items: center; position: relative; }
.cms-account-btn {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  color: var(--white); transition: background .2s ease, color .2s ease;
}
.cms-account-btn svg { width: 20px; height: 20px; }
.cms-account-btn:hover { background: rgba(255,255,255,.15); }
#header.scrolled .cms-account-btn { color: var(--navy-soft); }
#header.scrolled .cms-account-btn:hover { background: var(--gray-light); color: var(--navy); }
.cms-account-btn.is-admin { color: var(--gold-light); }
#header.scrolled .cms-account-btn.is-admin { color: var(--gold-dark); }

.cms-account-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0; min-width: 240px;
  background: var(--white); border-radius: 14px; box-shadow: 0 20px 50px rgba(15,23,42,.22);
  padding: 10px; display: none; z-index: 500; color: var(--navy);
}
.cms-account-dropdown.open { display: block; }
.cms-account-dropdown .cms-who { padding: 10px 12px 12px; border-bottom: 1px solid var(--gray-light); margin-bottom: 8px; }
.cms-account-dropdown .cms-who strong { display: block; font-size: .9rem; }
.cms-account-dropdown .cms-who span { font-size: .75rem; color: var(--gray); }
.cms-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-radius: 9px; font-size: .87rem; font-weight: 600;
}
.cms-toggle-row:hover { background: var(--gray-pale); }
.cms-toggle-row.is-locked { opacity: .45; cursor: not-allowed; pointer-events: none; }
.cms-toggle-row.is-locked:hover { background: none; }
.cms-switch { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--gray-light); flex-shrink: 0; transition: background .2s ease; }
.cms-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--white); transition: transform .2s ease; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.cms-switch.on { background: var(--gold); }
.cms-switch.on::after { transform: translateX(16px); }
.cms-dd-link {
  display: block; padding: 9px 12px; border-radius: 9px; font-size: .87rem; font-weight: 600; color: var(--navy);
}
.cms-dd-link:hover { background: var(--gray-pale); }
.cms-dd-link.danger { color: #ef4444; }

.cms-editmode-fab {
  position: fixed; left: 24px; bottom: 24px; z-index: 900;
  display: none; align-items: center; gap: 10px;
  background: var(--navy); color: var(--white); padding: 12px 18px 12px 14px;
  border-radius: 999px; font-size: .85rem; font-weight: 700; box-shadow: 0 12px 30px rgba(0,0,0,.3);
}
.cms-editmode-fab.visible { display: inline-flex; }
.cms-editmode-fab.active { background: var(--gold); }
.cms-editmode-fab .cms-switch { transform: scale(.85); }

body.cms-editing [data-cms],
body.cms-editing [data-cms-img],
body.cms-editing [data-cms-bg],
body.cms-editing [data-cms-array] {
  outline: 1px dashed transparent; outline-offset: 3px; cursor: pointer; position: relative;
  transition: outline-color .15s ease;
}
body.cms-editing [data-cms]:hover,
body.cms-editing [data-cms-img]:hover,
body.cms-editing [data-cms-bg]:hover,
body.cms-editing [data-cms-array]:hover {
  outline-color: var(--gold);
}
body.cms-editing [data-cms]:hover::after,
body.cms-editing [data-cms-img]:hover::after,
body.cms-editing [data-cms-bg]:hover::after,
body.cms-editing [data-cms-array]:hover::after {
  content: '✏️'; position: absolute; top: -10px; right: -10px; z-index: 5;
  width: 26px; height: 26px; border-radius: 50%; background: var(--gold); color: var(--white);
  display: flex; align-items: center; justify-content: center; font-size: 13px;
  box-shadow: 0 4px 10px rgba(0,0,0,.25);
}

.cms-modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,.55);
  align-items: center; justify-content: center; z-index: 2000; padding: 20px;
}
.cms-modal-overlay.open { display: flex; }
.cms-modal {
  width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto;
  background: var(--white); border-radius: 16px; box-shadow: 0 30px 70px rgba(0,0,0,.35);
  color: var(--navy); font-family: 'Be Vietnam Pro', sans-serif;
}
.cms-modal.wide { max-width: 620px; }
.cms-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--gray-light); }
.cms-modal-head h3 { font-size: 1.02rem; font-weight: 800; }
.cms-modal-close { font-size: 1.1rem; color: var(--gray); line-height: 1; padding: 4px; }
.cms-modal-body { padding: 20px 22px; }
.cms-modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--gray-light); }

.cms-field { margin-bottom: 14px; }
.cms-field label { display: block; font-size: .8rem; font-weight: 700; margin-bottom: 6px; color: var(--gray); }
.cms-field input[type=text], .cms-field input[type=password], .cms-field textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--gray-light); border-radius: 9px; font-size: .92rem;
}
.cms-field textarea { resize: vertical; min-height: 90px; }
.cms-field input:focus, .cms-field textarea:focus { outline: none; border-color: var(--gold); }
.cms-error { display: none; background: #fef2f2; color: #ef4444; border: 1px solid #fecaca; border-radius: 9px; padding: 9px 13px; font-size: .82rem; margin-bottom: 14px; }
.cms-error.show { display: block; }

.cms-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 9px; font-size: .87rem; font-weight: 700; }
.cms-btn-gold { background: var(--gold); color: var(--white); }
.cms-btn-gold:hover { background: var(--gold-dark); }
.cms-btn-ghost { background: var(--gray-pale); color: var(--navy); }
.cms-btn-ghost:hover { background: var(--gray-light); }
.cms-btn:disabled { opacity: .6; cursor: not-allowed; }

.cms-img-preview { width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; background: var(--gray-pale); margin-bottom: 12px; }
.cms-img-preview.empty { display: flex; align-items: center; justify-content: center; color: var(--gray); font-size: .8rem; height: 140px; }

.cms-array-grid { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.cms-array-item { position: relative; width: 96px; }
.cms-array-item img { width: 96px; height: 96px; object-fit: cover; border-radius: 9px; border: 1px solid var(--gray-light); }
.cms-array-item .cms-arr-remove {
  position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%;
  background: #ef4444; color: var(--white); font-size: .72rem; display: flex; align-items: center; justify-content: center;
}
.cms-array-item .cms-arr-move { display: flex; justify-content: center; gap: 4px; margin-top: 4px; }
.cms-array-item .cms-arr-move button { font-size: .75rem; color: var(--gray); padding: 2px 5px; }
.cms-array-item .cms-arr-move button:hover { color: var(--navy); }
.cms-array-add { width: 96px; height: 96px; border: 1px dashed var(--gray-light); border-radius: 9px; display: flex; align-items: center; justify-content: center; color: var(--gray); font-size: 1.6rem; cursor: pointer; }

.cms-toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: var(--white); padding: 12px 20px; border-radius: 999px;
  font-size: .85rem; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s ease; z-index: 3000;
  box-shadow: 0 12px 30px rgba(0,0,0,.3); font-family: 'Be Vietnam Pro', sans-serif;
}
.cms-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.cms-toast.success { background: #059669; }
.cms-toast.error { background: #ef4444; }
