/* ==================================================
   設計 Token 系統
   ================================================== */
:root {
  /* 主色色階 */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;

  /* 成功色色階 */
  --success-50: #f0fdf4;
  --success-100: #dcfce7;
  --success-200: #bbf7d0;
  --success-300: #86efac;
  --success-500: #22c55e;
  --success-600: #16a34a;
  --success-700: #15803d;
  --success-900: #14532d;

  /* 警告色色階 */
  --warning-50: #fffbeb;
  --warning-100: #fef3c7;
  --warning-200: #fde68a;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --warning-700: #b45309;

  /* 危險色色階 */
  --danger-50: #fef2f2;
  --danger-100: #fee2e2;
  --danger-200: #fecaca;
  --danger-500: #ef4444;
  --danger-600: #dc2626;
  --danger-700: #b91c1c;
  --danger-900: #7f1d1d;

  /* 灰色色階 */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* 輔助色 */
  --purple-500: #9333ea;
  --purple-600: #7e22ce;
  --pink-500: #ec4899;
  --orange-500: #f97316;
  --teal-500: #14b8a6;

  /* 語義映射（向後兼容） */
  --primary: var(--primary-600);
  --primary-dark: var(--primary-700);
  --primary-light: var(--primary-50);
  --success: var(--success-600);
  --warning: var(--warning-600);
  --danger: var(--danger-600);

  /* 字號 */
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 16px;
  --text-xl: 18px;
  --text-2xl: 20px;
  --text-3xl: 24px;

  /* 間距 */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* 圓角 */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* 陰影 */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.03);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.02);
  --shadow: 0 1px 3px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.05), 0 2px 4px -1px rgba(0,0,0,.03);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.1), 0 10px 10px -5px rgba(0,0,0,.04);
  --shadow-2xl: 0 24px 48px rgba(0,0,0,.14);

  /* 動畫 */
  --transition-fast: .12s ease;
  --transition-base: .15s ease;
  --transition-slow: .2s ease;
}

* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  margin: 0;
  background: var(--gray-50);
  color: var(--gray-800);
}

header {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

header h1 { margin: 0; font-size: 20px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-100); color: var(--gray-800); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: #fecaca; }
.btn-success { background: #dcfce7; color: #166534; }
.btn-success:hover { background: #bbf7d0; }
.btn-warning { background: #fef3c7; color: #92400e; }
.btn-warning:hover { background: #fde68a; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.container { padding: 24px; max-width: 1400px; margin: 0 auto; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  border: 1px solid var(--gray-200);
}
.stat-card .num { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: 12px; color: var(--gray-600); margin-top: 4px; }

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.toolbar input, .toolbar select {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  background: #fff;
}

.card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; font-size: 14px; }
th { background: var(--gray-100); color: var(--gray-600); font-weight: 600; }
tbody tr { border-top: 1px solid var(--gray-200); cursor: pointer; }
tbody tr:hover { background: var(--gray-50); }

.grade {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.grade-A { background: #dcfce7; color: #166534; }
.grade-B { background: #dbeafe; color: #1e40af; }
.grade-C { background: #fef3c7; color: #92400e; }
.grade-D { background: #f3f4f6; color: #4b5563; }
.grade-F { background: #fae8ff; color: #86198f; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  margin-right: 4px;
  margin-bottom: 4px;
}
.tag-vip { background: #fef3c7; color: #92400e; }
.tag-req { background: #dbeafe; color: #1e40af; }
.tag-status { background: #f3e8ff; color: #6b21a8; }
.tag-source { background: #dcfce7; color: #166534; }
.tag-purpose { background: #ffedd5; color: #9a3412; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,.1);
}
.detail-modal { max-width: 960px; }
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.detail-actions { display: flex; gap: 8px; align-items: center; }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--gray-600); }
.form-group input, .form-group select, .form-group textarea {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
}
.form-group textarea { min-height: 80px; resize: vertical; }
.text-muted { color: var(--gray-500); font-weight: 400; }
.mt-2 { margin-top: 8px; }

.assignment-options {
  display: flex;
  gap: 16px;
  margin-top: 4px;
}
.assignment-options .radio-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
}
.assignment-options .radio-label input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-600);
}
.form-hint {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}
select.disabled {
  background: var(--gray-100);
  color: var(--gray-400);
  cursor: not-allowed;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 16px;
  background: var(--gray-50);
  flex-wrap: wrap;
}
.tab {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-600);
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-panel { padding: 20px; }
.hidden { display: none !important; }

/* ==================================================
   狀態組件：Loading / Empty / Error / Skeleton
   ================================================== */
.empty {
  text-align: center;
  color: var(--gray-500);
  padding: var(--space-10) var(--space-6);
  font-size: var(--text-base);
  background: var(--gray-50);
  border-radius: var(--radius);
  border: 1px dashed var(--gray-200);
}
.empty::before {
  content: '📭';
  display: block;
  font-size: 32px;
  margin-bottom: var(--space-3);
  opacity: .7;
}

.error-state {
  text-align: center;
  color: var(--danger-700);
  padding: var(--space-10) var(--space-6);
  font-size: var(--text-base);
  background: var(--danger-50);
  border-radius: var(--radius);
  border: 1px dashed var(--danger-200);
}
.error-state::before {
  content: '⚠️';
  display: block;
  font-size: 32px;
  margin-bottom: var(--space-3);
}
.error-state button {
  margin-top: var(--space-4);
}

.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-10) var(--space-6);
  color: var(--gray-500);
  font-size: var(--text-base);
}
.loading-spinner::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: var(--radius-full);
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.skeleton {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius);
  animation: skeleton-loading 1.5s infinite;
  color: transparent !important;
  pointer-events: none;
}
.skeleton::before,
.skeleton::after,
.skeleton * { visibility: hidden; }
@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 70%; }
.skeleton-title { height: 18px; width: 60%; margin-bottom: 12px; }
.skeleton-circle { width: 40px; height: 40px; border-radius: var(--radius-full); }
.skeleton-row { height: 48px; margin-bottom: 8px; border-radius: var(--radius); }

.list-item {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  background: #fff;
}
.list-item h4 { margin: 0 0 6px; font-size: 15px; }
.list-item p { margin: 0; font-size: 13px; color: var(--gray-600); }
.list-item .meta { margin-top: 8px; display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--gray-600); align-items: center; }

.file-link { color: var(--primary); text-decoration: none; }
.file-link:hover { text-decoration: underline; }

.checkbox-group { display: flex; gap: 16px; flex-wrap: wrap; }
.checkbox-group label { display: flex; align-items: center; gap: 6px; font-weight: 400; cursor: pointer; }

.close-btn { background: var(--gray-100); border: none; width: 32px; height: 32px; border-radius: 50%; font-size: 22px; cursor: pointer; color: var(--gray-600); display: flex; align-items: center; justify-content: center; line-height: 1; }
.close-btn:hover { background: var(--gray-200); color: var(--gray-900); }
.reminder-header { padding: 14px 16px; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; background: var(--gray-50); }
.reminder-header h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 18px;
  border-radius: var(--radius);
  color: #fff;
  font-size: 14px;
  z-index: 200;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,.1);
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* 登入頁 */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}
.login-box {
  background: #fff;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,.08);
  width: 100%;
  max-width: 380px;
}
.login-box h2 { margin: 0 0 8px; font-size: 24px; }
.login-box p { margin: 0 0 24px; color: var(--gray-600); }
.login-box .form-group { margin-bottom: 16px; }
.login-box .btn.full { width: 100%; justify-content: center; }
.login-hint {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
  font-size: 12px;
  color: var(--gray-600);
  line-height: 1.8;
}
.login-error {
  margin-top: 12px;
  padding: 10px;
  background: #fee2e2;
  color: var(--danger);
  border-radius: var(--radius);
  font-size: 13px;
  text-align: center;
}

