.admin-trigger { user-select: none; }

.admin-modal {
  position: fixed; inset: 0; z-index: 10000;
  display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.78); backdrop-filter: blur(10px);
}
.admin-modal.open { display: flex; }
.admin-box {
  background: linear-gradient(180deg, #14141a, #08080c);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 18px; padding: 30px; width: 360px; max-width: 92vw;
  box-shadow: 0 30px 90px rgba(0,0,0,0.75);
  color: #e8e8ea;
  font-family: inherit;
}
.admin-box h3 { font-size: 17px; margin: 0 0 16px; font-weight: 700; letter-spacing: 0.02em; }
.admin-box input[type="password"] {
  width: 100%; padding: 13px 14px; border-radius: 11px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12);
  color: #fff; font-size: 14px; font-family: inherit;
  outline: none; transition: border-color .15s ease, background .15s ease;
}
.admin-box input[type="password"]:focus { border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.08); }
.admin-row { display: flex; gap: 8px; margin-top: 16px; }
.admin-btn {
  flex: 1; padding: 11px 14px; border-radius: 11px; cursor: pointer;
  background: linear-gradient(180deg, #f4f4f6, #c9c9cc); color: #050505;
  border: 0; font-weight: 700; font-size: 13px; letter-spacing: 0.04em;
  transition: transform .1s ease, opacity .15s ease;
}
.admin-btn:hover { transform: translateY(-1px); }
.admin-btn:disabled { opacity: 0.55; cursor: wait; transform: none; }
.admin-btn.ghost {
  background: transparent; color: #e8e8ea;
  border: 1px solid rgba(255,255,255,0.18);
}
.admin-err { color: #ff7b7b; font-size: 12px; margin-top: 10px; min-height: 14px; }

#adminPanel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 420px; max-width: 92vw; z-index: 9998;
  background: linear-gradient(180deg, #0e0e12, #060608);
  border-left: 1px solid rgba(255,255,255,0.1);
  box-shadow: -30px 0 80px rgba(0,0,0,0.6);
  display: flex; flex-direction: column;
  color: #e8e8ea;
  font-family: inherit;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.2,.7,.2,1);
}
#adminPanel.open { transform: translateX(0); }

#adminPanel .ap-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
}
.ap-title { display: flex; align-items: center; gap: 10px; }
.ap-title h2 { font-size: 15px; margin: 0; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.ap-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 10px #22c55e; }
.ap-close {
  background: transparent; border: 1px solid rgba(255,255,255,0.14);
  color: #e8e8ea; font-size: 18px; line-height: 1;
  width: 32px; height: 32px; border-radius: 10px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, border-color .15s ease;
}
.ap-close:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.3); }

.ap-search { padding: 12px 14px 6px; }
.ap-search input {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
  color: #fff; font-size: 13px; font-family: inherit; outline: none;
  transition: border-color .15s ease, background .15s ease;
}
.ap-search input:focus { border-color: rgba(255,255,255,0.3); background: rgba(255,255,255,0.07); }

.ap-body { flex: 1; overflow-y: auto; padding: 6px 8px 12px; }
.ap-body::-webkit-scrollbar { width: 8px; }
.ap-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
.ap-body::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }

.ap-section { margin: 6px; border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; overflow: hidden; background: rgba(255,255,255,0.015); }
.ap-section-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: transparent; border: 0; cursor: pointer;
  color: #e8e8ea; font-family: inherit; font-size: 13px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase; text-align: left;
  transition: background .15s ease;
}
.ap-section-head:hover { background: rgba(255,255,255,0.04); }
.ap-chev { font-size: 11px; opacity: 0.6; transition: transform .2s ease; }
.ap-section.collapsed .ap-chev { transform: rotate(-90deg); }
.ap-section.collapsed .ap-section-body { display: none; }
.ap-section-body { padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 10px; }

.ap-field { display: flex; flex-direction: column; gap: 6px; position: relative; }
.ap-field.changed::before {
  content: ''; position: absolute; left: -6px; top: 6px; bottom: 6px; width: 2px;
  background: #f4c542; border-radius: 2px;
}
.ap-label { font-size: 11px; color: #a0a0aa; letter-spacing: 0.05em; text-transform: uppercase; font-weight: 600; }
.ap-input {
  width: 100%; padding: 9px 11px; border-radius: 9px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
  color: #fff; font-size: 13px; font-family: inherit;
  outline: none; resize: vertical; line-height: 1.45;
  transition: border-color .15s ease, background .15s ease;
}
.ap-input:focus { border-color: rgba(255,255,255,0.35); background: rgba(255,255,255,0.07); }
textarea.ap-input { min-height: 56px; font-family: inherit; }

.ap-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.4);
}
.ap-status { flex: 1; font-size: 12px; color: #888; letter-spacing: 0.03em; }
.ap-status.dirty { color: #f4c542; font-weight: 600; }
.ap-btn {
  padding: 9px 16px; border-radius: 10px; cursor: pointer;
  background: linear-gradient(180deg, #f4f4f6, #c9c9cc); color: #050505;
  border: 0; font-weight: 700; font-size: 12px; letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: transform .1s ease, opacity .15s ease;
}
.ap-btn:hover { transform: translateY(-1px); }
.ap-btn:disabled { opacity: 0.5; cursor: wait; transform: none; }
.ap-btn.ghost {
  background: transparent; color: #e8e8ea;
  border: 1px solid rgba(255,255,255,0.18);
}

body.admin-mode { padding-right: 420px; transition: padding-right .3s cubic-bezier(.2,.7,.2,1); }
@media (max-width: 760px) {
  body.admin-mode { padding-right: 0; overflow: hidden; }
  #adminPanel { width: 100%; max-width: 100%; border-left: 0; }
  #adminPanel .ap-head { padding: 18px 18px; }
  .ap-title h2 { font-size: 14px; }
  .ap-close { width: 36px; height: 36px; font-size: 20px; }
  .ap-search input { padding: 12px 14px; font-size: 14px; }
  .ap-section { margin: 8px 6px; }
  .ap-section-head { padding: 14px 14px; font-size: 13px; }
  .ap-label { font-size: 10px; }
  .ap-input { padding: 11px 13px; font-size: 14px; }
  .ap-foot { padding: 14px 16px; gap: 10px; }
  .ap-btn { padding: 11px 18px; font-size: 13px; }
}

[data-edit].ap-highlight {
  outline: 2px solid #f4c542; outline-offset: 4px; border-radius: 4px;
  box-shadow: 0 0 30px rgba(244,197,66,0.35);
  transition: outline .2s ease, box-shadow .2s ease;
}

.admin-toast {
  position: fixed; bottom: 24px; left: calc(50% - 210px); transform: translateX(-50%);
  background: rgba(15,15,18,0.96); color: #fff;
  border: 1px solid rgba(255,255,255,0.18); border-radius: 999px;
  padding: 11px 22px; font-size: 13px; z-index: 10001;
  opacity: 0; transition: opacity .25s ease, transform .25s ease;
  pointer-events: none; font-weight: 600;
}
.admin-toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
@media (max-width: 760px) {
  .admin-toast { left: 50%; bottom: 90px; }
  .admin-box { padding: 24px; width: 340px; }
  .admin-box input[type="password"] { padding: 14px 14px; font-size: 16px; }
  .admin-btn { padding: 13px 14px; font-size: 14px; }
}
