/**
 * HeJu - 组件样式
 * 卡片、按钮、输入框、Modal、记录列表、条形图等
 */

/* ========== 卡片 ========== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.btn-secondary {
  background: var(--secondary);
  color: #fff;
}

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: var(--bg);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* ========== FAB 浮动按钮 ========== */
.fab {
  position: fixed;
  bottom: 80px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.fab:active {
  transform: scale(0.92);
}

@media (min-width: 769px) {
  .fab {
    bottom: 32px;
    right: 32px;
  }
}

/* ========== 表单输入 ========== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  color: var(--text-hint);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--card-bg);
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus {
  border-color: var(--primary);
}

.form-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--card-bg);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-select:focus {
  border-color: var(--primary);
}

/* ========== 金额输入 ========== */
.amount-input {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  border: none;
  border-bottom: 2px solid var(--border);
  border-radius: 0;
  padding: 12px 0;
}

.amount-input:focus {
  border-bottom-color: var(--primary);
}

/* ========== Toggle 切换 ========== */
.toggle-group {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.toggle-option {
  flex: 1;
  padding: 8px 0;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--card-bg);
  border: none;
  transition: background-color 0.15s, color 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.toggle-option + .toggle-option {
  border-left: 1px solid var(--border);
}

.toggle-option.active-expense {
  background: var(--expense-color);
  color: #fff;
}

.toggle-option.active-income {
  background: var(--income-color);
  color: #fff;
}

.toggle-option.active {
  background: var(--primary);
  color: #fff;
}

/* ========== Modal 浮层 ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px;
  position: relative;
}

/* 桌面端居中显示 */
@media (min-width: 769px) {
  .modal-overlay {
    align-items: center;
  }

  .modal {
    border-radius: var(--radius);
    max-height: 80vh;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

/* ========== 引导弹窗 ========== */
.onboarding-modal .modal {
  text-align: center;
}

.onboarding-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.onboarding-subtitle {
  font-size: 13px;
  color: var(--text-hint);
  margin-bottom: 24px;
}

.onboarding-form .form-group {
  text-align: left;
}

/* ========== 月份筛选栏 ========== */
.month-filter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.month-filter-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.month-filter-btn:hover {
  background: var(--border);
}

.month-filter-label {
  font-size: 15px;
  font-weight: 600;
  min-width: 100px;
  text-align: center;
}

/* ========== 汇总卡片 ========== */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.summary-item {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  text-align: center;
}

.summary-item-label {
  font-size: 11px;
  color: var(--text-hint);
  margin-bottom: 4px;
}

.summary-item-value {
  font-size: 18px;
  font-weight: 700;
}

.summary-item-value.income {
  color: var(--income-color);
}

.summary-item-value.expense {
  color: var(--expense-color);
}

.summary-item-value.balance {
  color: var(--secondary);
}

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

  .summary-item {
    padding: 10px 8px;
  }

  .summary-item-value {
    font-size: 15px;
  }
}

/* ========== 分类条形图 ========== */
.category-chart {
  margin-top: 8px;
}

.category-bar-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12px;
}

.category-bar-label {
  width: 70px;
  flex-shrink: 0;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-bar-track {
  flex: 1;
  height: 16px;
  background: var(--bg);
  border-radius: 8px;
  overflow: hidden;
  margin: 0 10px;
}

.category-bar-fill {
  height: 100%;
  border-radius: 8px;
  min-width: 2px;
  transition: width 0.3s;
}

.category-bar-amount {
  width: 70px;
  flex-shrink: 0;
  text-align: right;
  color: var(--text-secondary);
  font-size: 11px;
}

/* ========== AA 视图 ========== */
.aa-card {
  text-align: center;
}

.aa-row {
  display: flex;
  justify-content: space-around;
  margin-bottom: 16px;
}

.aa-person {
  text-align: center;
}

.aa-person-name {
  font-size: 12px;
  color: var(--text-hint);
  margin-bottom: 4px;
}

.aa-person-amount {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.aa-divider {
  width: 1px;
  background: var(--border);
}

.aa-result {
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
}

.aa-result strong {
  color: var(--primary);
}

/* ========== 记录列表 ========== */
.record-list {
  margin-top: 8px;
}

.record-item-wrapper {
  position: relative;
  overflow: hidden;
  margin-bottom: 1px;
}

.record-item-delete {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 80px;
  background: var(--danger);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
}

.record-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--card-bg);
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: transform 0.15s;
  border-bottom: 1px solid var(--bg);
}

.record-item:active {
  background: var(--bg);
}

.record-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-right: 12px;
  flex-shrink: 0;
  background: var(--bg);
}

.record-info {
  flex: 1;
  min-width: 0;
}

.record-category {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.record-meta {
  font-size: 11px;
  color: var(--text-hint);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.record-payer-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  background: var(--bg);
  color: var(--text-hint);
}

.record-amount {
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
  margin-left: 8px;
}

.record-amount.income {
  color: var(--income-color);
}

.record-amount.expense {
  color: var(--expense-color);
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-hint);
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.empty-state-text {
  font-size: 14px;
}

/* ========== 分类颜色 ========== */
.cat-color-food { background-color: #FF9800; }
.cat-color-transport { background-color: #2196F3; }
.cat-color-rent { background-color: #9C27B0; }
.cat-color-utility { background-color: #00BCD4; }
.cat-color-grocery { background-color: #8BC34A; }
.cat-color-medical { background-color: #F44336; }
.cat-color-fun { background-color: #E91E63; }
.cat-color-social { background-color: #FF5722; }
.cat-color-parents { background-color: #795548; }
.cat-color-pet { background-color: #607D8B; }
.cat-color-other { background-color: #9E9E9E; }
.cat-color-income { background-color: #4CAF50; }

/* ========== Tab 切换 ========== */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.tab-item {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-hint);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  user-select: none;
}

.tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* ========== 记账 v2：主页 ========== */
.fin-month-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.fin-month-label {
  font-size: 15px;
  font-weight: 600;
  min-width: 100px;
  text-align: center;
}

.fin-overview {
  padding: 16px;
}

.fin-overview-row {
  display: flex;
  justify-content: space-between;
}

.fin-overview-item {
  text-align: center;
  flex: 1;
}

.fin-overview-label {
  font-size: 11px;
  color: var(--text-hint);
  margin-bottom: 4px;
}

.fin-overview-value {
  font-size: 18px;
  font-weight: 700;
}

.fin-overview-value.expense { color: var(--expense-color); }
.fin-overview-value.income { color: var(--income-color); }

.fin-overview-cmp {
  text-align: center;
  font-size: 12px;
  margin-top: 10px;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-hint);
}
.fin-overview-cmp.expense { color: var(--expense-color); }
.fin-overview-cmp.income { color: var(--income-color); }

/* 分类堆叠条 */
.fin-cat-bar-card {
  padding: 14px 16px;
}

.fin-stack-bar {
  display: flex;
  height: 20px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.fin-stack-seg {
  min-width: 3px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.fin-stack-seg:hover {
  opacity: 0.8;
}

.fin-cat-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fin-cat-legend-item {
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.fin-cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* 筛选标签 */
.fin-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #FFF0EE;
  border-radius: 20px;
  font-size: 13px;
  color: var(--primary);
  margin-bottom: 12px;
}

.fin-filter-tag button {
  border: none;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}

/* 流水列表 */
.fin-tx-list {
  margin-top: 8px;
}

.fin-tx-group {
  margin-bottom: 4px;
}

.fin-tx-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
  font-size: 12px;
  color: var(--text-hint);
  font-weight: 600;
}

.fin-tx-group-sum {
  font-weight: 400;
}

/* 撤销横幅 */
.fin-undo-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 8px;
}

.fin-undo-btn {
  border: 1px solid rgba(255,255,255,0.5);
  background: transparent;
  color: #fff;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  margin-left: 12px;
  flex-shrink: 0;
}

.fin-undo-btn:hover {
  background: rgba(255,255,255,0.15);
}

/* ========== 记账 v2：录入页 ========== */
.fin-input-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.fin-input-back {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
}

.fin-input-title {
  font-size: 16px;
  font-weight: 600;
}

.fin-input-del {
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
}

/* 类型 Tab */
.fin-type-tabs {
  display: flex;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.fin-type-tab {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-hint);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  user-select: none;
}

.fin-type-tab.active.expense {
  color: var(--expense-color);
  border-bottom-color: var(--expense-color);
}

.fin-type-tab.active.income {
  color: var(--income-color);
  border-bottom-color: var(--income-color);
}

/* 金额显示 */
.fin-amount-display {
  text-align: right;
  padding: 16px 8px 12px;
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
}

.fin-amount-yen {
  font-size: 20px;
  color: var(--text-hint);
  margin-right: 4px;
}

.fin-amount-num {
  font-size: 42px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s;
}

/* 分类 9 宫格 */
.fin-cat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

@media (max-width: 400px) {
  .fin-cat-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.fin-cat-grid-full {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.fin-cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}

.fin-cat-item:hover {
  background: var(--bg);
}

.fin-cat-item.selected {
  background: #FFF0EE;
  box-shadow: inset 0 0 0 2px var(--primary);
}

.fin-cat-icon {
  font-size: 22px;
  margin-bottom: 2px;
}

.fin-cat-name {
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.fin-cat-item.selected .fin-cat-name {
  color: var(--primary);
  font-weight: 600;
}

.fin-cat-more {
  opacity: 0.6;
}

/* 快速备注 */
.fin-quick-notes {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 10px;
  -webkit-overflow-scrolling: touch;
}

.fin-quick-note {
  flex-shrink: 0;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.fin-quick-note:hover {
  background: var(--bg);
}

/* 付款人按钮组（在 fin-payer-split-row 内）*/
.fin-payer-group {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.fin-payer-btn {
  padding: 7px 12px;
  border: none;
  background: var(--card-bg);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  border-right: 1px solid var(--border);
}

.fin-payer-btn:last-child {
  border-right: none;
}

.fin-payer-btn.active {
  background: var(--primary);
  color: #fff;
}

.fin-split-btn {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  padding: 7px 10px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  margin-left: auto;
}

/* 分摊选择弹窗 */
.fin-split-option {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid var(--bg);
}

.fin-split-option:hover {
  background: var(--bg);
}

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

/* 账户行 */
.fin-account-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.fin-account-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.1s;
  flex: 1;
  text-align: center;
  background: var(--bg);
}

.fin-account-item.active {
  border-color: var(--primary);
  background: #FFF0EE;
}

.fin-account-icon {
  font-size: 18px;
  margin-bottom: 2px;
}

.fin-account-name {
  font-size: 9px;
  color: var(--text-hint);
}

.fin-account-item.active .fin-account-name {
  color: var(--primary);
}

/* 小节标签 */
.fin-section-label {
  font-size: 11px;
  color: var(--text-hint);
  margin-bottom: 6px;
  font-weight: 500;
}

/* 付款人 + 分摊并排 */
.fin-payer-split-row {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
  align-items: flex-end;
}

.fin-payer-side {
  flex: 1;
}

.fin-split-side {
  flex-shrink: 0;
}

/* 日期 + 备注行 */
.fin-extra-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.fin-date-input {
  width: 140px;
  flex-shrink: 0;
  font-size: 13px;
  padding: 8px 10px;
}

.fin-note-input {
  flex: 1;
  font-size: 13px;
  padding: 8px 10px;
}

/* 保存行 */
.fin-save-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

/* 数字键盘 */
.fin-numpad {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  padding: 8px 0;
}

.fin-numpad-key {
  height: 48px;
  border: none;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 20px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s;
}

.fin-numpad-key:active {
  background: var(--border);
}

.fin-numpad-del {
  font-size: 18px;
}

@media (max-width: 768px) {
  .fin-overview-value {
    font-size: 15px;
  }
  .fin-amount-num {
    font-size: 36px;
  }
}

/* ========== 记账 v2：总览卡片扩展 ========== */
.fin-overview-top {
  display: flex;
  align-items: flex-start;
}

.fin-overview-top .fin-overview-row {
  flex: 1;
}

.fin-settle-entry {
  flex-shrink: 0;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  white-space: nowrap;
  margin-left: 8px;
  margin-top: 2px;
}

.fin-settle-entry:hover {
  background: #FFF0EE;
}

/* 预算进度条 */
.fin-budget-bar {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--bg);
}

.fin-budget-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-hint);
  margin-bottom: 4px;
}

.fin-budget-track {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}

.fin-budget-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

.fin-budget-set {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--bg);
  text-align: center;
}

.fin-budget-set-btn {
  border: none;
  background: transparent;
  color: var(--text-hint);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

/* 分类预算对比标签 */
.fin-cat-budget {
  font-size: 10px;
  color: var(--text-hint);
  margin-left: 2px;
}

.fin-cat-budget.over {
  color: var(--expense-color);
  font-weight: 600;
}

/* 预算 80% 友好提示 */
.fin-budget-hint {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: #E8F5E9;
  color: #2E7D32;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
}

.fin-budget-hint-close {
  border: none;
  background: transparent;
  color: #2E7D32;
  font-size: 14px;
  cursor: pointer;
  margin-left: auto;
  padding: 0 4px;
  flex-shrink: 0;
}

/* ========== AA 结算页 ========== */
.fin-settled-banner {
  padding: 10px 14px;
  background: #E8F5E9;
  color: #2E7D32;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
  text-align: center;
}

.fin-settle-card {
  text-align: center;
}

.fin-settle-total {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.fin-settle-total strong {
  font-size: 20px;
  color: var(--text-primary);
}

.fin-settle-grid {
  display: flex;
  align-items: stretch;
  margin-bottom: 12px;
}

.fin-settle-col {
  flex: 1;
  padding: 8px 0;
}

.fin-settle-divider {
  width: 1px;
  background: var(--border);
  margin: 0 12px;
}

.fin-settle-col-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.fin-settle-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 3px 8px;
}

.fin-settle-label {
  color: var(--text-hint);
}

.fin-settle-joint {
  font-size: 11px;
  color: var(--text-hint);
  margin-bottom: 12px;
}

.fin-settle-result {
  font-size: 18px;
  font-weight: 700;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.fin-settle-result.income {
  color: var(--income-color);
  background: #E8F5E9;
}

.fin-settle-result.expense {
  color: var(--expense-color);
  background: #FFF0EE;
}

/* 结算明细列表 */
.fin-settle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--bg);
  cursor: pointer;
  font-size: 13px;
}

.fin-settle-item:last-child {
  border-bottom: none;
}

.fin-settle-item-left {
  display: flex;
  align-items: center;
  min-width: 0;
}

.fin-settle-item-right {
  text-align: right;
  flex-shrink: 0;
}

.fin-settle-item-amt {
  font-weight: 600;
  display: block;
}

.fin-settle-item-detail {
  font-size: 11px;
  color: var(--text-hint);
  display: block;
}

.fin-settle-item-split {
  font-size: 10px;
  color: var(--secondary);
  display: block;
}

/* 预算设置 Modal */
.fin-budget-cats-title {
  font-size: 12px;
  color: var(--text-hint);
  margin-bottom: 8px;
  cursor: pointer;
}

.fin-budget-cats {
  max-height: 300px;
  overflow-y: auto;
}

.fin-budget-cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--bg);
}

.fin-budget-cat-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.fin-budget-cat-input {
  width: 90px;
  text-align: right;
  padding: 6px 8px;
  font-size: 13px;
}

/* ========== 日历网格 ========== */
.cal-grid {
  padding: 12px;
  overflow: hidden;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 8px;
}

.cal-weekday {
  font-size: 12px;
  color: var(--text-hint);
  padding: 6px 0;
  font-weight: 500;
}

.cal-weekday.cal-weekend {
  color: var(--primary-light);
}

.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day {
  position: relative;
  text-align: center;
  padding: 8px 2px 6px;
  min-height: 44px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.1s;
  user-select: none;
}

.cal-day:hover {
  background: var(--bg);
}

.cal-day-empty {
  cursor: default;
}

.cal-day-empty:hover {
  background: transparent;
}

.cal-day-number {
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
}

.cal-day-today {
  background: var(--primary);
  color: #fff;
}

.cal-day-today:hover {
  background: var(--primary-dark);
}

.cal-day-dots {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-top: 4px;
}

.cal-day-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
}

.cal-day-today .cal-day-dot {
  border: 1px solid rgba(255,255,255,0.6);
}

@media (max-width: 768px) {
  .cal-day {
    min-height: 40px;
    padding: 6px 1px 4px;
  }

  .cal-day-number {
    font-size: 13px;
  }

  .cal-day-dot {
    width: 4px;
    height: 4px;
  }
}

/* ========== 日历事件列表（日详情弹窗内） ========== */
.cal-event-list {
  margin-bottom: 4px;
}

.cal-event-item {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--bg);
  cursor: pointer;
}

.cal-event-item:last-child {
  border-bottom: none;
}

.cal-event-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-right: 10px;
  flex-shrink: 0;
}

.cal-event-info {
  flex: 1;
  min-width: 0;
}

.cal-event-title {
  font-size: 14px;
  font-weight: 500;
}

.cal-event-meta {
  font-size: 11px;
  color: var(--text-hint);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-repeat-tag {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  background: var(--secondary-light);
  color: #fff;
}

.cal-event-delete-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-hint);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-event-delete-btn:hover {
  background: #fee;
  color: var(--danger);
}

/* ========== 日程关联人选择 ========== */
.cal-person-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.cal-person-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ========== 未来 7 天日程列表 ========== */
.cal-upcoming-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-hint);
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--bg);
}

.cal-upcoming-item {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--bg);
}

.cal-upcoming-item:last-child {
  border-bottom: none;
}

.cal-upcoming-icon {
  font-size: 16px;
  margin-right: 10px;
  flex-shrink: 0;
}

.cal-upcoming-title {
  flex: 1;
  font-size: 14px;
}

.cal-upcoming-time {
  font-size: 12px;
  color: var(--text-hint);
  flex-shrink: 0;
  margin-left: 8px;
}

/* ========== 全局提醒横幅 ========== */
.alert-banner-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  pointer-events: none;
}

.alert-banner {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  font-size: 13px;
  line-height: 1.5;
  pointer-events: auto;
}

.alert-banner-normal {
  background: var(--secondary);
  color: #fff;
}

.alert-banner-parent {
  background: var(--primary);
  color: #fff;
}

.alert-banner-care {
  background: #795548;
  color: #fff;
}

.alert-banner-text {
  flex: 1;
  word-break: break-word;
  line-height: 1.4;
}

.alert-banner-close {
  width: 24px;
  height: 24px;
  border: none;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.alert-banner-close:hover {
  background: rgba(255,255,255,0.35);
}

/* 有横幅时给侧边栏和内容区留出空间 */
body.has-alerts .sidebar {
  top: 0;
}

body.has-alerts .content {
  padding-top: 24px;
}

@media (max-width: 768px) {
  .alert-banner {
    padding: 8px 12px;
    font-size: 12px;
  }
}

/* ========== 每日一题 ========== */

/* 题目卡片 */
.daily-question-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  text-align: center;
  margin-bottom: 20px;
}

.daily-theme-tag {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 11px;
  color: #fff;
  margin-bottom: 16px;
}

.daily-theme-tag-sm {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  color: #fff;
}

.daily-question-text {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.daily-date {
  font-size: 12px;
  color: var(--text-hint);
}

/* 答题区 */
.daily-answers-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .daily-answers-area {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.daily-answer-block {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.daily-answer-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-hint);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.daily-answer-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  resize: vertical;
  min-height: 80px;
  outline: none;
  font-family: inherit;
  line-height: 1.6;
  transition: border-color 0.15s;
}

.daily-answer-input:focus {
  border-color: var(--primary);
  background: var(--card-bg);
}

.daily-answer-waiting {
  color: var(--text-hint);
  font-size: 14px;
  text-align: center;
  padding: 24px 0;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.daily-answer-done {
  color: var(--success);
  font-size: 13px;
  text-align: center;
  padding: 24px 0;
  background: #f0faf0;
  border-radius: var(--radius-sm);
}

.daily-answer-revealed {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-word;
}

/* 揭晓 & 存回忆 */
.daily-reveal-section {
  text-align: center;
  margin-bottom: 20px;
}

.daily-save-btn {
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

.daily-save-btn:hover {
  background: #FFF0EE !important;
}

.daily-saved-tag {
  color: var(--primary);
  font-size: 14px;
  font-weight: 500;
}

/* 历史记录 */
.daily-history-stats {
  font-size: 13px;
  color: var(--text-hint);
  margin-bottom: 12px;
}

.daily-history-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.daily-filter-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  background: var(--card-bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.daily-filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.daily-history-item {
  margin-bottom: 12px;
}

.daily-history-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.daily-history-date {
  font-size: 12px;
  color: var(--text-hint);
}

.daily-history-heart {
  color: var(--primary);
  font-size: 14px;
  margin-left: auto;
}

.daily-history-question {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.daily-history-answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}

@media (max-width: 768px) {
  .daily-history-answers {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.daily-history-answer {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.daily-history-answer-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-hint);
  margin-bottom: 4px;
}

.daily-history-answer-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

.daily-history-save-btn {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--primary);
  border-radius: 20px;
  font-size: 11px;
  color: var(--primary);
  background: transparent;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.15s;
}

.daily-history-save-btn:hover {
  background: #FFF0EE;
}

/* ========== 父母模式 ========== */

/* 4 卡片网格 */
.parent-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 768px) {
  .parent-cards-grid {
    grid-template-columns: 1fr;
  }
}

.parent-card {
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.parent-card:hover {
  box-shadow: var(--shadow-lg);
}

.parent-card-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.parent-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-right: 12px;
  flex-shrink: 0;
}

.parent-card-name {
  font-size: 15px;
  font-weight: 600;
}

.parent-card-role {
  font-size: 11px;
  color: var(--text-hint);
  margin-top: 1px;
}

.parent-card-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.parent-card-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: var(--bg);
  color: var(--text-secondary);
  white-space: nowrap;
}

.parent-card-tag.tag-warn {
  background: #FFF0EE;
  color: var(--primary);
  font-weight: 500;
}

.parent-card-empty {
  color: var(--text-hint);
  font-size: 13px;
  text-align: center;
  padding: 10px 0;
}

/* 详情 Modal 内部 */
.parent-detail-scroll {
  max-height: 60vh;
  overflow-y: auto;
  margin: 0 -24px;
  padding: 0 24px;
}

@media (max-width: 768px) {
  .parent-detail-scroll {
    max-height: 65vh;
  }
}

.parent-detail-section {
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--bg);
}

.parent-detail-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.parent-detail-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
}

/* 节日决策 */
.holiday-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
}

