/* ==========================================================================
   Finance — design layer ("modern fintech")
   White surfaces · deep navy ink · electric blue = money in · coral = money out
   Tabular numerals · hairline borders · subtle motion, expressive moments
   All finance screens are wrapped in .fin so these tokens never leak.
   ========================================================================== */
.fin, .fn-success, .fn-sheet {
  --fn-canvas: #f5f7fb;
  --fn-surface: #ffffff;
  --fn-surface-2: #f8fafc;
  --fn-ink: #0b1220;
  --fn-ink-2: #3b4658;
  --fn-ink-3: #6b7689;
  --fn-ink-4: #9aa4b5;
  --fn-line: #e7ebf1;
  --fn-line-2: #d9dfe8;
  --fn-in: #2f6bff;            /* money in / primary */
  --fn-in-ink: #1f4fd6;
  --fn-in-soft: #eaf0ff;
  --fn-in-soft-2: #d6e2ff;
  --fn-out: #e5484d;           /* money out / overdue */
  --fn-out-soft: #fdeceb;
  --fn-ok: #12a150;            /* paid / positive */
  --fn-ok-soft: #e6f7ee;
  --fn-warn: #d97706;          /* due soon / partial */
  --fn-warn-soft: #fdf3e3;
  --fn-radius: 14px;
  --fn-radius-sm: 9px;
  --fn-shadow: 0 1px 2px rgba(11, 18, 32, .04), 0 8px 24px -12px rgba(11, 18, 32, .12);
  --fn-shadow-lg: 0 24px 60px -20px rgba(11, 18, 32, .28);
  --fn-ease: cubic-bezier(.2, .7, .2, 1);
  color: var(--fn-ink);
  font-variant-numeric: tabular-nums;
  padding-bottom: 24px;
}
.fin .num, .fin .fn-money, .fin td.r, .fin .fn-kpi b { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "cv11" 1; }
.fin .money-in { color: var(--fn-in-ink); } .fin .money-out { color: var(--fn-out); } .fin .money-ok { color: var(--fn-ok); }