/* 頭部導航 */
.header-left { display: flex; align-items: center; gap: 32px; }
.header-right { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.nav { display: flex; gap: 4px; }
.nav-item {
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--gray-600);
  text-decoration: none;
  font-weight: 500;
}
.nav-item:hover { background: var(--gray-100); }
.nav-item.active { background: #eff6ff; color: var(--primary); }

/* 看板 */
.dashboard-header { margin-bottom: 24px; }
.dashboard-header h2 { margin: 0 0 6px; font-size: 22px; }
.dashboard-header p { margin: 0; color: var(--gray-600); }
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}
.dashboard-card { padding: 20px; }
.dashboard-card h3 { margin: 0 0 16px; font-size: 16px; }
.chart-wrap { display: flex; flex-direction: column; gap: 10px; }
.chart-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.chart-label { width: 90px; color: var(--gray-600); }
.chart-bar-wrap {
  flex: 1;
  height: 22px;
  background: var(--gray-100);
  border-radius: 11px;
  overflow: hidden;
}
.chart-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 11px;
  transition: width .5s ease;
}
.chart-bar.green { background: var(--success); }
.chart-bar.yellow { background: var(--warning); }
.chart-bar.red { background: var(--danger); }
.chart-bar.purple { background: #9333ea; }
.chart-bar.pink { background: #db2777; }
.chart-value { width: 36px; text-align: right; font-weight: 600; }

.stat-card {
  position: relative;
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0,0,0,.05);
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
}
.stat-card:nth-child(2)::after { background: var(--success); }
.stat-card:nth-child(3)::after { background: var(--warning); }
.stat-card:nth-child(4)::after { background: var(--danger); }
.stat-card:nth-child(5)::after { background: #9333ea; }
.stat-card:nth-child(6)::after { background: var(--gray-600); }

/* 電話隱藏 */
.phone-mask {
  cursor: pointer;
  color: var(--primary);
  user-select: none;
  padding: 2px 6px;
  border-radius: 4px;
  background: #eff6ff;
  font-size: 13px;
}
.phone-mask:hover { background: #dbeafe; }

/* 禁用下載 */
.file-disabled {
  color: var(--gray-600);
  cursor: not-allowed;
  text-decoration: none;
}

/* 提醒面板 */
.reminder-bell {
  position: relative;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 18px;
}
.reminder-bell:hover { background: var(--gray-100); }
.reminder-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 10px;
}
.reminder-panel {
  position: fixed;
  top: 64px;
  right: 20px;
  width: 360px;
  max-height: 70vh;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(0,0,0,.12);
  z-index: 90;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.reminder-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.reminder-header h3 { margin: 0; font-size: 15px; }
.reminder-header-actions { display: flex; align-items: center; gap: 6px; }
.reminder-header .minimize-btn,
.reminder-header .close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  color: var(--gray-600);
  border: none;
  cursor: pointer;
  transition: all .15s;
  padding: 0;
}
.reminder-header .minimize-btn:hover {
  background: var(--primary);
  color: #fff;
}
.reminder-header .close-btn:hover {
  background: var(--danger);
  color: #fff;
}
.reminder-panel.minimized {
  width: 220px;
  max-height: 56px;
  top: auto;
  bottom: 20px;
  right: 20px;
}
.reminder-panel.minimized .reminder-body { display: none; }
.reminder-list { overflow-y: auto; padding: 10px; flex: 1; }
.reminder-item {
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  transition: background .15s;
}
.reminder-main { flex: 1; cursor: pointer; }
.reminder-item:hover { background: var(--gray-50); }
.reminder-item.unread { border-left: 3px solid var(--danger); }
.reminder-item .type { font-weight: 600; color: var(--primary); }
.reminder-item .time { color: var(--gray-600); font-size: 11px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }

/* 迷你進度條 */
.mini-progress {
  width: 80px;
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}
.mini-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #3b82f6);
  border-radius: 4px;
  transition: width .3s;
}
.rate-text { font-size: 12px; font-weight: 600; color: var(--gray-700); }
.rate-done { color: #16a34a; }

/* 知識庫 IMA 式佈局 */
.kb-ima-layout { display: flex; gap: 16px; height: calc(100vh - 140px); min-height: 500px; }
.kb-sidebar { width: 260px; flex-shrink: 0; background: #fff; border-radius: var(--radius); border: 1px solid var(--gray-200); display: flex; flex-direction: column; }
.kb-sidebar-header { padding: 14px 16px; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }
.kb-sidebar-header h3 { margin: 0; font-size: 15px; }
.kb-sidebar-actions { display: flex; gap: 8px; }
.kb-tree { flex: 1; overflow-y: auto; padding: 8px; }
.kb-tree-item { user-select: none; }
.kb-tree-node {
  display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: var(--radius);
  cursor: pointer; font-size: 14px; color: var(--gray-800);
}
.kb-tree-node:hover { background: var(--gray-50); }
.kb-tree-node.active { background: var(--primary-light); color: var(--primary); }
.kb-tree-children { padding-left: 18px; }
.kb-tree-toggle { width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--gray-500); }
.kb-tree-toggle.leaf { visibility: hidden; }
.kb-main { flex: 1; background: #fff; border-radius: var(--radius); border: 1px solid var(--gray-200); display: flex; flex-direction: column; overflow: hidden; }
.kb-toolbar { padding: 12px 16px; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.kb-breadcrumb { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.kb-breadcrumb a { color: var(--primary); text-decoration: none; }
.kb-breadcrumb a:hover { text-decoration: underline; }
.kb-search { display: flex; gap: 8px; }
.kb-search input { width: 220px; }
.kb-content { flex: 1; overflow-y: auto; padding: 16px; }
.kb-folder-row { background: #f8fafc; }
.kb-folder-row:hover { background: #f1f5f9; }
.kb-empty { color: var(--gray-500); text-align: center; padding: 40px 0; }
.kb-file-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px; border: 1px solid var(--gray-200); border-radius: var(--radius); margin-bottom: 10px;
}
.kb-file-card:hover { background: var(--gray-50); }
.kb-file-info { flex: 1; }
.kb-file-name { font-weight: 600; font-size: 14px; }
.kb-file-meta { font-size: 12px; color: var(--gray-600); margin-top: 2px; }
@media (max-width: 768px) {
  .kb-ima-layout { flex-direction: column; height: auto; }
  .kb-sidebar { width: 100%; max-height: 240px; }
}

/* ==================================================
   時間軸
   ================================================== */
.timeline {
  position: relative;
  padding-left: 28px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
}
.timeline-item {
  position: relative;
  padding-bottom: var(--space-6);
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -24px;
  top: 2px;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: #fff;
  border: 2px solid var(--gray-300);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.timeline-dot::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--gray-300);
}
.timeline-item.call .timeline-dot { border-color: var(--primary-400); }
.timeline-item.call .timeline-dot::after { background: var(--primary-500); }
.timeline-item.wechat .timeline-dot { border-color: var(--success-400); }
.timeline-item.wechat .timeline-dot::after { background: var(--success-500); }
.timeline-item.meeting .timeline-dot { border-color: var(--warning-400); }
.timeline-item.meeting .timeline-dot::after { background: var(--warning-500); }
.timeline-item.email .timeline-dot { border-color: var(--purple-500); }
.timeline-item.email .timeline-dot::after { background: var(--purple-500); }
.timeline-item.milestone .timeline-dot {
  width: 22px;
  height: 22px;
  left: -26px;
  border-color: var(--primary);
  background: var(--primary-50);
}
.timeline-item.milestone .timeline-dot::after {
  width: 10px;
  height: 10px;
  background: var(--primary);
}
.timeline-content {
  background: var(--gray-50);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  border: 1px solid var(--gray-200);
}
.timeline-content:hover {
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  flex-wrap: wrap;
}
.timeline-title {
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--gray-800);
}
.timeline-time {
  font-size: var(--text-sm);
  color: var(--gray-500);
}
.timeline-body {
  font-size: var(--text-base);
  color: var(--gray-700);
  line-height: 1.6;
  margin-bottom: var(--space-3);
}
.timeline-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  font-size: var(--text-sm);
  color: var(--gray-500);
}
.timeline-meta .tag {
  margin: 0;
}

/* 進度條 */
.progress-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.progress-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.progress-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gray-300);
  margin-top: 3px;
  flex-shrink: 0;
}
.progress-step.active .progress-dot { background: var(--primary); }
.progress-step.completed .progress-dot { background: var(--success); }
.progress-content { flex: 1; }
.progress-title { font-weight: 600; font-size: 14px; }
.progress-meta { font-size: 12px; color: var(--gray-600); margin-top: 2px; }

/* 付款計劃 */
.payment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.payment-info { display: flex; flex-direction: column; gap: 2px; }
.payment-node { font-weight: 600; }
.payment-amount { color: var(--gray-600); font-size: 13px; }
.payment-status { font-size: 12px; padding: 2px 8px; border-radius: 12px; display: inline-block; }
.payment-status.received { background: #dcfce7; color: #166534; }
.payment-status.pending { background: #fef3c7; color: #92400e; }
.payment-status.danger { background: #fee2e2; color: #991b1b; }
.payment-status.received { background: #dcfce7; color: #166534; }
.payment-status.pending { background: #fef3c7; color: #92400e; }

/* ==================================================
   客戶詳情獨立頁面
   ================================================== */
.customer-detail-page {
  animation: pageFadeIn var(--transition-slow) ease;
}
.customer-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}
.customer-detail-header h2 {
  margin: 0;
  font-size: var(--text-2xl);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.customer-detail-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-5);
  align-items: start;
}
.customer-detail-sidebar {
  position: sticky;
  top: 80px;
}
.customer-detail-sidebar .customer-profile-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  padding: var(--space-6);
  text-align: center;
}
.customer-detail-sidebar .customer-avatar {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  margin: 0 auto var(--space-4);
}
.customer-detail-sidebar .customer-name {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-1);
}
.customer-detail-sidebar .customer-meta {
  color: var(--gray-500);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}
.customer-detail-sidebar .quick-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.customer-detail-sidebar .quick-actions .btn {
  justify-content: center;
}
.customer-detail-nav {
  margin-top: var(--space-4);
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.customer-detail-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: var(--gray-600);
  text-decoration: none;
  font-size: var(--text-base);
  border-left: 3px solid transparent;
  transition: all var(--transition-base);
}
.customer-detail-nav a:hover {
  background: var(--gray-50);
  color: var(--gray-800);
}
.customer-detail-nav a.active {
  background: var(--primary-50);
  color: var(--primary-700);
  border-left-color: var(--primary);
  font-weight: 600;
}
.customer-detail-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.customer-detail-section {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.customer-detail-section .section-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.customer-detail-section .section-header h3 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
}
.customer-detail-section .section-body {
  padding: var(--space-5);
}

/* 詳情信息網格 */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-5);
}
.info-item { display: flex; flex-direction: column; gap: var(--space-1); }
.info-item label { font-size: var(--text-sm); color: var(--gray-500); font-weight: 600; }
.info-item div { font-size: var(--text-base); color: var(--gray-800); }

