/* ====== CSS Variables ====== */
:root {
  --primary: #409eff;
  --primary-dark: #337ecc;
  --primary-light: #ecf5ff;
  --bg: #f5f5fb;
  --bg-white: #ffffff;
  --text: #333333;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border: #e5e7eb;
  --sidebar-width: 240px;
  --header-height: 60px;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 16px rgba(64,158,255,0.15);
  --transition: all 0.3s ease;
}

/* ====== Reset ====== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* ====== App Layout ====== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}
.main-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: var(--transition);
}
.main-content {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* ====== Sidebar ====== */
.site-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  overflow-y: auto;
}
.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.sidebar-logo i { color: var(--primary); font-size: 22px; }
.sidebar-logo img {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 6px;
}
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--text-secondary);
  font-size: 14px;
  transition: var(--transition);
  border-left: 3px solid transparent;
}
.nav-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}
.nav-item i { width: 20px; text-align: center; font-size: 15px; }
.nav-divider {
  padding: 16px 20px 6px;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sidebar-ads {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

/* ====== Header ====== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.site-header::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  z-index: -1;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  height: var(--header-height);
  max-width: 1200px;
  margin: 0 auto;
}
.header-left { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.header-search {
  flex: 1;
  max-width: 500px;
}
.sidebar-toggle {
  display: none;
  font-size: 20px;
  color: var(--text-secondary);
  padding: 8px;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}
.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), #667eea);
  border-radius: 8px;
  color: white;
  font-size: 16px;
}
.search-form { width: 100%; }
.search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 0 4px 0 16px;
  transition: var(--transition);
}
.search-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(64,158,255,0.15);
}
.search-icon { color: var(--text-muted); font-size: 14px; }
.search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 12px;
  outline: none;
  font-size: 14px;
}
.search-btn {
  padding: 6px 16px;
  background: var(--primary);
  color: white;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}
.search-btn:hover { background: var(--primary-dark); }
.header-right { display: flex; align-items: center; gap: 8px; }
.header-link {
  font-size: 22px;
  color: var(--text-secondary);
  transition: var(--transition);
}
.header-link:hover { color: var(--primary); transform: scale(1.1); }

/* ====== Hero ====== */
.home-hero {
  text-align: center;
  padding: 48px 20px 36px;
  background: linear-gradient(135deg, #667eea 0%, var(--primary) 100%);
  border-radius: 16px;
  margin-bottom: 32px;
  color: white;
}
.hero-title { font-size: 32px; font-weight: 800; margin-bottom: 12px; }
.hero-desc { font-size: 16px; opacity: 0.9; }

/* ====== Sections ====== */
.tool-section { margin-bottom: 36px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title i { color: var(--primary); }
.section-more {
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.section-more:hover { color: var(--primary); }

/* ====== Tool Grid ====== */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.tool-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  background: var(--bg-white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: var(--transition);
  color: var(--text);
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
  color: var(--text);
}
.tool-card-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tool-card-icon img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}
.tool-icon-fallback {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  border-radius: 10px;
  color: var(--primary);
  font-size: 18px;
}
.tool-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.3;
}
.tool-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tool-card-cat {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 4px;
  font-size: 11px;
}

/* ====== Tool Detail ====== */
.tool-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.tool-detail-title {
  display: flex;
  align-items: center;
  gap: 16px;
}
.tool-detail-icon {
  width: 56px;
  height: 56px;
  object-fit: contain;
}
.tool-detail-title h1 {
  font-size: 24px;
  font-weight: 700;
}
.tool-detail-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}
.tool-detail-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}
.meta-cat a {
  padding: 4px 12px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 20px;
  font-size: 13px;
}
.meta-views {
  font-size: 13px;
  color: var(--text-muted);
}
.tool-detail-layout {
  display: flex;
  gap: 24px;
}
.tool-detail-main { flex: 1; min-width: 0; }
.tool-detail-sidebar {
  flex-shrink: 0;
  width: 300px;
}
.tool-detail-body {
  background: var(--bg-white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
}

/* ====== Tool Common Styles ====== */
.tool-container { width: 100%; }
.tool-row { margin-bottom: 16px; }
.tool-label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.tool-input, .tool-textarea, .tool-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: var(--transition);
  background: var(--bg-white);
}
.tool-input:focus, .tool-textarea:focus, .tool-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(64,158,255,0.15);
}
.tool-textarea { min-height: 150px; resize: vertical; font-family: 'Courier New', monospace; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-secondary { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: #67c23a; color: white; }
.btn-danger { background: #f56c6c; color: white; }
.btn-group { display: flex; flex-wrap: wrap; gap: 8px; }
.result-box {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-family: 'Courier New', monospace;
  font-size: 14px;
  word-break: break-all;
  white-space: pre-wrap;
  min-height: 60px;
}
.tool-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}
.tool-tab {
  padding: 10px 20px;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  cursor: pointer;
}

/* Simplified / Traditional Chinese converter */
.converter-public-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  background: #fffbeb;
  color: #92400e;
}
.converter-public-notice i { margin-top: 3px; }
.converter-public-notice strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}
.converter-public-notice p {
  font-size: 12px;
  line-height: 1.65;
}
.chinese-converter-toolbar {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.converter-mode {
  padding: 8px 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
}
.converter-mode:hover { color: var(--primary); }
.converter-mode.active {
  background: var(--bg-white);
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}
.chinese-converter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.chinese-converter-grid .tool-row { min-width: 0; }
.chinese-converter-grid .tool-textarea {
  min-height: 280px;
  line-height: 1.75;
  font-family: inherit;
}
.converter-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.converter-label-row span {
  color: var(--text-muted);
  font-size: 12px;
}
.chinese-converter-actions { align-items: center; }
.converter-status {
  min-height: 20px;
  margin-left: 4px;
  color: var(--text-muted);
  font-size: 13px;
}
.converter-history {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.converter-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.converter-history-header h2 {
  margin-bottom: 4px;
  font-size: 17px;
}
.converter-history-header p {
  color: var(--text-muted);
  font-size: 12px;
}
.converter-history-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.converter-history-body {
  min-width: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}
.converter-history-body:hover { background: var(--bg); color: var(--text); }
.converter-history-meta {
  color: var(--text-muted);
  font-size: 12px;
}
.converter-history-source,
.converter-history-result {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.converter-history-result::before {
  content: "→";
  margin-right: 10px;
  color: var(--primary);
}
.converter-history-empty {
  padding: 28px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  text-align: center;
}

/* Public Chinese conversion record detail */
.conversion-record-page { max-width: 900px; margin: 0 auto; }
.conversion-record-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.conversion-record-header h1 {
  margin: 12px 0 8px;
  font-size: 28px;
}
.conversion-record-header p {
  color: var(--text-muted);
  font-size: 13px;
}
.conversion-record-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 16px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 13px;
}
.conversion-record-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.conversion-record-grid section,
.conversion-record-explanation {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-white);
}
.conversion-record-grid h2,
.conversion-record-explanation h2 {
  margin-bottom: 12px;
  font-size: 16px;
}
.conversion-record-text {
  min-height: 110px;
  line-height: 1.9;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.conversion-record-explanation {
  margin-top: 18px;
  color: var(--text-secondary);
  line-height: 1.8;
}
.conversion-record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.tool-tab:hover { color: var(--primary); }
.tool-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tool-tab-panel { display: none; }
.tool-tab-panel.active { display: block; }

/* ====== Ads ====== */
.ad-container { text-align: center; }
.ad-item { display: block; margin: 8px 0; }
.ad-item img { max-width: 100%; border-radius: var(--radius); }
.ad-text { padding: 12px; background: #fffbe6; border: 1px solid #ffe58f; border-radius: var(--radius); }
.home-ads-top, .tool-ads-top { margin-bottom: 20px; }

/* ====== Footer ====== */
.site-footer {
  padding: 24px;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg-white);
  margin-top: auto;
}
.footer-content { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px; }
.footer-text { font-size: 14px; color: var(--text-muted); }
.footer-link { font-size: 14px; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }
.footer-link:hover { color: var(--primary); }
.footer-icp { font-size: 12px; color: var(--text-muted); }
.footer-copy { font-size: 12px; color: var(--text-muted); }
.footer-ads { margin-bottom: 16px; }

/* ====== Empty State ====== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; display: block; opacity: 0.4; }
.empty-state p { font-size: 16px; }

/* ====== Category Page ====== */
.category-page { }
.category-page .section-title { margin-bottom: 20px; }
.category-tool-count {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
}

.category-intro {
  margin-bottom: 24px;
  padding: 16px 20px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
}
.category-intro p {
  margin: 0;
}

.category-faq-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.category-faq-section .section-title {
  margin-bottom: 16px;
  font-size: 18px;
}

.related-categories {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.related-categories .section-title {
  margin-bottom: 16px;
  font-size: 18px;
}
.related-cat-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.related-cat-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 24px;
  color: var(--text-secondary);
  font-size: 14px;
  text-decoration: none;
  transition: var(--transition);
}
.related-cat-card:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.related-cat-card i {
  color: var(--primary);
}

/* ====== Search Results ====== */
.search-results .section-title { margin-bottom: 20px; }

/* ====== Admin Styles ====== */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 220px;
  background: #1f2937;
  color: #e5e7eb;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.admin-sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-sidebar-header i { color: var(--primary); }
.admin-sidebar-header img {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 6px;
}
.admin-nav { flex: 1; padding: 12px 0; }
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: #9ca3af;
  font-size: 14px;
  transition: var(--transition);
}
.admin-nav-item:hover { background: rgba(255,255,255,0.05); color: white; }
.admin-nav-item.active { background: rgba(64,158,255,0.15); color: var(--primary); }
.admin-nav-item i { width: 18px; text-align: center; }
.admin-nav-section { padding: 16px 20px 6px; font-size: 11px; color: #6b7280; text-transform: uppercase; letter-spacing: 1px; }
.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: white;
  border-bottom: 1px solid var(--border);
}
.admin-header-title { font-size: 16px; font-weight: 600; }
.admin-user { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--text-secondary); }
.admin-content { flex: 1; padding: 24px; background: var(--bg); overflow-x: hidden; }

