/* ============================================
   银行流水分析 — CraftUI Dashboard 风格
   响应式：桌面端侧边栏 + 手机端底部标签栏
   ============================================ */

/* Font */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&display=swap');

/* CSS Variables */
:root {
  /* Brand - matched to SVG #4880FF */
  --c-primary: #4880FF;
  --c-primary-light: rgba(72, 128, 255, 0.10);
  --c-primary-dark: #4379EE;
  --c-primary-text: #3661D6;

  /* Status */
  --c-success: #00B69B;
  --c-success-text: #00B69B;
  --c-danger: #FF6B6B;
  --c-danger-text: #DC2626;
  --c-warning: #F4BE5E;
  --c-warning-text: #92400E;

  /* Background */
  --c-bg: #F5F6FA;
  --c-card: #FFFFFF;
  --c-card-hover: rgba(245, 246, 250, 0.6);
  --c-surface: #F1F4F9;

  /* Text */
  --c-text: #1C1D21;
  --c-text-secondary: #8181A5;
  --c-text-muted: #A0A0B8;

  /* Border & Line */
  --c-border: #F0F0F3;
  --c-border-light: #EEEEEE;

  /* Radius */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 12px;

  /* Spacing */
  --gap-xs: 8px;
  --gap-sm: 16px;
  --gap-md: 24px;
  --gap-lg: 28px;
  --gap-xl: 40px;

  /* Sidebar */
  --sidebar-w: 260px;
  --icon-nav-w: 128px;
  --topbar-h: 64px;
  --tab-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Font */
  --font-family: 'Lato', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  font-size: 16px;
  height: 100%;
}

body {
  font-family: var(--font-family);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  height: 100%;
  overflow: hidden;
}

/* SVG 图标统一尺寸 */
.cui-svg-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  vertical-align: middle;
}
.cui-svg-icon-lg { width: 26px; height: 26px; }
.cui-svg-icon-sm { width: 16px; height: 16px; }
.cui-svg-icon-xl { width: 32px; height: 32px; }
.cui-svg-icon-xxl { width: 44px; height: 44px; }

/* SVG 图标容器统一样式 */
.brief-icon, .core-icon, .secondary-icon {
  font-size: 24px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* 容器内 SVG 使用品牌色 */
.brief-icon svg { color: var(--c-primary); }
.core-icon svg { color: var(--c-primary); }
.secondary-icon svg { opacity: 0.7; }

/* ============================================
   App Layout (桌面端三栏: 图标栏+侧边栏+主内容)
   ============================================ */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100%;
  background: var(--c-bg);
}

/* —— Icon Nav Bar —— */
.icon-nav {
  width: var(--icon-nav-w);
  height: 100%;
  background: var(--c-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.icon-nav-logo {
  width: 48px; height: 48px;
  margin: 20px auto 16px;
  border-radius: var(--r-xs);
  flex-shrink: 0;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.icon-nav-logo-img {
  width: 100%; height: 100%;
  object-fit: contain;
  border-radius: var(--r-xs);
}

.icon-nav-menu {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  overflow-y: auto;
}

.icon-nav-item {
  width: 100%; height: auto; min-height: 56px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px; padding: 8px 8px;
  border: none; background: transparent;
  border-radius: var(--r-xs);
  cursor: pointer; position: relative;
  transition: background 0.15s;
  flex-shrink: 0;
  color: var(--c-text-secondary);
  font-family: var(--font-family);
}
.nav-icon-img {
  width: 36px; height: 36px;
  display: block;
  color: var(--c-text-muted);
  transition: color 0.15s;
  padding: 4px;
}
.icon-nav-item.active .nav-icon-img { color: var(--c-primary); }
.nav-icon-label {
  font-size: 10px; font-weight: 700;
  color: var(--c-text-muted);
  transition: color 0.15s;
  text-align: center; line-height: 1.1;
}
.icon-nav-item.active .nav-icon-label { color: var(--c-primary); }
.icon-nav-item:hover { background: var(--c-surface); }
.icon-nav-item.active {
  background: var(--c-primary-light);
  color: var(--c-primary);
}
.icon-nav-item.active::after {
  content: '';
  position: absolute;
  right: 0; top: 25%; bottom: 25%;
  width: 2px;
  background: var(--c-primary);
  border-radius: 1px;
}
.icon-nav-item .badge {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 2px solid var(--c-card);
}
.badge-danger { background: var(--c-danger); }
.badge-success { background: var(--c-success); }

.icon-nav-bottom {
  display: flex; flex-direction: column; align-items: center;
  padding-bottom: 12px; width: 100%;
  margin-top: auto;
  border-top: 1px solid var(--c-border);
}
.icon-nav-avatar { display: none; }

/* —— Sidebar —— */
.sidebar {
  width: var(--sidebar-w);
  height: 100%;
  background: var(--c-card);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-header { display: none; }
.sidebar-logo-icon { display: none; }
.sidebar-greeting { display: none; }
.sidebar-app-name { display: none; }

.sidebar-section {
  padding: 0 24px;
  flex-shrink: 0;
}
.sidebar-spacer { flex: 1; min-height: 0; overflow-y: auto; padding-top: 20px; }
.sidebar-section-title {
  font-size: 14px; font-weight: 700;
  color: var(--c-text);
  margin-bottom: 10px;
}

.sidebar-event {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--c-surface);
  border-radius: var(--r-md);
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.sidebar-event:hover { background: rgba(245,245,250,0.7); }
.sidebar-event-icon {
  width: 34px; height: 34px;
  background: var(--c-primary-light);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: var(--c-primary);
  flex-shrink: 0;
}
.sidebar-event-info { flex: 1; min-width: 0; }
.sidebar-event-title {
  font-size: 13px; font-weight: 700; color: var(--c-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-event-desc {
  font-size: 12px; color: var(--c-text-secondary);
}
.sidebar-event-badge {
  font-size: 11px; font-weight: 700;
  color: var(--c-text-secondary);
  white-space: nowrap;
}

.sidebar-cal-event {
  padding: 14px 16px;
  background: var(--c-surface);
  border-radius: var(--r-lg);
  margin-bottom: 8px;
  position: relative;
}
.sidebar-cal-time {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 4px;
}
.sidebar-cal-dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.cal-dot-blue { background: var(--c-primary); }
.cal-dot-yellow { background: var(--c-warning); }
.sidebar-cal-text {
  font-size: 11px; font-weight: 700; color: var(--c-primary);
}
.sidebar-cal-name {
  font-size: 13px; font-weight: 700; color: var(--c-text);
  margin-bottom: 2px;
}
.sidebar-cal-desc {
  font-size: 11px; color: var(--c-text-secondary);
}
.sidebar-cal-arrow {
  position: absolute; right: 14px; top: 16px;
  color: var(--c-text-secondary); font-size: 13px;
}

.sidebar-spacer { flex: 1; min-height: 0; overflow-y: auto; }

/* —— Main Content (desktop) —— */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  min-width: 0;
}

/* Top Bar */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}
.topbar-menu-btn {
  width: 36px; height: 36px;
  border-radius: 6px;
  background: var(--c-border);
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px; color: var(--c-text-secondary);
  transition: background 0.15s;
}
.topbar-menu-btn:hover { background: #E5E5EE; }
.topbar-title {
  font-size: 18px; font-weight: 700;
  color: var(--c-text);
}
.topbar-actions {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
}
.topbar-icon-btn {
  width: 36px; height: 36px;
  border-radius: 6px;
  background: var(--c-border);
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px; color: var(--c-text-secondary);
  transition: background 0.15s;
}
.topbar-icon-btn:hover { background: #E5E5EE; }

/* Page Content Area */
.page-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 24px 24px;
  scroll-behavior: smooth;
}

.page { animation: fadeSlideIn 0.3s ease; }
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Counter Cards (stats bar)
   ============================================ */
.counters-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--gap-md);
  margin-bottom: var(--gap-md);
}

.counter-card {
  background: var(--c-card);
  border-radius: var(--r-lg);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 90px;
}
.counter-card-left { display: flex; flex-direction: column; gap: 2px; }
.counter-card-value {
  font-size: 20px; font-weight: 700;
  color: var(--c-text);
  line-height: 1.2;
}
.counter-card-label {
  font-size: 13px; color: var(--c-text-secondary);
}
.counter-card-pct {
  font-size: 11px; font-weight: 700;
}

/* Hero triple card */
.hero-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--gap-sm);
  margin-bottom: var(--gap-md);
}
.hero-card {
  background: var(--c-card);
  border-radius: var(--r-lg);
  padding: 16px 14px;
  text-align: center;
}
.hero-card-val {
  font-size: 22px; font-weight: 700;
  line-height: 1.2;
}
.hero-card-lbl {
  font-size: 12px; color: var(--c-text-secondary);
  margin-top: 4px;
}
.hero-card.income .hero-card-val { color: var(--c-primary); }
.hero-card.expense .hero-card-val { color: var(--c-danger); }
.hero-card.balance .hero-card-val { color: var(--c-success-text); }

/* ============================================
   Card System
   ============================================ */
.card {
  background: var(--c-card);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  margin-bottom: var(--gap-sm);
}

.card-title {
  font-size: 15px; font-weight: 700;
  color: var(--c-text);
  margin-bottom: 14px;
}

.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap-xs); }

