/* ============================================================
   Treasure Vault 10+1 module styles (Sales > Treasure Vault 10+1)
   Scoped under #treasurevault-root, tv- prefixed — mirrors the
   cream/ink Inter palette established in orders.css so the module
   sits visually consistent with the rest of Sales. Modals, the
   customer picker and form controls reuse orders.css's ord-*
   classes directly (loaded globally), so this file only covers
   the tv- specific list/detail/installment UI.
   ============================================================ */

#treasurevault-root {
  font-family: 'Inter', sans-serif;
  background: #F6F3EA;
  color: #22262E;
  padding: 24px 20px 40px;
}
#treasurevault-root * { box-sizing: border-box; }
.tv-container { max-width: 1180px; margin: 0 auto; }

/* ---------- Topbar ---------- */
.tv-topbar { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.tv-title { font-family: 'Inter', sans-serif; font-weight: 800; font-size: 30px; margin: 0; color: #20242B; }
.tv-subtitle { font-size: 12.5px; color: #6B7280; margin: 4px 0 0; }
.tv-subtitle-note { font-size: 11px; color: #8B8577; margin: 2px 0 0; font-style: italic; }

/* ---------- Stat row ---------- */
.tv-stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tv-stat-card { background: #FFFFFF; border: 1px solid #EAE4D4; border-radius: 10px; padding: 14px 16px; }
.tv-stat-num { font-family: 'Inter', sans-serif; font-weight: 800; font-size: 24px; color: #20242B; font-variant-numeric: tabular-nums; }
.tv-stat-lbl { font-size: 11px; color: #8B8577; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; margin-top: 2px; }

/* ---------- Filter chips ---------- */
.tv-filter-row { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tv-filter-chip {
  font-family: 'Inter', sans-serif; font-size: 12.5px; font-weight: 600; padding: 6px 14px; border-radius: 999px;
  border: 1px solid #DDD6C4; background: #FFFFFF; color: #5F5E58; cursor: pointer;
}
.tv-filter-chip.tv-active { background: #20242B; color: #F6F3EA; border-color: #20242B; }

/* ---------- Table ---------- */
.tv-table-wrap { background: #FFFFFF; border: 1px solid #EAE4D4; border-radius: 10px; overflow: hidden; }
.tv-table-head, .tv-table-row {
  display: grid; grid-template-columns: 110px 1.3fr 1fr 1.2fr 110px 110px; gap: 10px; align-items: center;
}
.tv-table-head {
  padding: 10px 18px; font-size: 10.5px; color: #8B8577; text-transform: uppercase; letter-spacing: .06em;
  font-weight: 700; border-bottom: 1px solid #EFEADB;
}
.tv-table-row { padding: 13px 18px; border-bottom: 1px solid #F1EFE8; font-size: 13px; cursor: pointer; }
.tv-table-row:last-child { border-bottom: none; }
.tv-table-row:hover { background: #FAF8F1; }
.tv-row-plan-no { font-weight: 700; color: #2F6E6E; font-variant-numeric: tabular-nums; }
.tv-row-empty { padding: 30px 18px; text-align: center; color: #8B8577; font-size: 13px; }

/* ---------- Status pills ---------- */
.tv-pill { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.tv-pill-active { background: #E9F2F1; color: #2F6E6E; }
.tv-pill-completed { background: #EAF6EA; color: #2E7D46; }
.tv-pill-cancelled { background: #FBEAE8; color: #B5453A; }

/* ---------- Progress + late badge ---------- */
.tv-progress { font-variant-numeric: tabular-nums; font-weight: 600; }
.tv-late-badge {
  display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; margin-left: 6px;
  padding: 1px 7px; border-radius: 999px; background: #FBF1DF; color: #B5772F;
}

/* ---------- Detail page ---------- */
.tv-back { background: none; border: none; color: #8B8577; font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 0; margin-bottom: 14px; display: inline-flex; align-items: center; gap: 4px; }
.tv-detail-back { }
.tv-detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; }
.tv-detail-plan-no { font-family: 'Inter', sans-serif; font-weight: 800; font-size: 24px; margin: 0; color: #20242B; font-variant-numeric: tabular-nums; }
.tv-detail-customer { font-size: 13.5px; color: #6B7280; }

.tv-block-title { font-size: 13px; font-weight: 700; color: #20242B; margin: 22px 0 10px; }

/* ---------- Banners ---------- */
.tv-banner { border-radius: 10px; padding: 14px 16px; font-size: 13px; line-height: 1.5; margin-bottom: 16px; }
.tv-banner-ok { background: #EAF6EA; color: #2E7D46; border: 1px solid #CFE9CF; }
.tv-banner-warn { background: #FBF1DF; color: #8A5A17; border: 1px solid #F0DDB0; }

/* ---------- Voucher preview ---------- */
.tv-voucher-preview {
  background: #20242B; color: #F6F3EA; border-radius: 12px; padding: 18px 20px; margin-bottom: 16px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
}
.tv-voucher-amount { font-family: 'Inter', sans-serif; font-weight: 800; font-size: 26px; font-variant-numeric: tabular-nums; }

/* ---------- Installment list ---------- */
.tv-installment-list { background: #FFFFFF; border: 1px solid #EAE4D4; border-radius: 10px; overflow: hidden; }
.tv-inst-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid #F1EFE8;
}
.tv-inst-row:last-child { border-bottom: none; }
.tv-inst-no { font-weight: 700; font-size: 12.5px; color: #20242B; width: 34px; flex: none; }
.tv-inst-due { font-size: 12px; color: #8B8577; flex: 1; }
.tv-inst-state { font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.tv-inst-paid .tv-inst-state { background: #EAF6EA; color: #2E7D46; }
.tv-inst-late .tv-inst-state { background: #FBF1DF; color: #B5772F; }
.tv-inst-overdue .tv-inst-state { background: #FBEAE8; color: #B5453A; }
.tv-inst-grace .tv-inst-state { background: #FBF1DF; color: #8A5A17; }
.tv-inst-upcoming .tv-inst-state { background: #F1EFE8; color: #8B8577; }
.tv-inst-pay {
  font-size: 12px; font-weight: 700; color: #2F6E6E; background: none; border: 1px solid #2F6E6E;
  border-radius: 7px; padding: 5px 12px; cursor: pointer;
}

/* ---------- Action row + details grid ---------- */
.tv-action-row { display: flex; gap: 10px; margin: 18px 0; flex-wrap: wrap; }
.tv-details-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; background: #FFFFFF; border: 1px solid #EAE4D4; border-radius: 10px; padding: 16px 18px; }
.tv-detail-item-lbl { font-size: 10.5px; color: #8B8577; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.tv-detail-item-val { font-size: 13px; color: #22262E; margin-top: 2px; }

@media (max-width: 720px) {
  .tv-table-head { display: none; }
  .tv-table-row { grid-template-columns: 1fr; row-gap: 4px; }
}
