/* ========== 景桁法律助手 — 深色法律主题 v2 ========== */

:root {
  /* 主色 — 法律蓝 */
  --primary: #2563EB;
  --primary-light: #3B82F6;
  --primary-dark: #1D4ED8;
  --primary-glow: rgba(37, 99, 235, 0.25);

  /* 强调色 — 亮金色 */
  --accent: #FBBF24;
  --accent-light: #FCD34D;

  /* 危险色 */
  --danger: #EF4444;
  --danger-light: #FCA5A5;

  /* 成功色 */
  --success: #10B981;

  /* 场景色 */
  --scene-trademark: #3B82F6;
  --scene-copyright: #8B5CF6;
  --scene-patent: #06B6D4;
  --scene-brand: #F59E0B;
  --scene-secret: #EF4444;
  --scene-other: #6B7280;

  /* 背景色 — 更深层次 */
  --bg-primary: #0B1120;
  --bg-secondary: #111B2E;
  --bg-card: #162033;
  --bg-card-hover: #1C2A42;
  --bg-input: #0D1526;
  --bg-overlay: rgba(11, 17, 32, 0.9);

  /* 文字色 */
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --text-accent: #FBBF24;

  /* 边框 */
  --border: #1E2D45;
  --border-light: #2A3F5F;

  /* 圆角 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* 间距 */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* 阴影 */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.15);
}

/* ========== 全局重置 ========== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary-light);
  text-decoration: none;
}

/* ========== 顶部导航 ========== */
#app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(11, 17, 32, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.brand-icon {
  font-size: 24px;
}

.brand-text {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.chat-count {
  background: rgba(251, 191, 36, 0.1);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(251, 191, 36, 0.2);
}

/* 新对话按钮 */
.btn-new-chat {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-new-chat:active {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ========== 主内容区 ========== */
#app-content {
  max-width: 640px;
  margin: 0 auto;
  padding: 60px var(--space-md) 160px;
  min-height: 100vh;
}

/* ========== 底部导航 ========== */
#app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(11, 17, 32, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

#app-nav .nav-items {
  display: flex;
  max-width: 640px;
  margin: 0 auto;
}

#app-nav .nav-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 4px;
  color: var(--text-muted);
  font-size: 11px;
  transition: color 0.2s;
  position: relative;
  text-decoration: none;
}

.nav-item.active {
  color: var(--primary-light);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--primary-light);
  border-radius: 1px;
}

.nav-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.nav-label {
  font-weight: 500;
}

/* ========== 免责声明条（导航栏内部） ========== */
#disclaimer-bar {
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
  padding: 4px var(--space-md);
  max-width: 640px;
  margin: 0 auto;
}