/* Metric mini */
.metric-mini {
  padding: 12px;
  background: var(--c-surface);
  border-radius: var(--r-sm);
  text-align: center;
}
.metric-mini-val { font-size: 17px; font-weight: 700; color: var(--c-text); }
.metric-mini-lbl { font-size: 11px; color: var(--c-text-secondary); margin-top: 2px; }

/* ============================================
   Upload
   ============================================ */
.upload-zone {
  background: var(--c-card);
  border: 2px dashed var(--c-border);
  border-radius: var(--r-lg);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: var(--gap-sm);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--c-primary);
  background: var(--c-primary-light);
}
.upload-icon-big { display: flex; justify-content: center; align-items: center; margin-bottom: 10px; color: var(--c-primary); }
.upload-zone-text { font-size: 14px; color: var(--c-text); font-weight: 700; }
.upload-zone-hint { font-size: 12px; color: var(--c-text-muted); margin-top: 4px; margin-bottom: 14px; }

/* Notice */
.notice {
  background: var(--c-primary-light);
  border-left: 3px solid var(--c-primary);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  margin-bottom: var(--gap-sm);
}
.notice-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.notice-list { padding-left: 18px; font-size: 12px; color: var(--c-text-secondary); line-height: 1.8; }

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px;
  border-radius: var(--r-sm);
  font-size: 14px; font-weight: 700;
  border: none; cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-family);
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--c-primary);
  color: white;
}
.btn-primary:hover { background: var(--c-primary-dark); }

.btn-outline {
  background: transparent;
  color: var(--c-primary);
  border: 1.5px solid var(--c-primary);
}
.btn-outline:hover { background: var(--c-primary-light); }

.btn-block { width: 100%; display: flex; }