/* 授權徽章 */
.auth-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.auth-yes { background: #dcfce7; color: #166534; }
.auth-no { background: #fee2e2; color: var(--danger); }

/* 知識庫 */
#knowledgeTable td:first-child { max-width: 360px; line-height: 1.8; }

/* AI 助手 */
.ai-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--gray-200);
  padding-bottom: 8px;
}
.ai-tab {
  padding: 8px 18px;
  border: 1px solid var(--gray-200);
  background: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  color: var(--gray-700);
}
.ai-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.ai-tab:hover { border-color: var(--primary); color: var(--primary); }
.ai-tab.active:hover { color: #fff; }
.ai-tool-panel {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 900px;
}
.ai-tool-panel h3 { margin: 0 0 16px; font-size: 18px; }
.ai-tool-panel .form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.ai-tool-panel .form-grid .full { grid-column: 1 / -1; }
.ai-result {
  margin-top: 20px;
  padding: 16px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  white-space: pre-wrap;
  line-height: 1.7;
}
.ai-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 13px;
  color: var(--gray-600);
}
.ai-result-body { font-size: 14px; color: var(--gray-800); }
.ai-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  height: calc(100vh - 140px);
  min-height: 500px;
}
.ai-sidebar {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-sidebar h3 { margin: 0 0 8px; font-size: 16px; }
.ai-samples { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.ai-samples button {
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-50);
  cursor: pointer;
  font-size: 13px;
  color: var(--gray-800);
}
.ai-samples button:hover { background: #eff6ff; border-color: var(--primary); color: var(--primary); }
.ai-main {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ai-chat {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: var(--gray-50);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ai-input {
  padding: 14px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 10px;
  background: #fff;
}
.ai-input input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
}
.ai-message { display: flex; }
.ai-message.ai-user { justify-content: flex-end; }
.ai-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.ai-user .ai-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.ai-assistant .ai-bubble { background: #fff; color: var(--gray-800); border: 1px solid var(--gray-200); border-bottom-left-radius: 4px; box-shadow: 0 2px 4px rgba(0,0,0,.04); }
.ai-sources {
  margin-top: 6px;
  margin-left: 4px;
  font-size: 12px;
  color: var(--gray-500);
  line-height: 1.4;
}

/* 批量導入 */
.hint { color: var(--gray-600); font-size: 13px; margin: 0 0 12px; }
.hint a { color: var(--primary); }
.import-summary { font-size: 14px; margin-bottom: 10px; }
.import-errors { list-style: none; padding: 0; margin: 0; font-size: 12px; }
.import-errors li { padding: 6px 8px; background: #fee2e2; color: var(--danger); border-radius: 4px; margin-bottom: 4px; }

/* 統計卡片擴展 */
.stat-card-orange .num { color: #ea580c; }
.stat-card-orange::after { background: #ea580c; }
.stat-card-purple .num { color: #9333ea; }
.stat-card-purple::after { background: #9333ea; }
.stat-card-green .num { color: #16a34a; }
.stat-card-green::after { background: #16a34a; }
.stat-card-blue .num { color: #2563eb; }
.stat-card-blue::after { background: #2563eb; }
.stat-card-yellow .num { color: #ca8a04; }
.stat-card-yellow::after { background: #ca8a04; }
.stat-card-pink .num { color: #db2777; }
.stat-card-pink::after { background: #db2777; }

/* 小表格 */
.table-sm { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-sm th, .table-sm td { padding: 8px; border-bottom: 1px solid var(--gray-200); text-align: left; }
.table-sm th { background: var(--gray-50); font-weight: 600; }

.full-width { grid-column: 1 / -1; }

/* A 類已成交客戶文案進程（按項目類別分組） */
.a-copywriter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.a-copywriter-header h3 { margin: 0; }
.a-copywriter-summary {
  font-size: 13px;
  color: var(--gray-500);
}
.a-copywriter-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.a-copywriter-section {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.a-copywriter-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.a-copywriter-section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 8px;
}
.a-copywriter-section-title::before {
  content: '';
  width: 4px;
  height: 16px;
  background: var(--primary);
  border-radius: var(--radius-full);
}
.a-copywriter-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-700);
  background: var(--primary-50);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}
.a-copywriter-link {
  color: var(--primary-700);
  font-weight: 600;
  text-decoration: none;
}
.a-copywriter-link:hover {
  text-decoration: underline;
}
.a-copywriter-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}
.a-copywriter-badge.badge-done {
  background: var(--success-100);
  color: var(--success-700);
}
.a-copywriter-badge.badge-pending {
  background: var(--warning-100);
  color: var(--warning-700);
}
.a-copywriter-badge.badge-none {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* 通用 UI 組件樣式 */
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}
.badge.badge-done {
  background: var(--success-100);
  color: var(--success-700);
}
.badge.badge-pending {
  background: var(--warning-100);
  color: var(--warning-700);
}
.badge.badge-none {
  background: var(--gray-100);
  color: var(--gray-600);
}
.badge.badge-warning {
  background: var(--error-100);
  color: var(--error-700);
}
.badge.badge-info {
  background: var(--primary-100);
  color: var(--primary-700);
}
.badge.badge-default {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* 簽約服務客戶進度看板 */
.stage-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-top: 12px;
}
.stage-card {
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
}
.stage-card .stage-num {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--gray-900);
}
.stage-card .stage-label {
  font-size: 12px;
  color: var(--gray-600);
  margin-top: 4px;
}
.stage-card.stage-done {
  background: var(--success-50);
  border-color: var(--success-200);
}
.stage-card.stage-done .stage-num {
  color: var(--success-700);
}
.stage-card.stage-pending {
  background: var(--warning-50);
  border-color: var(--warning-200);
}
.stage-card.stage-pending .stage-num {
  color: var(--warning-700);
}
.stage-card.stage-warning {
  background: var(--error-50);
  border-color: var(--error-200);
}
.stage-card.stage-warning .stage-num {
  color: var(--error-700);
}
.stage-card.stage-info {
  background: var(--primary-50);
  border-color: var(--primary-200);
}
.stage-card.stage-info .stage-num {
  color: var(--primary-700);
}

/* 增值服務提醒 */
.vas-reminder-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.vas-reminder {
  border-left: 3px solid var(--gray-300);
  background: var(--gray-50);
}
.vas-reminder.soon {
  border-left-color: var(--primary-500);
  background: var(--primary-50);
}
.vas-reminder.warning {
  border-left-color: var(--warning-500);
  background: var(--warning-50);
}
.vas-reminder.danger {
  border-left-color: var(--error-500);
  background: var(--error-50);
}
.vas-reminder .vas-note {
  color: var(--gray-600);
  font-size: 12px;
  margin-top: 4px;
}

@media (max-width: 768px) {
  .stage-cards {
    grid-template-columns: repeat(3, 1fr);
  }
  .a-copywriter-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .a-copywriter-section {
    padding: 12px;
  }
  .a-copywriter-section-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}

/* 內容運營工具欄 */
.content-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.content-toolbar .toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.content-toolbar .filter-group {
  margin-left: auto;
}

/* 新媒體看板 */
.nm-dashboard-card {
  grid-column: 1 / -1;
}
.nm-dashboard-card .nm-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.nm-dashboard-card .nm-stat {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.nm-dashboard-card .nm-stat .num {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}
.nm-dashboard-card .nm-stat .label {
  font-size: 12px;
  color: var(--gray-600);
  margin-top: 4px;
}
.nm-dashboard-card .nm-stat .label small {
  display: block;
  color: var(--gray-500);
  font-size: 11px;
  margin-top: 2px;
}

/* ========== UI 美觀優化 ========== */

/* 全局圓角與陰影升級 */
.card, .modal, .stat-card, .list-item, .kb-sidebar, .kb-main, .ai-main, .ai-sidebar, .ai-tool-panel {
  box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.04);
}
.card:hover, .kb-file-card:hover, .list-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
}

/* 按鈕質感升級 */
.btn {
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
  transition: all .18s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 2px 6px rgba(37,99,235,.25);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 4px 10px rgba(37,99,235,.3);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%); color: #fff; box-shadow: 0 2px 6px rgba(22,163,74,.2); }
.btn-success:hover { background: linear-gradient(180deg, #16a34a 0%, #15803d 100%); }
.btn-danger { background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%); color: #fff; box-shadow: 0 2px 6px rgba(220,38,38,.2); }
.btn-danger:hover { background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%); }

/* 頭部導航升級 */
header {
  background: linear-gradient(180deg, #fff 0%, #fafbfc 100%);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  padding: 14px 28px;
}
header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.2px;
  color: var(--gray-800);
}
.nav-item {
  padding: 8px 16px;
  border-radius: 20px;
  transition: all .15s;
}
.nav-item.active {
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  color: var(--primary);
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

/* ==================================================
   表格卡片化（移動端激活）
   ================================================== */
.table-cards table { width: 100%; border-collapse: collapse; }
.table-cards thead { display: table-header-group; }
.table-cards tbody tr { border-top: 1px solid var(--gray-200); }

@media (max-width: 768px) {
  .table-cards {
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
  }
  .table-cards table,
  .table-cards tbody,
  .table-cards tr,
  .table-cards td {
    display: block;
    width: 100%;
  }
  .table-cards thead { display: none; }
  .table-cards tbody tr {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-3);
    padding: var(--space-4);
  }
  .table-cards tbody tr:hover { background: #fff; }
  .table-cards td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
    border: none;
    font-size: var(--text-md);
    text-align: right;
  }
  .table-cards td:not(:last-child) { border-bottom: 1px solid var(--gray-100); }
  .table-cards td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--gray-500);
    font-size: var(--text-sm);
    text-align: left;
    flex-shrink: 0;
    margin-right: var(--space-3);
  }
  .table-cards td.actions {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: var(--space-2);
  }
  .table-cards td.actions::before { display: none; }
}

/* 表格升級 */
table {
  border-radius: var(--radius);
  overflow: hidden;
}
th {
  background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
  color: var(--gray-600);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .3px;
  padding: 14px 16px;
}
td { padding: 14px 16px; vertical-align: middle; }
tbody tr {
  transition: background .12s;
}
tbody tr:hover { background: #f8fafc; }
tbody tr:nth-child(even) { background: #fafbfc; }
tbody tr:nth-child(even):hover { background: #f1f5f9; }
td.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 表單與輸入框升級 */
.form-group input, .form-group select, .form-group textarea,
.toolbar input, .toolbar select, .ai-input input {
  border: 1px solid var(--gray-200);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.03);
  transition: all .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus,
.toolbar input:focus, .toolbar select:focus, .ai-input input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12), inset 0 1px 2px rgba(0,0,0,.03);
}

/* 彈窗動畫與質感 */
.modal-overlay {
  animation: fadeIn .15s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal {
  animation: slideUp .2s ease;
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(0,0,0,.14);
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal-header {
  background: linear-gradient(180deg, #fff 0%, #fafbfc 100%);
  padding: 18px 22px;
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 22px; background: #fafbfc; }

/* 看板與統計卡片升級 */
.dashboard-header h2 { font-size: 24px; font-weight: 700; }
.stat-card {
  padding: 18px;
  border-radius: 12px;
  text-align: left;
  position: relative;
}
.stat-card .num { font-size: 28px; margin-bottom: 4px; }
.stat-card .label { font-size: 13px; }
.stat-card::after { height: 4px; border-radius: 0 0 4px 4px; }
.dashboard-card {
  border-radius: 12px;
  padding: 22px;
}
.dashboard-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-100);
}

/* 標籤與徽章升級 */
.grade, .tag, .auth-badge, .payment-status {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
  font-weight: 600;
}

/* 工具欄升級 */
.toolbar {
  background: #fff;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.03);
}

/* 空狀態升級 */
.empty {
  padding: 48px;
  color: var(--gray-500);
  font-size: 14px;
  background: #fafbfc;
  border-radius: var(--radius);
}

/* 提醒面板升級 */
.reminder-panel {
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,.14);
}
.reminder-item {
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}

/* 知識庫文件卡片升級 */
.kb-file-card {
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.03);
  transition: all .15s;
}
.kb-file-card:hover {
  border-color: var(--primary);
  transform: translateX(2px);
}

/* AI 助手升級 */
.ai-tab {
  border-radius: 20px;
  padding: 8px 20px;
  transition: all .15s;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.ai-tab.active {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 4px 10px rgba(37,99,235,.25);
}
.ai-result {
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

/* 滾動條美化 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--gray-100); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* 分頁內容切換淡入 */
#page-dashboard, #page-customers, #page-users, #page-knowledge, #page-ai, #page-content {
  animation: pageFadeIn .25s ease;
}
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== 移動端適配 ========== */

/* 移動端菜單按鈕（默認桌面端隱藏） */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
}
.mobile-menu-btn span {
  display: block;
  height: 2px;
  background: var(--gray-700);
  border-radius: 1px;
}
.mobile-menu-btn.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-menu-btn.active span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* 底部導航（默認隱藏，僅移動端顯示） */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: #fff;
  border-top: 1px solid var(--gray-200);
  box-shadow: 0 -2px 10px rgba(0,0,0,.05);
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--gray-500);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  padding: 8px 4px;
  transition: color .15s;
  min-width: 0;
}
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-icon { font-size: 20px; line-height: 1; }
.bottom-nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* 移動端更多菜單 */
.mobile-more-menu {
  position: fixed;
  inset: 0;
  z-index: 110;
}
.mobile-more-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.4);
}
.mobile-more-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
  max-height: 70vh;
  overflow-y: auto;
  animation: slideUp .2s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.mobile-more-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.mobile-more-header h3 { margin: 0; font-size: 16px; }
.mobile-more-list { display: flex; flex-direction: column; gap: 4px; }
.mobile-more-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  border-radius: var(--radius);
  color: var(--gray-800);
  text-decoration: none;
  font-size: 15px;
}
.mobile-more-list a:hover { background: var(--gray-50); }

@media (max-width: 768px) {
  /* 整體佈局 */
  .container { padding: 12px; padding-bottom: 80px; }
  body { font-size: 15px; }

  /* 頭部 */
  header {
    padding: 10px 14px;
    flex-wrap: wrap;
  }
  .header-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
  }
  header h1 { font-size: 18px; }
  .header-left {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
  }
  .mobile-menu-btn { display: flex; }

  /* 導航折疊 */
  .nav {
    display: none;
    flex-direction: column;
    gap: 4px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--gray-200);
  }
  .nav.open { display: flex; }
  .nav-item {
    padding: 12px 14px;
    font-size: 15px;
  }

  .header-right {
    gap: 8px;
    font-size: 13px;
  }
  .header-right .btn-sm {
    padding: 6px 10px;
    font-size: 12px;
  }

  /* 底部導航 */
  .bottom-nav { display: flex; }

  /* 看板 */
  .dashboard-header h2 { font-size: 20px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-card .num { font-size: 22px; }
  .stat-card .label { font-size: 11px; }
  .stat-card-task { cursor: pointer; background: #fff; border: 1px solid var(--primary-200); }
  .stat-card-task .num { color: var(--primary); }
  .stat-card-reminder { border-color: var(--warning-200); }
  .stat-card-reminder .num { color: var(--warning-600); }
  .dashboard-grid { grid-template-columns: 1fr; gap: 14px; }
  .dashboard-card { padding: 16px; }
  .chart-label { width: 70px; font-size: 12px; }

  /* 客戶卡片列表（移動端） */
  .customer-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border: 0.5px solid var(--gray-200);
  }
  .customer-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
  }
  .customer-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }
  .customer-card-name { font-size: 16px; font-weight: 600; }
  .customer-card-time { font-size: 12px; color: var(--gray-500); }
  .customer-card-phone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 10px;
    padding: 8px 10px;
    background: var(--gray-50);
    border-radius: 8px;
  }
  .customer-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 10px;
  }
  .customer-card-tags { margin-bottom: 12px; }
  .customer-card-actions {
    display: flex;
    gap: 8px;
  }
  .customer-card-actions .btn {
    flex: 1;
    justify-content: center;
    min-height: 36px;
    font-size: 13px;
  }

  /* 工具欄 */
  .toolbar {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    padding: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .toolbar input, .toolbar select {
    flex-shrink: 0;
    width: auto;
    min-width: 130px;
    min-height: 40px;
    font-size: 15px;
  }
  .toolbar .btn {
    flex-shrink: 0;
    justify-content: center;
    min-height: 40px;
  }

  /* 表格橫向滾動 */
  .card:has(> table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 700px; }
  th, td {
    padding: 10px 12px;
    font-size: 13px;
    white-space: nowrap;
  }
  td.actions { white-space: normal; }

  /* 表單 */
  .form-grid { grid-template-columns: 1fr; gap: 14px; }
  .form-group input, .form-group select, .form-group textarea {
    min-height: 42px;
    font-size: 15px;
  }

  /* 彈窗 */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal {
    max-width: 100%;
    width: 100%;
    max-height: 92vh;
    border-radius: 12px 12px 0 0;
  }
  .detail-modal { max-width: 100%; }
  .modal-header { padding: 14px 16px; }
  .modal-header h3 { font-size: 16px; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; }
  .detail-actions { flex-wrap: wrap; gap: 8px; }

  /* 標籤頁 */
  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding: 0 12px;
  }
  .tab {
    white-space: nowrap;
    padding: 12px 14px;
    font-size: 14px;
  }
  .tab-panel { padding: 16px 12px; }

  /* 客戶詳情獨立頁面 */
  .customer-detail-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }
  .customer-detail-header h2 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-lg);
  }
  .customer-detail-layout {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  .customer-detail-sidebar {
    position: static;
    order: -1;
  }
  .customer-detail-sidebar .customer-profile-card {
    padding: var(--space-4);
    text-align: left;
    display: flex;
    align-items: center;
    gap: var(--space-4);
  }
  .customer-detail-sidebar .customer-avatar {
    width: 56px;
    height: 56px;
    font-size: 22px;
    margin: 0;
  }
  .customer-detail-sidebar .customer-name {
    font-size: var(--text-lg);
  }
  .customer-detail-sidebar .customer-phone-row {
    font-size: var(--text-base);
    color: var(--gray-600);
    margin-top: var(--space-1);
  }
  .customer-detail-sidebar .quick-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-3);
  }
  .customer-detail-sidebar .quick-actions .btn {
    flex: 1;
    min-width: 72px;
    justify-content: center;
    font-size: var(--text-sm);
    min-height: 40px;
  }
  .customer-detail-nav {
    display: flex;
    overflow-x: auto;
    gap: var(--space-1);
    padding: var(--space-2);
    border-radius: var(--radius-lg);
  }
  .customer-detail-nav a {
    white-space: nowrap;
    border-left: none;
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
  }
  .customer-detail-nav a.active {
    background: var(--primary-100);
    color: var(--primary-700);
  }
  .customer-detail-section .section-header {
    padding: var(--space-3) var(--space-4);
  }
  .customer-detail-section .section-body {
    padding: var(--space-4);
  }
  .timeline {
    padding-left: 22px;
  }
  .timeline-dot {
    width: 14px;
    height: 14px;
    left: -19px;
  }
  .timeline-item.milestone .timeline-dot {
    width: 18px;
    height: 18px;
    left: -21px;
  }

  /* 詳情信息 */
  .info-grid { grid-template-columns: 1fr; gap: 12px; }

  /* 提醒面板 */
  .reminder-panel {
    width: calc(100% - 24px);
    right: 12px;
    top: 58px;
    max-height: 75vh;
  }

  /* AI 助手 */
  .ai-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
  }
  .ai-tab {
    white-space: nowrap;
    padding: 8px 14px;
    font-size: 13px;
  }
  .ai-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
    gap: 14px;
  }
  .ai-sidebar { display: none; }
  .ai-main { min-height: 60vh; }
  .ai-tool-panel {
    max-width: 100%;
    padding: 16px;
  }
  .ai-tool-panel .form-grid { grid-template-columns: 1fr; }
  .ai-bubble { max-width: 85%; font-size: 14px; }
  .ai-input { padding: 10px; }
  .ai-input input { min-height: 42px; }

  /* 知識庫 */
  .kb-ima-layout {
    flex-direction: column;
    height: auto;
    min-height: auto;
    gap: 12px;
  }
  .kb-sidebar { width: 100%; max-height: 240px; }
  .kb-search input { width: 100%; }
  .kb-file-card { flex-direction: column; align-items: flex-start; gap: 10px; }

  /* 內容運營 */
  .content-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .content-toolbar .toolbar-group {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .content-toolbar .filter-group { margin-left: 0; }

  /* 列表項 */
  .list-item { padding: 12px; }
  .list-item h4 { font-size: 14px; }
  .list-item .meta { gap: 8px; }

  /* 按鈕觸控優化 */
  .btn {
    min-height: 40px;
    padding: 10px 16px;
  }
  .btn-sm { min-height: 34px; }

  /* Toast */
  .toast {
    left: 16px;
    right: 16px;
    top: auto;
    bottom: 20px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr 1fr; }
  header h1 { font-size: 16px; }
  .nav-item { padding: 10px 12px; font-size: 14px; }
}