/* ---------- page frame ---------- */
.fn-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.fn-head h1 { font-size: 24px; font-weight: 760; letter-spacing: -.02em; line-height: 1.15; margin: 0; }
.fn-head .eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--fn-ink-3); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.fn-head .eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--fn-ok); animation: fn-pulse 2.4s infinite; }
@keyframes fn-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(18, 161, 80, .45); } 60% { box-shadow: 0 0 0 6px rgba(18, 161, 80, 0); } }
.fn-head .sub { color: var(--fn-ink-3); font-size: 13.5px; margin-top: 3px; }
.fn-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fn-nav { display: flex; gap: 4px; padding: 4px; background: var(--fn-surface); border: 1px solid var(--fn-line); border-radius: 999px; width: max-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; margin-bottom: 20px; box-shadow: var(--fn-shadow); }
.fn-nav::-webkit-scrollbar { display: none; }
.fn-nav a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 640; color: var(--fn-ink-3); white-space: nowrap; transition: background .18s var(--fn-ease), color .18s var(--fn-ease); }
.fn-nav a svg { width: 15px; height: 15px; }
.fn-nav a:hover { color: var(--fn-ink); background: var(--fn-surface-2); }
.fn-nav a.on { background: var(--fn-ink); color: #fff; }

/* ---------- buttons ---------- */
.fin .fn-btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--fn-line-2); background: var(--fn-surface); color: var(--fn-ink); font-size: 13px; font-weight: 640; cursor: pointer; transition: transform .15s var(--fn-ease), box-shadow .15s var(--fn-ease), background .15s, border-color .15s; font-family: inherit; text-decoration: none; }
.fin .fn-btn svg { width: 15px; height: 15px; }
.fin .fn-btn:hover { border-color: var(--fn-ink-4); box-shadow: var(--fn-shadow); transform: translateY(-1px); }
.fin .fn-btn:active { transform: translateY(0) scale(.98); }
.fin .fn-btn.pri { background: var(--fn-in); border-color: var(--fn-in); color: #fff; box-shadow: 0 6px 16px -6px rgba(47, 107, 255, .6); }
.fin .fn-btn.pri:hover { background: var(--fn-in-ink); border-color: var(--fn-in-ink); }
.fin .fn-btn.dark { background: var(--fn-ink); border-color: var(--fn-ink); color: #fff; }
.fin .fn-btn.danger { color: var(--fn-out); border-color: #f4c7c9; } .fin .fn-btn.danger:hover { background: var(--fn-out-soft); }
.fin .fn-btn.ghost { border-color: transparent; background: transparent; box-shadow: none; } .fin .fn-btn.ghost:hover { background: var(--fn-surface-2); }
.fin .fn-btn.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; } .fin .fn-btn.sm svg { width: 14px; height: 14px; }
.fin .fn-btn.icon { padding: 7px; } .fin .fn-btn:disabled { opacity: .55; cursor: default; transform: none; }

/* ---------- cards ---------- */
.fn-card { background: var(--fn-surface); border: 1px solid var(--fn-line); border-radius: var(--fn-radius); box-shadow: var(--fn-shadow); padding: 18px 20px; min-width: 0; }
.fn-card h3 { font-size: 14.5px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; letter-spacing: -.01em; }
.fn-card h3 svg { width: 16px; height: 16px; color: var(--fn-ink-3); }
.fn-card h3 .hint { margin-left: auto; font-size: 12px; font-weight: 550; color: var(--fn-ink-3); }
.fn-card h3 .hint a { color: var(--fn-in-ink); }
.fn-grid { display: grid; gap: 16px; }
.fn-grid.two { grid-template-columns: 1fr 1fr; } .fn-grid.three { grid-template-columns: repeat(3, 1fr); } .fn-grid.hero { grid-template-columns: 1.15fr 1.15fr .9fr; }
.fn-grid > * { min-width: 0; }
.fn-enter { animation: fn-rise .5s var(--fn-ease) both; }
.fn-enter:nth-child(2) { animation-delay: .05s; } .fn-enter:nth-child(3) { animation-delay: .1s; } .fn-enter:nth-child(4) { animation-delay: .15s; } .fn-enter:nth-child(5) { animation-delay: .2s; } .fn-enter:nth-child(6) { animation-delay: .25s; }
@keyframes fn-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- hero tiles ---------- */
.fn-hero { position: relative; overflow: hidden; padding: 22px 22px 18px; }
.fn-hero .lbl { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--fn-ink-3); display: flex; align-items: center; gap: 8px; }
.fn-hero .lbl svg { width: 14px; height: 14px; }
.fn-hero .big { font-size: clamp(30px, 3.2vw, 40px); font-weight: 780; letter-spacing: -.03em; line-height: 1.05; margin: 10px 0 8px; }
.fn-hero .meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--fn-ink-3); }
.fn-hero.in { background: linear-gradient(135deg, #fff 0%, #f3f6ff 100%); }
.fn-hero.in .big { color: var(--fn-in-ink); }
.fn-hero.owed .big { color: var(--fn-ink); }
.fn-hero .spark { position: absolute; right: 14px; bottom: 10px; width: 150px; height: 46px; opacity: .9; }
.fn-hero .spark path.line { fill: none; stroke: var(--fn-in); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 600; stroke-dashoffset: 600; animation: fn-draw 1.2s .2s var(--fn-ease) forwards; }
.fn-hero .spark path.area { fill: url(#fn-spark-grad); opacity: 0; animation: fn-fade 1s .8s forwards; }
@keyframes fn-draw { to { stroke-dashoffset: 0; } } @keyframes fn-fade { to { opacity: 1; } }
.fn-delta { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.fn-delta.up { background: var(--fn-ok-soft); color: var(--fn-ok); } .fn-delta.down { background: var(--fn-out-soft); color: var(--fn-out); } .fn-delta.flat { background: var(--fn-surface-2); color: var(--fn-ink-3); }
.fn-ring-wrap { display: flex; align-items: center; gap: 16px; }
.fn-ring { width: 108px; height: 108px; flex: none; }
.fn-ring circle.track { fill: none; stroke: var(--fn-line); stroke-width: 9; }
.fn-ring circle.val { fill: none; stroke: var(--fn-in); stroke-width: 9; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset 1.2s var(--fn-ease); }
.fn-ring text { font-size: 20px; font-weight: 780; fill: var(--fn-ink); text-anchor: middle; letter-spacing: -.02em; }
.fn-ring text.s { font-size: 9px; font-weight: 700; fill: var(--fn-ink-3); letter-spacing: .08em; }
.fn-ring-legend { font-size: 12.5px; color: var(--fn-ink-3); display: grid; gap: 6px; }
.fn-ring-legend b { color: var(--fn-ink); font-size: 14px; display: block; }
.fn-ring-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; }

/* ---------- KPI strip ---------- */
.fn-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.fn-kpi { background: var(--fn-surface); border: 1px solid var(--fn-line); border-radius: 12px; padding: 12px 14px; cursor: default; transition: transform .18s var(--fn-ease), box-shadow .18s var(--fn-ease), border-color .18s; }
.fn-kpi[data-href] { cursor: pointer; } .fn-kpi[data-href]:hover { transform: translateY(-2px); box-shadow: var(--fn-shadow); border-color: var(--fn-line-2); }
.fn-kpi .lbl { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--fn-ink-3); }
.fn-kpi b { display: block; font-size: 21px; font-weight: 760; letter-spacing: -.02em; margin: 4px 0 2px; }
.fn-kpi .sub { font-size: 11.5px; color: var(--fn-ink-3); }
.fn-kpi.warn { border-color: #f4c7c9; background: linear-gradient(180deg, #fff, #fff6f6); } .fn-kpi.warn b { color: var(--fn-out); }

/* ---------- attention list ---------- */
.fn-attn { display: flex; flex-direction: column; gap: 6px; }
.fn-attn-row { display: grid; grid-template-columns: 36px 1fr auto auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--fn-line); background: var(--fn-surface); transition: background .15s, border-color .15s, transform .15s var(--fn-ease); }
.fn-attn-row:hover { border-color: var(--fn-line-2); background: var(--fn-surface-2); }
.fn-attn-row.late .fn-avatar { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--fn-out); }
.fn-attn-row.soon .fn-avatar { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--fn-warn); }
.fn-avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 760; color: #fff; background: var(--fn-ink); letter-spacing: .02em; flex: none; }
.fn-attn-row .who b { display: block; font-size: 13.5px; } .fn-attn-row .who span { font-size: 12px; color: var(--fn-ink-3); }
.fn-attn-row .amt { text-align: right; } .fn-attn-row .amt b { display: block; font-size: 15px; } .fn-attn-row .amt span { font-size: 11.5px; font-weight: 700; }
.fn-attn-row .act { display: flex; gap: 4px; }

/* ---------- chips / status ---------- */
.fn-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; background: var(--fn-surface-2); color: var(--fn-ink-2); border: 1px solid var(--fn-line); }
.fn-chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.fn-chip.ok { background: var(--fn-ok-soft); color: var(--fn-ok); border-color: transparent; }
.fn-chip.bad { background: var(--fn-out-soft); color: var(--fn-out); border-color: transparent; }
.fn-chip.warn { background: var(--fn-warn-soft); color: var(--fn-warn); border-color: transparent; }
.fn-chip.info { background: var(--fn-in-soft); color: var(--fn-in-ink); border-color: transparent; }
.fn-chip.plain::before { display: none; }