.btn-sm {
  padding: 6px 14px; font-size: 12px; border-radius: 6px;
  background: var(--c-border);
  color: var(--c-text-secondary); border: none;
}
.btn-sm:hover { background: #E5E5EE; }

.btn-icon-sm {
  width: 32px; height: 32px; border: none; background: var(--c-border);
  border-radius: 50%; font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.btn-icon-sm:hover { background: #E5E5EE; }

/* File info card */
.file-info-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--c-card);
  border-radius: var(--r-lg);
}
.file-icon-sm { font-size: 24px; }
.file-details { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.file-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: 11px; color: var(--c-text-secondary); }

/* Bank Selector v2 — 增强版 */
.bank-selector-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #f0f4ff 0%, #f5f7fa 100%);
  border: 1px solid #dde4f0;
  border-radius: var(--r-md);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.bank-selector-row:focus-within {
  border-color: var(--c-primary, #4880FF);
  box-shadow: 0 0 0 3px rgba(72,128,255,0.1);
}
.form-label-sm {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-secondary);
  white-space: nowrap;
}
.bank-required-hint {
  color: var(--c-danger, #FF6B6B);
  font-weight: 700;
  margin-right: 2px;
}
.bank-select {
  flex: 1;
  padding: 7px 12px;
  border: 1px solid var(--c-border, #ddd);
  border-radius: var(--r-md);
  font-size: 13px;
  background: #fff;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
  min-width: 140px;
}
.bank-select:focus { border-color: var(--c-primary, #4880FF); box-shadow: 0 0 0 2px rgba(72,128,255,0.15); }

/* 自动识别成功时的视觉强化 */
.bank-selector-row.bank-auto-detected {
  border-color: var(--c-success, #00B69B);
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 50%, #f5f7fa 100%);
  box-shadow: 0 0 0 3px rgba(0,182,155,0.08);
}
.bank-selector-row.bank-auto-detected .bank-select {
  border-color: var(--c-success, #00B69B);
  font-weight: 600;
  color: var(--c-success, #059669);
}
.bank-selector-row.bank-auto-detected .bank-select:focus {
  box-shadow: 0 0 0 2px rgba(0,182,155,0.2);
}
.bank-auto-hint {
  font-size: 11px;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 60px;
  font-weight: 500;
  transition: color 0.2s;
}

/* Progress */
.progress-section { margin-top: var(--gap-sm); }
.progress-bar {
  width: 100%; height: 6px;
  background: var(--c-border); border-radius: 3px;
  overflow: hidden; margin-bottom: 10px;
}
.progress-fill {
  height: 100%; background: var(--c-primary);
  border-radius: 3px; transition: width 0.4s ease;
}
.progress-text { font-size: 14px; font-weight: 700; color: var(--c-text); }
.progress-detail { font-size: 12px; color: var(--c-text-secondary); margin-top: 3px; }

/* ============================================
   Data Table
   ============================================ */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 600px;
}
.data-table th {
  padding: 10px 10px;
  text-align: left;
  font-weight: 700;
  color: var(--c-text-secondary);
  font-size: 11px;
  background: var(--c-surface);
  border-bottom: 2px solid var(--c-border);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
.data-table tr:hover td { background: var(--c-surface); }
.col-income { color: var(--c-primary); text-align: right !important; font-weight: 700; }
.col-expense { color: var(--c-danger); text-align: right !important; font-weight: 700; }

/* Tags */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 10px; font-weight: 700;
  white-space: nowrap;
}
.tag-income { background: var(--c-primary-light); color: var(--c-primary); }
.tag-expense { background: #FEF2F2; color: var(--c-danger-text); }

/* Pagination */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
}
.page-info { font-size: 12px; color: var(--c-text-secondary); }

/* Data Validation */
.data-validation {
  padding: 10px 16px; border-radius: var(--r-sm);
  margin-bottom: var(--gap-sm);
  font-size: 12px; line-height: 1.6;
}
.data-validation.warning {
  background: rgba(244, 190, 94, 0.12);
  color: var(--c-warning-text);
}
.data-validation.info {
  background: var(--c-primary-light);
  color: var(--c-primary-text);
}

/* ============================================
   Tabs (Desktop)
   ============================================ */
.desktop-tabs {
  display: flex; gap: 2px;
  background: var(--c-border);
  border-radius: var(--r-sm);
  padding: 3px;
  margin-bottom: var(--gap-md);
  position: sticky; top: 0; z-index: 20;
}
.desktop-tab {
  flex: 1; padding: 10px 10px;
  border: none; background: transparent;
  border-radius: 6px;
  font-size: 13px; font-weight: 700;
  color: var(--c-text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-family);
}
.desktop-tab.active {
  background: var(--c-primary);
  color: white;
}
.desktop-tab:hover:not(.active) { background: var(--c-surface); }

/* ============================================
   Rules Page
   ============================================ */
.rules-card {
  margin-bottom: var(--gap-sm);
  overflow: hidden;
}
.rules-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0; cursor: pointer; user-select: none;
}
.rules-title-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700;
}
.rules-icon-r { font-size: 20px; }
.rules-header-right {
  display: flex; align-items: center; gap: 10px;
}
.rules-arrow {
  font-size: 11px; color: var(--c-text-secondary);
  transition: transform 0.3s;
}
.rules-header.open .rules-arrow { transform: rotate(180deg); }
.rules-body { margin-top: 12px; display: none; }
.rules-body.open { display: block; }

/* Rule Item — 垂直双字段 (交易对象+备注/摘要) + 开关 */
.rule-item { margin-bottom: 14px; }
.rule-label {
  display: block; font-size: 12px; font-weight: 700;
  color: var(--c-text-secondary);
}
/* 新垂直布局 */
.rule-item-v {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--c-border);
}
.rule-item-v:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.rule-item-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.rule-item-header .rule-label { margin-bottom: 0; }
.rule-fields-v {
  display: flex; flex-direction: column; gap: 6px;
}
.rule-fields-v .rule-input {
  width: 100%;
}
/* 行内布局（快进快出/夜间交易等参数） */
.rule-fields-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.rule-inline-label {
  font-size: 11px;
  color: var(--c-text-secondary);
  white-space: nowrap;
}
.rule-inline-hint {
  font-size: 10px;
  color: var(--c-text-muted);
  white-space: nowrap;
}
/* 行内字段块（标签在上，输入框在下） */
.rule-field-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* 旧水平布局 (保留兼容旧代码) */
.rule-fields {
  display: flex; gap: 8px; align-items: center;
}
.rule-fields .rule-input {
  flex: 1; min-width: 0;
}
.rule-input {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--c-border); border-radius: var(--r-sm);
  font-size: 13px; background: var(--c-card);
  color: var(--c-text); font-family: var(--font-family);
  transition: border-color 0.2s;
}
.rule-fields .rule-input:first-child { max-width: 55%; }
.rule-fields .rule-input:nth-child(2) { max-width: 45%; }
.rule-input:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-light);
}
.rule-input::placeholder { color: var(--c-text-muted); }

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px; height: 22px;
  flex-shrink: 0;
}
.rule-toggle { width: 36px; height: 20px; }
.toggle-input {
  opacity: 0; width: 0; height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #D1D5DB;
  border-radius: 22px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}
.rule-toggle .toggle-slider::before {
  height: 14px; width: 14px;
  left: 3px; bottom: 3px;
}
.toggle-input:checked + .toggle-slider {
  background: var(--c-primary);
}
.toggle-input:checked + .toggle-slider::before {
  transform: translateX(18px);
}
.rule-toggle .toggle-input:checked + .toggle-slider::before {
  transform: translateX(16px);
}

/* 父级开关关闭时，所有子项变灰 */
.rules-body.disabled-by-parent .rule-item,
.rules-body.disabled-by-parent .rule-item-v {
  opacity: 0.45; pointer-events: none;
}

/* ============================================
   Overview Page — 基本概况 三区布局
   ============================================ */

/* —— 1. 简要显示区域 —— */
.overview-brief-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--gap-sm);
  margin-bottom: 12px;
}

.brief-card {
  background: var(--c-card);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--c-border);
}
.brief-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 40px; height: 40px;
  background: var(--c-surface);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
}
.brief-info { flex: 1; min-width: 0; }
.brief-label {
  font-size: 11px; color: var(--c-text-muted);
  margin-bottom: 2px;
}
.brief-value {
  font-size: 13px; font-weight: 700; color: var(--c-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* —— 2. 核心数据区域 —— */
.overview-core-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--gap-sm);
  margin-bottom: 12px;
}

.core-card {
  background: var(--c-card);
  border-radius: var(--r-lg);
  padding: 18px 16px;
  text-align: center;
  border: 1px solid var(--c-border);
  position: relative;
  overflow: hidden;
}

.core-icon {
  font-size: 28px;
  margin-bottom: 8px;
}
.core-body {
  display: flex; flex-direction: column; align-items: center;
}
.core-label {
  font-size: 12px; color: var(--c-text-muted);
  margin-bottom: 4px;
}
.core-amount {
  font-size: 22px; font-weight: 700;
  line-height: 1.2;
}
.core-income .core-amount { color: var(--c-primary); }
.core-expense .core-amount { color: var(--c-danger); }
.core-interest .core-amount { color: var(--c-success-text); }

.core-sub {
  font-size: 11px; color: var(--c-text-muted);
  margin-top: 4px;
}

/* —— 3. 次要数据区域 —— */
.overview-secondary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--gap-sm);
  margin-bottom: 12px;
}

