/* ui/billing.css — owned by W20. Every selector prefixed .bl- (SHELL_CONTRACT 3.2).
   Every custom property is declared at :root AND carried as a var() fallback, so nothing here
   can render white-on-white if it is ever mounted outside this wrapper (gate_css_vars).
   text-transform:uppercase sits on ONE leaf class (.bl-eyebrow) and never on a container. */

:root {
  --bl-indigo: #4330F5;
  --bl-depth: #271257;
  --bl-deep: #1A0B3D;
  --bl-link: #581C87;
  --bl-ink: #14102A;
  --bl-mute: #6B7280;
  --bl-line: #E5E7EB;
  --bl-wash: #F7F6FE;
  --bl-good: #1E7735;
  --bl-good-bg: #F1FCF3;
  --bl-warn: #B45309;
  --bl-warn-bg: #FFFBEB;
  --bl-stop: #9F1239;
  --bl-stop-bg: #FFF1F4;
}

.bl-wrap {
  font-family: Poppins, system-ui, sans-serif;
  color: var(--bl-ink, #14102A);
  max-width: 1120px;
  padding: 8px 4px 64px;
}

/* ---- PRICING. Three columns and a list. -------------------------------------------------
   Every custom property below is declared at :root above and carried with a var() fallback,
   per gate_css_vars: W58's invisible-button bug was vars that never reached a portalled panel,
   so a literal fallback is the difference between a styled card and a white-on-white one. */
.bl-plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 12px;
}
@media (max-width: 860px) {
  .bl-plans { grid-template-columns: 1fr; }
}
.bl-plan {
  border: 1px solid var(--bl-line, #E5E7EB);
  border-radius: 10px;
  padding: 18px 18px 20px;
  background: #FFF;
}
/* The plan this account is on. A LABEL, not a lock: it states a fact, it refuses nothing. */
.bl-plan-on {
  border-color: var(--bl-indigo, #4330F5);
  background: var(--bl-wash, #F7F6FE);
}
.bl-plan-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 22px;
}
.bl-plan-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--bl-depth, #271257);
}
.bl-plan-pill {
  font-size: 11px;
  font-weight: 600;
  color: var(--bl-indigo, #4330F5);
  border: 1px solid var(--bl-indigo, #4330F5);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.bl-plan-price {
  font-size: 22px;
  font-weight: 600;
  color: var(--bl-ink, #14102A);
  margin-top: 10px;
}
.bl-plan-yours {
  font-size: 13px;
  color: var(--bl-mute, #6B7280);
  margin-top: 2px;
  min-height: 18px;
}
.bl-plan-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  font-size: 13px;
  line-height: 1.9;
  color: var(--bl-ink, #14102A);
}
/* The vendors a plan adds. Muted and divided: they answer "who connects", which is a
   different question from "what do I get", and stacking them in one list makes a buyer read
   thirteen names as thirteen features. */
.bl-plan-vendors {
  color: var(--bl-mute, #6B7280);
  border-top: 1px solid var(--bl-line, #E5E7EB);
  margin-top: 14px;
  padding-top: 12px;
}

/* ---- the card. Loop IQ chrome, to the 0.67px. ------------------------------------------ */
.bl-card {
  background: #FFF;
  border: 0.67px solid var(--bl-line, #E5E7EB);
  border-radius: 12px;
  padding: 24px;
}

/* ---- 1. THE BAR. What is owed, and the one thing to do about it. Four words, two numbers. */
.bl-bar {
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
  margin: 4px 0 20px;
}
.bl-stat { display: flex; flex-direction: column; gap: 2px; }
.bl-stat .bl-k {
  font-size: 11px; font-weight: 600; letter-spacing: .5px; color: var(--bl-mute, #6B7280);
}
.bl-stat .bl-v {
  font-family: var(--font-head, 'Sansation', 'Poppins', sans-serif);
  font-size: 26px; font-weight: 600; letter-spacing: -.4px;
  font-variant-numeric: tabular-nums;
}
.bl-stat .bl-v.bl-is-stop { color: var(--bl-stop, #9F1239); }
.bl-bar .bl-spacer { flex: 1 1 auto; }

.bl-eyebrow {
  display: inline-block;
  font-size: 12px; font-weight: 600; letter-spacing: .6px;
  text-transform: uppercase;                     /* leaf only, never a container */
  color: var(--bl-mute, #6B7280);
}

/* ---- buttons. Primary is filled depth. A destructive action NEVER gets it. -------------- */
.bl-btn {
  font: 600 13px/1 Poppins, system-ui, sans-serif;
  border-radius: 9999px; padding: 10px 18px; cursor: pointer;
  border: 0.67px solid var(--bl-line, #E5E7EB); background: #FFF;
  color: var(--bl-ink, #14102A);
  transition: background .12s ease, border-color .12s ease;
}
.bl-btn:hover { border-color: #C9C5D6; background: #FCFCFE; }
.bl-btn-primary {
  background: var(--bl-depth, #271257); border-color: var(--bl-depth, #271257); color: #FFF;
}
.bl-btn-primary:hover { background: var(--bl-deep, #1A0B3D); border-color: var(--bl-deep, #1A0B3D); }
.bl-btn:disabled { opacity: .45; cursor: not-allowed; }

/* A link, not a button. Clearing a field is destructive and it does not get to look inviting. */
.bl-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: 500 12px/1 Poppins, system-ui, sans-serif;
  color: var(--bl-link, #581C87); text-decoration: underline; text-underline-offset: 2px;
}
.bl-link:hover { color: var(--bl-deep, #1A0B3D); }
.bl-link.bl-danger { color: var(--bl-stop, #9F1239); }

/* ---- 2. THE COLUMNS ------------------------------------------------------------------- */
.bl-cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 980px) { .bl-cols { grid-template-columns: minmax(0, 1fr); } }

.bl-side { display: flex; flex-direction: column; gap: 20px; }

/* ---- 3. FILTERS. Pills. They are the interaction, so they look like one. ---------------- */
.bl-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.bl-pill {
  border-radius: 9999px; padding: 6px 14px; cursor: pointer;
  font: 600 12px/1.4 Poppins, system-ui, sans-serif;
  border: 0.67px solid var(--bl-line, #E5E7EB); background: #FFF; color: var(--bl-mute, #6B7280);
}
.bl-pill:hover { border-color: #C9C5D6; color: var(--bl-ink, #14102A); }
.bl-pill[aria-pressed="true"] {
  background: var(--bl-depth, #271257); border-color: var(--bl-depth, #271257); color: #FFF;
}
.bl-sel {
  font: 500 12px/1 Poppins, system-ui, sans-serif;
  border-radius: 9999px; padding: 7px 12px; cursor: pointer;
  border: 0.67px solid var(--bl-line, #E5E7EB); background: #FFF; color: var(--bl-ink, #14102A);
}
.bl-count { font-size: 12px; color: var(--bl-mute, #6B7280); margin-left: auto; }

/* ---- 4. THE INVOICE LIST -------------------------------------------------------------- */
.bl-rows { display: flex; flex-direction: column; }
.bl-row {
  display: grid; grid-template-columns: 132px 1fr 96px 110px 34px;
  gap: 12px; align-items: center;
  padding: 14px 8px; border-bottom: 0.67px solid var(--bl-line, #E5E7EB);
  cursor: pointer; border-radius: 8px;
  transition: background .1s ease;
}
.bl-row:hover { background: var(--bl-wash, #F7F6FE); }
.bl-row[aria-selected="true"] { background: var(--bl-wash, #F7F6FE); }
.bl-row:last-child { border-bottom: 0; }
.bl-no { font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.bl-per { font-size: 13px; color: var(--bl-mute, #6B7280); }
.bl-amt { text-align: right; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bl-dl {
  border: 0; background: none; cursor: pointer; color: var(--bl-mute, #6B7280);
  font-size: 15px; line-height: 1; padding: 6px; border-radius: 8px;
}
.bl-dl:hover { color: var(--bl-depth, #271257); background: #FFF; }
@media (max-width: 720px) {
  .bl-row { grid-template-columns: 1fr 96px 34px; }
  .bl-row .bl-per { display: none; }
}

/* status chips */
.bl-chip {
  display: inline-block; border-radius: 9999px; padding: 3px 10px;
  font: 600 11px/1.5 Poppins, system-ui, sans-serif; white-space: nowrap;
}
.bl-chip-paid { background: var(--bl-good-bg, #F1FCF3); color: var(--bl-good, #1E7735); }
.bl-chip-due { background: var(--bl-warn-bg, #FFFBEB); color: var(--bl-warn, #B45309); }
.bl-chip-overdue { background: var(--bl-stop-bg, #FFF1F4); color: var(--bl-stop, #9F1239); }

/* ---- 5. THE FIELD. Pre-filled, overridable, and it never renders blank. ---------------- */
.bl-field { padding: 14px 0; border-bottom: 0.67px solid var(--bl-line, #E5E7EB); }
.bl-field:first-of-type { padding-top: 0; }
.bl-field:last-child { border-bottom: 0; padding-bottom: 0; }
.bl-flabel {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: .5px; color: var(--bl-mute, #6B7280);
  margin-bottom: 6px;
}
.bl-fval { font-size: 14px; font-weight: 500; word-break: break-word; }
.bl-fsub { font-size: 12px; color: var(--bl-mute, #6B7280); margin-top: 3px; }

/* THE ABSENCE STATE. Visibly not a value. Not blank, not zero, not an Invalid Date. */
.bl-nodata {
  display: inline-block;
  font-size: 13px; font-weight: 500; font-style: italic;
  color: var(--bl-warn, #B45309); background: var(--bl-warn-bg, #FFFBEB);
  border-radius: 8px; padding: 4px 10px;
}

.bl-edit { display: flex; flex-direction: column; gap: 8px; }
.bl-inp {
  width: 100%; box-sizing: border-box;
  font: 400 14px/1.4 Poppins, system-ui, sans-serif;
  border: 0.67px solid var(--bl-line, #E5E7EB); border-radius: 10px; padding: 9px 12px;
  color: var(--bl-ink, #14102A); background: #FFF;
}
.bl-inp:focus {
  outline: none; border-color: var(--bl-indigo, #4330F5);
  box-shadow: 0 0 0 3px rgba(67, 48, 245, .1);
}
.bl-actions { display: flex; align-items: center; gap: 10px; }
.bl-err { font-size: 12px; color: var(--bl-stop, #9F1239); }

/* ---- 6. THE DETAIL. A drawer, not a page. ---------------------------------------------- */
.bl-detail { margin-top: 16px; }
.bl-dhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.bl-dtitle { font-family: var(--font-head, 'Sansation', 'Poppins', sans-serif); font-size: 19px; font-weight: 600; }
.bl-dmeta { font-size: 12px; color: var(--bl-mute, #6B7280); margin-top: 4px; }
.bl-items { width: 100%; border-collapse: collapse; margin-top: 18px; }
.bl-items th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .5px;
  color: var(--bl-mute, #6B7280); padding: 8px 0; border-bottom: 0.67px solid var(--bl-line, #E5E7EB);
}
.bl-items td { padding: 11px 0; border-bottom: 0.67px solid var(--bl-line, #E5E7EB); font-size: 13px; }
.bl-items .bl-n { text-align: right; font-variant-numeric: tabular-nums; }
.bl-items tfoot td { border-bottom: 0; padding: 6px 0; color: var(--bl-mute, #6B7280); }
.bl-items tfoot tr:last-child td {
  color: var(--bl-ink, #14102A); font-weight: 700; font-size: 15px;
  border-top: 1.5px solid var(--bl-ink, #14102A); padding-top: 12px;
}
/* The breakdown under a line item. Quiet — it is evidence, not a headline. */
.bl-where {
  margin-top: 4px; font-size: 11px; color: var(--bl-mute, #6B7280);
  font-variant-numeric: tabular-nums; letter-spacing: .1px;
}
.bl-where i { font-style: italic; color: var(--bl-warn, #B45309); }

.bl-why { margin-top: 16px; font-size: 12px; color: var(--bl-mute, #6B7280); }
.bl-why b { color: var(--bl-ink, #14102A); font-weight: 600; }

/* ---- 7. DEMO MARKER. Quiet here; unmissable in anything that can be forwarded. ---------- */
.bl-demo {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 9999px; padding: 4px 12px;
  font: 600 11px/1.5 Poppins, system-ui, sans-serif;
  background: var(--bl-wash, #F7F6FE); color: var(--bl-depth, #271257);
  border: 0.67px solid #DDD8F5;
}

/* ---- 8. HISTORY. Who changed what, from what, to what. --------------------------------- */
.bl-hist { margin-top: 20px; }
.bl-hist summary {
  cursor: pointer; font-size: 12px; font-weight: 600; color: var(--bl-link, #581C87);
  list-style: none;
}
.bl-hist summary::-webkit-details-marker { display: none; }
.bl-hrow {
  display: flex; gap: 10px; align-items: baseline;
  padding: 9px 0; border-bottom: 0.67px solid var(--bl-line, #E5E7EB); font-size: 12px;
}
.bl-hrow:last-child { border-bottom: 0; }
.bl-hwho { font-weight: 600; white-space: nowrap; }
.bl-hwhat { color: var(--bl-mute, #6B7280); flex: 1 1 auto; }
.bl-hwhen { color: var(--bl-mute, #6B7280); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bl-chain { margin-top: 10px; font-size: 11px; color: var(--bl-mute, #6B7280); }
.bl-chain.bl-broken { color: var(--bl-stop, #9F1239); font-weight: 600; }

.bl-empty { padding: 26px 2px; font-size: 13px; color: var(--bl-mute, #6B7280); }
.bl-sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