/* ---------- ledger tables ---------- */
.fn-ledger-wrap { background: var(--fn-surface); border: 1px solid var(--fn-line); border-radius: var(--fn-radius); box-shadow: var(--fn-shadow); overflow: hidden; }
.fn-ledger-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--fn-line); background: var(--fn-surface-2); }
.fn-ledger-tools .grow { flex: 1; } .fn-ledger-tools .count { font-size: 12.5px; color: var(--fn-ink-3); font-weight: 600; }
.fn-scroll { overflow: auto; max-height: min(70vh, 720px); }
.fn-ledger { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.fn-ledger th { position: sticky; top: 0; z-index: 1; background: var(--fn-surface); text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--fn-ink-3); padding: 11px 14px; border-bottom: 1px solid var(--fn-line); white-space: nowrap; }
.fn-ledger td { padding: 12px 14px; border-bottom: 1px solid var(--fn-line); vertical-align: middle; white-space: nowrap; }
.fn-ledger td:first-child { white-space: normal; min-width: 200px; }
.fn-ledger td:first-child .sub { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fn-ledger tr:last-child td { border-bottom: none; }
.fn-ledger th.r, .fn-ledger td.r { text-align: right; }
.fn-ledger td .sub { font-size: 11.5px; color: var(--fn-ink-3); margin-top: 2px; }
.fn-ledger tbody tr { transition: background .12s; } .fn-ledger tbody tr:hover { background: var(--fn-surface-2); }
.fn-ledger tbody tr.click { cursor: pointer; } .fn-ledger tbody tr.click:hover td:first-child { box-shadow: inset 3px 0 0 var(--fn-in); }
.fn-ledger tbody tr.gone td { opacity: .5; text-decoration: line-through; }
.fn-ledger tfoot td { background: var(--fn-surface-2); font-weight: 700; font-size: 12.5px; border-top: 1px solid var(--fn-line-2); }
.fn-ledger .acts { display: inline-flex; gap: 3px; opacity: .55; transition: opacity .15s; } .fn-ledger tr:hover .acts { opacity: 1; }
.fin.dense .fn-ledger td { padding: 7px 12px; } .fin.dense .fn-ledger th { padding: 8px 12px; } .fin.dense .fn-ledger { font-size: 12.5px; }
.fn-bar { display: inline-block; width: 70px; height: 5px; border-radius: 3px; background: var(--fn-line); vertical-align: middle; overflow: hidden; }
.fn-bar i { display: block; height: 100%; width: 100%; background: var(--fn-in); transform-origin: left; transition: transform .9s var(--fn-ease); }
.fn-bar.ok i { background: var(--fn-ok); } .fn-bar.bad i { background: var(--fn-out); } .fn-bar.warn i { background: var(--fn-warn); }
.fn-bar.wide { width: 140px; }

/* ---------- filters ---------- */
.fn-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.fn-filters input, .fn-filters select { width: auto; max-width: 240px; padding: 8px 11px; border: 1px solid var(--fn-line-2); border-radius: 10px; font-size: 13px; background: var(--fn-surface); color: var(--fn-ink); font-family: inherit; }
.fn-filters input:focus, .fn-filters select:focus { outline: none; border-color: var(--fn-in); box-shadow: 0 0 0 3px var(--fn-in-soft-2); }
.fn-seg { display: inline-flex; background: var(--fn-surface); border: 1px solid var(--fn-line-2); border-radius: 10px; padding: 3px; gap: 2px; }
.fn-seg a { padding: 6px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 640; color: var(--fn-ink-3); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.fn-seg a.on { background: var(--fn-ink); color: #fff; }
.fn-seg a b { margin-left: 5px; font-size: 11px; opacity: .7; }
.fn-search { position: relative; } .fn-search svg { position: absolute; left: 10px; top: 50%; width: 14px; height: 14px; transform: translateY(-50%); color: var(--fn-ink-4); pointer-events: none; }
.fn-search input { padding-left: 30px; min-width: 220px; }

/* ---------- sheets (drawer on desktop, bottom sheet on mobile) ---------- */
.fn-sheet-dim { position: fixed; inset: 0; background: rgba(11, 18, 32, .42); backdrop-filter: blur(2px); z-index: 1200; opacity: 0; transition: opacity .25s; }
.fn-sheet-dim.on { opacity: 1; }
.fn-sheet { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--fn-surface); z-index: 1201; box-shadow: var(--fn-shadow-lg); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .32s var(--fn-ease); font-variant-numeric: tabular-nums; }
.fn-sheet.on { transform: none; }
.fn-sheet.lg { width: min(720px, 100%); }
.fn-sheet-h { padding: 18px 22px 14px; border-bottom: 1px solid var(--fn-line); display: flex; align-items: flex-start; gap: 12px; }
.fn-sheet-h h2 { font-size: 18px; font-weight: 740; letter-spacing: -.015em; margin: 0; }
.fn-sheet-h .sub { font-size: 13px; color: var(--fn-ink-3); margin-top: 3px; }
.fn-sheet-x { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--fn-line); background: var(--fn-surface); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--fn-ink-3); flex: none; }
.fn-sheet-x:hover { background: var(--fn-surface-2); color: var(--fn-ink); } .fn-sheet-x svg { width: 15px; height: 15px; }
.fn-sheet-b { padding: 18px 22px; overflow: auto; flex: 1; }
.fn-sheet-f { padding: 12px 22px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--fn-line); display: flex; gap: 8px; justify-content: flex-end; background: var(--fn-surface); }
.fn-sheet-f .left { margin-right: auto; }