.secondary-card {
  background: var(--c-card);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  border: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.secondary-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.secondary-label {
  font-size: 11px; color: var(--c-text-muted);
}
.secondary-icon {
  font-size: 18px;
  opacity: 0.7;
}
.secondary-value {
  font-size: 18px; font-weight: 700;
  color: var(--c-text);
  line-height: 1.2;
}

/* ============================================
   Response: Mobile
   ============================================ */
@media (max-width: 768px) {
  .overview-brief-row {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
  }
  .brief-card { padding: 10px 10px; }
  .brief-icon { width: 32px; height: 32px; font-size: 18px; }
  .brief-value { font-size: 12px; }

  .overview-core-row {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
  }
  .core-card { padding: 14px 10px; }
  .core-amount { font-size: 18px; }
  .core-icon { font-size: 24px; }

  .overview-secondary-grid {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
  }
  .secondary-card { padding: 12px 12px; }
  .secondary-value { font-size: 15px; }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1200px) {
  .overview-secondary-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* ============================================
   Trend Chart (面积图 + 切换 + 提示)
   ============================================ */
.trend-chart-card {
  position: relative;
  overflow: visible;
}
.trend-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.trend-chart-title {
  font-size: 15px; font-weight: 700;
  color: var(--c-text);
}
.trend-toggle-btn {
  width: auto; min-width: 80px; height: 28px;
  padding: 0 12px;
  border: 1px solid var(--c-border);
  background: var(--c-card);
  border-radius: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  color: var(--c-text-secondary);
  font-family: var(--font-family);
  transition: all 0.15s;
  white-space: nowrap;
}
.trend-toggle-btn:hover {
  background: var(--c-primary-light);
  border-color: var(--c-primary);
  color: var(--c-primary);
}
.trend-toggle-btn.active {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: white;
}

@media (max-width: 768px) {
  .trend-toggle-btn {
    min-width: 70px; height: 26px;
    font-size: 11px; padding: 0 10px;
    border-radius: 13px;
  }
}

/* 图例 (canvas内绘制，保留CSS备用) */
.trend-legend {
  display: flex; gap: 14px; align-items: center;
  margin-left: auto; margin-right: 48px;
}
.trend-legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--c-text-secondary);
  font-weight: 500;
}
.trend-legend-dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.trend-legend-dot.dot-income { background: var(--c-primary); }
.trend-legend-dot.dot-expense { background: var(--c-danger); }
.trend-legend-dot.dot-surplus { background: var(--c-primary); }

/* Tooltip */
.trend-chart-container {
  position: relative;
}
.trend-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--c-text);
  color: white;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: 12px;
  line-height: 1.6;
  z-index: 100;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  transition: opacity 0.1s;
  opacity: 0;
  transform: translate(-50%, -100%);
  margin-top: -8px;
}
.trend-tooltip.show { opacity: 1; }
.trend-tooltip .tooltip-month {
  font-weight: 700; font-size: 13px;
  margin-bottom: 4px;
  color: rgba(255,255,255,0.8);
}
.trend-tooltip .tooltip-val {
  display: flex; align-items: center; gap: 8px;
}
.trend-tooltip .tooltip-dot {
  width: 6px; height: 6px; border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.trend-tooltip .tooltip-dot.dot-income { background: var(--c-primary); }
.trend-tooltip .tooltip-dot.dot-expense { background: var(--c-danger); }
.trend-tooltip .tooltip-dot.dot-surplus { background: var(--c-primary); }

@media (max-width: 768px) {
  .trend-chart-title { font-size: 14px; }
  .trend-toggle-btn { width: 28px; height: 28px; font-size: 14px; }
  .trend-tooltip { font-size: 11px; padding: 8px 12px; }
}

/* ============================================
   Charts (General)
   ============================================ */
.chart-container {
  position: relative;
}
.chart-container canvas {
  width: 100% !important;
  max-height: 260px;
}
/* ============================================
   Composition Charts (水平柱状图)
   ============================================ */
.chart-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-lg);
}

.comp-chart-section {
  min-width: 0;
}
.comp-chart-title {
  font-size: 13px; font-weight: 700;
  color: var(--c-text-secondary);
  margin-bottom: 12px;
}
.comp-bars {
  display: flex; flex-direction: column; gap: 10px;
}
.comp-bar-row {
  display: flex; align-items: center; gap: 10px;
}
.comp-bar-label {
  width: 72px; flex-shrink: 0;
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--c-text);
  white-space: nowrap;
}
.comp-dot {
  width: 8px; height: 8px; border-radius: 2px;
  flex-shrink: 0;
}
.comp-bar-track {
  flex: 1; min-width: 0;
  height: 8px; background: var(--c-surface);
  border-radius: 4px; overflow: hidden;
}
.comp-bar-fill {
  height: 100%; border-radius: 4px;
  transition: width 0.5s ease;
  min-width: 4px;
}
.comp-bar-pct {
  width: 36px; flex-shrink: 0;
  font-size: 11px; font-weight: 700;
  color: var(--c-text-secondary);
  text-align: right;
}
.comp-empty {
  font-size: 12px; color: var(--c-text-muted);
  text-align: center; padding: 16px 0;
}

@media (max-width: 768px) {
  .chart-dual {
    grid-template-columns: 1fr;
    gap: var(--gap-sm);
  }
  .comp-bar-label { width: 60px; font-size: 11px; }
  .comp-bar-pct { width: 30px; font-size: 10px; }
}

/* ============================================
   收支分析 (Income/Expense Analysis)
   ============================================ */
/* 三大指标行 */
.indicator-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--gap-sm);
  margin-bottom: 16px;
}
.indicator-card {
  background: var(--c-card);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  border: 1px solid var(--c-border);
  text-align: center;
}
.indicator-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--c-text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.indicator-value {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 4px;
}
.indicator-value.indicator-good { color: var(--c-success); }
.indicator-value.indicator-normal { color: var(--c-warning); }
.indicator-value.indicator-poor { color: var(--c-danger); }
.indicator-desc {
  font-size: 11px;
  color: var(--c-text-muted);
  line-height: 1.3;
}

@media (max-width: 600px) {
  .indicator-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .indicator-card { padding: 12px; }
  .indicator-value { font-size: 20px; }
}

@media (min-width: 601px) and (max-width: 900px) {
  .indicator-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}
.analyse-section-title {
  font-size: 16px; font-weight: 700;
  color: var(--c-text);
  margin: 16px 0 10px 2px;
}
.analyse-section-title:first-child { margin-top: 0; }

/* 分析项（可展开） */
.analyse-item {
  margin-bottom: 14px;
}
.analyse-item-info {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0; cursor: default;
}
.analyse-item-info.clickable {
  cursor: pointer;
  user-select: none;
}
.analyse-item-info.clickable:hover { opacity: 0.8; }
.analyse-item-label {
  font-size: 14px; font-weight: 600; color: var(--c-text);
  flex-shrink: 0; min-width: 80px;
}
.analyse-item-amt {
  font-size: 15px; font-weight: 700;
  flex-shrink: 0;
}
.analyse-item-pct {
  font-size: 12px; color: var(--c-text-muted);
  flex-shrink: 0; margin-left: auto;
}
.analyse-expand {
  font-size: 11px; color: var(--c-text-muted);
  flex-shrink: 0; width: 16px; text-align: center;
  transition: transform 0.2s;
}
.analyse-bar {
  width: 100%; height: 6px;
  background: var(--c-surface);
  border-radius: 3px; overflow: hidden;
  margin-top: 4px;
}
.analyse-bar-fill {
  height: 100%; border-radius: 3px;
  transition: width 0.5s ease;
}

/* 明细展开区 */
.analyse-detail {
  margin-top: 6px;
  padding: 8px 0 0 8px;
  border-left: 2px solid var(--c-border);
  animation: fadeSlideIn 0.2s ease;
}
.detail-table { font-size: 12px; }
.detail-table th { font-size: 11px; padding: 6px 8px; }

/* 支出分析项 */
.analyse-item-exp { margin-bottom: 14px; }

