:root {
  --admin-bg: #f3f4f8;
  --admin-card: #ffffff;
  --admin-border: #e6e8f0;
  --admin-text: #2c3038;
  --admin-sub: #8a90a0;
  --admin-primary: #4f7fd6;
  --admin-radius: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'HarmonyOS Sans SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  background: var(--admin-bg);
  color: var(--admin-text);
  -webkit-font-smoothing: antialiased;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--admin-border);
}

.admin-header-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.back-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--admin-border);
  background: #fff;
  color: var(--admin-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
}

.back-btn svg {
  width: 18px;
  height: 18px;
}

.admin-title {
  flex: 1;
  font-size: 18px;
  font-weight: 800;
}

.save-fab {
  position: fixed;
  right: 22px;
  bottom: 26px;
  z-index: 60;
  padding: 14px 26px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #4f7fd6, #6a8ff0);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 30px rgba(79, 127, 214, 0.4);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease, opacity 0.2s;
}

.save-fab:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 38px rgba(79, 127, 214, 0.5);
}

.save-fab:active {
  transform: translateY(-1px) scale(0.97);
}

.save-fab:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.save-fab svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 480px) {
  .save-fab {
    right: 16px;
    bottom: 18px;
    padding: 13px 22px;
    font-size: 14px;
  }
}

.admin-main {
  max-width: 780px;
  margin: 0 auto;
  padding: 24px 20px 120px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  padding: 22px;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.section-head svg {
  width: 18px;
  height: 18px;
  color: var(--admin-primary);
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  flex: 1;
}

.field {
  margin-bottom: 16px;
}

.field:last-child {
  margin-bottom: 0;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--admin-sub);
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-hint {
  font-size: 11.5px;
  color: #b0b6c4;
  font-weight: 400;
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--admin-text);
  background: #fbfbfd;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input,
.select {
  height: 46px;
}

.select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%238a90a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(79, 127, 214, 0.14);
}

.textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.6;
}

.row {
  display: flex;
  gap: 12px;
}

.row > .field {
  flex: 1;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}

.toggle-label {
  font-size: 14px;
}

.toggle {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #d5d9e3;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.25s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: transform 0.25s;
}

.toggle input:checked + .toggle-slider {
  background: var(--admin-primary);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 6px 16px rgba(90, 110, 150, 0.25);
  background: #eef0f6;
}

.avatar-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
}

.avatar-row .field {
  flex: 1;
  margin-bottom: 0;
}

.btn-upload {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px dashed var(--admin-primary);
  background: rgba(79, 127, 214, 0.06);
  color: var(--admin-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-upload:hover {
  background: rgba(79, 127, 214, 0.12);
}

.list-item {
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 14px;
  background: #fafbfd;
  position: relative;
}

.list-item:last-child {
  margin-bottom: 0;
}

.list-item-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.list-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #eef0f6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--admin-sub);
  flex-shrink: 0;
}

.list-icon svg {
  width: 16px;
  height: 16px;
}

.list-icon img {
  width: 22px;
  height: 22px;
  object-fit: cover;
  border-radius: 6px;
}

.icon-custom-field .avatar-row {
  align-items: center;
}

.icon-custom-preview {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #eef0f6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.icon-custom-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.icon-custom-field.hidden {
  display: none;
}

/* ---------- Custom dropdown (icon / color) ---------- */
.dd {
  position: relative;
}

.dd-trigger {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: #fbfbfd;
  font-size: 14px;
  font-family: inherit;
  color: var(--admin-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.dd-trigger:hover {
  border-color: var(--admin-primary);
}

.dd.open .dd-trigger {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(79, 127, 214, 0.14);
}

.dd-current {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.dd-current svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--admin-primary);
}

.dd-current img {
  width: 20px;
  height: 20px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.dd-current-label {
  font-size: 13px;
  color: var(--admin-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dd-caret {
  font-size: 11px;
  color: var(--admin-sub);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.dd.open .dd-caret {
  transform: rotate(180deg);
}

.dd-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  background: #fff;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(60, 70, 100, 0.18);
  padding: 6px;
  display: none;
  max-height: 280px;
  overflow-y: auto;
}

.dd.open .dd-menu {
  display: block;
}

.dd-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: none;
  border-radius: 9px;
  background: none;
  font-size: 13px;
  font-family: inherit;
  color: var(--admin-text);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.dd-option:hover {
  background: #f0f3fa;
}

.dd-option.active {
  background: rgba(79, 127, 214, 0.1);
  color: var(--admin-primary);
}

.dd-option svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--admin-primary);
}

.dd-option img {
  width: 20px;
  height: 20px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.dd-option-label {
  flex: 1;
  color: inherit;
}

.dd-dot {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(60, 70, 100, 0.15);
}

.dd-option-custom {
  border-top: 1px solid var(--admin-border);
  border-radius: 0 0 9px 9px;
  padding-top: 10px;
  cursor: default;
}

.dd-option-custom:hover {
  background: none;
}

.dd-color-input {
  width: 92px;
  height: 30px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  padding: 0 8px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--admin-text);
  background: #fff;
  outline: none;
  cursor: text;
  letter-spacing: 0.5px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.dd-color-input:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 2px rgba(79, 127, 214, 0.14);
}

.list-item-title {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--admin-border);
  background: #fff;
  color: var(--admin-sub);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s;
}

.icon-btn:hover {
  color: var(--admin-primary);
  border-color: var(--admin-primary);
}

.icon-btn.danger:hover {
  color: #d6455b;
  border-color: #d6455b;
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

.color-inputs {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.color-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--admin-sub);
}

.color-field input[type='color'] {
  width: 52px;
  height: 40px;
  border: none;
  border-radius: 10px;
  padding: 0;
  background: none;
  cursor: pointer;
}

.btn-add {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed var(--admin-primary);
  background: rgba(79, 127, 214, 0.05);
  color: var(--admin-primary);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
}

.btn-add:hover {
  background: rgba(79, 127, 214, 0.1);
}

.btn-add svg {
  width: 15px;
  height: 15px;
}

.action-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  padding: 11px 20px;
  border-radius: 12px;
  border: 1px solid var(--admin-border);
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn:hover {
  border-color: var(--admin-primary);
  color: var(--admin-primary);
}

.btn-primary {
  background: var(--admin-primary);
  border-color: var(--admin-primary);
  color: #fff;
}

.btn-primary:hover {
  opacity: 0.9;
  color: #fff;
}

.btn-warn {
  background: #fff5f5;
  border-color: #f0c9cf;
  color: #c2455a;
}

.btn-warn:hover {
  background: #ffebee;
  border-color: #c2455a;
  color: #c2455a;
}

.btn-success {
  background: #f0faf2;
  border-color: #bfe2c9;
  color: #2c8f5a;
}

.btn-success:hover {
  border-color: #2c8f5a;
  color: #2c8f5a;
}

.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #2c3038;
  color: #fff;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  opacity: 0;
  transition: all 0.3s;
  z-index: 100;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.login-mask {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #f3f4f8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-box {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid var(--admin-border);
  border-radius: 20px;
  padding: 32px 28px;
  text-align: center;
}

.login-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, #8ab8e8, #a78bfa);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.login-icon svg {
  width: 26px;
  height: 26px;
}

.login-box h2 {
  font-size: 19px;
  margin-bottom: 6px;
}

.login-box p {
  font-size: 13px;
  color: var(--admin-sub);
  margin-bottom: 20px;
}

.login-box .input {
  margin-bottom: 14px;
  text-align: center;
  letter-spacing: 2px;
}

.hidden {
  display: none;
}
