/* IRR/XIRR 内部收益率 irr-calc */
:root {
  --irr-blue: #2563eb;
  --irr-blue-soft: #eff6ff;
  --irr-blue-deep: #1d4ed8;
  --irr-green: #059669;
  --irr-green-soft: #ecfdf5;
  --irr-amber: #d97706;
  --irr-amber-soft: #fffbeb;
  --irr-red: #dc2626;
  --irr-red-soft: #fef2f2;
}

/* 模式切换 */
.irr-mode-switch { display: flex; gap: 8px; background: #f1f5f9; border-radius: 12px; padding: 5px; margin-bottom: 16px; }
.mode-btn {
  flex: 1; border: none; background: transparent; padding: 9px 0; border-radius: 9px;
  font-size: 14px; font-weight: 600; color: #64748b; cursor: pointer; transition: all .15s;
}
.mode-btn:hover { color: var(--irr-blue); }
.mode-btn.is-on { background: #fff; color: var(--irr-blue); box-shadow: 0 1px 4px rgba(15, 23, 42, .12); }

/* 现金流行 */
.irr-panel-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; gap: 10px; flex-wrap: wrap; }
.irr-panel-head .ph-tip { font-size: 12px; color: #9ca3af; line-height: 1.6; }
.cf-list { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; padding-right: 2px; }
.cf-row { display: grid; grid-template-columns: 86px 1fr 34px; align-items: center; gap: 8px; }
.cf-row-x { grid-template-columns: 132px 1fr 34px; }
.cf-idx { font-size: 12px; color: #6b7280; white-space: nowrap; }
.cf-row .ck-input { padding: 7px 10px; font-size: 14px; }
.cf-del {
  border: none; background: #f3f4f6; color: #9ca3af; width: 30px; height: 30px;
  border-radius: 8px; cursor: pointer; font-size: 13px; transition: all .15s;
}
.cf-del:hover { background: var(--irr-red-soft); color: var(--irr-red); }

.irr-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.irr-actions .btn { flex: 1; min-width: 96px; padding: 8px 6px; font-size: 13px; }

.irr-freq-row { margin-top: 14px; }
.irr-freq-row .ck-label { display: block; font-size: 13px; color: #374151; margin-bottom: 5px; font-weight: 600; }
.irr-freq-row .ck-input { width: 100%; }
.irr-freq-help { font-size: 12px; color: #9ca3af; margin-top: 5px; line-height: 1.6; }

.irr-legend { margin-top: 14px; padding: 11px 13px; background: var(--irr-blue-soft); border-radius: 12px; font-size: 12px; line-height: 1.85; color: #374151; }
.irr-legend b { color: #111827; }

/* 结果区 */
.irr-hero { text-align: center; padding: 6px 0 14px; border-bottom: 1px dashed #e5e7eb; margin-bottom: 14px; }
.irr-hero-label { font-size: 13px; color: #6b7280; margin-bottom: 4px; }
.irr-hero-num { font-size: 40px; font-weight: 800; color: var(--irr-blue); font-family: ui-monospace, Menlo, Consolas, monospace; line-height: 1.15; }
.irr-hero-note { font-size: 12px; color: #9ca3af; margin-top: 2px; }
.irr-hero-sub { display: flex; justify-content: center; align-items: baseline; gap: 6px; margin-top: 8px; font-size: 13px; color: #6b7280; flex-wrap: wrap; }
.irr-hero-sub b { font-size: 19px; color: #111827; font-family: ui-monospace, Menlo, Consolas, monospace; }

.irr-verdict { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: #374151; margin-bottom: 12px; line-height: 1.7; }
.irr-tag { padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.irr-tag.irr-bad { background: var(--irr-red-soft); color: var(--irr-red); }
.irr-tag.irr-warn { background: var(--irr-amber-soft); color: var(--irr-amber); }
.irr-tag.irr-ok { background: var(--irr-green-soft); color: var(--irr-green); }
.irr-tag.irr-good { background: var(--irr-blue-soft); color: var(--irr-blue); }

.irr-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.irr-summary span { background: #f8fafc; border-radius: 10px; padding: 8px 12px; font-size: 12px; color: #6b7280; display: flex; flex-direction: column; gap: 2px; }
.irr-summary b { font-size: 15px; color: #111827; font-family: ui-monospace, Menlo, Consolas, monospace; }
.cf-pos { color: var(--irr-green) !important; }
.cf-neg { color: var(--irr-red) !important; }

.irr-breakdown-head { font-size: 13px; font-weight: 700; color: #374151; margin: 2px 0 8px; }
.irr-table-scroll { border: 1px solid #e5e7eb; border-radius: 12px; overflow-x: auto; }
.irr-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.irr-table th, .irr-table td { padding: 8px 12px; text-align: right; white-space: nowrap; }
.irr-table th:first-child, .irr-table td:first-child { text-align: left; }
.irr-table thead th { background: #f8fafc; color: #6b7280; font-weight: 600; font-size: 12px; border-bottom: 1px solid #e5e7eb; }
.irr-table tbody td { border-bottom: 1px solid #f1f5f9; font-family: ui-monospace, Menlo, Consolas, monospace; color: #111827; }
.irr-table tbody tr:last-child td { border-bottom: none; }

/* 黑夜模式 */
@media (prefers-color-scheme: dark) {
  .irr-mode-switch { background: #1f2937; }
  .mode-btn { color: #9ca3af; }
  .mode-btn:hover { color: #93c5fd; }
  .mode-btn.is-on { background: #111827; color: #93c5fd; box-shadow: 0 1px 4px rgba(0,0,0,.4); }

  .cf-idx { color: #9ca3af; }
  .cf-del { background: #1f2937; color: #9ca3af; }
  .cf-del:hover { background: rgba(220,38,38,.2); color: #fca5a5; }

  .irr-panel-head .ph-tip, .irr-freq-help, .irr-hero-note { color: #9ca3af; }
  .irr-freq-row .ck-label, .irr-verdict, .irr-breakdown-head { color: #d1d5db; }
  .irr-legend { background: rgba(37,99,235,.16); color: #bfdbfe; }
  .irr-legend b { color: #f3f4f6; }

  .irr-hero { border-bottom-color: #374151; }
  .irr-hero-label { color: #9ca3af; }
  .irr-hero-num { color: #60a5fa; }
  .irr-hero-sub { color: #9ca3af; }
  .irr-hero-sub b { color: #f3f4f6; }

  .irr-tag.irr-bad { background: rgba(220,38,38,.18); color: #fca5a5; }
  .irr-tag.irr-warn { background: rgba(217,119,6,.18); color: #fbbf24; }
  .irr-tag.irr-ok { background: rgba(5,150,105,.18); color: #6ee7b7; }
  .irr-tag.irr-good { background: rgba(37,99,235,.2); color: #93c5fd; }

  .irr-summary span { background: #1f2937; color: #9ca3af; }
  .irr-summary b { color: #f3f4f6; }
  .cf-pos { color: #6ee7b7 !important; }
  .cf-neg { color: #fca5a5 !important; }

  .irr-table-scroll { border-color: #374151; }
  .irr-table thead th { background: #1f2937; color: #9ca3af; border-bottom-color: #374151; }
  .irr-table tbody td { border-bottom-color: #1f2937; color: #f3f4f6; }
}