/* 刚性支出子项 */
.analyse-sub-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0; border-bottom: 1px solid var(--c-border);
}
.analyse-sub-item:last-child { border-bottom: none; }
.analyse-sub-name {
  font-size: 13px; color: var(--c-text-secondary);
}
.analyse-sub-amt {
  font-size: 14px; font-weight: 700;
  color: var(--c-danger);
}

/* 其他收入/支出 */
.analyse-other {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; margin-top: 8px;
  border-top: 1px dashed var(--c-border);
}
.analyse-other-label {
  font-size: 13px; color: var(--c-text-secondary);
}
.analyse-other-amt {
  font-size: 15px; font-weight: 700;
  color: var(--c-text-muted);
}

/* ============================================
   交易对手明细弹窗
   ============================================ */
.modal-sheet-lg {
  width: min(90vw, 640px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-lg);
}
/* 弹窗内表格容器：屏幕宽度不足时水平滚动 */
.modal-sheet-lg .table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  padding: 0;
}
.modal-sheet-lg .cparty-detail-table {
  width: 100%;
  min-width: auto;              /* 覆盖全局 .data-table 的 min-width: 600px */
  table-layout: auto;
}
/* 列宽分配 — 宽屏总宽 530px < 可用 600px，完整显示无滚动条 */
.modal-sheet-lg .cparty-detail-table th:nth-child(1),
.modal-sheet-lg .cparty-detail-table td:nth-child(1) {
  width: 36px;
  text-align: center;
}
.modal-sheet-lg .cparty-detail-table th:nth-child(2),
.modal-sheet-lg .cparty-detail-table td:nth-child(2) {
  width: 128px;
  white-space: nowrap;
}
.modal-sheet-lg .cparty-detail-table th:nth-child(3),
.modal-sheet-lg .cparty-detail-table td:nth-child(3) {
  width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modal-sheet-lg .cparty-detail-table th:nth-child(4),
.modal-sheet-lg .cparty-detail-table td:nth-child(4) {
  width: 100px;
  text-align: right;
  white-space: nowrap;
}
.modal-sheet-lg .cparty-detail-table th:nth-child(5),
.modal-sheet-lg .cparty-detail-table td:nth-child(5) {
  min-width: 130px;
  white-space: normal;
  word-break: break-word;
}
.modal-sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; flex-shrink: 0;
}
.modal-sheet-title {
  font-size: 16px; font-weight: 700;
  color: var(--c-text);
}
.modal-sheet-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: var(--c-surface); border-radius: 50%;
  cursor: pointer; font-size: 14px; color: var(--c-text-muted);
}
.modal-sheet-close:hover { background: var(--c-border); }
.modal-sheet-body {
  flex: 1; overflow-y: auto;
  font-size: 13px;
}

/* 对手概要条 */
.cparty-summary {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin-bottom: 12px;
  background: var(--c-surface); border-radius: var(--r-sm);
  font-size: 13px;
}
.cparty-summary-label {
  font-weight: 600; color: var(--c-text-secondary);
}
.cparty-summary-amt {
  font-weight: 700;
  margin-left: auto;
}
.cparty-summary-amt.col-income { color: var(--c-primary); }
.cparty-summary-amt.col-expense { color: var(--c-danger); }
.cparty-summary-count {
  font-size: 12px; color: var(--c-text-muted);
  margin-left: 4px;
}

/* 明细表 */
.cparty-detail-table { font-size: 12px; }
.cparty-detail-table th { font-size: 11px; padding: 6px 8px; }
.cparty-detail-table td { padding: 6px 8px; }
.cparty-detail-table tbody tr { cursor: default; }
.cparty-detail-table tbody tr:hover { background: var(--c-surface); }

/* 可点击行 */
.top10-row-clickable {
  cursor: pointer;
}
.top10-row-clickable:hover {
  background: var(--c-primary-light) !important;
}

/* 翻页 */
.modal-pagination {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 12px 0 4px; flex-shrink: 0;
}
.modal-page-info {
  font-size: 12px; color: var(--c-text-secondary);
}

/* ============================================
   Alert — 左汇总 + 右4列网格
   ============================================ */
.alert-layout {
  display: flex;
  gap: var(--gap-sm);
  align-items: stretch;
}

/* 左侧风险汇总卡片 */
.alert-summary-card {
  width: 200px;
  flex-shrink: 0;
  background: var(--c-card);
  border-radius: var(--r-lg);
  padding: 20px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
}

.alert-summary-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-text);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--c-border-light);
  text-align: center;
}

.alert-summary-items {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
  justify-content: center;
  align-items: center;
  padding: 8px 0;
}

.alert-summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.alert-summary-count {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
}

.alert-summary-label {
  font-size: 13px;
  color: var(--c-text-secondary);
  font-weight: 600;
}

/* 右侧4列网格 */
.alert-grid-4 {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-sm);
  min-width: 0;
}

.alert-card {
  border-left: none !important;
  display: flex;
  flex-direction: column;
}

.alert-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 10px;
}
.alert-title { font-size: 15px; font-weight: 700; }
.alert-badge {
  padding: 3px 12px; border-radius: 4px;
  font-size: 11px; font-weight: 700; color: white;
  white-space: nowrap; flex-shrink: 0;
}
.alert-badge.high { background: #EF4444; }
.alert-badge.watch { background: #F97316; }
.alert-badge.normal { background: #22C55E; }
.alert-detail { font-size: 13px; color: var(--c-text-secondary); line-height: 1.6; flex: 1; }
.alert-detail p { margin-bottom: 3px; }
.alert-detail strong { font-size: 14px; color: var(--c-text); }

/* 点击查看明细 — 固定在卡片右下角 */
.alert-click-hint {
  margin-top: auto;
  padding-top: 8px;
  font-size: 11px;
  color: var(--c-primary);
  font-weight: 600;
  text-align: right;
}

/* Assessment — 左右布局 + 指标卡片 */
.assessment-layout {
  display: flex;
  gap: var(--gap-md);
  margin-bottom: var(--gap-sm);
}
.assessment-left {
  flex: 1;
  min-width: 0;
}
.assessment-right {
  width: 240px;
  flex-shrink: 0;
}
.assessment-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-sm);
}
.assess-card {
  background: var(--c-card);
  border-radius: var(--r-lg);
  padding: 14px 14px 10px;
  border: 1px solid var(--c-border);
}
.assess-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-left: 8px;
  margin-bottom: 8px;
}
.assess-card-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--c-text-secondary);
}
.assess-card-score {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}
.assess-card-max {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-text-muted);
  margin-left: 2px;
}
.assess-bar-track {
  height: 4px;
  background: var(--c-surface);
  border-radius: 2px;
  overflow: hidden;
}
.assess-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* 右侧评分卡 */
.score-card {
  text-align: center;
}
.score-label-wrap {
  margin: 8px 0;
}

/* 评分明细小字 */
.score-detail-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 4px;
}