/* ---------- 第三階段 UI 樣式 ---------- */

/* FAQ 列表 */
.faq-list { display: flex; flex-direction: column; gap: 12px; }
.faq-item {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  transition: box-shadow 0.2s;
}
.faq-item:hover { box-shadow: var(--shadow); }
.faq-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.faq-category {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  margin-right: 8px;
}
.faq-question { font-weight: 600; color: var(--gray-900); }
.faq-answer { color: var(--gray-700); line-height: 1.6; white-space: pre-wrap; }
.faq-meta {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--gray-500);
}
.faq-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* AI FAQ 速查 */
.ai-faq-list { display: flex; flex-direction: column; gap: 8px; }
.ai-faq-item {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.ai-faq-item:hover { background: var(--primary-light); transform: translateX(2px); }
.ai-faq-q { font-size: 13px; font-weight: 600; color: var(--gray-900); margin-bottom: 4px; }
.ai-faq-a { font-size: 12px; color: var(--gray-600); }

/* AI 緩存 */
#aiCacheTop .empty { padding: 12px 0; }

/* 數據字典 */
#dataDictCard .empty { text-align: center; padding: 24px; color: var(--gray-500); }

/* 日報自動預填 */
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; }
#btnAutoFillDailyReport { margin-right: auto; }

@media (max-width: 768px) {
  .faq-header { flex-direction: column; }
  .faq-actions { width: 100%; justify-content: flex-end; }
  #btnAutoFillDailyReport { margin-right: 0; }
}