/* ---------- forms ---------- */
.fn-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.fn-form .wide { grid-column: 1 / -1; }
.fn-field { display: flex; flex-direction: column; gap: 5px; text-transform: none; letter-spacing: 0; margin: 0; }
.fn-field > span { font-size: 12px; font-weight: 700; color: var(--fn-ink-2); letter-spacing: .01em; }
.fn-field > span small { font-weight: 500; color: var(--fn-ink-3); }
.fn-field input, .fn-field select, .fn-field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--fn-line-2); border-radius: 10px; font-size: 14px; background: var(--fn-surface); color: var(--fn-ink); font-family: inherit; transition: border-color .15s, box-shadow .15s; }
.fn-field input:focus, .fn-field select:focus, .fn-field textarea:focus { outline: none; border-color: var(--fn-in); box-shadow: 0 0 0 3px var(--fn-in-soft-2); }
.fn-field input[type=number] { font-variant-numeric: tabular-nums; }
.fn-field.money { position: relative; } .fn-field.money input { padding-left: 26px; font-weight: 640; } .fn-field.money::after { content: '₹'; position: absolute; left: 11px; bottom: 11px; color: var(--fn-ink-3); font-size: 14px; }
.fn-check { text-transform: none; letter-spacing: 0; margin: 0; display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--fn-ink); cursor: pointer; padding: 8px 0; }
.fn-check input { width: 18px; height: 18px; accent-color: var(--fn-in); margin: 0; }
.fn-check small { color: var(--fn-ink-3); }
.fn-section { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--fn-ink-3); margin: 6px 0 -4px; grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
.fn-section::after { content: ''; flex: 1; height: 1px; background: var(--fn-line); }
.fn-summary { background: var(--fn-ink); color: #fff; border-radius: 12px; padding: 14px 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fn-summary div span { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .6; }
.fn-summary div b { font-size: 18px; font-weight: 760; letter-spacing: -.02em; }
.fn-summary div b.acc { color: #8fb0ff; }
.fn-presets { display: inline-flex; gap: 4px; margin-left: auto; }
.fn-presets a { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--fn-line-2); font-size: 12px; font-weight: 640; cursor: pointer; color: var(--fn-ink-2); }
.fn-presets a:hover { border-color: var(--fn-in); color: var(--fn-in-ink); }
.fn-inst-row { display: grid; grid-template-columns: 30px 1fr 1fr 34px; gap: 8px; align-items: center; margin-bottom: 8px; }
.fn-inst-row .n { width: 26px; height: 26px; border-radius: 50%; background: var(--fn-surface-2); border: 1px solid var(--fn-line); font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; color: var(--fn-ink-3); }
.fn-inst-row input { padding: 8px 10px; border: 1px solid var(--fn-line-2); border-radius: 9px; font-size: 13px; width: 100%; font-family: inherit; }
.fn-inst-sum { font-size: 12.5px; color: var(--fn-ink-3); margin-top: 4px; }
.fn-pick { position: relative; }
.fn-suggest { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); background: var(--fn-surface); border: 1px solid var(--fn-line); border-radius: 12px; box-shadow: var(--fn-shadow-lg); max-height: 280px; overflow: auto; padding: 4px; }
.fn-suggest.static { position: static; box-shadow: none; margin-top: 8px; max-height: 340px; }
.fn-suggest a { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-size: 13px; }
.fn-suggest a:hover { background: var(--fn-in-soft); }
.fn-suggest a b { display: block; } .fn-suggest a span { font-size: 11.5px; color: var(--fn-ink-3); }
.fn-suggest .fn-avatar { width: 30px; height: 30px; font-size: 11px; }
.fn-chosen { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--fn-in-soft-2); background: var(--fn-in-soft); border-radius: 12px; font-size: 13.5px; }
.fn-chosen .sub { color: var(--fn-ink-3); font-size: 12px; } .fn-chosen a { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--fn-in-ink); cursor: pointer; }

