/* ============================================
   WebTools — 企业级配色 (Enterprise Slate)
   Primary: #1E40AF  (Blue-800)
   Accent:  #3B82F6  (Blue-500)
   Slate gray backgrounds, professional blue accents
   Calm, restrained, trustworthy — built for business
   ============================================ */

/* ========== 动画 ========== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========== 亮色主题（默认） ========== */
:root {
  /* 主色 — 商务深蓝 */
  --primary: #1E40AF;
  --primary-dark: #1E3A8A;
  --primary-light: #DBEAFE;
  --primary-glow: rgba(30, 64, 175, 0.12);
  /* 辅助色 */
  --accent: #3B82F6;
  --accent-dark: #2563EB;
  --accent-light: #EFF6FF;
  --accent-glow: rgba(59, 130, 246, 0.10);

  /* 背景 — 石板灰层次 */
  --bg: #F1F5F9;           /* slate-100 */
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8FAFC; /* slate-50 */
  --bg-sidebar: #0F172A;    /* slate-900 */
  --bg-header: rgba(255, 255, 255, 0.92);
  --bg-subtle: #F8FAFC;     /* slate-50 */

  /* 文字 */
  --text: #0F172A;          /* slate-900 */
  --text-light: #475569;    /* slate-600 */
  --text-muted: #94A3B8;    /* slate-400 */
  --text-white: #F1F5F9;

  /* 边框 */
  --border: #E2E8F0;       /* slate-200 */
  --border-light: #F1F5F9;  /* slate-100 */
  --border-dark: #CBD5E1;   /* slate-300 */

  /* 阴影 — 克制、扁平 */
  --shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.04), 0 1px 3px 0 rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-hover: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.10), 0 8px 10px -6px rgba(15, 23, 42, 0.06);

  /* 圆角 — 适度、不过大 */
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;

  /* 过渡 */
  --transition: all 0.2s ease;

  /* 字体 */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

/* ========== 亮色显式声明 ========== */
[data-theme="light"] {
  --primary: #1E40AF;
  --primary-dark: #1E3A8A;
  --primary-light: #DBEAFE;
  --primary-glow: rgba(30, 64, 175, 0.12);
  --accent: #3B82F6;
  --accent-dark: #2563EB;
  --accent-light: #EFF6FF;
  --accent-glow: rgba(59, 130, 246, 0.10);
  --bg: #F1F5F9;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8FAFC;
  --bg-sidebar: #0F172A;
  --bg-header: rgba(255, 255, 255, 0.92);
  --bg-subtle: #F8FAFC;
  --text: #0F172A;
  --text-light: #475569;
  --text-muted: #94A3B8;
  --text-white: #F1F5F9;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --border-dark: #CBD5E1;
  --shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.04), 0 1px 3px 0 rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-hover: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.10), 0 8px 10px -6px rgba(15, 23, 42, 0.06);
}

/* ========== 暗色主题 ========== */
[data-theme="dark"] {
  --primary: #60A5FA;
  --primary-dark: #3B82F6;
  --primary-light: #1E3A8A;
  --primary-glow: rgba(96, 165, 250, 0.15);
  --accent: #93C5FD;
  --accent-dark: #60A5FA;
  --accent-light: #0F172A;
  --accent-glow: rgba(147, 197, 253, 0.10);
  --bg: #0F172A;
  --bg-card: #1E293B;       /* slate-800 */
  --bg-card-hover: #334155;  /* slate-700 */
  --bg-sidebar: #020617;     /* slate-950 */
  --bg-header: rgba(15, 23, 42, 0.92);
  --bg-subtle: #1E293B;
  --text: #E2E8F0;           /* slate-200 */
  --text-light: #94A3B8;     /* slate-400 */
  --text-muted: #64748B;     /* slate-500 */
  --text-white: #F1F5F9;
  --border: #334155;         /* slate-700 */
  --border-light: #1E293B;
  --border-dark: #475569;
  --shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.3), 0 1px 3px 0 rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

/* ========== Reset ========== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}
a:hover { color: var(--primary-dark); }

img { max-width: 100%; }

/* ========== 滚动条 ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ========== 粒子（隐藏，企业风格不需要） ========== */
.particle { display: none !important; }
body::before { display: none !important; }

/* ========== 顶部导航 ========== */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-header);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.header-logo .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ========== 主题切换按钮 ========== */
.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-light);
  width: 36px;
  height: 36px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--transition);
}
.theme-toggle:hover {
  background: var(--bg-subtle);
  border-color: var(--border-dark);
  color: var(--text);
}