/* 項目庫 */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.project-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.1s;
}
.project-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}
.project-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
.project-card-header h4 {
  margin: 0;
  font-size: 16px;
  color: var(--gray-900);
}
.project-tag {
  display: inline-block;
  padding: 3px 8px;
  background: var(--primary);
  color: #fff;
  border-radius: 12px;
  font-size: 11px;
  white-space: nowrap;
}
.project-tag.secondary {
  background: var(--gray-200);
  color: var(--gray-700);
}
.project-card-meta {
  font-size: 13px;
  color: var(--gray-600);
  margin-bottom: 12px;
}
.project-card-points {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.project-point {
  font-size: 13px;
  color: var(--gray-800);
  background: var(--gray-50);
  padding: 6px 10px;
  border-radius: var(--radius);
  border-left: 3px solid var(--success);
}
.project-card-footer {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--gray-500);
  border-top: 1px solid var(--gray-100);
  padding-top: 10px;
}
.project-detail-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.project-detail-section {
  margin-bottom: 16px;
}
.project-detail-section h4 {
  font-size: 14px;
  color: var(--gray-700);
  margin-bottom: 8px;
}
.project-detail-section p {
  margin: 0;
  color: var(--gray-800);
  line-height: 1.6;
}
.project-selling-points {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 12px;
  color: #92400e;
  line-height: 1.7;
}
.project-files {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.project-file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--gray-50);
  border-radius: var(--radius);
  color: var(--primary);
  font-size: 13px;
  text-decoration: none;
}
.project-file-link:hover {
  background: var(--gray-100);
}

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 12px; }
.faq-item {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.faq-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.faq-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  background: var(--gray-50);
}
.faq-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.faq-title span:not(.faq-q):not(.faq-category):not(.faq-inactive) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.faq-q {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--primary-100);
  color: var(--primary-700);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.faq-category {
  font-size: 12px;
  color: var(--primary-700);
  background: var(--primary-50);
  border: 1px solid var(--primary-200);
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.faq-inactive {
  font-size: 12px;
  color: var(--gray-600);
  background: var(--gray-100);
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.faq-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--gray-500);
  flex-shrink: 0;
}
.faq-views, .faq-helpful { white-space: nowrap; }
.faq-author { color: var(--gray-700); }
.faq-time { white-space: nowrap; }
.faq-toggle-icon {
  width: 20px;
  text-align: center;
  color: var(--gray-500);
}
.faq-body {
  padding: 16px;
  border-top: 1px solid var(--gray-100);
  background: #fff;
}
.faq-answer {
  color: var(--gray-800);
  line-height: 1.7;
  margin-bottom: 12px;
}
.faq-tags {
  font-size: 12px;
  color: var(--gray-600);
  margin-bottom: 12px;
}
.faq-actions {
  display: flex;
  gap: 8px;
}

