/* Admin Console & Appearance Studio */
.admin-shell {
  display: grid;
  grid-template-columns: 200px 1fr;
  height: 100%;
  min-height: 540px;
}

.admin-sidebar {
  background: rgba(0, 0, 0, 0.26);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-brand strong {
  display: block;
  font-size: 16px;
}

.admin-brand small {
  font-size: 11px;
  color: var(--text-muted);
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.admin-tab {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.admin-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.admin-tab.active {
  background: rgba(74, 222, 128, 0.2);
  color: #bbf7d0;
  font-weight: 600;
}

.admin-side-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.full-w {
  width: 100%;
}

.admin-content {
  padding: 22px 26px;
  overflow-y: auto;
}

.admin-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.admin-section-head h4 {
  margin: 0;
  font-size: 17px;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-filter-input,
.admin-filter-select {
  height: 34px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 24, 20, 0.65);
  color: #f8fafc;
  font-size: 12.5px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.admin-filter-input {
  width: 200px;
}

.admin-filter-input::placeholder {
  color: rgba(226, 232, 240, 0.52);
}

.admin-filter-input:focus,
.admin-filter-select:focus {
  border-color: rgba(74, 222, 128, 0.65);
}

.admin-filter-select option {
  background: #1e293b;
  color: #fff;
}

.admin-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 12px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.35);
  font-size: 12.5px;
}

.admin-bulk-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.admin-card-head h5 {
  margin: 0;
}

.admin-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.admin-card h5 {
  margin: 0 0 12px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.92);
}

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

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.form-field.span-2 {
  grid-column: 1 / -1;
}

.form-field label {
  font-size: 12px;
  color: var(--text-sub);
  display: flex;
  justify-content: space-between;
}

.form-checkbox-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 22px;
}

.form-field .form-checkbox-label,
.form-checkbox-label {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  margin: 0;
  line-height: 1.4;
}

.form-checkbox-label input[type="checkbox"] {
  margin: 0;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  accent-color: #4ade80;
}

.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px;
}

.icon-pick-btn {
  height: 36px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.85);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

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

.icon-pick-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.icon-pick-btn.active {
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.2);
  color: #bbf7d0;
}

.form-field input[type="text"],
.form-field input[type="password"],
.form-field input[type="url"],
.form-field input[type="number"],
.form-field select,
.form-field textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  padding: 9px 11px;
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
}

.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  border-color: #4ade80;
}

.form-error {
  color: #fca5a5;
  font-size: 12px;
  margin-bottom: 10px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.toggle-row:last-child {
  border-bottom: none;
}

.toggle-row strong {
  display: block;
  font-size: 13px;
}

.toggle-row small {
  font-size: 11px;
  color: var(--text-muted);
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.admin-row.is-dragging,
.admin-group-wrap.is-dragging,
.group-site-chip.is-dragging {
  opacity: 0.45;
}

.admin-row.drag-over,
.admin-group-wrap.drag-over {
  border-color: #4ade80;
  box-shadow: inset 0 2px 0 #4ade80;
}

.group-site-chip.drag-over {
  border-color: #4ade80;
  box-shadow: inset 2px 0 0 #4ade80;
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 26px;
  color: var(--text-muted);
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
  font-size: 13px;
  letter-spacing: -1px;
}

.drag-handle:active {
  cursor: grabbing;
}

.row-check {
  width: 15px;
  height: 15px;
  margin: 0;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: #4ade80;
}

.admin-row-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  font-weight: 700;
}

.admin-row-icon.is-group-icon {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.admin-row-icon.is-group-icon svg {
  width: 18px;
  height: 18px;
}

.admin-row-icon.is-letter {
  color: #ffffff;
}

.admin-row-icon.has-img {
  background: rgba(255, 255, 255, 0.92);
}

.admin-inline-select {
  max-width: 120px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.admin-inline-select option {
  background: #1e293b;
  color: #fff;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.88);
}

.admin-badge.is-pinned {
  background: rgba(56, 189, 248, 0.18);
  color: #bae6fd;
  border-color: rgba(56, 189, 248, 0.4);
}

.admin-badge.is-sync-ok {
  background: rgba(74, 222, 128, 0.2);
  color: #bbf7d0;
  border-color: rgba(74, 222, 128, 0.45);
}

.admin-badge.is-sync-warn {
  background: rgba(250, 204, 21, 0.2);
  color: #fef08a;
  border-color: rgba(250, 204, 21, 0.45);
}

.admin-badge.is-sync-err {
  background: rgba(248, 113, 113, 0.25);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.5);
}

.admin-empty-hint {
  font-size: 12.5px;
  color: var(--text-muted);
}

.sync-inline-msg {
  margin-top: 10px;
  font-size: 12.5px;
  color: #86efac;
  display: none;
}

.sync-inline-msg.is-err {
  color: #fca5a5;
}

.group-delete-confirm {
  padding: 12px 14px;
  border-top: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12.5px;
}

.group-delete-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-row-icon img {
  width: 74%;
  height: 74%;
  object-fit: contain;
}

.admin-row-info {
  flex: 1;
  min-width: 0;
}

.admin-row-info strong {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
}

.admin-row-info small {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 8px;
}

.preset-swatch {
  height: 58px;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 6px 8px;
  font-size: 11px;
  color: #fff;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.preset-swatch.active {
  border-color: #4ade80;
}

.logo-preset-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.logo-preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 4px;
  border-radius: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-sub);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.logo-preset-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: translateY(-1px);
}

