.admin-panel {
  position: relative;
}

.admin-tabs {
  display: inline-flex;
  gap: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  margin-bottom: var(--space-2);
  box-shadow: var(--shadow-sm);
}

.tab-button {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
}

.tab-button.active {
  background: var(--color-primary);
  color: white;
}

.settings-panel {
  margin-top: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
}

.settings-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.settings-topbar .panel-title {
  margin: 0;
}

.settings-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.unsaved-badge {
  display: inline-block;
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.btn-icon {
  padding: 0.3rem 0.55rem;
  font-size: 0.85rem;
  line-height: 1;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--color-primary-rgb, 56,102,65), 0.4); }
  50% { box-shadow: 0 0 0 5px rgba(var(--color-primary-rgb, 56,102,65), 0); }
}

.btn-pulse {
  animation: pulse-border 1.8s ease-in-out infinite;
}

.settings-section {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-top: var(--space-2);
  overflow: hidden;
}

.settings-section-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-muted-bg, #f5f5f0);
  border: none;
  padding: 0.75rem var(--space-2);
  cursor: pointer;
  text-align: left;
  font-size: 1rem;
}

.settings-section-header:hover {
  background: var(--color-focus, #eef2e6);
}

.settings-section-header .settings-heading {
  margin: 0;
  flex: 1;
}

.settings-section-count {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  background: var(--color-border);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}

.settings-chevron {
  font-size: 1.1rem;
  transition: transform 0.2s;
  color: var(--color-text-muted);
}

.settings-chevron.collapsed {
  transform: rotate(-90deg);
}

.settings-section-body {
  padding: var(--space-2);
  border-top: 1px solid var(--color-border);
}

.settings-field {
  margin-bottom: var(--space-2);
}

.settings-rule-row {
  display: grid;
  grid-template-columns: 1.5rem 1fr auto;
  gap: 0.5rem;
  align-items: start;
  margin-bottom: 0.5rem;
}

.settings-rule-index {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted);
  background: var(--color-border);
  border-radius: 50%;
  flex-shrink: 0;
}

.settings-type-header {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  padding: 0 0 0.35rem 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0.5rem;
}

.settings-type-col-sm {
  /* aligns with input */
}

/* Loading skeleton */
.settings-skeleton {
  padding: var(--space-2);
}

.skeleton-line {
  height: 1rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, #e8e8e4 25%, #f0f0ec 50%, #e8e8e4 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  margin-bottom: 0.75rem;
  width: 60%;
}

.skeleton-line-wide { width: 85%; }
.skeleton-line-short { width: 40%; }

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Error state */
.settings-error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3);
  color: var(--color-danger);
  text-align: center;
}

.settings-error-icon {
  font-size: 2rem;
}

.settings-error-state p {
  color: var(--color-text-muted);
  margin: 0;
}

.settings-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}

.settings-input:focus,
.settings-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-focus);
}

.settings-textarea {
  width: 100%;
  min-height: 90px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  resize: vertical;
}

.settings-textarea-lg {
  min-height: 130px;
}

.settings-input-sm {
  max-width: 90px;
}

.settings-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--color-text);
}

.settings-hint {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin: 0.35rem 0 0;
}

.logo-preview {
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  background: var(--color-muted-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  display: inline-block;
}

.logo-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.settings-actions {
  margin-top: var(--space-3);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.settings-row {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.settings-heading {
  margin: 0;
  color: var(--color-text);
  font-size: 1rem;
}

.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
}

.notification.success {
  background: var(--color-success);
  color: white;
}

.notification.error {
  background: var(--color-danger);
  color: white;
}

.notification.warning {
  background: #e67e00;
  color: white;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