@media (max-width: 768px) {
  .assessment-layout {
    flex-direction: column;
  }
  .assessment-right {
    width: 100%;
  }
  .assessment-cards {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}

/* ============================================
   Assessment — Score Ring
   ============================================ */
.score-ring-wrap {
  display: flex; justify-content: center; align-items: center; padding: 8px 0;
}
.score-ring {
  position: relative; width: 140px; height: 140px;
  display: flex; align-items: center; justify-content: center;
}
.score-ring svg { /* 通过JS调整stroke-dashoffset实现起始位置 */ }
.score-ring .ring-bg {
  fill: none; stroke: var(--c-border);
  stroke-width: 10;
}
.score-ring .ring-fill {
  fill: none; stroke-width: 10; stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}
.score-num-overlay {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center; width: 100%;
}
.score-number { font-size: 36px; font-weight: 700; line-height: 1; }
.score-label-sm { font-size: 12px; color: var(--c-text-secondary); margin-top: 4px; }

.score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 6px;
  font-size: 12px;
  border-bottom: 1px solid var(--c-border-light);
}
.score-item:last-child { border-bottom: none; }
.score-name {
  color: var(--c-text-secondary);
  font-weight: 600;
}
.score-val {
  font-weight: 700;
  font-size: 13px;
}
  padding: 10px 14px;
  background: var(--c-surface);
  border-radius: var(--r-sm);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; font-weight: 700;
}

/* Quality Grid — 4列水平排列 */
.quality-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: var(--gap-xs);
}
.quality-item {
  padding: 14px; background: var(--c-surface);
  border-radius: var(--r-sm); text-align: center;
}
.quality-item .q-label { font-size: 11px; color: var(--c-text-secondary); margin-bottom: 4px; }
.quality-item .q-value { font-size: 17px; font-weight: 700; }
.quality-item .q-tag {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 700; margin-top: 4px;
}
.q-tag.good { background: rgba(124,231,172,0.2); color: var(--c-success-text); }
.q-tag.warn { background: rgba(244,190,94,0.2); color: var(--c-warning-text); }
.q-tag.bad { background: rgba(255,128,139,0.2); color: var(--c-danger-text); }

/* ============================================
   Assessment — 紧凑卡片布局
   ============================================ */

/* 双列网格 */
.assess-grid {
  display: flex;
  gap: var(--gap-sm);
  align-items: stretch;
}
.assess-col-left {
  width: 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
}
.assess-col-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
}

/* 综合评分卡片 */
.assess-score-card .score-ring-wrap {
  padding: 2px 0;
}
.score-ring-lg svg {
  display: block;
  margin: 0 auto;
}
.score-number-lg {
  font-size: 52px;
}
.score-label-sm {
  font-size: 14px;
}

/* 评分明细带进度条 */
.score-detail-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.score-detail-item {
  padding: 6px 0;
}
.sdi-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.sdi-name {
  font-size: 13px;
  color: var(--c-text-secondary);
  font-weight: 600;
}
.sdi-val {
  font-size: 15px;
  font-weight: 800;
}
.sdi-bar-track {
  height: 4px;
  background: var(--c-surface);
  border-radius: 2px;
  overflow: hidden;
}
.sdi-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* 质量指标网格（2x2） */
.assess-quality-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.aq-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--c-surface);
  border-radius: var(--r-sm);
  padding: 12px 18px;
  gap: 12px;
}
.aq-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.aq-label {
  font-size: 13px;
  color: var(--c-text-primary);
  font-weight: 700;
  line-height: 1.3;
}
.aq-tag {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  width: fit-content;
}
.aq-tag.good { background: rgba(124,231,172,0.2); color: var(--c-success-text); }
.aq-tag.warn { background: rgba(244,190,94,0.2); color: var(--c-warning-text); }
.aq-tag.bad { background: rgba(255,128,139,0.2); color: var(--c-danger-text); }
.aq-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1;
  min-width: 0;
}
.aq-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  text-align: right;
  color: var(--c-text-primary);
  white-space: nowrap;
}

/* 关键结论卡片 */
.assess-conclusions-card {
  flex: 1;
}
.conclusion-item-lg {
  display: flex;
  align-items: flex-start; gap: 10px;
  padding: 12px 0;
  font-size: 15px;
  line-height: 1.7;
  border-bottom: 1px solid var(--c-border-light);
}
.conclusion-item-lg:last-child { border-bottom: none; }
.conclusion-item-lg .conclusion-icon {
  font-size: 16px;
}

/* 压力测试表格紧凑 */
.assess-stress-card .data-table {
  min-width: auto;
  font-size: 12px;
}
.assess-stress-card .data-table th,
.assess-stress-card .data-table td {
  padding: 8px 10px;
}

/* 手机：左右堆叠 */
@media (max-width: 900px) {
  .assess-grid {
    flex-direction: column;
  }
  .assess-col-left {
    width: 100%;
  }
  .assess-quality-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Category Rows */
.category-header-row {
  font-size: 14px; font-weight: 700; padding-bottom: 8px;
  margin-bottom: 8px; border-bottom: 2px solid var(--c-border);
}
.category-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0; border-bottom: 1px solid var(--c-border);
  font-size: 13px;
}
.category-row:last-child { border-bottom: none; }
.category-bar {
  width: 100%; height: 5px;
  background: var(--c-border); border-radius: 3px;
  margin-top: 4px; overflow: hidden;
}
.category-bar-fill {
  height: 100%; border-radius: 3px;
  transition: width 0.4s ease;
}

/* ============================================
   TOP10 表格布局
   ============================================ */
.top10-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-md);
}
.top10-col {
  min-width: 0;
}
.top10-subtitle {
  font-size: 13px; font-weight: 700;
  margin-bottom: 8px;
}
.top10-table { font-size: 12px; min-width: auto; }
.top10-table th { font-size: 11px; padding: 6px 8px; text-align: center; }
.top10-table td { padding: 6px 8px; text-align: center; }
/* TOP10 金额列右对齐，保持数字可读性 */
.top10-table td.col-income,
.top10-table td.col-expense {
  text-align: right !important;
}

@media (max-width: 768px) {
  .top10-grid {
    grid-template-columns: 1fr;
    gap: var(--gap-sm);
  }
}

/* ============================================
   History
   ============================================ */
.history-card {
  padding: 16px 20px; cursor: pointer; transition: all 0.15s;
}
.history-card:hover { background: var(--c-surface); }
.history-card .hc-name { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.history-card .hc-summary {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
  font-size: 13px; text-align: center;
}
.hist-val { font-weight: 700; font-size: 15px; }
.hist-lbl { font-size: 11px; color: var(--c-text-muted); }
.hist-date { font-size: 11px; color: var(--c-text-muted); margin-top: 8px; }
.hist-actions {
  display: flex; gap: 8px; margin-top: 10px;
  padding-top: 10px; border-top: 1px solid var(--c-border);
}

/* Folder Tabs */
.folder-tabs-row {
  display: flex; gap: 6px; overflow-x: auto;
  padding-bottom: 8px; margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}
.folder-tab {
  padding: 6px 16px; border-radius: 20px;
  font-size: 12px; font-weight: 700; border: none;
  background: var(--c-card); color: var(--c-text-secondary);
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: all 0.15s;
}
.folder-tab:hover { background: var(--c-surface); }
.folder-tab.active { background: var(--c-primary); color: white; }

/* Empty State */
.empty-state {
  text-align: center; padding: 48px 16px;
  color: var(--c-text-secondary);
}
.empty-icon { font-size: 44px; display: block; margin-bottom: 12px; }
.empty-hint { font-size: 12px; color: var(--c-text-muted); margin-top: 4px; }

/* Profile */
.section-title-sm { font-size: 14px; font-weight: 700; margin-bottom: 14px; }
.form-group { margin-bottom: 12px; }
.form-label {
  display: block; font-size: 12px; font-weight: 700;
  color: var(--c-text-secondary); margin-bottom: 4px;
}
.form-input {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--c-border); border-radius: var(--r-sm);
  font-size: 14px; background: var(--c-card);
  color: var(--c-text); font-family: var(--font-family);
  transition: border-color 0.2s;
}
.form-input:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-light);
}
.connection-status { margin-top: 8px; font-size: 12px; text-align: center; }
.connection-status.success { color: var(--c-success-text); }
.connection-status.error { color: var(--c-danger-text); }

