* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --sidebar-bg: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  --sidebar-bg-solid: #ffffff;
  --sidebar-hover: #f1f5f9;
  --sidebar-active: linear-gradient(135deg, #4a90e2 0%, #7bb3f0 100%);
  --sidebar-active-shadow: 0 4px 12px rgba(74, 144, 226, 0.15);
  --sidebar-text: #64748b;
  --sidebar-text-active: #ffffff;
  --sidebar-border: #e2e8f0;
  --sidebar-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-color);
  min-height: 100vh;
  overflow-x: hidden;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg-solid);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: width var(--transition-normal), transform var(--transition-normal);
  overflow: hidden;
  box-shadow: var(--sidebar-shadow);
  border-right: 1px solid var(--sidebar-border);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar-header {
  padding: 20px 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #4a90e2 0%, #7bb3f0 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.15);
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  letter-spacing: -0.5px;
}

.logo-highlight {
  color: var(--primary-color);
}

.sidebar-nav {
  flex: 1;
  padding: 8px 16px;
  overflow-y: auto;
}

.nav-list {
  list-style: none;
}

.nav-item {
  margin: 4px 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  overflow: hidden;
  position: relative;
}

.nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: linear-gradient(135deg, #4a90e2 0%, #7bb3f0 100%);
  border-radius: 2px;
  transition: height var(--transition-fast);
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: var(--text-primary);
}

.nav-link:hover::before {
  height: 20px;
}

.nav-link.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  box-shadow: var(--sidebar-active-shadow);
}

.nav-link.active::before {
  height: 24px;
  background: white;
}

.nav-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 8px;
  background: transparent;
  transition: background var(--transition-fast);
}

.nav-icon svg {
  display: block;
  margin: auto;
  transform: translateX(-0.5px);
}

.nav-link:hover .nav-icon {
  background: rgba(74, 144, 226, 0.08);
}

.nav-link.active .nav-icon {
  background: rgba(255, 255, 255, 0.2);
}

.nav-text {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  transition: opacity var(--transition-normal);
}



.sidebar-footer {
  padding: 12px;
  margin-top: auto;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  cursor: pointer;
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
  padding: 6px;
  justify-content: space-between;
}

.user-info:hover {
  background: var(--sidebar-hover);
  border-color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.08);
}

.user-info.active {
  background: rgba(74, 144, 226, 0.08);
}

.user-avatar {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #4a90e2 0%, #7bb3f0 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.15);
}

.user-avatar svg {
  display: block;
  margin: auto;
}

.user-details {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 13px;
  color: var(--sidebar-text);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.role-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: var(--primary-100);
  color: var(--primary-700);
  margin-left: 6px;
}



.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  transition: all var(--transition-fast);
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}

.action-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
  transform: scale(1.05);
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.content-header {
  padding: 24px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.content-body {
  padding: 24px 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--primary-400);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .content-header {
    padding: 16px 20px;
  }
  
  .content-body {
    padding: 16px 20px;
  }
}

.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 280px;
  max-width: 480px;
  border: 1px solid var(--border-color);
}

.toast.toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-success .toast-icon {
  color: var(--success-color);
}

.toast-error .toast-icon {
  color: var(--danger-color);
}

.toast-warning .toast-icon {
  color: var(--warning-color);
}

.toast-info .toast-icon {
  color: var(--primary-color);
}

.toast-message {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.5;
}

.toast-success {
  border-left: 4px solid var(--success-color);
}

.toast-error {
  border-left: 4px solid var(--danger-color);
}

.toast-warning {
  border-left: 4px solid var(--warning-color);
}

.toast-info {
  border-left: 4px solid var(--primary-color);
}

.confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(0);
}

.confirm-overlay.confirm-show {
  opacity: 1;
}

.confirm-modal {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  width: 420px;
  max-width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.confirm-overlay.confirm-show .confirm-modal {
  transform: scale(1) translateY(0);
}

.confirm-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border-color);
}

.confirm-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.confirm-icon-warning,
.confirm-icon-danger {
  color: var(--danger-color);
}

.confirm-icon-success {
  color: var(--success-color);
}

.confirm-icon-info {
  color: var(--primary-color);
}

.confirm-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.confirm-body {
  padding: 20px 24px;
}

.confirm-message {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.confirm-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px 24px;
}

.confirm-footer .btn {
  min-width: 80px;
}

/* Sidebar nav button reset — override native <button> defaults */
button.nav-link {
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font: inherit;
}