.holiday-stat {
  font-size: 13px;
  color: var(--text-secondary);
}

.holiday-stat strong {
  font-size: 18px;
  color: var(--text-primary);
}

.holiday-fairness {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.holiday-fair {
  background: #e8f5e9;
  color: #388e3c;
}

.holiday-ok {
  background: #fff8e1;
  color: #f57f17;
}

.holiday-unfair {
  background: #fce4ec;
  color: #c62828;
}

.holiday-years {
  margin-top: 4px;
}

.holiday-year-row {
  display: flex;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--bg);
  font-size: 13px;
  gap: 10px;
}

.holiday-year-row:last-child {
  border-bottom: none;
}

.holiday-year {
  font-weight: 600;
  color: var(--text-secondary);
  width: 50px;
  flex-shrink: 0;
}

.holiday-choice {
  color: var(--text-primary);
  font-weight: 500;
}

.holiday-note {
  color: var(--text-hint);
  font-size: 12px;
  margin-left: auto;
}

/* 就医档案 */
.med-record {
  padding: 12px 0;
  border-bottom: 1px solid var(--bg);
}

.med-record:last-child {
  border-bottom: none;
}

.med-record-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.med-record-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.med-record-hospital {
  font-size: 12px;
  color: var(--text-hint);
}

.med-record-del {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--text-hint);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
}