/* Admin cards & tables */
.admin-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}
.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.admin-card-title { font-size: 16px; font-weight: 600; }
.admin-card-body { padding: 20px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.stat-icon.blue { background: #dbeafe; color: #2563eb; }
.stat-icon.green { background: #d1fae5; color: #059669; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.orange { background: #fed7aa; color: #ea580c; }
.stat-value { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 13px; color: var(--text-muted); }

.admin-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.admin-info-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
}
.admin-info-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.admin-info-value {
  font-weight: 600;
  word-break: break-all;
}
.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
}
.admin-table-wrap .admin-table { min-width: 640px; }
.admin-empty { color: var(--text-muted); }
.admin-code-block {
  white-space: pre-wrap;
  word-break: break-all;
  background: #f6f8fa;
  padding: 12px;
  border-radius: var(--radius);
}

/* Admin table */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.admin-table tr:hover td { background: #fafafa; }
.admin-table .actions { display: flex; gap: 8px; }
.admin-table .actions a, .admin-table .actions button {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 4px;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.badge-success { background: #d1fae5; color: #059669; }
.badge-danger { background: #fee2e2; color: #dc2626; }
.badge-info { background: #dbeafe; color: #2563eb; }

/* Admin form */
.admin-form .form-group { margin-bottom: 16px; }
.admin-form label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.admin-form input[type="text"],
.admin-form input[type="email"],
.admin-form input[type="password"],
.admin-form input[type="number"],
.admin-form input[type="datetime-local"],
.admin-form input[type="url"],
.admin-form textarea,
.admin-form select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: var(--transition);
}
.admin-form input:focus, .admin-form textarea:focus, .admin-form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(64,158,255,0.15);
}
.admin-form .form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.admin-form .form-actions { display: flex; gap: 10px; padding-top: 16px; }
.featured-tool-admin-list { display: grid; gap: 10px; }
.featured-tool-admin-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.featured-tool-order {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 12px;
  font-weight: 700;
}
.featured-tool-actions { display: flex; gap: 6px; margin-left: auto; }
.featured-tool-actions form { margin: 0; }
.featured-tool-actions .btn { min-width: 36px; padding: 7px 10px; }
.featured-tool-actions .btn:disabled { cursor: not-allowed; opacity: .45; }
.site-logo-setting { display: flex; align-items: center; gap: 20px; }
.site-logo-preview {
  width: 112px;
  height: 112px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--bg);
}
.site-logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.site-logo-placeholder { color: var(--text-muted); font-size: 32px; }
.site-logo-controls { flex: 1; min-width: 0; }
.site-logo-controls input[type="file"] { width: 100%; max-width: 480px; }
.site-logo-remove { display: inline-flex !important; align-items: center; gap: 6px; margin-top: 12px; font-weight: 400 !important; }

/* Admin pagination */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 16px 0; }
.pagination a, .pagination span {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--primary); color: white; border-color: var(--primary); }

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea, var(--primary));
}
.login-card {
  width: 400px;
  background: white;
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.login-card h1 {
  text-align: center;
  margin-bottom: 8px;
  font-size: 24px;
}
.login-card .login-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 14px;
}
.login-card .form-group { margin-bottom: 20px; }
.login-card label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.login-card input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
}
.login-card input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(64,158,255,0.15);
}
.login-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 16px; }
.login-error {
  background: #fee2e2;
  color: #dc2626;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
  text-align: center;
}
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #d1fae5; color: #059669; }
.alert-error { background: #fee2e2; color: #dc2626; }

/* ====== Responsive ====== */
@media (max-width: 1024px) {
  .tool-detail-sidebar { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .site-sidebar {
    transform: translateX(-100%);
  }
  .site-sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open { display: block; }
  .main-area { margin-left: 0 !important; }
  .sidebar-toggle { display: block; }
  .main-content { padding: 16px; }
  .hero-title { font-size: 24px; }
  .hero-desc { font-size: 14px; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-detail-title h1 { font-size: 18px; }
  .chinese-converter-grid { grid-template-columns: 1fr; }
  .chinese-converter-grid .tool-textarea { min-height: 220px; }
  .converter-history-header { align-items: flex-start; flex-direction: column; }
  .converter-history-item { flex-direction: column; }
  .converter-history-body {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .converter-history-result::before { margin-right: 6px; }
  .conversion-record-header h1 { font-size: 22px; }
  .conversion-record-grid { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
  .admin-header { padding: 0 16px; }
  .admin-content { padding: 16px; }
  .stat-grid { grid-template-columns: 1fr; }
  .admin-form-grid { grid-template-columns: 1fr; }
  .admin-form .form-actions { flex-wrap: wrap; }
  .featured-tool-admin-item { align-items: flex-start; flex-wrap: wrap; }
  .featured-tool-actions { width: 100%; margin-left: 36px; }
  .site-logo-setting { align-items: flex-start; flex-direction: column; }
  .login-card { width: 90%; padding: 24px; }
  .header-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 16px;
    gap: 8px;
  }
  .header-left {
    order: 1;
  }
  .header-right {
    order: 2;
    margin-left: auto;
    gap: 8px;
  }
  .header-search {
    order: 3;
    flex-basis: 100%;
    max-width: 100%;
  }
  .logo-text { display: none; }
}

/* ====== Language Switcher ====== */
.lang-switcher {
  position: relative;
  margin-right: 12px;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: var(--transition);
}

.lang-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.lang-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 100px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition);
  z-index: 1000;
}

.lang-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: block;
  padding: 8px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  transition: var(--transition);
}

.lang-option:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.lang-option.active {
  color: var(--primary);
  font-weight: 600;
}

/* ====== Friend Links ====== */
.friend-links {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.friend-links a {
  display: inline-block;
  margin: 4px 12px 4px 0;
  font-size: 13px;
  text-decoration: none;
  transition: var(--transition);
  opacity: 0.85;
}
.friend-links a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* ====== Article Styles ====== */
.article-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--text-muted);
}
.article-breadcrumb a {
  color: var(--text-secondary);
}
.article-breadcrumb a:hover {
  color: var(--primary);
}
.article-breadcrumb .separator {
  color: var(--text-muted);
}