/* ---------- enrolment detail ---------- */
.fn-profile { display: flex; align-items: center; gap: 14px; }
.fn-profile .fn-avatar { width: 52px; height: 52px; font-size: 17px; background: linear-gradient(135deg, var(--fn-in), #6a8dff); }
.fn-profile h1 { font-size: 22px; }
.fn-statement { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1px solid var(--fn-line); border-radius: var(--fn-radius); overflow: hidden; background: var(--fn-surface); box-shadow: var(--fn-shadow); }
.fn-statement > div { padding: 16px 18px; border-right: 1px solid var(--fn-line); }
.fn-statement > div:last-child { border-right: none; }
.fn-statement .lbl { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--fn-ink-3); }
.fn-statement b { display: block; font-size: 24px; font-weight: 760; letter-spacing: -.02em; margin: 6px 0 4px; }
.fn-statement .sub { font-size: 12px; color: var(--fn-ink-3); }
.fn-steps { position: relative; padding-left: 4px; }
.fn-step { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: start; padding: 10px 0; position: relative; }
.fn-step + .fn-step::before { content: ''; position: absolute; left: 13px; top: -14px; height: 24px; width: 2px; background: var(--fn-line); }
.fn-step .dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--fn-line-2); background: var(--fn-surface); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: var(--fn-ink-3); position: relative; z-index: 1; }
.fn-step.paid .dot { background: var(--fn-ok); border-color: var(--fn-ok); color: #fff; }
.fn-step.overdue .dot { background: var(--fn-out); border-color: var(--fn-out); color: #fff; animation: fn-pulse-red 2.2s infinite; }
.fn-step.partial .dot { border-color: var(--fn-warn); color: var(--fn-warn); background: conic-gradient(var(--fn-warn) var(--p, 40%), var(--fn-surface) 0); }
.fn-step.due .dot { border-color: var(--fn-in); color: var(--fn-in-ink); }
@keyframes fn-pulse-red { 0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, .35); } 60% { box-shadow: 0 0 0 7px rgba(229, 72, 77, 0); } }
.fn-step .t b { font-size: 14px; display: block; } .fn-step .t span { font-size: 12px; color: var(--fn-ink-3); }
.fn-step .r { text-align: right; } .fn-step .r b { font-size: 15px; display: block; } .fn-step .r .acts { margin-top: 5px; display: inline-flex; gap: 4px; }
.fn-receipt { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 11px 12px; border: 1px solid var(--fn-line); border-radius: 12px; margin-bottom: 8px; background: var(--fn-surface); transition: transform .18s var(--fn-ease), box-shadow .18s; }
.fn-receipt:hover { transform: translateY(-1px); box-shadow: var(--fn-shadow); }
.fn-receipt .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--fn-ok-soft); color: var(--fn-ok); display: inline-flex; align-items: center; justify-content: center; } .fn-receipt .ic svg { width: 18px; height: 18px; }
.fn-receipt.refund .ic { background: var(--fn-out-soft); color: var(--fn-out); }
.fn-receipt.gone { opacity: .55; } .fn-receipt.gone .amt { text-decoration: line-through; }
.fn-receipt .t b { font-size: 14px; display: block; } .fn-receipt .t span { font-size: 12px; color: var(--fn-ink-3); }
.fn-receipt .amt { font-size: 16px; font-weight: 760; text-align: right; } .fn-receipt .acts { display: flex; gap: 3px; justify-content: flex-end; margin-top: 4px; opacity: .6; transition: opacity .15s; } .fn-receipt:hover .acts { opacity: 1; }
.fn-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.fn-history { font-size: 12.5px; display: grid; gap: 6px; max-height: 300px; overflow: auto; }
.fn-history div { display: grid; grid-template-columns: 130px 1fr; gap: 10px; } .fn-history .when { color: var(--fn-ink-4); font-variant-numeric: tabular-nums; }