.med-record-del:hover {
  color: var(--danger);
}

.med-row {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  padding: 2px 0;
}

.med-label {
  display: inline-block;
  width: 40px;
  font-size: 11px;
  color: var(--text-hint);
  flex-shrink: 0;
}

/* ========== 记账：子导航 ========== */
.fin-sub-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.fin-sub-nav-btn {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 16px;
  cursor: pointer;
}

.fin-sub-nav-btn:hover {
  background: var(--bg);
}

/* ========== 月度复盘 ========== */
.fin-review-card {
  margin-bottom: 12px;
}

.fin-review-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

.fin-review-grid4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
  text-align: center;
}

@media (max-width: 400px) {
  .fin-review-grid4 {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
}

.fin-review-num {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.fin-review-num.expense { color: var(--expense-color); }
.fin-review-num.income { color: var(--income-color); }

.fin-review-lbl {
  font-size: 10px;
  color: var(--text-hint);
  margin-top: 2px;
}

/* TOP3 排名 */
.fin-review-rank {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--bg);
}

.fin-review-rank:last-child { border-bottom: none; }

.fin-review-rank-n {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fin-review-rank-name {
  font-size: 13px;
  width: 60px;
  flex-shrink: 0;
}

.fin-review-rank-bar {
  flex: 1;
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}

.fin-review-rank-bar span {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
}

.fin-review-rank-amt {
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  width: 70px;
  text-align: right;
}

/* 同比 */
.fin-review-cmp-row {
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--bg);
}

.fin-review-cmp-up {
  color: var(--expense-color);
  font-weight: 700;
}

.fin-review-cmp-down {
  color: var(--income-color);
  font-weight: 700;
}

.fin-review-cmp-summary {
  padding-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* 亮点 */
.fin-review-highlight {
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--bg);
}

.fin-review-highlight:last-child { border-bottom: none; }

/* 双人贡献 */
.fin-review-duo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.fin-review-duo-person {
  text-align: center;
}

.fin-review-duo-name {
  font-size: 12px;
  color: var(--text-hint);
  margin-bottom: 4px;
}

.fin-review-duo-amt {
  font-size: 20px;
  font-weight: 700;
}

.fin-review-duo-vs {
  font-size: 24px;
}

/* 关怀提示 */
.fin-review-insight {
  padding: 8px 12px;
  background: #FFF8E1;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #5D4037;
  margin-bottom: 6px;
  line-height: 1.6;
}

/* ========== 趋势图 ========== */
.fin-chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.fin-chart-legend {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.fin-chart-legend span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 堆叠柱状图 */
.fin-stacked-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 140px;
}

.fin-stacked-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.fin-stacked-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse;
  min-height: 2px;
}

.fin-stacked-seg {
  min-height: 2px;
}

.fin-stacked-label {
  font-size: 10px;
  color: var(--text-hint);
  margin-top: 4px;
}
