:root {
  --primary: #1a6fd6;
  --primary-light: #e8f3ff;
  --accent: #f59e0b;
  --danger: #ef4444;
  --success: #10b981;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0,0,0,0.06);
  --firm-color: #b8860b;
}

* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
}

/* ====== 顶部主导航 ====== */
.app-header {
  height: 64px; background: linear-gradient(135deg, #1a3a6e, #2a5298);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
  /* 定位上下文：sticky 本身即为定位元素（position ≠ static），
     可作为 .top-nav 绝对定位的包含块（等效于 position:relative），
     同时保留顶栏吸顶能力（最小变更，不破坏既有行为） */
  position: sticky; top: 0; z-index: 100; color: #fff;
}
.brand { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.brand .logo { font-size: 28px; }
.brand-text { display: flex; flex-direction: column; }
.firm-name { font-size: 16px; font-weight: 700; letter-spacing: 1px; }
.app-name { font-size: 12px; opacity: .8; margin-top: 2px; }

/* 桌面端：绝对定位 + 相对 .app-header 水平居中（left:50% + translate(-50%,-50%)），
   品牌 .brand 仍在左（flex 文档流首位），导航不占文档流、不与品牌争位 */
.top-nav {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; gap: 4px;
}
.top-nav a {
  color: rgba(255,255,255,.85); text-decoration: none; padding: 8px 16px;
  border-radius: 8px; font-size: 14px; font-weight: 500; transition: .15s;
}
.top-nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.top-nav a.active { background: rgba(255,255,255,.2); color: #fff; }

.header-right { display: flex; align-items: center; gap: 12px; }

/* ====== 布局 ====== */
.app-body { display: flex; min-height: calc(100vh - 64px - 40px); }

.sidebar {
  width: 260px; background: var(--card-bg); border-right: 1px solid var(--border);
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
  position: sticky; top: 64px; height: calc(100vh - 64px - 40px); overflow-y: auto;
}
.sidebar-user { margin-bottom: 4px; }

.search-box input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  outline: none; font-size: 14px;
}
.search-box input:focus { border-color: var(--primary); }

.tool-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-group-title {
  font-size: 11px; color: var(--text-muted); padding: 8px 12px 4px;
  font-weight: 600; letter-spacing: 0.5px;
}
.tool-nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  text-decoration: none; color: var(--text); font-size: 13px; transition: .15s;
}
.tool-nav a:hover { background: var(--primary-light); color: var(--primary); }
.tool-nav a.active { background: var(--primary); color: #fff; }
.tool-nav .icon { width: 20px; text-align: center; }

.sidebar-footer { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--border); }

.content { flex: 1; padding: 24px; max-width: 1100px; margin: 0 auto; width: 100%; }

.app-footer {
  height: 40px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; font-size: 12px; color: var(--text-muted);
  border-top: 1px solid var(--border); background: var(--card-bg);
}
.footer-version { opacity: .6; }

/* ====== 首页 ====== */
.hero { text-align: center; padding: 32px 20px 16px; }
.hero h2 { margin: 0 0 8px; font-size: 28px; color: var(--primary); }
.hero p { color: var(--text-muted); margin: 0; font-size: 14px; }

.quick-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px; margin: 20px 0;
}
.quick-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; cursor: pointer; transition: .15s; text-align: center;
  box-shadow: var(--shadow);
}
.quick-card:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: 0 8px 28px rgba(0,0,0,0.1); }
.qc-icon { font-size: 36px; margin-bottom: 8px; }
.qc-title { font-weight: 600; font-size: 16px; }
.qc-desc { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.cat-section { margin-top: 30px; }
.cat-section h3 { color: var(--text); margin: 0 0 16px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.cat-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; display: flex; align-items: center; gap: 8px; cursor: pointer; transition: .15s;
}
.cat-card:hover { border-color: var(--primary); background: var(--primary-light); }
.cat-icon { font-size: 24px; }

/* ====== 工具详情 ====== */
.tool-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
}
.tool-header .icon { font-size: 36px; color: var(--primary); }
.tool-header h2 { margin: 0; font-size: 22px; }
.tool-header .back { font-size: 14px; color: var(--primary); cursor: pointer; }
.cat-tag { font-size: 12px; background: var(--primary-light); color: var(--primary); padding: 2px 10px; border-radius: 12px; }

