/* ===== 财务管理（富爸爸现金流） ===== */
:root {
  --fin-positive: #c24146;
  --fin-negative: #13795b;
  --fin-accent: #316c64;
  --fin-line: #dbe4e8;
}
.min-width-0 { min-width: 0; }

.fin-positive { color: var(--fin-positive) !important; }
.fin-negative { color: var(--fin-negative) !important; }

.fin-panel {
  overflow: hidden;
  border: 1px solid var(--fin-line);
  box-shadow: 0 3px 12px rgba(34, 55, 68, .055);
}
.fin-panel > .card-header {
  min-height: 46px;
  border-bottom: 1px solid var(--fin-line);
  color: #243746;
  font-size: 13.5px;
}
.fin-zone--cash > .card-header { background: #fff8e8 !important; }
.fin-zone--balance > .card-header { background: #edf5f8 !important; }
.fin-zone--opportunity > .card-header { background: #fff5e9 !important; }
.fin-zone--cashflow > .card-header { background: #f1f5f2 !important; }
.fin-zone--assets > .card-header,
.fin-zone--income > .card-header { background: #fff2f1 !important; }
.fin-zone--liabilities > .card-header,
.fin-zone--expense > .card-header { background: #edf7f2 !important; }
.fin-zone--temporary > .card-header { background: #f4f3eb !important; }
.fin-zone--history > .card-header { background: #f1f4f6 !important; }

.fin-panel .btn-accent {
  background: var(--fin-accent);
  border-radius: 6px;
}
.fin-panel .btn-accent:hover { background: #24574f; }
.fin-panel .form-control:focus,
.fin-panel .form-select:focus {
  border-color: #76a69a;
  box-shadow: 0 0 0 3px rgba(49, 108, 100, .13);
}
.fin-panel .table { --bs-table-hover-bg: #f6f8f7; }
.fin-panel .table thead th {
  background: #f5f7f8;
  color: #536674;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.fin-zone--temporary table { min-width: 600px; }
.fin-zone--temporary [data-transaction-edit],
.fin-zone--temporary [data-transaction-del] { min-width: 30px; }
.fin-zone--temporary tbody td { padding-top: 9px; padding-bottom: 9px; }
.fin-metric { border-color: #e0e6e8; background: linear-gradient(145deg, #fff 0%, #f8faf9 100%); }
.fin-zone--cash .fin-big { color: var(--fin-positive); }

/* 图标与色系 */
.fin-ic {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 34px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; background: #f1f5f9;
}
.fin-ic.fin-cash { background: #fff1e8; color: var(--fin-positive); }
.fin-pos { color: var(--fin-positive); }
.fin-neg { color: var(--fin-negative); }

.fin-big {
  font-size: 26px; font-weight: 800; line-height: 1.2; color: var(--ink);
  white-space: nowrap;
}
.fin-big.neg { color: var(--fin-negative); }

/* 指标卡 */
.fin-metric { padding: 14px 16px; }
.fin-m-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.fin-m-num { font-size: 21px; font-weight: 800; margin-top: 4px; }
.fin-m-num.fin-pos { color: var(--fin-positive); }
.fin-m-num.neg { color: var(--fin-negative); }
#mPassive { color: var(--fin-positive) !important; }
#freePctTxt { color: var(--fin-positive) !important; }
.fin-m-sub { font-size: 11px; color: #94a3b8; margin-top: 2px; line-height: 1.4; }

/* 财务自由进度环 */
.fin-ring {
  width: 76px; height: 76px; border-radius: 50%; flex: 0 0 76px;
  background: conic-gradient(var(--fin-positive) calc(var(--p, 0) * 1%), #e2e8f0 0);
  display: flex; align-items: center; justify-content: center;
  transition: background .3s;
}
.fin-ring.done { background: conic-gradient(var(--fin-positive) 100%, #e2e8f0 0); }
#freeRing { background: conic-gradient(var(--fin-positive) calc(var(--p, 0) * 1%), #e2e8f0 0) !important; }
.fin-ring-in {
  width: 58px; height: 58px; border-radius: 50%; background: #fff;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center;
}
.fin-ring-in b { font-size: 15px; line-height: 1.2; }
.fin-ring-in span { font-size: 9px; color: var(--muted); }

/* 钱流结构横条 */
.fin-bar-row { margin-bottom: 14px; }
.fin-bar-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; color: #475569; margin-bottom: 4px;
}
.fin-bar-label b { font-weight: 700; color: var(--ink); }
.fin-bar {
  height: 9px; background: #eef2f7; border-radius: 6px; overflow: hidden;
}
.fin-bar i {
  display: block; height: 100%; width: 0; border-radius: 6px;
  width: calc(var(--w, 0) * 1%); transition: width .4s;
}
.fin-flow-eq { color: var(--muted); }

/* 明细列表 */
.fin-list { max-height: 430px; overflow-y: auto; }
.fin-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid #f1f5f9;
}
.fin-item:last-child { border-bottom: none; }
.fin-item:hover { background: #f8fafc; }
.fin-item .fname { font-weight: 600; min-width: 0; }
.fin-item .ftype {
  font-size: 10.5px; background: #f1f5f9; color: #64748b;
  padding: 1px 8px; border-radius: 20px; flex: 0 0 auto;
}
.fin-item .fdesc { font-size: 12px; color: #94a3b8; }
.fin-item .fmoney { margin-left: auto; text-align: right; flex: 0 0 auto; }
.fin-item .fmoney .am {
  font-weight: 700; font-size: 14px;
}
.fin-item .fmoney .am.pos { color: var(--fin-negative); }
.fin-item .fmoney .am.neg { color: var(--fin-positive); }
.fin-item .fmoney .sub { font-size: 11px; color: #94a3b8; }
.fin-item .fops { display: none; gap: 2px; flex: 0 0 auto; }
.fin-item:hover .fops { display: inline-flex; }
.fin-item .fops button {
  width: 24px; height: 24px; border: none; background: #fff; color: #64748b;
  border-radius: 6px; font-size: 13px; line-height: 1; padding: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .1);
}
.fin-item .fops button:hover { background: var(--accent); color: #fff; }
.fin-item .fops button.danger:hover { background: #dc2626; }

@media (hover: none) {
  .fin-item .fops { display: inline-flex; }
}

.fin-sum { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.fin-sum.pos { color: var(--fin-negative); }
.fin-sum.neg { color: var(--fin-positive); }
.fin-empty {
  padding: 26px 18px; text-align: center; color: var(--muted);
  font-size: 13px; line-height: 1.7;
}

.fin-tip {
  background: #fff8e8; border: 1px solid #ead8ae; color: #655126;
  border-left: 4px solid #d3a749;
  border-radius: 7px; padding: 12px 16px; font-size: 13px; line-height: 1.8;
}
.fin-tip b { color: #8a671a; }

@media (max-width: 767.98px) {
  .sidebar { display: none; }
  .main { width: 100%; padding: 16px 12px 36px; }
  .page-head { margin-bottom: 14px; }
  .page-head .page-title { font-size: 21px; }
  .page-head .page-sub { max-width: 100%; }
  .fin-panel > .card-header { flex-wrap: wrap; }
  .fin-metric { min-height: 92px; }
  .fin-zone--temporary .table-responsive { padding-bottom: 2px; }
}
