/* ═══════════════════════════════════════════════════════
   念念 — 智能记账模块样式
   ═══════════════════════════════════════════════════════ */

/* ── 通用 ──────────────────────────────────────────── */

.bk-page {
  padding: 16px;
  padding-bottom: 80px;
  overflow-y: auto;
  flex: 1;
}

.bk-page__greeting {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--nn-ink);
  margin: 0 0 16px 0;
}

.bk-empty-hint {
  text-align: center;
  color: var(--nn-muted);
  font-size: var(--fs-sm);
  padding: 32px 0;
}

/* ── 服务页卡片 ────────────────────────────────────── */

.bk-service-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--nn-surface);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 8px rgba(46,124,104,0.06);
  cursor: pointer;
  transition: transform 0.15s;
}
.bk-service-card:active { transform: scale(0.98); }

.bk-service-card__icon {
  font-size: 2rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--nn-brand-soft, #E6F0EC);
  border-radius: 14px;
  flex-shrink: 0;
}

.bk-service-card__body { flex: 1; min-width: 0; }

.bk-service-card__title {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--nn-ink);
  margin-bottom: 4px;
}

.bk-service-card__subtitle {
  font-size: var(--fs-xs);
  color: var(--nn-muted);
  margin-bottom: 8px;
}

.bk-service-card__meta {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 4px;
}

.bk-service-card__meta-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.bk-service-card__meta-label {
  font-size: var(--fs-xs);
  color: var(--nn-muted);
}

.bk-service-card__income {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--nn-brand, #2E7C68);
}

.bk-service-card__expense {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--nn-danger, #D15040);
}

.bk-service-card__todo-count {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--nn-ink);
}

/* ── Header 按钮 ───────────────────────────────────── */

.bk-header-btn {
  font-size: var(--fs-sm) !important;
  padding: 6px 14px !important;
  border-radius: 18px !important;
}

.nn-header__back {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--nn-ink);
  flex-shrink: 0;
}
.nn-header__back:hover { background: var(--nn-brand-soft, #E6F0EC); }
.nn-header__back:active { transform: scale(0.95); }
.nn-header__back svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 标题居中：绝对定位 */
.nn-header {
  position: relative;
}
.nn-header__title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.bk-header-add {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--nn-brand-soft, #E6F0EC);
  color: var(--nn-brand, #2E7C68);
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.bk-header-add:active { transform: translateY(-50%) scale(0.92); }

/* ── 添加账户类型 sheet ────────────────────────────── */

.bk-account-type-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}

.bk-account-type-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--nn-surface);
  border-radius: 14px;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s;
}
.bk-account-type-item:active { transform: scale(0.98); }

.bk-account-type-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.bk-account-type-body { flex: 1; }
.bk-account-type-name {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--nn-ink);
  margin-bottom: 2px;
}
.bk-account-type-desc {
  font-size: var(--fs-xs);
  color: var(--nn-muted);
}

/* ── 余额行 ────────────────────────────────────────── */

.bk-balance-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--nn-surface);
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(46,124,104,0.06);
  cursor: pointer;
}

.bk-balance-row__label {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--nn-ink);
  flex-shrink: 0;
}

.bk-balance-row__pills {
  display: flex;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.bk-balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 10px;
  font-size: var(--fs-xs);
  font-weight: 500;
}