.ai-faq-item {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--gray-50);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.ai-faq-item:hover { background: var(--primary-50); }
.ai-faq-q {
  font-size: 13px;
  color: var(--gray-900);
  margin-bottom: 4px;
  line-height: 1.4;
}
.ai-faq-category {
  font-size: 11px;
  color: var(--primary-600);
}

/* ==================================================
   員工工作匯報看板
   ================================================== */
.sdr-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}
.sdr-header h3 {
  margin: 0 0 4px;
  font-size: 18px;
  color: var(--gray-900);
}
.sdr-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--gray-500);
}
.sdr-filters {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.sdr-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sdr-filter label {
  font-size: 12px;
  color: var(--gray-600);
  font-weight: 500;
}
.sdr-filter input,
.sdr-filter select {
  padding: 6px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  min-width: 120px;
}
.sdr-summary {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--gray-50);
  border-radius: 8px;
}
.sdr-stat {
  flex: 1;
  text-align: center;
}
.sdr-stat-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}
.sdr-stat-label {
  font-size: 12px;
  color: var(--gray-600);
  margin-top: 4px;
}
.sdr-role-section {
  margin-bottom: 24px;
}
.sdr-role-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-200);
}
.sdr-role-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-800);
}
.sdr-role-count {
  font-size: 12px;
  color: var(--gray-500);
  background: var(--gray-100);
  padding: 2px 8px;
  border-radius: 12px;
}
.sdr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.sdr-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.1s;
}
.sdr-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}
.sdr-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
}
.sdr-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-100);
  color: var(--primary-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}
.sdr-info {
  flex: 1;
  min-width: 0;
}
.sdr-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
}
.sdr-role {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}
.sdr-card-body {
  padding: 14px 16px;
}
.sdr-section {
  margin-bottom: 12px;
}
.sdr-section:last-child {
  margin-bottom: 0;
}
.sdr-label {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 4px;
  font-weight: 500;
}
.sdr-text {
  font-size: 14px;
  color: var(--gray-800);
  line-height: 1.6;
  white-space: pre-line;
  word-break: break-word;
}
.sdr-notes {
  color: var(--gray-600);
  font-size: 13px;
}
.sdr-empty {
  font-size: 13px;
  color: var(--gray-500);
  text-align: center;
  padding: 20px 0;
}
.sdr-card-footer {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--gray-500);
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
}
.sdr-unreported {
  border-left: 4px solid var(--warning-500);
}
.sdr-reported {
  border-left: 4px solid var(--success-500);
}
@media (max-width: 768px) {
  .sdr-header {
    flex-direction: column;
  }
  .sdr-filters {
    width: 100%;
  }
  .sdr-summary {
    flex-direction: column;
    gap: 12px;
  }
  .sdr-grid {
    grid-template-columns: 1fr;
  }
}
