*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #6366f1; --primary-hover: #4f46e5; --primary-light: #e0e7ff; --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --success: #10b981; --success-light: #d1fae5; --warning: #f59e0b; --warning-light: #fef3c7;
  --info: #3b82f6; --info-light: #dbeafe; --danger: #ef4444; --danger-light: #fee2e2;
  --bg: #0f172a; --card-bg: #1e293b; --sidebar-bg: #1e293b; --sidebar-text: #cbd5e1; --hover-bg: #334155;
  --text: #f1f5f9; --text-light: #94a3b8; --border: #334155; --radius: 12px; --radius-lg: 16px; --radius-sm: 8px;
  --shadow: 0 4px 6px -1px rgba(0,0,0,.3), 0 2px 4px -2px rgba(0,0,0,.2); 
  --shadow-hover: 0 10px 15px -3px rgba(0,0,0,.4), 0 4px 6px -4px rgba(0,0,0,.2);
  --shadow-card: 0 1px 3px 0 rgba(0,0,0,.3), 0 1px 2px -1px rgba(0,0,0,.2);
  --transition: .25s cubic-bezier(.4,0,.2,1);
  --green: #10b981; --red: #ef4444; --orange: #f59e0b;
  --primary-alpha: rgba(99,102,241,0.08);
}
body {
  --primary: #6366f1; --primary-hover: #4f46e5; --primary-light: #e0e7ff; --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --success: #10b981; --success-light: #d1fae5; --warning: #f59e0b; --warning-light: #fef3c7;
  --info: #3b82f6; --info-light: #dbeafe; --danger: #ef4444; --danger-light: #fee2e2;
  --bg: #0f172a; --card-bg: #1e293b; --sidebar-bg: #1e293b; --sidebar-text: #cbd5e1; --hover-bg: #334155;
  --text: #f1f5f9; --text-light: #94a3b8; --border: #334155;
}
body[data-theme="midnight"] {
  --primary: #6366f1 !important; --primary-hover: #4f46e5 !important; --primary-light: #e0e7ff !important; --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
  --bg: #0f172a !important; --card-bg: #1e293b !important; --sidebar-bg: #1e293b !important; --sidebar-text: #cbd5e1 !important; --hover-bg: #334155 !important;
  --text: #f1f5f9 !important; --text-light: #94a3b8 !important; --border: #334155 !important;
}
body[data-theme="deep-space"] {
  --primary: #8b5cf6 !important; --primary-hover: #7c3aed !important; --primary-light: #ede9fe !important; --primary-gradient: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%) !important;
  --bg: #0a0a0f !important; --card-bg: #12121a !important; --sidebar-bg: #12121a !important; --sidebar-text: #9ca3af !important; --hover-bg: #27272a !important;
  --text: #f9fafb !important; --text-light: #9ca3af !important; --border: #27272a !important;
}
body[data-theme="forest"] {
  --primary: #10b981 !important; --primary-hover: #059669 !important; --primary-light: #d1fae5 !important; --primary-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  --bg: #064e3b !important; --card-bg: #065f46 !important; --sidebar-bg: #065f46 !important; --sidebar-text: #a7f3d0 !important; --hover-bg: #065f46 !important;
  --text: #f0fdf4 !important; --text-light: #6ee7b7 !important; --border: #047857 !important;
}
body[data-theme="ocean"] {
  --primary: #3b82f6 !important; --primary-hover: #2563eb !important; --primary-light: #dbeafe !important; --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
  --bg: #0c4a6e !important; --card-bg: #075985 !important; --sidebar-bg: #075985 !important; --sidebar-text: #7dd3fc !important; --hover-bg: #0369a1 !important;
  --text: #f0f9ff !important; --text-light: #7dd3fc !important; --border: #0369a1 !important;
}
body[data-theme="light"] {
  --primary: #6366f1 !important; --primary-hover: #4f46e5 !important; --primary-light: #e0e7ff !important; --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
  --success: #10b981 !important; --warning: #f59e0b !important; --info: #3b82f6 !important; --danger: #ef4444 !important;
  --bg: #f8fafc !important; --card-bg: #ffffff !important; --sidebar-bg: #ffffff !important; --sidebar-text: #475569 !important; --hover-bg: #f1f5f9 !important;
  --text: #1e293b !important; --text-light: #64748b !important; --border: #e2e8f0 !important;
}
body[data-theme="red"] {
  --primary: #C41E3A !important; --primary-hover: #A01830 !important; --primary-light: #FDE8ED !important; --primary-gradient: linear-gradient(135deg, #C41E3A 0%, #E63946 100%) !important;
  --bg: #1A0A0A !important; --card-bg: #2D1015 !important; --sidebar-bg: #2D1015 !important; --sidebar-text: #E8B4B8 !important; --hover-bg: #3D1C1C !important;
  --text: #FFF0F0 !important; --text-light: #D4A5A5 !important; --border: #5C2028 !important;
}
.message-error {
  background: var(--danger-light);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--danger);
  font-size: 13px;
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--card-bg);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
  transition: background var(--transition);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }
.app { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; border-right: 1px solid var(--border); }
.sidebar-header { padding: 28px 24px; border-bottom: 1px solid var(--border); }
.logo-container {
  position: relative;
  width: 50px;
  height: 50px;
  margin-bottom: 12px;
}
.logo-emoji {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  z-index: 1;
  filter: drop-shadow(0 0 12px rgba(99, 102, 241, 0.8));
  animation: logoFloat 3s ease-in-out infinite;
}
@keyframes logoFloat {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.1); }
}
.logo-ring {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(99, 102, 241, 0.3);
  border-radius: 50%;
  animation: ringPulse 3s ease-in-out infinite;
}
@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 0.3; }
}
.sidebar-header h2 { font-size: 20px; font-weight: 700; background: var(--primary-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 4px; }
.sidebar-header .subtitle { font-size: 12px; color: rgba(255,255,255,.4); font-weight: 400; }
.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.sidebar-nav .nav-section { padding: 10px 24px 6px; font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(255,255,255,.3); font-weight: 600; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; padding: 12px 24px; color: var(--sidebar-text); text-decoration: none; font-size: 14px; font-weight: 500; transition: var(--transition); border-left: 3px solid transparent; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(99,102,241,.1); border-left-color: var(--primary); color: #fff; }
.sidebar-nav a .nav-icon { font-size: 18px; width: 22px; text-align: center; }
.sidebar-nav a .nav-text { flex: 1; text-align: left; }
.main { margin-left: 260px; flex: 1; min-height: 100vh; }
.topbar { background: var(--card-bg); padding: 16px 32px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow-card); }
.topbar h1 { font-size: 22px; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.notif-dropdown { position: relative; }
.notif-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.15);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.notif-trigger:hover { background: rgba(99, 102, 241, 0.15); }
.notif-bell { font-size: 18px; }
.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
  box-shadow: 0 0 0 2px var(--card-bg);
}
.notif-menu {
  width: 336px;
  max-height: 420px;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.notif-menu .dropdown-header {
  flex-shrink: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.notif-list {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}
.notif-list::-webkit-scrollbar { width: 10px; }
.notif-list::-webkit-scrollbar-track { background: var(--border); border-radius: 5px; }
.notif-list::-webkit-scrollbar-thumb { background: var(--text-light); border-radius: 5px; border: 2px solid var(--card-bg); }
.notif-list::-webkit-scrollbar-thumb:hover { background: var(--primary); }
.notif-list { scrollbar-width: thin; scrollbar-color: var(--text-light) var(--border); }
.notif-item {
  display: flex; align-items: flex-start;
  gap: 10px; padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.notif-item:last-child { border-bottom: none; }
.notif-item.is-read { opacity: 0.5; }
.notif-item.is-read:hover { opacity: 0.75; }
.notif-item:hover { background: rgba(99, 102, 241, 0.04); }
.notif-mark-read {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all var(--transition);
}
.notif-mark-read:hover { background: rgba(99, 102, 241, 0.25); }
.btn-mark-all-read {
  background: none; border: 1px solid var(--primary);
  color: var(--primary); font-size: 11px;
  padding: 2px 8px; border-radius: 4px;
  cursor: pointer; transition: all var(--transition);
}
.btn-mark-all-read:hover { background: var(--primary); color: #fff; }
.btn-clear-all {
  background: none; border: 1px solid #ef4444;
  color: #ef4444; font-size: 11px;
  padding: 2px 8px; border-radius: 4px;
  cursor: pointer; transition: all var(--transition);
}
.btn-clear-all:hover { background: #ef4444; color: #fff; }
.notif-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  margin-top: 6px; flex-shrink: 0;
}
.notif-status-running .notif-status-dot { background: #3b82f6; }
.notif-status-done .notif-status-dot { background: #22c55e; }
.notif-status-paused .notif-status-dot { background: #f59e0b; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.notif-source { font-size: 10px; font-weight: 500; padding: 2px 6px; border-radius: 4px; background: var(--border); color: var(--text-light); flex-shrink: 0; }
.notif-source.source-auto { background: rgba(99,102,241,0.15); color: var(--primary); }
.notif-source.source-manual { background: rgba(16,185,129,0.15); color: #22c55e; }
.notif-desc { font-size: 11px; color: var(--text-light); margin-bottom: 2px; }
.notif-time { font-size: 10px; color: var(--text-light); }
.user-dropdown {
  position: relative;
}
.user-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 24px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  cursor: pointer;
  transition: all var(--transition);
}
.user-trigger:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.3);
}
.user-icon { font-size: 16px; }
.user-name { font-size: 13px; font-weight: 500; color: var(--sidebar-text); }
.dropdown-arrow {
  font-size: 10px;
  color: var(--text-light);
  transition: transform var(--transition);
}
.user-dropdown:hover .dropdown-arrow,
.user-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 280px;
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-hover);
  overflow: hidden;
  z-index: 1000;
  animation: dropdownFadeIn 0.2s ease;
}
@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.user-avatar {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: var(--primary-gradient);
  border-radius: 50%;
}
.user-info {
  flex: 1;
}
.user-info .username {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.user-info .role {
  display: block;
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}
.dropdown-divider {
  height: 1px;
  background: var(--border);
}
.dropdown-section {
  padding: 12px 16px;
}
.section-title {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.theme-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.theme-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
}
.theme-btn:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.3);
}
.theme-btn.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--primary);
}
.theme-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.theme-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  cursor: pointer;
  transition: background var(--transition);
}
.dropdown-item:hover {
  background: rgba(99, 102, 241, 0.1);
}
.item-icon { font-size: 16px; }
.item-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.logout-item:hover {
  background: rgba(239, 68, 68, 0.1);
}
.logout-item .item-text {
  color: #ef4444;
}
.content { padding: 28px 32px; }
.detail-nav-bar {
  position: sticky;
  z-index: 40;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.detail-nav-divider {
  color: var(--border);
  font-size: 18px;
  user-select: none;
}
.detail-nav-title {
  font-size: 13px;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.page { display: none; }
.page.active { display: block; }
.card { background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 24px; margin-bottom: 24px; border: 1px solid var(--border); transition: var(--transition); }
.card:hover { box-shadow: var(--shadow-hover); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-header h3 { font-size: 18px; font-weight: 600; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; margin-bottom: 28px; }
.stat-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 20px; display: flex; align-items: center; gap: 16px; transition: var(--transition); border: 1px solid var(--border); }
.stat-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.stat-icon { width: 50px; height: 50px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
.stat-icon.red { background: linear-gradient(135deg, rgba(239,68,68,.15) 0%, rgba(239,68,68,.05) 100%); color: #ef4444; }
.stat-icon.green { background: linear-gradient(135deg, rgba(16,185,129,.15) 0%, rgba(16,185,129,.05) 100%); color: #10b981; }
.stat-icon.blue { background: linear-gradient(135deg, rgba(59,130,246,.15) 0%, rgba(59,130,246,.05) 100%); color: #3b82f6; }
.stat-icon.orange { background: linear-gradient(135deg, rgba(245,158,11,.15) 0%, rgba(245,158,11,.05) 100%); color: #f59e0b; }
.stat-icon.purple { background: linear-gradient(135deg, rgba(139,92,246,.15) 0%, rgba(139,92,246,.05) 100%); color: #8b5cf6; }
.stat-info .stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat-info .stat-label { font-size: 13px; color: var(--text-light); margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }
.table-wrap { overflow-x: auto; overflow-y: visible; background: var(--card-bg); border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-card); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th, table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border); }
table th { font-weight: 600; color: var(--text-light); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; background: rgba(99,102,241,.05); position: sticky; top: 0; overflow: visible; z-index: 10; }
table tbody tr { transition: var(--transition); }
table tbody tr:hover { background: rgba(99,102,241,.08); }
table tbody tr:last-child td { border-bottom: none; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 16px; font-size: 12px; font-weight: 600; }
.badge-red { background: rgba(239,68,68,.15); color: #ef4444; }
.badge-green { background: rgba(16,185,129,.15); color: #10b981; }
.badge-blue { background: rgba(59,130,246,.15); color: #3b82f6; }
.badge-orange { background: rgba(245,158,11,.15); color: #f59e0b; }
.badge-purple { background: rgba(139,92,246,.15); color: #8b5cf6; }
.badge-gray { background: rgba(148,163,184,.15); color: #94a3b8; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border: none; border-radius: var(--radius); font-size: 13px; font-weight: 600; cursor: pointer; transition: var(--transition); text-decoration: none; position: relative; overflow: hidden; }
.btn::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,.1) 0%, transparent 50%); opacity: 0; transition: opacity var(--transition); }
.btn:hover::before { opacity: 1; }
.btn-primary { background: var(--primary-gradient); color: #fff; box-shadow: 0 4px 14px 0 rgba(99,102,241,.4); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px 0 rgba(99,102,241,.5); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: rgba(255,255,255,.05); border-color: var(--primary); color: var(--primary); }
.btn-outline.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-xs { padding: 4px 10px; font-size: 11px; border-radius: var(--radius-sm); }
.key-row { display:flex; align-items:center; gap:8px; margin-bottom:4px; font-size:12px }
.key-row code { flex:1; padding:4px 8px; background:rgba(255,255,255,.08); border-radius:4px; word-break:break-all }
.btn-success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); color: #fff; box-shadow: 0 4px 14px 0 rgba(16,185,129,.3); }
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 6px 20px 0 rgba(16,185,129,.4); }
.btn-info { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); color: #fff; box-shadow: 0 4px 14px 0 rgba(59,130,246,.3); }
.btn-info:hover { transform: translateY(-1px); box-shadow: 0 6px 20px 0 rgba(59,130,246,.4); }
.btn-warning { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: #fff; box-shadow: 0 4px 14px 0 rgba(245,158,11,.3); }
.btn-warning:hover { transform: translateY(-1px); box-shadow: 0 6px 20px 0 rgba(245,158,11,.4); }
.btn-danger { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); color: #fff; }
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 6px 20px 0 rgba(239,68,68,.4); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 24px; }
.pagination button { padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); cursor: pointer; font-size: 13px; font-weight: 500; transition: var(--transition); color: var(--text); }
.pagination button:hover { background: rgba(99,102,241,.1); border-color: var(--primary); }
.pagination button.active { background: var(--primary-gradient); color: #fff; border-color: var(--primary); box-shadow: 0 4px 14px 0 rgba(99,102,241,.4); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }
.pagination-right { display: flex; align-items: center; gap: 16px; margin-left: 16px; }
.pagination-info { font-size: 13px; color: var(--text-light); white-space: nowrap; }
.th-with-tip { position: relative; overflow: visible; }
.tip-icon { cursor: pointer; color: var(--primary); font-style: normal; font-size: 13px; margin-left: 2px; position: relative; display: inline-block; }
.tip-icon .tip-popup {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #f1f5f9;
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  pointer-events: none;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
}
.tip-icon .tip-popup::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: #1e293b;
}
.tip-icon:hover .tip-popup { display: block; }
.pagination-size-wrap { position: relative; }
.pagination-size-select {
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: var(--transition);
}
.pagination-size-select:hover { border-color: var(--primary); }
.pagination-size-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.2); }
.pagination-size-select option { background: var(--card-bg); color: var(--text); }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.form-group input, .form-group textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; transition: var(--transition); background: rgba(0,0,0,.2); color: var(--text); }
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.2); }
.form-group select { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; transition: var(--transition); background: var(--card-bg); color: var(--text); cursor: pointer; appearance: auto; }
.form-group select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.2); }
.form-group select option { background: var(--card-bg); color: var(--text); }
.form-group textarea { resize: vertical; min-height: 100px; font-family: inherit; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.filter-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-bar input, .filter-bar select { padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--card-bg); color: var(--text); }
.filter-bar select option { background: var(--card-bg); color: var(--text); }
.filter-bar input:focus, .filter-bar select:focus { outline: none; border-color: var(--primary); }
.filter-bar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.filter-bar-right .pagination-size-select { margin-left: 0; }
.loading { text-align: center; padding: 60px; color: var(--text-light); }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; top: 24px; right: 24px; padding: 14px 20px; border-radius: var(--radius); color: #fff; font-size: 14px; z-index: 9999; animation: slideIn .3s cubic-bezier(.4,0,.2,1); box-shadow: var(--shadow-hover); }
.alert-success { background: rgba(16,185,129,.15); color: #10b981; border: 1px solid rgba(16,185,129,.3); }
.alert-error { background: rgba(239,68,68,.15); color: #ef4444; border: 1px solid rgba(239,68,68,.3); }
.toast-success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.toast-error { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.empty-state { text-align: center; padding: 60px; color: var(--text-light); }
.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; opacity: .5; }
.empty-state h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 14px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-item { padding: 12px 16px; background: rgba(0,0,0,.1); border-radius: var(--radius); }
.detail-item .detail-label { font-size: 12px; color: var(--text-light); text-transform: uppercase; letter-spacing: .5px; }
.detail-item .detail-value { font-size: 15px; font-weight: 600; margin-top: 4px; }
.gene-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 20px; border-left: 4px solid var(--primary); margin-bottom: 16px; border: 1px solid var(--border); }
.gene-card.complete { border-left-color: var(--success); }
.gene-card .gene-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.gene-card .gene-header h4 { font-size: 16px; font-weight: 600; }
.gene-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.gene-item { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; background: rgba(0,0,0,.15); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.gene-item .gene-label { font-size: 11px; color: var(--text-light); text-transform: uppercase; letter-spacing: .5px; }
.gene-item .gene-value { font-size: 14px; font-weight: 600; }
.gene-item .gene-value.empty { color: #64748b; font-style: italic; font-weight: 400; }
.chart-bar-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.chart-bar-label { width: 120px; font-size: 13px; text-align: right; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-light); }
.chart-bar { flex: 1; height: 24px; background: rgba(0,0,0,.2); border-radius: var(--radius-sm); overflow: hidden; }
.chart-bar-fill { height: 100%; background: var(--primary-gradient); border-radius: var(--radius-sm); transition: width .6s cubic-bezier(.4,0,.2,1); display: flex; align-items: center; padding-left: 10px; }
.chart-bar-count { font-size: 12px; color: #fff; font-weight: 600; }
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 24px; background: rgba(0,0,0,.1); padding: 4px; border-radius: var(--radius); width: fit-content; }
.tab-btn { padding: 12px 24px; background: none; border: none; font-size: 14px; font-weight: 500; cursor: pointer; color: var(--text-light); border-radius: calc(var(--radius) - 4px); transition: var(--transition); }
.tab-btn.active { color: #fff; background: var(--primary-gradient); font-weight: 600; box-shadow: 0 4px 12px rgba(99,102,241,.3); }
.tab-btn:hover:not(.active) { color: var(--text); background: rgba(255,255,255,.05); }
.rank-change-up { color: #10b981; font-weight: 600; }
.rank-change-down { color: #ef4444; font-weight: 600; }
.code-block { background: rgba(0,0,0,.3); color: #e2e8f0; padding: 20px; border-radius: var(--radius); font-family: 'JetBrains Mono', 'Consolas', monospace; font-size: 13px; overflow-x: auto; white-space: pre-wrap; border: 1px solid var(--border); }
input::placeholder, textarea::placeholder { color: #64748b; }
.login-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg);
}
.login-bg-gradient {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(59, 130, 246, 0.06) 0%, transparent 40%);
  animation: gradientShift 8s ease infinite;
}
@keyframes gradientShift {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}
.login-bg-grid {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(99, 102, 241, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: gridMove 20s linear infinite;
}
@keyframes gridMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(60px, 60px); }
}
.login-wrapper {
  position: relative;
  z-index: 10;
  padding: 24px;
}
.login-card {
  width: 420px;
  max-width: 90vw;
  background: color-mix(in srgb, var(--card-bg) 85%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 40px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.25),
    0 0 80px rgba(99, 102, 241, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.login-card:hover {
  transform: translateY(-4px);
  box-shadow: 
    0 30px 60px -15px rgba(0, 0, 0, 0.3),
    0 0 100px rgba(99, 102, 241, 0.12);
}
.login-header {
  text-align: center;
  margin-bottom: 32px;
}
.logo-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.logo-icon {
  font-size: 56px;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.6));
  animation: logoPulse 2s ease-in-out infinite;
}
@keyframes logoPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.logo-glow {
  position: absolute;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, transparent 70%);
  border-radius: 50%;
  animation: glowPulse 2s ease-in-out infinite;
}
@keyframes glowPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 0.8; }
}
.login-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.login-subtitle {
  font-size: 13px;
  color: var(--text-light);
  font-weight: 400;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-input-group {
  position: relative;
}
.login-input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  background: color-mix(in srgb, var(--card-bg) 60%, transparent);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 12px;
  font-size: 14px;
  color: var(--text);
  transition: all 0.3s ease;
}
.login-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  background: color-mix(in srgb, var(--card-bg) 80%, transparent);
}
.login-input::placeholder {
  color: var(--text-light);
}
.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--text-light);
  pointer-events: none;
}
.login-error {
  color: #ef4444;
  font-size: 13px;
  text-align: center;
  padding: 10px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.login-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}
