:root {
  --bg-primary: #f5f5f7;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.72);
  --bg-card-hover: rgba(255, 255, 255, 0.85);
  --bg-input: rgba(245, 245, 247, 0.85);
  --border-color: rgba(210, 210, 215, 0.35);
  --border-active: rgba(250, 35, 59, 0.4);
  --text-primary: #1d1d1f;
  --text-secondary: rgba(80, 80, 90, 0.75);
  --text-muted: rgba(140, 140, 150, 0.6);
  --accent-1: #fa233b;
  --accent-2: #ff4d6a;
  --accent-glow: rgba(250, 35, 59, 0.15);
  --success: #34c759;
  --danger: #ff3b30;
  --warning: #ff9500;
  --info: #007aff;
  --gradient-primary: linear-gradient(135deg, #fa233b, #ff4d6a);
  --gradient-accent: linear-gradient(135deg, #ff6b81, #fa233b);
  --gradient-bg: linear-gradient(180deg, #f5f5f7 0%, #ffffff 40%, #f5f5f7 100%);
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(210, 210, 215, 0.25);
  --glass-shine: rgba(255, 255, 255, 0.5);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 24px var(--accent-glow);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 28px;
  --radius-pill: 999px;
  --transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--border-active);
}

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 15px;
  }
}

body {
  margin-bottom: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  min-height: 100vh;
}

::selection {
  background: var(--accent-1);
  color: white;
}

.btn {
  border-radius: var(--radius-sm);
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  transition: var(--transition);
  border: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
}

.btn-primary:hover {
  box-shadow: var(--shadow-glow);
  color: white;
}

.btn-outline-primary {
  background: transparent;
  border: 1px solid var(--accent-1);
  color: var(--accent-1);
}

.btn-outline-primary:hover {
  background: var(--gradient-primary);
  border-color: transparent;
  color: white;
}

.btn-success {
  background: linear-gradient(135deg, #059669, #10b981);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #ef4444);
}

.btn-info {
  background: linear-gradient(135deg, #0891b2, #06b6d4);
  color: white;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  color: var(--text-primary);
}

.btn-outline-secondary {
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.btn-outline-secondary:hover {
  background: var(--bg-card);
  border-color: var(--border-active);
  color: var(--text-primary);
}

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

.btn-lg {
  padding: 0.75rem 2rem;
  font-size: 1.1rem;
  border-radius: var(--radius-md);
}

.btn.active {
  background: var(--gradient-primary) !important;
  color: white !important;
  border-color: transparent !important;
  box-shadow: var(--shadow-glow);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
  font-weight: 600;
}

.card-body {
  padding: 1.25rem;
}

.card-footer {
  background: rgba(255, 255, 255, 0.03);
  border-top: 1px solid var(--border-color);
}

.form-control, .form-select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
  transition: var(--transition);
}

.form-control:focus, .form-select:focus {
  background: var(--bg-input);
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px var(--accent-glow);
  color: var(--text-primary);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-label {
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.text-muted {
  color: var(--text-muted) !important;
}

.text-primary {
  color: var(--accent-1) !important;
}

.text-success {
  color: var(--success) !important;
}

.text-danger {
  color: var(--danger) !important;
}

.table {
  color: var(--text-primary);
  margin-bottom: 0;
}

.table > :not(caption) > * > * {
  border-bottom-color: var(--border-color);
  padding: 0.75rem;
}

.table-hover > tbody > tr:hover {
  background: rgba(124, 58, 237, 0.08);
  color: var(--text-primary);
}

.table > thead {
  background: rgba(255, 255, 255, 0.03);
}

.table > thead > tr > th {
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.table-active {
  background: rgba(124, 58, 237, 0.15) !important;
  color: var(--text-primary) !important;
}

.table-active td {
  background: transparent !important;
}

.alert {
  border-radius: var(--radius-sm);
  border: none;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-info {
  background: rgba(6, 182, 212, 0.1);
  color: var(--info);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge {
  font-weight: 500;
  padding: 0.3em 0.65em;
  border-radius: 6px;
}

.badge.bg-secondary {
  background: var(--bg-card-hover) !important;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.badge.bg-success {
  background: rgba(16, 185, 129, 0.15) !important;
  color: var(--success);
}

.badge.bg-danger {
  background: rgba(239, 68, 68, 0.15) !important;
  color: var(--danger);
}

.list-group {
  border-radius: var(--radius-md);
  overflow: hidden;
}

.list-group-item {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
  transition: var(--transition);
}

.list-group-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.list-group-item.active {
  background: var(--gradient-primary) !important;
  border-color: transparent !important;
}

.spinner-border {
  color: var(--accent-1) !important;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.modal-header {
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 1.5rem;
}

.modal-header .btn-close {
  filter: invert(0.7);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  border-top: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
}

.modal-title {
  color: var(--text-primary);
  font-weight: 600;
}

.modal-backdrop.show {
  opacity: 0.6;
}

.nav-link {
  transition: var(--transition);
  border-radius: var(--radius-sm);
}

a {
  color: var(--accent-2);
  transition: var(--transition);
}

a:hover {
  color: var(--accent-1);
}

pre {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

img {
  border-radius: var(--radius-sm);
}

/* Toast 通知 */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast-notification {
  pointer-events: auto;
  min-width: 300px;
  max-width: 420px;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  animation: toastSlideIn 0.3s ease-out;
  backdrop-filter: blur(20px);
}

.toast-notification.toast-leaving {
  animation: toastSlideOut 0.3s ease-in forwards;
}

.toast-notification.toast-success {
  border-left: 3px solid var(--success);
}

.toast-notification.toast-error {
  border-left: 3px solid var(--danger);
}

.toast-notification.toast-warning {
  border-left: 3px solid var(--warning);
}

.toast-notification.toast-info {
  border-left: 3px solid var(--info);
}

.toast-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.toast-message {
  font-size: 0.85rem;
  color: var(--text-secondary);
  word-break: break-word;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  font-size: 1rem;
  line-height: 1;
  transition: var(--transition);
  border-radius: 4px;
}

.toast-close:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.1);
}

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

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

/* 确认对话框 */
.confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

.confirm-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  max-width: 400px;
  width: 90%;
  animation: scaleIn 0.2s ease-out;
}

.confirm-dialog-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.confirm-dialog-message {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.confirm-dialog-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.confirm-dialog-actions .btn {
  min-width: 80px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-active);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-primary);
  -webkit-box-shadow: 0 0 0px 1000px var(--bg-input) inset;
  transition: background-color 5000s ease-in-out 0s;
}