/* ============================================
   Toast
   ============================================ */
.toast {
  position: fixed; top: 20px; left: 50%;
  transform: translateX(-50%) translateY(-120px);
  background: var(--c-text); color: white;
  padding: 10px 24px; border-radius: 20px;
  font-size: 13px; font-weight: 700;
  white-space: nowrap; z-index: 9999;
  transition: transform 0.3s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  max-width: 90vw; text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--c-success-text); }
.toast.error { background: var(--c-danger-text); }

/* Loading Overlay */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(245,245,250,0.85);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 9998;
}
.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 12px; font-size: 14px; color: var(--c-text-secondary); font-weight: 700; }

/* ============================================
   Page Footer Buttons
   ============================================ */
.page-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 0; flex-wrap: wrap; justify-content: center;
}
.page-footer .btn { flex: 1; min-width: 0; }

/* Action Row (two side-by-side buttons) */
.action-row {
  display: flex; gap: 8px; margin-top: 12px;
}
.action-row .btn { flex: 1; }

/* Pagination buttons */
.pag-btn {
  padding: 10px 24px !important;
  font-size: 14px !important;
}

/* History Header */
.history-header-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.history-header-row .folder-tabs-row {
  flex: 1; margin-bottom: 0; padding-bottom: 0;
  overflow-x: auto;
}

/* Folder context menu (right-click or long-press) */
.folder-ctx-btn {
  font-size: 11px; padding: 2px 6px;
  border: none; background: var(--c-border);
  border-radius: 4px; cursor: pointer;
  color: var(--c-text-secondary);
  margin-left: 4px;
  font-family: var(--font-family);
}
.folder-ctx-btn:hover { background: var(--c-primary); color: white; }

.hist-card-header {
  display: flex; align-items: center; justify-content: space-between;
}
.hist-actions-row {
  display: flex; gap: 4px;
}
.hist-action-btn {
  font-size: 10px; padding: 2px 6px;
  border: none; background: var(--c-border);
  border-radius: 4px; cursor: pointer;
  color: var(--c-text-secondary);
  font-family: var(--font-family);
  white-space: nowrap;
}
.hist-action-btn:hover { background: var(--c-primary); color: white; }
.hist-action-btn.danger:hover { background: var(--c-danger); }

.hist-move-select {
  font-size: 11px; padding: 2px 4px;
  border: 1px solid var(--c-border);
  border-radius: 4px; font-family: var(--font-family);
}

/* ============================================
   Mobile: 底部 Tab Bar
   ============================================ */
.mobile-tab-bar {
  display: none;
}
@media (max-width: 768px) {
  /* Hide desktop sidebar & icon nav */
  .icon-nav, .sidebar { display: none; }

  /* Main content full width */
  .main-content {
    width: 100%;
    padding-bottom: calc(var(--tab-h) + var(--safe-bottom));
  }
  .topbar {
    padding: 0 14px;
    height: 52px;
  }
  .topbar-menu-btn { display: none; }
  .topbar-title { font-size: 16px; }

  /* 预警提示移动端 — 保持布局紧凑 */
  .alert-layout { flex-direction: column; }
  .alert-summary-card {
    width: 100%;
    flex-direction: row;
    align-items: center;
    padding: 14px 18px;
    min-height: auto;
  }
  .alert-summary-title {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    margin-right: 24px;
    font-size: 14px;
    white-space: nowrap;
  }
  .alert-summary-items {
    flex-direction: row;
    gap: 24px;
    justify-content: flex-end;
    flex: none;
    padding: 0;
  }
  .alert-summary-item { gap: 0; }
  .alert-summary-count { font-size: 24px; }
  .alert-summary-label { font-size: 12px; }
  .alert-grid-4 { grid-template-columns: 1fr 1fr; }

  .page-scroll {
    padding: 0 14px 16px;
  }

  /* Show mobile tab bar */
  .mobile-tab-bar {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--c-card);
    border-top: 1px solid var(--c-border);
    padding-bottom: var(--safe-bottom);
    z-index: 200;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
  }
  .mobile-tab-item {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 6px 2px; border: none;
    background: transparent; cursor: pointer;
    font-family: var(--font-family);
    transition: all 0.15s;
    font-size: 20px; color: var(--c-text-muted);
  }
  .mobile-tab-item .tab-label {
    font-size: 10px; margin-top: 1px;
    font-weight: 700; color: var(--c-text-muted);
  }
  .mobile-tab-item.active { color: var(--c-primary); }
  .mobile-tab-item.active .tab-label { color: var(--c-primary); }

  /* Adjust card grid */
  .card-grid { grid-template-columns: 1fr 1fr; }
  .hero-row { gap: 6px; }
  .hero-card { padding: 12px 8px; }
  .hero-card-val { font-size: 18px; }

  .counters-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .counter-card { padding: 14px 16px; min-height: 76px; }
  .counter-card-value { font-size: 17px; }

  .quality-grid { grid-template-columns: 1fr 1fr; }

  /* Desktop tabs become scrollable */
  .desktop-tabs {
    position: sticky; top: 0;
    overflow-x: auto;
  }
  .desktop-tab {
    flex: none; white-space: nowrap;
    padding: 8px 14px;
  }

  /* Rules page mobile: stack fields vertically */
  .rule-fields {
    flex-direction: column;
    gap: 6px;
  }
  .rule-fields .rule-input:first-child,
  .rule-fields .rule-input:nth-child(2) {
    max-width: 100%;
  }
  .rule-toggle {
    align-self: flex-end;
    margin-top: -2px;
  }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1200px) {
  .sidebar { width: 220px; }
  .sidebar-header { padding: 18px 16px 12px; }
  .sidebar-section { padding: 0 16px; }
  .hero-row { gap: 12px; }
  .counters-row { grid-template-columns: repeat(2, 1fr); }
}

/* Wide Desktop */
@media (min-width: 1440px) {
  .counters-row { grid-template-columns: repeat(4, 1fr); }
  .chart-dual { grid-template-columns: 1fr 1fr; }
}