.login-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(99, 102, 241, 0.5);
}
.login-btn:active:not(:disabled) {
  transform: translateY(0);
}
.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn-loading {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-loading .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.login-footer {
  margin-top: 24px;
  text-align: center;
}
.footer-text {
  font-size: 12px;
  color: var(--text-light);
}

.ai-float-btn {
  position: fixed;
  right: 24px;
  bottom: 28px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(99,102,241,.35);
  transition: transform .2s, box-shadow .2s;
  border: none;
}
.ai-float-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(99,102,241,.5);
}
.ai-drawer-overlay {
  position: fixed;
  top: 0;
  left: 260px;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,.4);
  z-index: 250;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn .2s ease;
}
.ai-drawer {
  width: 60%;
  min-width: 440px;
  height: 100%;
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  animation: slideInRight .25s ease;
  box-shadow: -4px 0 24px rgba(0,0,0,.3);
}
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.ai-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ai-drawer-header h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}
.ai-drawer-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ai-drawer-controls select {
  flex: 1;
  min-width: 0;
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color .2s, box-shadow .2s;
}
.ai-drawer-controls select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.2);
}
.ai-drawer-controls select option {
  background: var(--card-bg);
  color: var(--text);
}
.source-article-preview {
  max-height: 500px;
  overflow-y: auto;
  background: var(--bg);
  padding: 16px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
  color: var(--text);
  border: 1px solid var(--border);
  margin: 0 16px;
}