/* ========== 弹窗 ========== */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.modal-dialog {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.modal-header {
  padding: var(--space-lg) var(--space-lg) 0;
}

.modal-header h3 {
  font-size: 20px;
  color: var(--accent);
}

.modal-body {
  padding: var(--space-md) var(--space-lg);
}

.modal-section {
  margin-bottom: var(--space-md);
}

.modal-section h4 {
  font-size: 14px;
  color: var(--primary-light);
  margin-bottom: var(--space-sm);
}

.modal-section p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.modal-section ul {
  list-style: none;
  padding: 0;
}

.modal-section li {
  font-size: 14px;
  color: var(--text-secondary);
  padding: 6px 0;
  padding-left: 20px;
  position: relative;
}

.modal-section li::before {
  content: '•';
  position: absolute;
  left: 4px;
  color: var(--accent);
  font-weight: bold;
}

.modal-footer {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
}

/* ========== 按钮 ========== */
.btn-primary {
  width: 100%;
  padding: 14px var(--space-lg);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-primary:active {
  transform: scale(0.98);
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.2);
}

.btn-secondary {
  padding: 10px var(--space-lg);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:active {
  background: var(--bg-card-hover);
}

.btn-accent {
  padding: 12px var(--space-lg);
  background: linear-gradient(135deg, var(--accent), #D97706);
  color: #0B1120;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.25);
}

.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 4px;
}

.btn-copy:hover, .btn-copy:active {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

.btn-copy.copied {
  color: var(--success);
}

/* ========== 首页 ========== */
.hero {
  text-align: center;
  padding: var(--space-2xl) 0 var(--space-lg);
}

.hero-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: var(--space-sm);
  background: linear-gradient(135deg, #FFFFFF 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.hero-badge {
  display: inline-block;
  margin-top: var(--space-md);
  background: rgba(251, 191, 36, 0.1);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.scene-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.scene-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
  /* stagger 入场 */
  opacity: 0;
  transform: translateY(16px);
  animation: cardStagger 0.4s ease forwards;
}

.scene-card:nth-child(1) { animation-delay: 0.05s; }
.scene-card:nth-child(2) { animation-delay: 0.1s; }
.scene-card:nth-child(3) { animation-delay: 0.15s; }
.scene-card:nth-child(4) { animation-delay: 0.2s; }
.scene-card:nth-child(5) { animation-delay: 0.25s; }
.scene-card:nth-child(6) { animation-delay: 0.3s; }

@keyframes cardStagger {
  to { opacity: 1; transform: translateY(0); }
}

/* 场景卡片顶部色条 */
.scene-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.scene-card[data-scene="trademark"]::before { background: var(--scene-trademark); }
.scene-card[data-scene="copyright"]::before { background: var(--scene-copyright); }
.scene-card[data-scene="patent"]::before { background: var(--scene-patent); }
.scene-card[data-scene="brand"]::before { background: var(--scene-brand); }
.scene-card[data-scene="trade_secret"]::before { background: var(--scene-secret); }
.scene-card[data-scene="other"]::before { background: var(--scene-other); }

.scene-card:hover, .scene-card:active {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-sm);
}

.scene-card:active {
  transform: scale(0.97);
}

.scene-icon {
  font-size: 32px;
  margin-bottom: var(--space-sm);
}

.scene-name {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
}

.scene-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ========== 对话页 ========== */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px - 52px - 80px);
  margin: -60px calc(-1 * var(--space-md)) -140px;
  padding: 0;
}

.chat-scene-tag {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary-light);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: var(--space-md);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
}