/* Modal Sheet (mobile) */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(28,29,33,0.3);
  z-index: 300;
  display: flex; align-items: flex-end; justify-content: center;
}
/* Centered variant — for detail popups that should appear in the middle of the screen */
.modal-overlay.centered {
  align-items: center;
  justify-content: center;
}
.modal-sheet {
  width: 100%; max-width: 480px;
  background: var(--c-card);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 20px;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
/* 居中弹窗动画 — 淡入缩放 */
@keyframes fadeScaleIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.centered .modal-sheet,
.centered .modal-sheet-lg {
  animation: fadeScaleIn 0.25s ease;
}

/* Sidebar responsive */
@media (max-width: 1100px) {
  .sidebar { width: 200px; }
}
@media (max-width: 900px) {
  .sidebar { width: 180px; font-size: 12px; }
}

/* ============================================
   Login Page
   ============================================ */
.login-page {
  width: 100%; height: 100vh;
  background: var(--c-primary);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.login-bg {
  width: 100%; max-width: 1200px; height: 100%;
  display: flex; position: relative;
}
.login-left {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 60px 40px; z-index: 2;
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--c-card);
  border-radius: 24px;
  padding: 40px 36px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
  border: 0.3px solid #B9B9B9;
}
.login-logo { text-align: center; margin-bottom: 20px; }
.login-logo-img { width: 56px; height: 56px; border-radius: 12px; object-fit: contain; }
.login-title { font-size: 22px; font-weight: 700; text-align: center; color: var(--c-text); }
.login-subtitle { font-size: 13px; color: var(--c-text-secondary); text-align: center; margin-top: 4px; margin-bottom: 24px; }

.login-tabs { display: flex; background: var(--c-surface); border-radius: 8px; padding: 3px; margin-bottom: 20px; }
.login-tab { flex: 1; padding: 10px; border: none; background: transparent; border-radius: 6px; font-size: 14px; font-weight: 700; color: var(--c-text-secondary); cursor: pointer; font-family: var(--font-family); transition: all 0.15s; }
.login-tab.active { background: var(--c-primary); color: white; }

.login-form { }
.login-input-wrap { display: flex; align-items: center; gap: 10px; background: var(--c-surface); border-radius: 8px; padding: 0 14px; margin-bottom: 12px; border: 0.5px solid #D8D8D8; transition: border-color 0.2s; }
.login-input-wrap:focus-within { border-color: var(--c-primary); background: var(--c-card); }
.login-input-icon { font-size: 16px; flex-shrink: 0; }
.login-input { flex: 1; padding: 12px 0; border: none; background: transparent; font-size: 14px; color: var(--c-text); font-family: var(--font-family); outline: none; }
.login-sms-btn { padding: 6px 12px; border: none; background: var(--c-primary); color: white; border-radius: 6px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; font-family: var(--font-family); }
.login-sms-btn:disabled { background: var(--c-border); color: var(--c-text-muted); cursor: not-allowed; }
.login-forgot { text-align: right; margin-bottom: 16px; }
.login-forgot a { font-size: 12px; color: var(--c-text-secondary); text-decoration: none; }
.login-submit-btn { width: 100%; padding: 12px; border: none; background: var(--c-primary); color: white; font-size: 16px; font-weight: 700; border-radius: var(--r-sm); cursor: pointer; font-family: var(--font-family); transition: background 0.15s; }
.login-submit-btn:hover { background: var(--c-primary-dark); }
.login-error { margin-top: 12px; padding: 10px 14px; background: rgba(255,128,139,0.1); border-radius: var(--r-sm); font-size: 12px; color: var(--c-danger-text); text-align: center; }

.forgot-pwd-panel { }
.forgot-back { font-size: 14px; color: var(--c-primary); cursor: pointer; margin-bottom: 16px; font-weight: 700; }

.login-right {
  flex: 1; position: relative; overflow: hidden;
  background: radial-gradient(98.58% 98.58% at 57.43% 48.15%, var(--c-primary) 0%, #1B51E5 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-illustration { text-align: center; }
.login-illust-circle {
  width: 200px; height: 200px;
  border: 3px solid rgba(255,255,255,0.15);
  border-radius: 50%; margin: 0 auto 24px;
  display: flex; align-items: center; justify-content: center;
}
.login-illust-card {
  width: 120px; height: 80px;
  background: rgba(255,255,255,0.12);
  border-radius: 10px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: rgba(255,255,255,0.8);
}
.illust-chart-icon { font-size: 28px; }
.illust-text { font-size: 12px; color: rgba(255,255,255,0.6); margin-top: 4px; }

@media (max-width: 768px) {
  .login-right { display: none; }
  .login-left { padding: 40px 20px; }
  .login-card { padding: 30px 24px; }
}

/* ============================================
   Profile Page
   ============================================ */
.profile-header-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--c-card); border-radius: var(--r-lg);
  padding: 20px; margin-bottom: 12px;
}
.profile-avatar { width: 56px; height: 56px; border-radius: 50%; overflow: hidden; background: var(--c-surface); flex-shrink: 0; }
.profile-avatar-img { width: 100%; height: 100%; object-fit: cover; }
.profile-user-info { flex: 1; min-width: 0; }
.profile-user-name { font-size: 17px; font-weight: 700; color: var(--c-text); }
.profile-user-phone { font-size: 12px; color: var(--c-text-secondary); margin-top: 2px; }
.profile-membership-badge {
  padding: 4px 12px; border-radius: 12px;
  background: var(--c-primary-light); color: var(--c-primary);
  font-size: 11px; font-weight: 700; white-space: nowrap;
}

.profile-menu-card { padding: 0; overflow: hidden; }
.profile-menu-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; cursor: pointer; transition: background 0.15s;
}
.profile-menu-item:hover { background: var(--c-surface); }
.profile-menu-item:active { background: var(--c-border); }
.profile-menu-left { display: flex; align-items: center; gap: 10px; }
.profile-menu-icon { font-size: 18px; width: 24px; text-align: center; }
.profile-menu-label { font-size: 14px; font-weight: 500; color: var(--c-text); }
.profile-menu-right { display: flex; align-items: center; gap: 8px; }
.profile-menu-value { font-size: 13px; color: var(--c-text-secondary); }
.profile-menu-copy {
  font-size: 11px; font-weight: 700; color: var(--c-primary);
  padding: 2px 8px; background: var(--c-primary-light);
  border-radius: 4px; cursor: pointer;
}
.profile-menu-arrow { font-size: 18px; color: var(--c-text-muted); }
.profile-menu-divider { height: 1px; background: var(--c-border); margin: 0 18px; }
.profile-menu-logout { }

/* Mobile tab icon */
.mob-tab-icon { width: 22px; height: 22px; object-fit: contain; opacity: 0.5; }
.mobile-tab-item.active .mob-tab-icon { opacity: 1; }

/* Demo Experience Card */
.demo-experience-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 18px;
  background: linear-gradient(135deg, #EEF2FF 0%, #E8F0FE 100%);
  border: 1px solid #D0D8F0;
}
.demo-experience-content {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 0;
}
.demo-icon { font-size: 28px; flex-shrink: 0; }
.demo-title { font-size: 14px; font-weight: 700; color: var(--c-text); }
.demo-desc { font-size: 12px; color: var(--c-text-secondary); margin-top: 2px; }

/* [小程序免登] 重试 UI 样式 */
.miniprogram-login-msg {
  text-align: center;
  padding: 24px 0 0 0;
}

.mp-login-text {
  font-size: 14px;
  color: #F59E0B;
  margin-bottom: 20px;
}

.retry-btn {
  background: #F59E0B;
}

.retry-btn:hover {
  background: #D97706;
}
