:root{
  --pri:#c2172e;--ink:#0f172a;--mut:#6b7280;--bg:#f6f7fb;--card:#fff;--line:#eef0f4;--total:#eef2ff;
}
*{box-sizing:border-box}
body{margin:0;font-family:Inter,system-ui,Segoe UI,Roboto,Arial,sans-serif;background:#fafbfc;color:var(--ink)}
.wrap{max-width:1000px;margin:24px auto;padding:0 14px}
.title{font-weight:800;margin:0 0 6px}
.card{background:var(--card);border:1px solid #e5e7eb;border-radius:12px;padding:14px;margin-top:12px}
.row{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.grid{display:grid;gap:10px;grid-template-columns:repeat(2,minmax(0,1fr))}
@media (max-width:820px){.grid{grid-template-columns:1fr}}
.field{border:1px solid #e5e7eb;border-radius:10px;padding:10px;background:#fff;flex:1 1 220px;min-width:220px}
label{display:block;font-size:12px;color:var(--mut);margin-bottom:6px}
input,select{width:100%;padding:10px;border:1px solid #e5e7eb;border-radius:8px;font-size:15px}
input[readonly]{background:#f3f4f6}
.hint{font-size:12px;color:var(--mut);margin-top:6px}
.warn{color:#b91c1c;font-weight:800;font-size:12px;margin-top:6px;display:none}
.warn.show{display:block}
.products{display:flex;flex-wrap:wrap;gap:8px}
.prod{border:1px solid #e5e7eb;border-radius:999px;padding:8px 12px;background:#fff;cursor:pointer;font-weight:700}
.prod.active{background:var(--pri);color:#fff;border-color:var(--pri)}
.kv{display:grid;grid-template-columns:1fr auto;gap:6px}
.summary{display:grid;grid-template-columns:1.1fr 1fr 1fr;gap:10px}
@media (max-width:820px){.summary{grid-template-columns:1fr}}
.key{background:#f8fafc;border:1px dashed #e5e7eb;border-radius:10px;padding:12px}
.key big{font-size:22px;font-weight:800}
.promo{background:linear-gradient(135deg,#fff7ed,#fffbeb);border:1px solid #fde68a}
.promo .primary{font-size:30px;line-height:1.1}
.tag{display:inline-block;font-size:11px;font-weight:800;padding:3px 8px;border-radius:999px;background:#f59e0b;color:#fff;margin-bottom:4px}

/* Table */
table{width:100%;border-collapse:collapse;margin-top:10px;background:#fff;border-radius:10px;overflow:hidden}
th,td{padding:8px;border-bottom:1px solid var(--line);text-align:right;font-variant-numeric:tabular-nums}
th{background:#0f172a;color:#fff}
th:first-child,td:first-child{text-align:center}
/* Columns: 1 Period | 2 Balance | 3 TotalPay | 4 Principal | 5 Interest | 6 CondBack | 7 Gift | 8 Net | 9 Fee */
td:nth-child(3){background:var(--total);font-weight:700}
.col-condback,.col-net,.col-gift{display:none}
/* IB view shows Interest Back + Net */
#scheduleTable.ib .col-condback, #scheduleTable.ib .col-net{display:table-cell}
#scheduleTable.ib td:nth-child(6), #scheduleTable.ib th:nth-child(6){background:#fff1f2;color:#9f1239;font-weight:800}
#scheduleTable.ib td:nth-child(8), #scheduleTable.ib th:nth-child(8){background:#ecfeff;color:#155e75;font-weight:900}
/* Gift view shows Conditional Payment + Net */
#scheduleTable.gift .col-gift, #scheduleTable.gift .col-net{display:table-cell}
#scheduleTable.gift td:nth-child(7), #scheduleTable.gift th:nth-child(7){background:#fff1f2;color:#9f1239;font-weight:800}
#scheduleTable.gift td:nth-child(8), #scheduleTable.gift th:nth-child(8){background:#ecfeff;color:#155e75;font-weight:900}