.article-detail {
  max-width: 800px;
}

.article-content {
  background: var(--bg-white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 32px;
  margin-bottom: 32px;
}

.article-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 16px;
  color: var(--text);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
}
.article-meta .meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.article-meta .meta-item i {
  color: var(--primary);
}

.article-tool-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--primary-light);
  border-radius: var(--radius);
  margin-bottom: 24px;
}
.article-tool-card .tool-card-icon {
  width: 44px;
  height: 44px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
}
.article-tool-card .tool-card-info {
  flex: 1;
}
.article-tool-card .tool-card-info h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--text);
}
.article-tool-card .tool-card-info p {
  font-size: 13px;
  color: var(--text-muted);
}
.article-tool-card .btn {
  flex-shrink: 0;
}

.article-body {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
}
.article-body h2 {
  font-size: 20px;
  font-weight: 700;
  margin-top: 32px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
}
.article-body h3 {
  font-size: 17px;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 12px;
}
.article-body p {
  margin-bottom: 16px;
}
.article-body ul, .article-body ol {
  margin-bottom: 16px;
  padding-left: 24px;
}
.article-body li {
  margin-bottom: 8px;
}
.article-body strong {
  color: var(--text);
}

.article-cta {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.article-cta .btn-lg {
  padding: 14px 32px;
  font-size: 16px;
}

.related-articles {
  margin-top: 32px;
}
.related-articles .section-title {
  margin-bottom: 20px;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.article-card {
  display: flex;
  gap: 14px;
  padding: 18px;
  background: var(--bg-white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: var(--transition);
  color: var(--text);
  text-decoration: none;
}
.article-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
  color: var(--text);
}
.article-card-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  border-radius: 10px;
  color: var(--primary);
  font-size: 18px;
}
.article-card-info {
  flex: 1;
  min-width: 0;
}
.article-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}
.article-card-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.article-card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.article-list-page {
  max-width: 1000px;
}
.article-list-desc {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ====== Homepage Articles Section ====== */
.homepage-articles {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.homepage-articles .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.homepage-articles .section-more {
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.homepage-articles .section-more:hover {
  color: var(--primary);
}

/* ====== Tool Related Articles ====== */
.tool-related-articles {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.tool-related-articles .section-title {
  margin-bottom: 16px;
  font-size: 18px;
}

/* ====== Tool Breadcrumb ====== */
.tool-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.tool-breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}
.tool-breadcrumb a:hover {
  color: var(--primary);
}
.tool-breadcrumb .separator {
  color: var(--text-muted);
  font-size: 12px;
}

/* ====== How to Use ====== */
.tool-how-to {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.tool-how-to .section-title {
  margin-bottom: 16px;
  font-size: 18px;
}
.how-to-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.step-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
}
.step-item p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  padding-top: 3px;
}

/* ====== Related Tools Section ====== */
.related-tools-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.related-tools-section .section-title {
  margin-bottom: 16px;
  font-size: 18px;
}

.article-list-compact {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.article-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: var(--transition);
}
.article-list-item:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--text);
}
.article-list-item i:first-child {
  color: var(--primary);
  font-size: 14px;
  flex-shrink: 0;
}
.article-list-title {
  flex: 1;
  font-size: 14px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.article-list-meta {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.article-list-arrow {
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
}

/* ====== Tool FAQ Section ====== */
.tool-faq-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.tool-faq-section .section-title {
  margin-bottom: 16px;
  font-size: 18px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
}
.faq-item:hover {
  border-color: var(--primary);
}
.faq-item[open] {
  border-color: var(--primary);
  background: var(--primary-light);
}

.faq-question {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.faq-question::-webkit-details-marker {
  display: none;
}
.faq-question::marker {
  display: none;
  content: '';
}

.faq-arrow {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.faq-item[open] .faq-arrow {
  transform: rotate(90deg);
  color: var(--primary);
}

.faq-answer {
  padding: 0 16px 14px 38px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
}
.faq-answer p {
  margin: 0;
}