.logo-preset-btn.active {
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.16);
  color: #fff;
}

.logo-preset-preview {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.logo-preset-preview.none-preview {
  border: 1px dashed rgba(255, 255, 255, 0.35);
  font-size: 11px;
  color: var(--text-muted);
}

.logo-preset-btn small {
  font-size: 11px;
  white-space: nowrap;
}

.inline-input-btn {
  display: flex;
  gap: 8px;
}

.inline-input-btn input {
  flex: 1;
}

.admin-group-wrap {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

.admin-group-wrap .admin-row {
  border: none;
  border-radius: 0;
  background: transparent;
}

.admin-group-wrap.expanded {
  border-color: rgba(74, 222, 128, 0.4);
  overflow: visible;
}

.g-sites-toggle.active {
  background: rgba(74, 222, 128, 0.22);
  border-color: rgba(74, 222, 128, 0.5);
  color: #bbf7d0;
}

.group-sites-drawer {
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.group-sites-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.group-sites-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.group-site-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px 5px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 12px;
}

.chip-dot {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.chip-dot img {
  width: 74%;
  height: 74%;
  object-fit: contain;
}

.g-move-picker {
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 400px;
}

.g-move-search {
  width: 100%;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(15, 24, 20, 0.72);
  color: #f8fafc;
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.g-move-search::placeholder {
  color: rgba(226, 232, 240, 0.5);
}

.g-move-search:focus {
  border-color: rgba(74, 222, 128, 0.6);
  background: rgba(15, 24, 20, 0.9);
}

.g-move-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 250px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 12px;
  background: rgba(14, 24, 20, 0.96);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.55);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.g-move-menu.hidden {
  display: none;
}

.g-move-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #f1f5f9;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease;
}

.g-move-option:hover {
  background: rgba(74, 222, 128, 0.16);
}

.g-move-opt-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.g-move-opt-grp {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(226, 232, 240, 0.78);
  flex-shrink: 0;
}

.g-move-opt-act {
  font-size: 11px;
  color: #4ade80;
  font-weight: 600;
  flex-shrink: 0;
}

.g-move-empty {
  padding: 14px 10px;
  text-align: center;
  font-size: 12px;
  color: rgba(226, 232, 240, 0.55);
}

.chip-name {
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-act {
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.chip-act:hover {
  background: rgba(255, 255, 255, 0.24);
}

.chip-act.danger:hover {
  background: rgba(248, 113, 113, 0.3);
  color: #fecaca;
}

@media (max-width: 760px) {
  .modal-xl {
    width: 96vw;
    height: 90vh;
  }
  .admin-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .admin-sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    padding: 12px 14px;
    gap: 10px;
  }
  .admin-nav {
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 6px;
  }
  .admin-nav::-webkit-scrollbar {
    display: none;
  }
  .admin-tab {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 7px 11px;
  }
  .admin-side-footer {
    flex-direction: row;
    gap: 8px;
  }
  .admin-side-footer .full-w {
    width: auto;
    flex: 1;
    padding: 7px 10px;
    font-size: 12.5px;
  }
  .admin-content {
    padding: 14px;
  }
  .admin-toolbar {
    width: 100%;
  }
  .admin-filter-input {
    flex: 1;
    min-width: 140px;
    width: auto;
  }
  .admin-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .admin-row-info {
    min-width: calc(100% - 76px);
  }
  .admin-row-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .g-move-picker {
    min-width: 100%;
  }
  .form-grid,
  .theme-choice-grid {
    grid-template-columns: 1fr;
  }
  .logo-preset-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .preset-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
