/* ========== 主题变量（由 JS 覆盖） ========== */
:root {
    --tb-primary: #1677ff;
    --tb-accent: #4096ff;
    --tb-top-bg: #ffffff;
    --tb-side-bg: #f7faff;
    --tb-canvas-bg: #eaf1fb;
    --tb-text: #1f2d3d;
    --tb-text-sub: #5a6b82;
    --tb-border: rgba(22, 119, 255, 0.15);
    --tb-radius: 10px;
    --tb-font-size: 14px;
  
    --tb-primary-rgb: 22, 119, 255;
    --tb-primary-soft: rgba(22, 119, 255, 0.14);
    --tb-primary-strong: rgba(22, 119, 255, 0.85);
  
    --tb-top-h: 52px;
    --tb-bottom-h: 32px;
    --tb-side-w: 260px;
  
    --tb-shadow-1: 0 1px 3px rgba(15, 40, 90, 0.06);
    --tb-shadow-2: 0 6px 20px rgba(15, 40, 90, 0.12);
    --tb-shadow-glow: 0 0 0 3px rgba(var(--tb-primary-rgb), 0.12), 0 4px 14px rgba(var(--tb-primary-rgb), 0.18);
  }
  
  html[data-theme="dark"] {
    --tb-border: rgba(255, 255, 255, 0.08);
    --tb-text-sub: #8a9ab0;
    --tb-shadow-1: 0 1px 3px rgba(0, 0, 0, 0.4);
    --tb-shadow-2: 0 6px 20px rgba(0, 0, 0, 0.5);
  }
  
  * { box-sizing: border-box; }
  
  html, body {
    margin: 0; padding: 0; height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
    font-size: var(--tb-font-size);
    color: var(--tb-text);
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    overscroll-behavior: none;
  }
  
  body.login-body {
    background: linear-gradient(140deg, #e8f1ff 0%, #f4f9ff 50%, #dbeaff 100%);
  }
  html[data-theme="dark"] body.login-body {
    background: linear-gradient(140deg, #0e1015 0%, #141821 50%, #1a1f2e 100%);
  }
  
  button { font-family: inherit; }
  
  ::-webkit-scrollbar { width: 8px; height: 8px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: rgba(var(--tb-primary-rgb), 0.22);
    border-radius: 4px;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--tb-primary-rgb), 0.35);
  }
  
  /* ========== 通用弹窗 ========== */
  .modal[hidden] { display: none; }
  .modal {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
  }
  .modal-mask {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    animation: tb-fade 0.16s ease;
  }
  .modal-body {
    position: relative;
    width: 100%; max-width: 520px;
    max-height: 86vh;
    background: var(--tb-top-bg);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(var(--tb-primary-rgb), 0.08);
    display: flex; flex-direction: column;
    animation: tb-pop 0.18s ease;
    overflow: hidden;
    color: var(--tb-text);
  }
  @keyframes tb-fade { from { opacity: 0; } to { opacity: 1; } }
  @keyframes tb-pop {
    from { transform: scale(0.96); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
  }
  
  .modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--tb-border);
    flex-shrink: 0;
  }
  .modal-header h3 { margin: 0; font-size: 15px; font-weight: 600; }
  
  .modal-content {
    padding: 18px 20px;
    overflow-y: auto;
    flex: 1;
    font-size: 13px;
    line-height: 1.7;
  }
  .modal-footer {
    display: flex; gap: 8px; justify-content: flex-end;
    padding: 14px 20px;
    border-top: 1px solid var(--tb-border);
    flex-shrink: 0;
  }
  
  /* ========== 通用按钮 ========== */
  .btn {
    padding: 8px 18px;
    border-radius: var(--tb-radius);
    border: 1px solid var(--tb-border);
    background: transparent; color: var(--tb-text);
    font-size: 13px; cursor: pointer;
    transition: all 0.15s; outline: none;
  }
  .btn:hover { border-color: var(--tb-primary); color: var(--tb-primary); }
  .btn.primary {
    background: linear-gradient(135deg, var(--tb-primary) 0%, var(--tb-accent) 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 3px 10px rgba(var(--tb-primary-rgb), 0.28);
  }
  .btn.primary:hover {
    background: linear-gradient(135deg, var(--tb-accent) 0%, var(--tb-primary) 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 5px 16px rgba(var(--tb-primary-rgb), 0.36);
  }
  .btn.ghost { background: transparent; }
  .btn:disabled { opacity: 0.5; cursor: not-allowed; }
  
  /* ========== 图标按钮 ========== */
  .icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 9px;
    background: transparent; border: none; cursor: pointer;
    color: var(--tb-text-sub); transition: all 0.15s;
    outline: none;
  }
  .icon-btn:hover { background: var(--tb-primary-soft); color: var(--tb-primary); }
  .icon-btn:active { transform: scale(0.94); }
  .icon-btn svg { pointer-events: none; display: block; }
  .icon-btn.small { width: 22px; height: 22px; border-radius: 6px; }
  .icon-btn.wide {
    flex: 1; height: 32px;
    border: 1px solid var(--tb-border);
    border-radius: var(--tb-radius);
  }
  .icon-btn.wide:disabled { opacity: 0.35; cursor: not-allowed; }
  .icon-btn.float {
    width: 36px; height: 36px;
    background: var(--tb-top-bg);
    border: 1px solid var(--tb-border);
    box-shadow: var(--tb-shadow-1);
  }
  
  /* ========== toast ========== */
  .toasts {
    position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
    z-index: 9999;
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
  }
  .toast {
    padding: 10px 18px;
    background: rgba(30, 30, 30, 0.9);
    color: #fff; font-size: 13px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    opacity: 0; transform: translateY(-8px);
    transition: all 0.2s ease;
    max-width: 340px; word-break: break-word;
    text-align: center;
  }
  .toast.show { opacity: 1; transform: translateY(0); }
  .toast-success { background: rgba(22, 163, 74, 0.95); }
  .toast-error   { background: rgba(220, 38, 38, 0.95); }
  .toast-warning { background: rgba(217, 119, 6, 0.95); }
  
  /* ========== 通用 side-section ========== */
  .side-section {
    border-bottom: 1px solid var(--tb-border);
    padding: 12px 14px;
  }
  .side-title {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12px; font-weight: 700; letter-spacing: 0.6px;
    color: var(--tb-text-sub); text-transform: uppercase;
    margin-bottom: 10px;
  }
  .side-title .actions { display: flex; gap: 2px; }