.bk-balance-pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.bk-balance-pill--saving {
  background: var(--nn-brand-soft, #E6F0EC);
  color: var(--nn-brand, #2E7C68);
}
.bk-balance-pill--saving .bk-balance-pill__dot {
  background: var(--nn-brand, #2E7C68);
}

.bk-balance-pill--credit {
  background: #FFF6E0;
  color: #D4A574;
}
.bk-balance-pill--credit .bk-balance-pill__dot {
  background: #D4A574;
}

/* ── 汇总卡 ────────────────────────────────────────── */

.bk-summary-card {
  background: var(--nn-surface);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(46,124,104,0.06);
}

.bk-summary-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.bk-summary-card__month {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--nn-ink);
}

.bk-summary-card__balance {
  font-size: 2rem;
  font-weight: 700;
  font-family: var(--font-brand, 'Inter', 'Sora', sans-serif);
  color: var(--nn-ink);
  margin-bottom: 12px;
}

.bk-summary-card__row {
  display: flex;
  gap: 16px;
}

.bk-summary-card__income {
  font-size: var(--fs-sm);
  color: var(--nn-brand, #2E7C68);
  font-weight: 500;
}

.bk-summary-card__expense {
  font-size: var(--fs-sm);
  color: var(--nn-danger, #D15040);
  font-weight: 500;
}

/* ── 账单列表行 ────────────────────────────────────── */

.bk-bill-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f0efe8;
  cursor: pointer;
}
.bk-bill-row:last-child { border-bottom: none; }
.bk-bill-row:active { background: rgba(46,124,104,0.03); }

.bk-bill-row__icon {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f5ec;
  border-radius: 12px;
  flex-shrink: 0;
}

.bk-bill-row__body { flex: 1; min-width: 0; }

.bk-bill-row__title {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--nn-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bk-bill-row__meta {
  font-size: var(--fs-xs);
  color: var(--nn-muted);
  margin-top: 2px;
}

.bk-bill-row__amount {
  font-size: var(--fs-base);
  font-weight: 600;
  font-family: var(--font-brand, 'Inter', 'Sora', sans-serif);
  flex-shrink: 0;
}

.bk-amount--expense { color: var(--nn-danger, #D15040); }
.bk-amount--income { color: var(--nn-brand, #2E7C68); }

/* ── 日期分组 ──────────────────────────────────────── */

.bk-bill-group { margin-bottom: 8px; }

.bk-bill-group__date {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--nn-muted);
  padding: 8px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Section ───────────────────────────────────────── */

.bk-section { margin-bottom: 20px; }

.bk-section__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.bk-section__title {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--nn-ink);
}

.bk-section__more {
  font-size: var(--fs-sm);
  color: var(--nn-brand, #2E7C68);
  text-decoration: none;
}

/* ── FAB ───────────────────────────────────────────── */

.bk-fab {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--nn-brand, #2E7C68);
  color: #fff;
  font-size: 1.5rem;
  border: none;
  box-shadow: 0 4px 12px rgba(46,124,104,0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: transform 0.2s;
}
.bk-fab:active { transform: scale(0.92); }

/* ── Sub Tabbar ────────────────────────────────────── */

.bk-sub-tabbar {
  position: fixed !important;
  bottom: 0 !important;
  left: 0;
  right: 0;
  background: var(--nn-surface) !important;
  z-index: 51;
  display: grid !important; /* 覆盖 .nn-tabbar 的 display:none */
}
.bk-sub-tabbar .nn-tab {
  font-size: var(--fs-sm);
  padding: 6px 12px;
  font-weight: 500;
}

/* ── Toggle (支出/收入) ─────────────────────────────── */

.bk-toggle {
  display: flex;
  background: #f0efe8;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
}

.bk-toggle__item {
  flex: 1;
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--nn-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.bk-toggle__item.is-active {
  background: var(--nn-surface);
  color: var(--nn-ink);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ── 金额大输入 ────────────────────────────────────── */

.bk-amount-input {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-bottom: 24px;
  padding: 16px 0;
}

.bk-amount-input__prefix {
  font-size: 2rem;
  font-weight: 600;
  color: var(--nn-muted);
  font-family: var(--font-brand, 'Inter', 'Sora', sans-serif);
}

.bk-amount-input__field {
  border: none;
  background: transparent;
  font-size: 2.5rem;
  font-weight: 700;
  font-family: var(--font-brand, 'Inter', 'Sora', sans-serif);
  color: var(--nn-ink);
  width: 180px;
  text-align: center;
  outline: none;
}
.bk-amount-input__field::placeholder {
  color: #d0d0d0;
  font-weight: 400;
}

/* 隐藏数字input的上下箭头 */
.bk-amount-input__field::-webkit-outer-spin-button,
.bk-amount-input__field::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.bk-amount-input__field[type=number] {
  -moz-appearance: textfield;
}

/* ── Form Fields ───────────────────────────────────── */

.bk-field {
  margin-bottom: 20px;
}

.bk-field__label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--nn-ink);
  display: block;
  margin-bottom: 8px;
}

.bk-field__hint {
  font-size: var(--fs-xs);
  color: var(--nn-muted);
  margin-top: 6px;
}

/* ── Chip 组件 ─────────────────────────────────────── */

.bk-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bk-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 14px;
  font-size: var(--fs-xs);
  background: #f8f5ec;
  color: var(--nn-ink-soft);
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
  white-space: nowrap;
}

.bk-chip.is-active {
  background: var(--nn-brand-soft, #E6F0EC);
  color: var(--nn-brand, #2E7C68);
  border-color: var(--nn-brand, #2E7C68);
}

.bk-chip--credit.is-active {
  background: #FFF6E0;
  color: #D4A574;
  border-color: #D4A574;
}

.bk-chip-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px;
  scrollbar-width: none;
}
.bk-chip-scroll::-webkit-scrollbar { display: none; }
.bk-chip-scroll .bk-chip { flex-shrink: 0; }

/* ── 分类网格 ──────────────────────────────────────── */

.bk-cat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.bk-cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 6px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
  background: #f8f5ec;
  border: 1px solid transparent;
}

.bk-cat-item.is-active {
  background: var(--nn-brand-soft, #E6F0EC);
  border-color: var(--nn-brand, #2E7C68);
}

.bk-cat-item__emoji { font-size: 1.25rem; }
.bk-cat-item__label { font-size: var(--fs-xs); color: var(--nn-ink-soft); }
.bk-cat-item.is-active .bk-cat-item__label { color: var(--nn-brand, #2E7C68); }

/* ── 底部操作栏 ────────────────────────────────────── */

.bk-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--nn-surface);
  border-top: 1px solid #f0efe8;
  z-index: 52;
}

.bk-bottom-bar--actions {
  display: flex;
  gap: 12px;
}

.bk-btn--amber {
  background: #D4A574 !important;
  color: #fff !important;
}

/* ── 账单详情 ──────────────────────────────────────── */

.bk-detail__amount {
  font-size: 2.5rem;
  font-weight: 700;
  font-family: var(--font-brand, 'Inter', 'Sora', sans-serif);
  text-align: center;
  margin: 16px 0;
}

.bk-detail__source {
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--nn-muted);
  margin-bottom: 20px;
}

.bk-detail__props {
  margin-bottom: 16px;
}

.bk-detail-prop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f0efe8;
}

.bk-detail-prop__label {
  font-size: var(--fs-sm);
  color: var(--nn-muted);
  flex-shrink: 0;
  width: 72px;
}

.bk-detail-prop__value {
  font-size: var(--fs-sm);
  color: var(--nn-ink);
  text-align: right;
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}

.bk-detail__source-msg {
  background: #f8f5ec;
  border-radius: 12px;
  padding: 14px;
  margin-top: 12px;
}

.bk-detail__source-msg-title {
  font-size: var(--fs-xs);
  color: var(--nn-muted);
  margin-bottom: 6px;
}

.bk-detail__source-msg-content {
  font-size: var(--fs-sm);
  color: var(--nn-ink-soft);
  line-height: 1.5;
}

/* ── 账户卡片 ──────────────────────────────────────── */

.bk-account-card {
  background: var(--nn-surface);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(46,124,104,0.06);
}

.bk-account-card--saving {
  border-left: 3px solid var(--nn-brand, #2E7C68);
}

.bk-account-card--credit {
  border-left: 3px solid #D4A574;
}

.bk-account-card__name {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--nn-ink);
  margin-bottom: 4px;
}

.bk-account-card__balance {
  font-size: var(--fs-sm);
  color: var(--nn-ink-soft);
  margin-bottom: 4px;
}
.bk-account-card__balance strong {
  font-family: var(--font-brand, 'Inter', 'Sora', sans-serif);
  font-size: var(--fs-lg);
  color: var(--nn-ink);
}

.bk-account-card__meta {
  font-size: var(--fs-xs);
  color: var(--nn-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── 额度进度条 ────────────────────────────────────── */

.bk-usage-bar {
  height: 6px;
  background: #f0efe8;
  border-radius: 3px;
  margin: 8px 0;
  overflow: hidden;
}

.bk-usage-bar__fill {
  height: 100%;
  background: #D4A574;
  border-radius: 3px;
  transition: width 0.3s;
}

/* ── 还款按钮 ──────────────────────────────────────── */

.bk-btn-repay {
  border: 1px solid #D4A574;
  background: #FFF6E0;
  color: #D4A574;
  padding: 4px 12px;
  border-radius: 14px;
  font-size: var(--fs-xs);
  cursor: pointer;
  margin-left: 8px;
}

/* ── 还款页 ────────────────────────────────────────── */

.bk-repay-info {
  background: #FFF6E0;
  border-radius: 14px;
  padding: 14px;
  font-size: var(--fs-sm);
  color: #D4A574;
  font-weight: 500;
  margin-bottom: 16px;
}

.bk-repay-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.bk-repay-summary {
  background: #FFF6E0;
  border-radius: 14px;
  padding: 16px;
  margin: 16px 0;
}

.bk-repay-summary__title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: #D4A574;
  margin-bottom: 8px;
}

.bk-repay-summary__item {
  font-size: var(--fs-xs);
  color: var(--nn-ink-soft);
  padding: 4px 0;
  padding-left: 12px;
  position: relative;
}
.bk-repay-summary__item::before {
  content: '·';
  position: absolute;
  left: 0;
  color: #D4A574;
}

/* ── 图表 ──────────────────────────────────────────── */

.bk-period-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.bk-period-row .bk-chip {
  font-size: var(--fs-sm);
  padding: 8px 16px;
  border-radius: 14px;
}

.bk-date-range {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}
.bk-date-range .nn-input {
  font-size: var(--fs-xs);
  padding: 8px 10px;
}

.bk-summary-card__change {
  font-size: var(--fs-sm);
  font-weight: 600;
}
.bk-change--up { color: var(--nn-brand, #2E7C68); }
.bk-change--down { color: var(--nn-danger, #D15040); }

.bk-chart-pie {
  display: block;
  width: 200px;
  height: 200px;
  margin: 0 auto;
}

.bk-chart-trend {
  display: block;
  width: 100%;
  height: 160px;
}

.bk-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.bk-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--nn-ink-soft);
}

.bk-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── 余额告警 ──────────────────────────────────────── */

.bk-balance-warn {
  text-align: center;
  color: #D15040;
  font-size: var(--fs-xs);
  padding: 6px 12px;
  margin: -12px 0 16px;
  background: #FFF0EE;
  border-radius: 10px;
}

.bk-search-bar {
  margin-bottom: 8px;
}
.bk-search-bar .nn-input {
  border-radius: 12px;
  background: #f8f5ec;
  border: none;
}

/* ── screen 适配 ───────────────────────────────────── */

#bk-home.screen.is-active,
#bk-list.screen.is-active,
#bk-stats.screen.is-active {
  display: flex;
  flex-direction: column;
}