/* ========== 搜索框 ========== */
.search-box {
  position: relative;
}
.search-box input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 14px 7px 34px;
  border-radius: 7px;
  outline: none;
  width: 220px;
  font-size: 0.84rem;
  transition: var(--transition);
}
.search-box input::placeholder { color: var(--text-muted); }
.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  width: 280px;
}
.search-box .search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* ========== 主体布局 ========== */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px;
  position: relative;
  z-index: 1;
}

/* ========== Hero 区域 ========== */
.hero {
  text-align: center;
  padding: 40px 24px 36px;
  position: relative;
  animation: fadeInUp 0.4s ease;
}
.hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}
.hero p {
  color: var(--text-light);
  font-size: 1rem;
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ========== 快捷统计 ========== */
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.hero-stat {
  text-align: center;
}
.hero-stat .num {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}
.hero-stat .label {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* ========== 页面标题 ========== */
.page-title {
  text-align: center;
  margin-bottom: 36px;
  animation: fadeInUp 0.4s ease;
}
.page-title h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}
.page-title p {
  color: var(--text-light);
  font-size: 1rem;
}

/* ========== 公告条 ========== */
.announcement-bar {
  background: var(--primary);
  color: #fff;
  padding: 10px 20px;
  text-align: center;
  font-size: 0.84rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  animation: fadeIn 0.3s ease;
}

/* ========== 工具卡片网格 ========== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.tool-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: block;
  color: var(--text);
  text-decoration: none;
  animation: fadeInUp 0.4s ease;
}
.tool-card:nth-child(2) { animation-delay: 0.05s; }
.tool-card:nth-child(3) { animation-delay: 0.1s; }
.tool-card:nth-child(4) { animation-delay: 0.15s; }
.tool-card:nth-child(5) { animation-delay: 0.2s; }
.tool-card:nth-child(6) { animation-delay: 0.25s; }

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: var(--transition);
}

.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-dark);
  color: var(--text);
}
.tool-card:hover::before {
  transform: scaleX(1);
}

.tool-card .card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 16px;
  transition: var(--transition);
  color: var(--primary);
}
.tool-card:hover .card-icon {
  background: var(--primary);
  color: #fff;
}

.tool-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

.tool-card p {
  color: var(--text-light);
  font-size: 0.84rem;
  line-height: 1.6;
  margin-bottom: 14px;
}

.tool-card .card-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-ready { background: var(--primary-light); color: var(--primary-dark); }
.badge-beta { background: #FEF3C7; color: #92400E; }
.badge-dev { background: #F1F5F9; color: #475569; }

[data-theme="dark"] .badge-ready { background: rgba(59, 130, 246, 0.15); color: #93C5FD; }
[data-theme="dark"] .badge-beta { background: rgba(251, 191, 36, 0.12); color: #FBBF24; }
[data-theme="dark"] .badge-dev { background: rgba(148, 163, 184, 0.12); color: #94A3B8; }

.tool-card .card-arrow {
  position: absolute;
  right: 18px;
  bottom: 18px;
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: var(--transition);
}
.tool-card:hover .card-arrow {
  color: var(--primary);
  transform: translateX(3px);
}

/* ========== 分类标题 ========== */
.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.section-title .icon {
  color: var(--primary);
}

/* ========== 工具页面容器 ========== */
.tool-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  animation: fadeInUp 0.4s ease;
}

.tool-container .tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.tool-container .tool-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

.tool-container .tool-header .tool-source {
  font-size: 0.82rem;
  color: var(--text-light);
}
.tool-container .tool-header .tool-source a {
  color: var(--primary);
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--border-dark);
  background: var(--bg-subtle);
}