.chat-msg {
  margin-bottom: var(--space-md);
  animation: msgIn 0.3s ease;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg-user {
  display: flex;
  justify-content: flex-end;
}

.chat-msg-ai {
  display: flex;
  justify-content: flex-start;
}

.chat-bubble {
  max-width: 85%;
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
}

.chat-bubble-user {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.chat-bubble-ai {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.chat-bubble-ai h3 {
  font-size: 15px;
  color: var(--accent);
  margin: 12px 0 6px;
}

.chat-bubble-ai h3:first-child {
  margin-top: 0;
}

.chat-bubble-ai ul, .chat-bubble-ai ol {
  padding-left: 20px;
  margin: 6px 0;
}

.chat-bubble-ai li {
  margin: 4px 0;
}

.chat-bubble-ai strong {
  color: var(--accent);
}

.chat-bubble-ai em {
  color: var(--text-muted);
  font-style: normal;
  font-size: 12px;
}

.chat-bubble-ai hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

.chat-bubble-ai p {
  margin: 6px 0;
}

/* 打字光标 */
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 16px;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.8s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.chat-input-area {
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--space-sm);
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px var(--space-md);
  color: var(--text-primary);
  font-size: 15px;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-send {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.chat-send:active {
  transform: scale(0.95);
}

.chat-send:disabled {
  background: var(--bg-card);
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
}

/* 快捷问题 */
.quick-questions {
  padding: var(--space-sm) var(--space-md);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.quick-q {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.quick-q:active {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* AI快捷操作 */
.chat-actions {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
}

.chat-action-btn {
  flex: 1;
  padding: 10px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  color: var(--primary-light);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.chat-action-btn:active {
  background: rgba(37, 99, 235, 0.15);
}

/* 打字动画 */
.typing-dots {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ========== 维权路径页 ========== */
.path-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: var(--space-lg);
  color: var(--text-primary);
}

.path-step {
  position: relative;
  padding-left: 48px;
  padding-bottom: var(--space-xl);
}

.path-step::before {
  content: attr(data-order);
  position: absolute;
  left: 0;
  top: 0;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-size: 16px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.path-step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 17px;
  top: 40px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.path-step-header {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.path-step-toggle {
  font-size: 14px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.path-step.collapsed .path-step-toggle {
  transform: rotate(-90deg);
}

.path-step.collapsed .path-step-body {
  display: none;
}

.path-step-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
}

.path-step-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.path-step-body {
  padding-top: var(--space-sm);
}

.path-deadline {
  display: inline-block;
  background: rgba(251, 191, 36, 0.12);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  margin-bottom: var(--space-sm);
}

.path-materials, .path-tips {
  font-size: 13px;
  color: var(--text-secondary);
  margin: var(--space-sm) 0;
}

.path-materials li, .path-tips li {
  padding: 3px 0;
}

.path-warnings {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin: var(--space-lg) 0;
}

.path-warnings h4 {
  color: var(--danger-light);
  font-size: 14px;
  margin-bottom: var(--space-sm);
}

.path-warnings li {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 4px 0;
}

.path-lawyer {
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin: var(--space-lg) 0;
}

.path-lawyer h4 {
  color: var(--primary-light);
  font-size: 14px;
  margin-bottom: var(--space-sm);
}

.path-lawyer p {
  font-size: 14px;
  color: var(--text-secondary);
}

.path-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.path-actions .btn-secondary {
  flex: 1;
  text-align: center;
}

/* ========== 材料清单页 ========== */
.checklist-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: var(--space-sm);
}

.checklist-progress {
  margin-bottom: var(--space-lg);
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  overflow: hidden;
  margin-top: var(--space-sm);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 13px;
  color: var(--text-muted);
}

.checklist-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  transition: border-color 0.2s, opacity 0.2s;
}

.checklist-item.checked {
  border-color: rgba(16, 185, 129, 0.3);
  opacity: 0.7;
}

.checklist-check {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-light);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  transition: all 0.2s;
}

.checklist-check.checked {
  background: var(--success);
  border-color: var(--success);
}

.checklist-check.checked::after {
  content: '✓';
  color: white;
  font-size: 14px;
  font-weight: 700;
}

.checklist-info {
  flex: 1;
}

.checklist-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.checklist-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.checklist-how {
  font-size: 12px;
  color: var(--text-muted);
}

.checklist-priority {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
  margin-top: 2px;
}

.priority-must {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger-light);
}

.priority-suggest {
  background: rgba(251, 191, 36, 0.12);
  color: var(--accent);
}

.priority-optional {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-muted);
}

.checklist-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.checklist-actions .btn-secondary {
  flex: 1;
  text-align: center;
}

/* ========== 历史页 ========== */
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.history-header h2 {
  font-size: 22px;
  font-weight: 800;
}

.btn-clear-history {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
}

.btn-clear-history:active {
  background: var(--bg-card);
}

.history-session {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.history-session:active {
  background: var(--bg-card-hover);
}

.history-scene-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 6px;
}

.history-first-msg {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  gap: var(--space-md);
}

/* ========== 知识库页 ========== */
.faq-header {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: var(--space-lg);
}

.faq-category {
  margin-bottom: var(--space-lg);
}

.faq-category-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  overflow: hidden;
}

.faq-question {
  padding: var(--space-md);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-question::after {
  content: '+';
  color: var(--text-muted);
  font-size: 18px;
  font-weight: 300;
  transition: transform 0.2s;
}

.faq-item.open .faq-question::after {
  transform: rotate(45deg);
}

.faq-answer {
  display: none;
  padding: 0 var(--space-md) var(--space-md);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  border-top: 1px solid var(--border);
  padding-top: var(--space-sm);
}

.faq-item.open .faq-answer {
  display: block;
}

.faq-consult {
  display: inline-block;
  margin-top: var(--space-sm);
  color: var(--primary-light);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.faq-law-refs {
  margin-top: var(--space-sm);
  border-top: 1px dashed var(--border);
  padding-top: var(--space-sm);
}

.faq-law-toggle {
  font-size: 12px;
  color: var(--primary-light);
  cursor: pointer;
  font-weight: 600;
  padding: 2px 0;
}

.faq-law-detail {
  margin-top: var(--space-sm);
}

.faq-law-item {
  background: var(--bg-main, #f8f9fa);
  border-left: 3px solid var(--primary-light);
  padding: 8px 12px;
  margin-bottom: 6px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.faq-law-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.faq-law-content {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ========== Tab 切换 ========== */
.kb-tabs {
  display: flex;
  gap: 0;
  margin-bottom: var(--space-md);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
}

.kb-tab {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.kb-tab.active {
  color: var(--primary-light);
  background: var(--bg-main, #f0f4ff);
}

/* ========== 案例卡片 ========== */
.case-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  overflow: hidden;
  cursor: pointer;
}

.case-title {
  padding: var(--space-md);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
}

.case-date {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-main, #f5f5f5);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  margin-right: 6px;
  font-weight: 400;
}

.case-body {
  display: none;
  padding: 0 var(--space-md) var(--space-md);
  border-top: 1px solid var(--border);
  padding-top: var(--space-sm);
}

.case-card.open .case-body {
  display: block;
}

.case-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 8px;
}

.case-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.case-kw {
  font-size: 11px;
  color: var(--primary-light);
  background: rgba(59, 130, 246, 0.08);
  padding: 2px 8px;
  border-radius: 10px;
}

.case-source {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 16px 0 0;
}

/* ========== 关于页 ========== */
.about-section {
  margin-bottom: var(--space-xl);
}

.about-section h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

.about-section p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.about-features {
  display: grid;
  gap: var(--space-md);
}

.about-feature {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.about-feature-icon {
  font-size: 28px;
  margin-bottom: var(--space-sm);
}

.about-feature-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.about-feature-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ========== 页面过渡 ========== */
.page-enter {
  animation: pageSlideIn 0.25s ease;
}

@keyframes pageSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== 空状态 ========== */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) 0;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
}

.empty-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.empty-desc {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ========== 加载状态 ========== */
.loading-bar {
  width: 100%;
  height: 3px;
  background: var(--bg-card);
  position: relative;
  overflow: hidden;
  border-radius: 2px;
}

.loading-bar::after {
  content: '';
  position: absolute;
  left: -50%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  animation: loadingSlide 1.5s infinite ease-in-out;
}

@keyframes loadingSlide {
  0% { left: -50%; }
  100% { left: 100%; }
}

/* ========== 响应式 ========== */
@media (min-width: 641px) {
  .scene-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* ========== Admin 管理页 ========== */
.admin-login {
  max-width: 320px;
  margin: 60px auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text-primary);
  box-sizing: border-box;
}

.admin-input:focus {
  outline: none;
  border-color: var(--primary-light);
}

.admin-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.admin-btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary-light);
  color: #fff;
}

.admin-btn.secondary {
  background: var(--text-muted);
}

.admin-btn:hover {
  opacity: 0.9;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: var(--space-md);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
}

.stat-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary-light);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.admin-cats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

.admin-cat-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.admin-cat-btn.active {
  background: var(--primary-light);
  color: #fff;
  border-color: var(--primary-light);
}

.admin-cat-btn.add {
  background: var(--primary-light);
  color: #fff;
  border-color: var(--primary-light);
}

.admin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
}

.admin-row-main {
  font-size: 13px;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-row-cat {
  font-size: 11px;
  color: #fff;
  background: var(--primary-light);
  padding: 1px 6px;
  border-radius: 8px;
  margin-right: 6px;
}

.admin-row-law {
  font-weight: 600;
}

.admin-row-no {
  color: var(--primary-light);
  margin: 0 4px;
}

.admin-row-title {
  color: var(--text-muted);
}

.admin-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  margin-left: 8px;
}

.admin-action-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
}

.admin-action-btn.del {
  color: #ef4444;
  border-color: #fca5a5;
}

.admin-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.admin-form-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
}

.admin-form {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
}

.admin-form h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
}

.admin-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 10px 0 4px;
}

.admin-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}
