/* 深色主题（默认） */
:root,
:root[data-theme="dark"] {
    --bg-dark: #0a0f1a;
    --bg-card: #111827;
    --bg-card-hover: #1a2234;
    --border: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59,130,246,.3);
    --gradient-main: linear-gradient(135deg,#3b82f6 0%,#8b5cf6 100%);
  }

/* 浅色主题 */
:root[data-theme="light"] {
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --border: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59,130,246,.15);
    --gradient-main: linear-gradient(135deg,#3b82f6 0%,#8b5cf6 100%);
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
  }

  /* Layout */
  .app { display: flex; min-height: 100vh; }

  /* Left Sidebar */
  .sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
  }

  .sidebar-logo {
    padding: 0 12px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
  }

  .sidebar-logo h2 { 
    font-size: 18px; 
    font-weight: 700; 
  }
  
  .sidebar-logo .logo-text {
    font-family: 'Inter', 'DM Sans', sans-serif;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    text-transform: lowercase;
  }
  
  .sidebar-logo span { font-size: 12px; color: var(--text-muted); }

  .nav { flex: 1; }

  .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    margin-bottom: 6px;
    transition: all 0.2s ease;
  }

  .nav-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
  .nav-item.active { background: var(--accent-blue-glow); color: var(--accent-blue); }

  /* 父菜单项 */
  .nav-parent {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    margin-bottom: 6px;
  }

  .nav-parent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
  }

  .nav-parent-header:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
  }

  .nav-parent.active .nav-parent-header {
    background: var(--accent-blue-glow);
    color: var(--accent-blue);
  }

  .nav-arrow {
    font-size: 18px;
    transition: transform 0.2s ease;
    color: var(--text-muted);
  }

  .nav-parent.active .nav-arrow {
    transform: rotate(90deg);
    color: var(--accent-blue);
  }

  /* 子菜单 */
  .nav-children {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 0;
  }

  .nav-parent.active .nav-children {
    max-height: 400px;
    padding-left: 0;
  }

  .nav-child {
    padding: 10px 16px 10px 40px;
    margin-bottom: 4px;
    font-size: 14px;
    border-radius: 8px;
  }

  .nav-child:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
  }

  .nav-child.active {
    background: var(--accent-blue-glow);
    color: var(--accent-blue);
    font-weight: 600;
  }

  /* User footer */
  .sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 16px;
  }

  .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    background: var(--bg-dark);
  }

  .avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--gradient-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
  }

  .user-meta { flex: 1; }
  .user-meta .name { font-size: 14px; font-weight: 600; }
  .user-meta .role { font-size: 12px; color: var(--text-muted); }

  .logout {
    cursor: pointer;
    color: var(--text-secondary);
  }

  .logout:hover { color: var(--accent-blue); }

  /* 通知提示系统 */
  .notification-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
  }

  .notification {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    min-width: 300px;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    animation: slideDown 0.3s ease-out;
  }

  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .notification-success {
    border-left: 4px solid #10b981;
  }

  .notification-error {
    border-left: 4px solid #ef4444;
  }

  .notification-info {
    border-left: 4px solid var(--accent-blue);
  }

  .notification-icon {
    font-size: 20px;
    flex-shrink: 0;
  }

  .notification-success .notification-icon {
    color: #10b981;
  }

  .notification-error .notification-icon {
    color: #ef4444;
  }

  .notification-info .notification-icon {
    color: var(--accent-blue);
  }

  .notification-message {
    flex: 1;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
  }

  /* 确认删除弹窗 */
  .confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
  }

  .confirm-modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: modalFadeIn 0.2s ease-out;
  }

  @keyframes modalFadeIn {
    from {
      opacity: 0;
      transform: scale(0.95);
    }
    to {
      opacity: 1;
      transform: scale(1);
    }
  }

  .confirm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
  }

  .confirm-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
  }

  .confirm-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
  }

  .confirm-modal-close:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
  }

  .confirm-modal-body {
    padding: 24px;
  }

  .confirm-modal-body p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
  }

  .confirm-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 20px 24px;
    border-top: 1px solid var(--border);
  }

  .confirm-btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    font-family: inherit;
    min-width: 100px;
  }

  .confirm-btn-cancel {
    background: var(--bg-card-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border);
  }

  .confirm-btn-cancel:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--accent-blue);
  }

  .confirm-btn-delete {
    background: #ef4444;
    color: #fff;
  }

  .confirm-btn-delete:hover {
    background: #dc2626;
  }

  .confirm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  /* Main */
  .main { flex: 1; padding: 32px; }

  .page { display: none; }
  .page.active { display: block; animation: fade .25s ease; }

  @keyframes fade { from { opacity: 0 } to { opacity: 1 } }

  .page-header { margin-bottom: 32px; }
  .page-header h1 { font-size: 28px; font-weight: 700; }
  .page-header p { color: var(--text-secondary); margin-top: 4px; }

  /* Cards */
  .grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 0; /* 由分割线控制间距 */
  }

  /* Section Divider - 也可以放在主样式文件中 */
  .section-divider {
    height: 0;
    border-top: 1px dashed var(--border);
    margin: 32px 0;
    width: 100%;
  }

  .card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .card .label { 
    font-size: 14px; 
    color: var(--text-secondary); 
    font-weight: 500;
    white-space: nowrap;
  }
  
  .card .value {
    font-size: 18px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-blue);
    white-space: nowrap;
  }

  /* Table */
  table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
  }

  th, td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
  }

  th {
    background: var(--bg-card-hover);
    color: var(--text-muted);
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
  }

  tr:hover td { background: var(--bg-card-hover); }

  /* Settings Page Styles */
  .settings-container {
    max-width: 800px;
  }

  .settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
  }

  .settings-section {
    margin-bottom: 32px;
  }

  .settings-section:last-child {
    margin-bottom: 0;
  }

  .settings-section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
  }

  .settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
  }

  .settings-item:last-child {
    border-bottom: none;
  }

  .settings-item-info {
    flex: 1;
  }

  .settings-item-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
  }

  .settings-item-desc {
    font-size: 14px;
    color: var(--text-secondary);
  }

  .theme-switcher {
    display: flex;
    gap: 12px;
  }

  .theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    background: var(--bg-card-hover);
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
  }

  .theme-option:hover {
    border-color: var(--accent-blue);
    background: var(--accent-blue-glow);
  }

  .theme-option.active {
    border-color: var(--accent-blue);
    background: var(--accent-blue-glow);
  }

  .theme-icon {
    font-size: 24px;
  }

  .theme-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
  }