.ai-drawer-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.ai-drawer-input {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--card-bg);
}
.ai-drawer-input textarea {
  flex: 1;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  resize: none;
  font-family: inherit;
  min-height: 64px;
  max-height: 150px;
  background: var(--bg);
  color: var(--text);
}
.ai-drawer-input .btn {
  white-space: nowrap;
  align-self: flex-end;
}

/* 一键写作 */
.one-click-overlay { z-index: 250; }
.one-click-drawer {
  width: 92vw !important;
  max-width: 1400px;
  min-width: 700px;
}
.one-click-body {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  min-height: 0;
}
.one-click-settings {
  width: 300px;
  flex-shrink: 0;
  padding: 16px 20px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--card-bg);
}
.one-click-model-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: var(--bg);
}
.one-click-model-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
}
.one-click-model-item:hover {
  background: var(--hover-bg);
}
.one-click-model-item.active {
  background: var(--primary);
  color: #fff;
}
.one-click-model-item.active > div:last-child {
  flex: 1;
}
.one-click-model-item.active > div:last-child > div:last-child {
  opacity: 0.8;
}
.one-click-results {
  width: 280px;
  flex-shrink: 0;
  padding: 16px 12px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--card-bg);
}
.one-click-result-card {
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.one-click-result-card:hover {
  border-color: var(--primary);
  transform: translateX(-1px);
}
.one-click-result-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
  background: var(--primary);
  color: #fff;
}
.one-click-result-card.active > div:first-child {
  color: rgba(255,255,255,0.8);
}
.one-click-result-card.error {
  border-left: 3px solid #ef4444;
}
.one-click-result-card.active.error {
  background: #ef4444;
}
.one-click-result-card.selected {
  border-color: #ef4444;
  background: rgba(239,68,68,0.06);
}
.one-click-result-card.selected.active {
  border-color: #ef4444;
  background: var(--primary);
}
.one-click-detail {
  flex: 1;
  padding: 16px 20px;
  overflow-y: auto;
  min-width: 0;
}
.one-click-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 768px) {
  .ai-float-btn { right: 12px; bottom: 16px; width: 44px; height: 44px; font-size: 20px; }
  .ai-drawer-overlay { left: 0; }
  .ai-drawer { width: 100vw; max-width: 100vw; }
  .one-click-drawer { min-width: 100vw; }
  .one-click-body { flex-direction: column; }
  .one-click-settings, .one-click-results { width: 100%; border-right: none; border-bottom: 1px solid var(--border); max-height: 30vh; }
}