/* ---------- batches ---------- */
.fn-batches { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.fn-batch { position: relative; overflow: hidden; }
.fn-batch .top { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.fn-batch .top h4 { margin: 0; font-size: 16px; font-weight: 740; letter-spacing: -.01em; } .fn-batch .top .sub { font-size: 12.5px; color: var(--fn-ink-3); margin-top: 2px; }
.fn-batch .top .fn-chip { margin-left: auto; }
.fn-batch .nums { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.fn-batch .nums span { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--fn-ink-3); }
.fn-batch .nums b { font-size: 17px; font-weight: 760; letter-spacing: -.01em; }
.fn-batch .coll { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--fn-ink-3); margin-bottom: 12px; }
.fn-batch .coll .fn-bar { flex: 1; width: auto; height: 7px; }
.fn-pl { border-top: 1px dashed var(--fn-line-2); padding-top: 10px; font-size: 12.5px; display: grid; gap: 4px; }
.fn-pl div { display: flex; justify-content: space-between; color: var(--fn-ink-3); }
.fn-pl div.tot { font-weight: 760; color: var(--fn-ink); font-size: 14px; border-top: 1px solid var(--fn-line); padding-top: 8px; margin-top: 4px; }
.fn-margin { position: absolute; right: 18px; bottom: 18px; width: 56px; height: 56px; }
.fn-margin circle.track { fill: none; stroke: var(--fn-line); stroke-width: 6; }
.fn-margin circle.val { fill: none; stroke: var(--fn-ok); stroke-width: 6; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset 1s var(--fn-ease); }
.fn-margin text { font-size: 12px; font-weight: 800; fill: var(--fn-ink); text-anchor: middle; }
.fn-batch.done::after { content: 'Fully collected'; position: absolute; top: 14px; right: -34px; transform: rotate(35deg); background: var(--fn-ok); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 4px 40px; }

/* ---------- expense category chips + budgets ---------- */
.fn-cats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.fn-cats span { font-size: 12px; background: var(--fn-surface); border: 1px solid var(--fn-line); border-radius: 999px; padding: 5px 11px; color: var(--fn-ink-2); display: inline-flex; gap: 6px; align-items: center; }
.fn-cats span b { color: var(--fn-ink); } .fn-cats span.tot { background: var(--fn-ink); color: #fff; border-color: var(--fn-ink); } .fn-cats span.tot b { color: #fff; }
.fn-budget { display: grid; grid-template-columns: 150px 1fr 150px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--fn-line); font-size: 12.5px; }
.fn-budget:last-child { border-bottom: none; } .fn-budget .nm { font-weight: 640; color: var(--fn-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fn-budget .fn-bar { width: 100%; height: 8px; } .fn-budget .v { text-align: right; color: var(--fn-ink-3); } .fn-budget .v b { color: var(--fn-ink); }
.fn-budget.over .v b { color: var(--fn-out); }

/* ---------- charts ---------- */
.fn-chart { position: relative; height: 250px; }
.fn-legend { display: flex; gap: 14px; font-size: 12px; color: var(--fn-ink-3); margin-top: 8px; flex-wrap: wrap; }
.fn-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- reconcile ---------- */
.fn-rec { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fn-rec-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--fn-line); margin-bottom: 6px; font-size: 13px; cursor: pointer; transition: background .12s, border-color .12s; }
.fn-rec-row:hover { background: var(--fn-surface-2); } .fn-rec-row.on { background: var(--fn-in-soft); border-color: var(--fn-in-soft-2); }
.fn-rec-row input { width: 16px; height: 16px; accent-color: var(--fn-in); margin: 0; } .fn-rec-row .sub { font-size: 11.5px; color: var(--fn-ink-3); }
.fn-rec-row .amt { font-weight: 700; }
.fn-cash-row td.pos { color: var(--fn-ok); } .fn-cash-row td.neg { color: var(--fn-out); }

/* ---------- settings ---------- */
.fn-tpl { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--fn-line); font-size: 13px; flex-wrap: wrap; }
.fn-tpl .fn-mono { color: var(--fn-ink-3); }
.fn-access { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--fn-line); font-size: 13px; }
.fn-access select { padding: 6px 9px; border: 1px solid var(--fn-line-2); border-radius: 8px; font-family: inherit; font-size: 12.5px; }
.fn-trash { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--fn-line); font-size: 13px; } .fn-trash .t { flex: 1; } .fn-trash .sub { font-size: 11.5px; color: var(--fn-ink-3); }
.fn-codes { display: grid; grid-template-columns: repeat(2, max-content); gap: 8px 28px; margin: 12px 0; } .fn-codes span { font-family: ui-monospace, Menlo, monospace; font-size: 14px; background: var(--fn-surface-2); padding: 6px 10px; border-radius: 8px; border: 1px dashed var(--fn-line-2); }
.fn-qr { margin: 14px 0; width: 220px; } .fn-qr svg { width: 220px; height: 220px; border: 1px solid var(--fn-line); border-radius: 12px; padding: 6px; background: #fff; }
.fn-ol { padding-left: 20px; font-size: 14px; line-height: 1.6; }

/* ---------- states ---------- */
.fn-empty { text-align: center; padding: 46px 20px; color: var(--fn-ink-3); font-size: 13.5px; }
.fn-empty .art { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 16px; background: var(--fn-in-soft); color: var(--fn-in); display: flex; align-items: center; justify-content: center; } .fn-empty .art svg { width: 24px; height: 24px; }
.fn-empty b { display: block; color: var(--fn-ink); font-size: 15px; margin-bottom: 4px; }
.fn-skel { border-radius: 10px; background: linear-gradient(90deg, var(--fn-surface-2) 25%, #eef2f7 37%, var(--fn-surface-2) 63%); background-size: 400% 100%; animation: fn-shimmer 1.3s linear infinite; }
@keyframes fn-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.fn-success { padding: 0; position: fixed; inset: 0; z-index: 1300; display: flex; align-items: center; justify-content: center; background: rgba(11, 18, 32, .35); backdrop-filter: blur(3px); animation: fn-fade .2s both; }
.fn-success .box { background: var(--fn-surface); border-radius: 20px; padding: 30px 34px; text-align: center; box-shadow: var(--fn-shadow-lg); min-width: 300px; animation: fn-pop .4s var(--fn-ease) both; }
@keyframes fn-pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.fn-success .tick { width: 72px; height: 72px; margin: 0 auto 14px; }
.fn-success .tick circle { fill: none; stroke: var(--fn-ok); stroke-width: 3; stroke-dasharray: 220; stroke-dashoffset: 220; animation: fn-draw-c .6s var(--fn-ease) forwards; }
.fn-success .tick path { fill: none; stroke: var(--fn-ok); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: fn-draw-c .4s .45s var(--fn-ease) forwards; }
@keyframes fn-draw-c { to { stroke-dashoffset: 0; } }
.fn-success h3 { font-size: 18px; margin: 0 0 4px; } .fn-success p { color: var(--fn-ink-3); font-size: 13.5px; margin: 0 0 16px; }
.fn-success .fn-mono { font-size: 13px; background: var(--fn-surface-2); padding: 4px 8px; border-radius: 6px; }
.fn-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 1299; overflow: hidden; }
.fn-confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; animation: fn-fall 1.8s var(--fn-ease) forwards; }
@keyframes fn-fall { to { transform: translateY(110vh) rotate(540deg); opacity: .2; } }

/* ---------- lead panel embed ---------- */
.fn-lead { border: 1px solid var(--fn-line); border-radius: 12px; padding: 12px; margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.fn-lead .row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.fn-lead .row div span { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--fn-ink-3); }
.fn-lead .row div b { font-size: 15px; }

/* toasts must sit above sheets and success overlays */
#toast { z-index: 1400; }

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) { .fin *, .fn-sheet, .fn-sheet-dim, .fn-success .box, .fn-success .tick circle, .fn-success .tick path { animation: none !important; transition: none !important; } .fn-hero .spark path.line { stroke-dashoffset: 0; } .fn-hero .spark path.area { opacity: 1; } }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .fn-grid.two, .fn-grid.three, .fn-grid.hero, .fn-rec { grid-template-columns: 1fr; }
  .fn-statement { grid-template-columns: 1fr 1fr; } .fn-statement > div:nth-child(2) { border-right: none; } .fn-statement > div:nth-child(-n+2) { border-bottom: 1px solid var(--fn-line); }
}
@media (max-width: 768px) {
  .fin { padding-bottom: 96px; }
  .fn-head h1 { font-size: 21px; } .fn-actions { width: 100%; } .fn-actions .fn-btn { flex: 1; justify-content: center; }
  .fn-actions .fn-btn.ghost, .fn-actions .fn-btn.icon { flex: 0; }
  .fn-nav { width: 100%; border-radius: 12px; }
  .fn-hero .big { font-size: 30px; } .fn-hero .spark { display: none; }
  .fn-kpis { grid-template-columns: 1fr 1fr; }
  .fn-attn-row { grid-template-columns: 36px 1fr auto; } .fn-attn-row .act { grid-column: 1 / -1; justify-content: flex-end; }
  .fn-form { grid-template-columns: 1fr; }
  .fn-sheet { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; transform: translateY(100%); }
  .fn-sheet.lg { width: 100%; }
  .fn-sheet-h { padding: 14px 18px 12px; } .fn-sheet-h::before { content: ''; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; border-radius: 2px; background: var(--fn-line-2); transform: translateX(-50%); }
  .fn-sheet-b { padding: 14px 18px; } .fn-sheet-f { padding: 10px 18px calc(10px + env(safe-area-inset-bottom)); }
  .fn-filters input, .fn-filters select { flex: 1; min-width: 40%; max-width: none; } .fn-search input { min-width: 0; }
  .fn-seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  /* ledgers become cards */
  .fn-scroll { max-height: none; overflow: visible; }
  .fn-ledger, .fn-ledger tbody, .fn-ledger tr, .fn-ledger td { display: block; }
  .fn-ledger thead, .fn-ledger tfoot { display: none; }
  .fn-ledger tr { border-bottom: 1px solid var(--fn-line); padding: 10px 14px; }
  .fn-ledger td { border: none; padding: 3px 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: right; }
  .fn-ledger td.r { text-align: right; }
  .fn-ledger td::before { content: attr(data-l); font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--fn-ink-3); text-align: left; }
  .fn-ledger td:first-child { padding-top: 0; } .fn-ledger td:first-child::before { display: none; } .fn-ledger td:first-child { display: block; text-align: left; font-size: 14px; }
  .fn-ledger td.actions { justify-content: flex-end; } .fn-ledger td.actions::before { display: none; } .fn-ledger .acts { opacity: 1; }
  .fn-ledger tbody tr.click:hover td:first-child { box-shadow: none; }
  .fn-budget { grid-template-columns: 1fr; gap: 4px; } .fn-budget .v { text-align: left; }
  .fn-history div { grid-template-columns: 1fr; gap: 0; }
  .fn-batch .nums { grid-template-columns: 1fr 1fr; }
  .fn-margin { display: none; }
  .fn-step { grid-template-columns: 28px 1fr; } .fn-step .r { grid-column: 2; text-align: left; }
  .fn-receipt { grid-template-columns: 40px 1fr; } .fn-receipt .amt { grid-column: 2; text-align: left; } .fn-receipt .acts { justify-content: flex-start; opacity: 1; }
  .fn-summary { grid-template-columns: 1fr 1fr 1fr; } .fn-summary div b { font-size: 15px; }
  .fn-codes { grid-template-columns: 1fr; }
}