.btn-danger {
  background: #DC2626;
  color: #fff;
  border: 1px solid #DC2626;
}
.btn-danger:hover { background: #B91C1C; border-color: #B91C1C; color: #fff; }

.btn-success {
  background: #059669;
  color: #fff;
  border: 1px solid #059669;
}
.btn-success:hover { background: #047857; border-color: #047857; color: #fff; }

.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ========== 文件上传区域 ========== */
.upload-zone {
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius);
  padding: 44px 24px;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
  background: var(--bg-subtle);
  position: relative;
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-zone .upload-icon {
  font-size: 2.5rem;
  margin-bottom: 14px;
}
.upload-zone p { color: var(--text-light); margin-bottom: 4px; }
.upload-zone .upload-hint { font-size: 0.78rem; color: var(--text-muted); }
.upload-zone input[type="file"] { display: none; }

/* ========== 表单 ========== */
.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 0.84rem;
}
.form-group .hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-family: var(--font);
  background: var(--bg-card);
  color: var(--text);
  transition: var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-control::placeholder { color: var(--text-muted); }

select.form-control {
  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 12px center;
  padding-right: 32px;
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

/* ========== 颜色选择器 ========== */
input[type="color"] {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  padding: 4px;
}
input[type="color"]:hover { border-color: var(--primary); }

/* ========== 表格 ========== */
.table-wrapper {
  overflow-x: auto;
  margin: 16px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

table th {
  background: var(--bg-subtle);
  padding: 10px 16px;
  text-align: left;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

table tr:hover td {
  background: var(--bg-subtle);
}

table tr:last-child td {
  border-bottom: none;
}

/* ========== 信息面板 ========== */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.info-item {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid var(--border);
  transition: var(--transition);
}
.info-item:hover {
  border-color: var(--border-dark);
}

.info-item .info-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-item .info-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  word-break: break-all;
}

/* ========== 状态消息 ========== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeIn 0.3s ease;
}
.alert-success { background: #ECFDF5; color: #065F46; border-left: 3px solid #059669; }
.alert-error { background: #FEF2F2; color: #991B1B; border-left: 3px solid #DC2626; }
.alert-info { background: #EFF6FF; color: #1E40AF; border-left: 3px solid var(--primary); }
.alert-warning { background: #FFFBEB; color: #92400E; border-left: 3px solid #D97706; }

[data-theme="dark"] .alert-success { background: rgba(5, 150, 105, 0.12); color: #6EE7B7; }
[data-theme="dark"] .alert-error { background: rgba(220, 38, 38, 0.12); color: #FCA5A5; }
[data-theme="dark"] .alert-info { background: rgba(59, 130, 246, 0.12); color: #93C5FD; }
[data-theme="dark"] .alert-warning { background: rgba(217, 119, 6, 0.12); color: #FCD34D; }

/* ========== 空状态 ========== */
.empty-state {
  text-align: center;
  padding: 44px 24px;
  color: var(--text-light);
}
.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 14px;
  opacity: 0.35;
}
.empty-state p { font-size: 0.9rem; }

/* ========== 加载动画 ========== */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 24px auto;
}

/* ========== 分页 ========== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 24px;
}
.pagination a,
.pagination span {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text);
  transition: var(--transition);
}
.pagination a:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.pagination .active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ========== 面包屑导航 ========== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--border-dark); }

/* ========== 模态框 ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 560px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  transform: scale(0.96) translateY(8px);
  transition: var(--transition);
}
.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.modal-close:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ========== 标签/Tabs ========== */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
}
.tab {
  padding: 9px 18px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.84rem;
  color: var(--text-light);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}
.tab:hover { color: var(--primary); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ========== 后台管理 ========== */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 240px;
  background: var(--bg-sidebar);
  padding: 20px 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.admin-sidebar .sidebar-header {
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 12px;
}

.admin-sidebar .sidebar-header h2 {
  color: #F1F5F9;
  font-size: 1.05rem;
  font-weight: 700;
}

.admin-sidebar .sidebar-header p {
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.76rem;
  margin-top: 3px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.84rem;
  font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #F1F5F9;
}
.sidebar-nav a.active {
  background: rgba(59, 130, 246, 0.1);
  color: #60A5FA;
  border-left-color: #3B82F6;
}

.admin-content {
  margin-left: 240px;
  flex: 1;
  padding: 28px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}
.admin-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
}

/* ========== 统计卡片 ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.stat-card:hover {
  border-color: var(--border-dark);
  box-shadow: var(--shadow-md);
}
.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
}
.stat-card .stat-label {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ========== Hex编辑器 ========== */
.hex-viewer {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.7;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 14px;
  overflow-x: auto;
  border: 1px solid var(--border);
  max-height: 400px;
  overflow-y: auto;
}
.hex-viewer .hex-offset {
  color: var(--text-muted);
  margin-right: 16px;
  user-select: none;
}
.hex-viewer .hex-bytes {
  color: var(--primary);
  margin-right: 16px;
}
.hex-viewer .hex-ascii {
  color: var(--text-light);
}