/* Markdown 全屏预览 */
.md-preview-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.6); z-index: 300;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .2s ease;
}
.md-preview-container {
  width: 90vw; max-width: 960px; height: 90vh;
  background: var(--card-bg); border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  display: flex; flex-direction: column; overflow: hidden;
}
.md-preview-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.md-preview-body {
  flex: 1; overflow-y: auto; padding: 20px 28px;
  font-size: 14px; line-height: 1.8; color: var(--text);
  word-break: break-word;
  min-height: 0;
}
.md-preview-body h1 { font-size: 1.6em; margin: 0.8em 0 0.4em; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.md-preview-body h2 { font-size: 1.35em; margin: 0.7em 0 0.35em; }
.md-preview-body h3 { font-size: 1.15em; margin: 0.6em 0 0.3em; }
.md-preview-body p { margin: 0.5em 0; }
.md-preview-body ul, .md-preview-body ol { padding-left: 1.5em; margin: 0.4em 0; }
.md-preview-body li { margin: 0.2em 0; }
.md-preview-body code {
  background: var(--bg); padding: 2px 6px; border-radius: 4px;
  font-size: 0.9em; font-family: 'Consolas','Monaco',monospace;
}
.md-preview-body pre {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px 18px; overflow-x: auto;
  margin: 0.6em 0; font-size: 0.88em;
}
.md-preview-body pre code { background: none; padding: 0; }
.md-preview-body blockquote {
  border-left: 3px solid var(--primary); margin: 0.5em 0;
  padding: 6px 16px; color: var(--text-light); background: var(--bg);
  border-radius: 0 6px 6px 0;
}
.md-preview-body table { border-collapse: collapse; width: 100%; margin: 0.5em 0; }
.md-preview-body th, .md-preview-body td {
  border: 1px solid var(--border); padding: 8px 12px; text-align: left;
}
.md-preview-body th { background: var(--bg); font-weight: 600; }
.md-preview-body a { color: var(--primary); }
.md-preview-body img { max-width: 100%; border-radius: 6px; }
.md-preview-body hr { border: none; border-top: 1px solid var(--border); margin: 1em 0; }

.gene-dist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.gene-dist-card {
  overflow: hidden;
}

.gene-dist-card .card-header {
  padding-bottom: 12px;
}

.gene-dist-card .card-header h3 {
  font-size: 15px;
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .gene-dist-grid { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .content { padding: 16px; }
  .topbar { padding: 14px 16px; }
  .login-card {
    padding: 28px 24px;
    border-radius: 20px;
  }
}

/* ===== Modal Overlay Styles ===== */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 80px;
  z-index: 1000;
  overflow-y: auto;
}
.modal-content {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity:0; transform:translateY(-12px); } to { opacity:1; transform:translateY(0); } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h4 { font-size: 16px; margin: 0; }
.modal-body {
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
}
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}
@media (max-width: 768px) {
  .modal-overlay { padding: 40px 12px 12px; }
  .modal-content { border-radius: var(--radius-sm); }
  .login-title {
    font-size: 22px;
  }
}