.cat-block { margin-bottom: 30px; }
.cat-block h3 { color: var(--text); margin: 0 0 12px; padding-bottom: 6px; border-bottom: 2px solid var(--primary-light); }

.tool-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px;
}
.tool-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); cursor: pointer; transition: .15s;
  display: flex; flex-direction: column; gap: 8px;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(0,0,0,0.1); border-color: var(--primary); }
.tool-card .icon { font-size: 32px; color: var(--primary); }
.tool-card .title { font-weight: 600; font-size: 15px; }
.tool-card .desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* ====== 通用组件 ====== */
.panel {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 14px; color: var(--text); font-weight: 500; }
.form-group label .tip { color: var(--text-muted); font-weight: 400; font-size: 12px; margin-left: 4px; }
.form-group input, .form-group select, .form-group textarea {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none;
  font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); }
.form-group small { color: var(--text-muted); font-size: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border: none; border-radius: 8px; font-size: 14px; cursor: pointer; transition: .15s;
  background: var(--primary); color: #fff; font-weight: 500;
}
.btn:hover { opacity: .85; }
.btn-secondary { background: #f3f4f6; color: var(--text); }
.btn-secondary:hover { background: #e5e7eb; }
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-group { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

.result-box {
  background: var(--primary-light); border-left: 4px solid var(--primary); border-radius: 8px;
  padding: 16px; margin-top: 20px;
}
.result-box h4 { margin: 0 0 10px; color: var(--primary); }
.result-line { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed rgba(0,0,0,0.08); }
.result-line:last-child { border-bottom: none; }
.result-line strong { color: var(--primary); font-size: 18px; }

.table-wrap { overflow-x: auto; margin-top: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
th { background: var(--primary-light); color: var(--primary); }
tr:nth-child(even) { background: #fafafa; }

/* ====== 导航页 ====== */
.nav-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 12px; }
.nav-card {
  display: block; background: #fafbfc; border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; text-decoration: none; color: var(--text); position: relative; transition: .15s;
}
.nav-card:hover { background: var(--primary-light); border-color: var(--primary); transform: translateY(-2px); }
.nav-name { font-weight: 600; font-size: 15px; color: var(--primary); }
.nav-url { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.nav-desc { font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.4; }
.nav-go { position: absolute; right: 12px; top: 12px; color: var(--primary); font-size: 12px; }

/* ====== 全网搜索 ====== */
.hot-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.hot-tag {
  background: var(--primary-light); color: var(--primary);
  padding: 6px 14px; border-radius: 16px; font-size: 13px; cursor: pointer; transition: .15s;
}
.hot-tag:hover { background: var(--primary); color: #fff; }

/* ====== 会员管理 ====== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 16px 0; }
.stat-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 20px; text-align: center;
}
.stat-num { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.badge {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: #f3f4f6; color: var(--text-muted);
}
.badge-admin { background: var(--firm-color); color: #fff; margin-left: 4px; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #991b1b; }

/* ====== LPR 管理 ====== */
.lpr-admin .rates-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.lpr-admin .rate-item { display: flex; gap: 8px; align-items: center; }
.lpr-admin .rate-item input { flex: 1; }
.lpr-admin .rate-item .del { color: var(--danger); cursor: pointer; font-size: 18px; font-weight: bold; }
.admin-hint { font-size: 12px; color: var(--accent); margin-left: 8px; }

.hidden { display: none; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 60px; margin-bottom: 16px; opacity: .6; }

@media (max-width: 768px) {
  .sidebar { position: fixed; left: -260px; top: 64px; bottom: 40px; z-index: 90; transition: .2s; }
  .sidebar.open { left: 0; }
  .content { padding: 16px; }
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .app-header { padding: 0 12px; flex-wrap: wrap; height: auto; padding: 8px 12px; }
  .firm-name { font-size: 14px; }
  /* 移动端：取消绝对定位（position:static; transform:none; left/top:auto），
     导航回到文档流，宽度占满一行、水平居中，避免小屏错位；
     与桌面端规则不冲突：本断点内覆盖 position/transform/left/top，断点外仍走绝对定位居中 */
  .top-nav {
    position: static; left: auto; top: auto; transform: none;
    width: 100%; justify-content: center; margin-top: 8px;
  }
  .top-nav a { padding: 6px 10px; font-size: 13px; }
}

/* ====== 模态框 ====== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-box {
  background: #fff; border-radius: var(--radius); padding: 28px;
  max-width: 560px; width: 100%; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  text-align: left;
}
.modal-box h2 { margin-top: 0; color: var(--primary); }
.modal-box .form-group { margin-bottom: 14px; }
.modal-box textarea { min-height: 100px; }

/* ====== 反馈表单 ====== */
.feedback-box { border-top: 4px solid var(--primary); }
.feedback-box textarea { resize: vertical; }

/* ====== 免责声明 ====== */
.disclaimer-box { border-top: 4px solid var(--firm-color); max-width: 640px; }
.disclaimer-content { max-height: 50vh; overflow-y: auto; padding: 12px; background: #f9fafb; border-radius: 8px; margin: 12px 0; }
.disclaimer-content p { margin: 8px 0; line-height: 1.7; }
.disclaimer-content ol { margin: 8px 0; }
.disclaimer-content li { margin: 6px 0; line-height: 1.7; }


/* ====== Footer 链接 ====== */
.footer-links { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.footer-links a { color: rgba(255,255,255,0.8); text-decoration: none; font-size: 13px; transition: .15s; }
.footer-links a:hover { color: #fff; text-decoration: underline; }


/* ====== 侧边栏反馈按钮 ====== */
#btnFeedback { background: var(--primary-light); color: var(--primary); border:1px solid var(--primary); margin-top: 8px; }
#btnFeedback:hover { background: var(--primary); color: #fff; }
#btnDisclaimer { background: transparent; color: var(--text-muted); border:1px solid var(--border); margin-top: 4px; font-size: 12px; }
#btnDisclaimer:hover { background: #f3f4f6; color: var(--text); }

/* ====== 徽章扩展 ====== */
.badge-bug { background: #fee2e2; color: #991b1b; }
.badge-feature { background: #dbeafe; color: #1e40af; }
.badge-data { background: #d1fae5; color: #065f46; }
.badge-ui { background: #fef3c7; color: #92400e; }
.badge-other { background: #f3f4f6; color: #374151; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-resolved { background: #d1fae5; color: #065f46; }

/* ====== 工具结果免责提示 ====== */
.result-disclaimer {
  font-size: 12px; color: var(--text-muted); text-align: center;
  margin-top: 16px; padding: 10px; background: #f9fafb;
  border-radius: 8px; border: 1px dashed var(--border);
}
.result-disclaimer a { color: var(--primary); text-decoration: none; }
.result-disclaimer a:hover { text-decoration: underline; }






/* ========= 安全日志表格 ========= */
.log-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.log-table th,
.log-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
  font-size: 13px;
}

.log-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #333;
}

.log-table tr:hover {
  background: #f8f9fa;
}

/* ========= 会话超时提示 ========= */
.session-timeout-warning {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 9999;
  max-width: 300px;
}

.session-timeout-warning h4 {
  margin: 0 0 8px 0;
  color: #856404;
}

.session-timeout-warning p {
  margin: 0 0 12px 0;
  color: #856404;
  font-size: 14px;
}

/* ========= 控制台警告 ========= */
console-warning {
  display: none;
}


/* ========= 顶部联系方式 ========= */
.header-contact {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  margin-left: 20px;
  font-size: 13px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.2s;
}
.header-contact:hover {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.contact-icon {
  font-size: 14px;
}
.contact-link {
  color: #2c3e50;
  text-decoration: none;
  font-weight: 500;
}
.contact-link:hover {
  color: #667eea;
  text-decoration: underline;
}

/* ========= 免责声明横幅 ========= */
.disclaimer-banner {
  background: linear-gradient(90deg, #fff3cd 0%, #ffe5b4 100%);
  border-bottom: 2px solid #ffc107;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #856404;
  position: relative;
  z-index: 99;
}
.banner-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.banner-text {
  flex: 1;
  line-height: 1.5;
}
.banner-text strong {
  color: #d39e00;
}
.banner-text a {
  color: #0066cc;
  text-decoration: none;
  font-weight: 500;
}
.banner-text a:hover {
  text-decoration: underline;
}
.banner-link {
  color: #856404;
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid #ffc107;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}
.banner-link:hover {
  background: #ffc107;
  color: #fff;
}
.banner-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #856404;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
  flex-shrink: 0;
}
.banner-close:hover {
  color: #c33;
}

/* ========= Footer 免责声明 ========= */
.footer-disclaimer {
  width: 100%;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 12px;
  line-height: 1.6;
  color: #856404;
  text-align: justify;
}
.footer-disclaimer strong {
  color: #d39e00;
}
.footer-disclaimer a {
  color: #0066cc;
  text-decoration: none;
  font-weight: 500;
}
.footer-disclaimer a:hover {
  text-decoration: underline;
}
.footer-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  margin-bottom: 6px;
}
.footer-contact {
  font-size: 12px;
  color: #555;
}
.footer-contact a {
  color: #0066cc;
  text-decoration: none;
}
.footer-contact a:hover {
  text-decoration: underline;
}

/* 让 footer 的内容纵向排列 */
.app-footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
}
.app-footer > .footer-links {
  width: 100%;
  text-align: center;
}


/* ========= 修复 footer 免责声明（不随页面滚动）========= */
.app-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 20px;
  background: #fafafa;
  border-top: 1px solid #e0e0e0;
}
.app-footer .footer-disclaimer {
  width: 100%;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.6;
  color: #5d4037;
  text-align: justify;
}
.app-footer .footer-disclaimer a {
  color: #1565c0;
  text-decoration: none;
  font-weight: 500;
}
.app-footer .footer-disclaimer a:hover {
  text-decoration: underline;
}
.app-footer .footer-main {
  width: 100%;
  text-align: center;
  font-size: 12px;
  color: #666;
}
.app-footer .footer-main a {
  color: #1565c0;
  text-decoration: none;
}
.app-footer .footer-main a:hover {
  text-decoration: underline;
}


/* ========= 底部常驻（Fixed Footer） ========= */
body {
  padding-bottom: 100px !important;
}
#appMain {
  padding-bottom: 0;
}
.app-footer {
  position: fixed !important;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  height: auto !important;
  background: #ffffff !important;
  border-top: 2px solid #e0e0e0 !important;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08) !important;
  padding: 10px 20px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}
.app-footer .footer-disclaimer {
  background: #fff8e1 !important;
  border: 1px solid #ffe082 !important;
  border-radius: 4px !important;
  padding: 8px 12px !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
  color: #5d4037 !important;
  text-align: justify !important;
  width: 100% !important;
}
.app-footer .footer-disclaimer a {
  color: #1565c0 !important;
  text-decoration: none !important;
  font-weight: 500 !important;
}
.app-footer .footer-main {
  display: flex !important;
  flex-direction: row !important;
  align-items: baseline !important;
  justify-content: center !important;
  gap: 12px !important;
  flex-wrap: wrap !important;
  text-align: center !important;
  font-size: 12px !important;
  color: #666 !important;
  width: 100% !important;
  margin: 0 !important;
}
.app-footer .footer-main a {
  color: #1565c0 !important;
  text-decoration: none !important;
}
/* ICP 备案号分隔，避免移动端换行挤占 */
.footer-icp { white-space: nowrap; }

/* ========= 律所口号（与版权行同一行、同一 baseline 水平并列） ========= */
.footer-slogan {
  display: inline;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 2px;
  line-height: 1;
  color: #333;
  text-align: center;
  white-space: nowrap;
}
.footer-copy {
  display: inline;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  color: #666;
}