/* ========== 烧录日志终端 ========== */
.terminal {
  background: #0F172A;
  color: #93C5FD;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.8;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  border: 1px solid #334155;
}

/* ========== 进度条 ========== */
.progress-bar {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar .progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ========== 最近更新时间线 ========== */
.timeline {
  position: relative;
  padding-left: 24px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  margin-bottom: 18px;
  padding-left: 16px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-card);
}
.timeline-item .time {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.timeline-item .desc {
  font-size: 0.84rem;
  color: var(--text-light);
}

/* ========== 页脚 ========== */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.footer a {
  color: var(--text-light);
}
.footer a:hover { color: var(--primary); }

/* ========== Toast消息 ========== */
.toast-container {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 260px;
}
.toast-success { background: #059669; }
.toast-error { background: #DC2626; }
.toast-info { background: var(--primary); }
.toast-warning { background: #D97706; }

/* ========== 预设模板卡片 ========== */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.preset-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: var(--transition);
}
.preset-card:hover {
  border-color: var(--primary);
  background: var(--bg-card);
}
.preset-card h4 {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.preset-card p {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* ========== 设置页面表单 ========== */
.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.settings-section h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}
.settings-row label {
  font-weight: 600;
  font-size: 0.84rem;
  padding-top: 9px;
}
.settings-row .hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.color-preview {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  vertical-align: middle;
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 1px var(--border);
}

/* ========== 设备连接卡片 ========== */
.device-connect-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: 32px;
  overflow: hidden;
  animation: fadeInUp 0.4s ease;
}

.dcc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.dcc-title-area {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dcc-title-area .dcc-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.dcc-title-area h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.dcc-title-area p {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.dcc-body {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.dcc-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
}
.dcc-baud {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dcc-baud label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.form-control-sm {
  padding: 6px 10px;
  font-size: 0.8rem;
  width: 110px;
}

/* 设备信息面板 */
.device-info-panel {
  flex: 1;
  min-width: 200px;
}
.device-info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}
.di-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  min-width: 60px;
}
.di-value {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.di-value.mono { font-family: var(--font-mono); }
.di-ok { color: #059669; }
.di-warn { color: #D97706; }
.di-muted { color: var(--text-muted); }
.device-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* 设备状态标签 */
.device-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 600;
}
.device-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-connected {
  background: #10B981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.08); }
}
.dot-disconnected {
  background: var(--text-muted);
}
.dot-unsupported {
  background: #EF4444;
}
.tag-connected {
  background: #ECFDF5;
  color: #065F46;
}
.tag-disconnected {
  background: var(--bg-subtle);
  color: var(--text-muted);
}
.tag-unsupported {
  background: #FEF2F2;
  color: #991B1B;
}
[data-theme="dark"] .tag-connected { background: rgba(5, 150, 105, 0.15); color: #6EE7B7; }
[data-theme="dark"] .tag-unsupported { background: rgba(220, 38, 38, 0.15); color: #FCA5A5; }

/* ========== 串口监视器 ========== */
.serial-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.serial-meta {
  display: flex;
  gap: 20px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  flex-wrap: wrap;
}

/* 配置区 */
.serial-config {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 16px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.serial-cfg-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.serial-cfg-group label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.serial-cfg-btns {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* 主工作区 */
.serial-workspace {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  margin-bottom: 16px;
}

/* 接收区 */
.serial-receive-area {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-card);
}
.serial-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}
.serial-toolbar-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}
.serial-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.serial-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
  color: var(--text-light);
  cursor: pointer;
  white-space: nowrap;
}
.serial-toggle input[type="checkbox"],
.serial-toggle input[type="radio"] {
  accent-color: var(--primary);
}
.serial-view-mode {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.btn-tab {
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 600;
  border: none;
  background: var(--bg-card);
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
}
.btn-tab:hover { background: var(--bg-subtle); color: var(--text); }
.btn-tab.active {
  background: var(--primary);
  color: #fff;
}

/* 接收输出区 */
.serial-output {
  flex: 1;
  min-height: 360px;
  max-height: 520px;
  overflow-y: auto;
  padding: 12px;
  background: #0F172A;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.7;
}
.serial-placeholder {
  color: #64748B;
  text-align: center;
  padding: 60px 0;
  font-size: 0.84rem;
}
.serial-placeholder-sm {
  color: var(--text-muted);
  font-size: 0.76rem;
  padding: 8px 0;
  text-align: center;
}
.serial-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 1px 0;
  word-break: break-all;
}
.serial-ts {
  color: #475569;
  font-size: 0.7rem;
  flex-shrink: 0;
  white-space: nowrap;
}
.serial-hex {
  color: #93C5FD;
}
.serial-ascii {
  color: #E2E8F0;
}
.serial-ascii-inline {
  color: #64748B;
  margin-left: 8px;
  border-left: 1px solid #334155;
  padding-left: 8px;
}

/* 发送区 */
.serial-send-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: var(--bg-card);
}
.serial-send-header {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}
.serial-send-type {
  display: flex;
  gap: 16px;
}
.serial-send-input {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  min-height: 80px;
  resize: vertical;
}
.serial-send-options {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.76rem;
}
.serial-interval-input {
  font-size: 0.76rem;
}
.serial-send-btns {
  display: flex;
  gap: 8px;
}

/* 发送历史 */
.serial-history {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
}
.serial-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.serial-history-list {
  max-height: 120px;
  overflow-y: auto;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.74rem;
}
.history-item:hover {
  background: var(--bg-subtle);
}
.history-time {
  color: var(--text-muted);
  font-size: 0.7rem;
  white-space: nowrap;
}
.history-mode {
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.64rem;
  font-weight: 700;
}
.badge-ascii { background: var(--primary-light); color: var(--primary-dark); }
.badge-hex { background: #FEF3C7; color: #92400E; }
.history-text {
  color: var(--text-light);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* 快速命令 */
.serial-quick-cmds {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
}
.quick-cmd-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.quick-cmd-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.quick-cmd-btn:hover {
  background: var(--primary);
  color: #fff;
}
.quick-cmd-del {
  font-size: 0.9rem;
  opacity: 0.5;
  line-height: 1;
}
.quick-cmd-del:hover { opacity: 1; }
.quick-cmd-add {
  display: flex;
  gap: 6px;
}

/* 统计条 */
.serial-stats-bar {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-card);
}
.serial-stat {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 10px 16px;
  border-right: 1px solid var(--border);
  font-size: 0.78rem;
}
.serial-stat:last-child { border-right: none; }
.ss-label {
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.4px;
}
.ss-value {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
}
.ss-unit {
  color: var(--text-muted);
  font-size: 0.7rem;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .header { padding: 0 16px; height: 52px; }
  .search-box input { width: 140px; }
  .search-box input:focus { width: 180px; }
  .main { padding: 20px 16px; }
  .hero { padding: 28px 16px 24px; }
  .hero h1 { font-size: 1.7rem; }
  .page-title h1 { font-size: 1.5rem; }
  .tools-grid { grid-template-columns: 1fr; }
  .tool-container { padding: 20px; }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .admin-sidebar { width: 56px; }
  .admin-sidebar .sidebar-header h2,
  .admin-sidebar .sidebar-header p,
  .sidebar-nav a span { display: none; }
  .admin-content { margin-left: 56px; padding: 20px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .hero-stats { gap: 20px; }
  .settings-row { grid-template-columns: 1fr; }
  .settings-row label { padding-top: 0; }
  .dcc-body { flex-direction: column; align-items: stretch; }
  .dcc-actions { flex-wrap: wrap; }
  .dcc-baud { flex: 1; }
  .form-control-sm { width: 100%; }
  .serial-workspace { grid-template-columns: 1fr; }
  .serial-config { gap: 8px; }
  .serial-cfg-btns { margin-left: 0; width: 100%; }
  .serial-stats-bar { flex-wrap: wrap; }
  .serial-stat { flex: 1 1 50%; border-bottom: 1px solid var(--border); }
  .serial-stat:nth-child(3), .serial-stat:nth-child(4) { border-bottom: none; }
  .serial-stat:nth-child(odd) { border-right: 1px solid var(--border); }
  .serial-output { min-height: 280px; }
}

@media (max-width: 480px) {
  .info-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .admin-content { padding: 16px; }
  .header-logo span { display: none; }
  .hero h1 { font-size: 1.4rem; }
  .hero-stats { flex-direction: column; gap: 12px; }
}

/* ========== 打印样式 ========== */
@media print {
  .header, .footer, .admin-sidebar, .theme-toggle, .search-box, .particle { display: none; }
  body::before { display: none; }
  .admin-content { margin-left: 0; }
  .tool-card { break-inside: avoid; }
}
