/* Pengaturan rebuild — Penagihan's three pages (Langganan, Faktur, Metode pembayaran) and Paket (billing.js). Page
   styles on top of pg.css / pg-app.css. Everything here is pg-bill-* (or a pg-* class in a billing context), built on
   the --pg-* tokens. Sections: 1 dialog bodies outside .pg-root · 2 Penagihan's pages · 3 Paket · 4 Ubah paket ·
   5 Bayar faktur · 6 the other dialogs · 7 the wash of a changed row · 8 phone. */

/* ---------- 1. Dialog bodies outside .pg-root ----------
   Dialogs live in #layer, outside .pg-root, so pg.css's page resets do not reach them: the same zero-specificity
   resets for what billing draws there (its own dialogs, and its steps inside identity.js's account dialog). */
:where(#overlay-billing, #overlay-add-business, .pg-bill-task) :where(h4, p, ul, ol, dl, dd) { margin: 0; }
:where(#overlay-billing, #overlay-add-business, .pg-bill-task) :where(ul, ol) { padding: 0; list-style: none; }
:where(#overlay-billing, #overlay-add-business, .pg-bill-task) :where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(#overlay-billing, #overlay-add-business, .pg-bill-task) :where(button) { cursor: pointer; }
:where(#overlay-billing, #overlay-add-business, .pg-bill-task) :where(.pg-input, .pg-textarea, .pg-select) { color: var(--pg-ink); }
.lk-dialog.pg-dlg :is(.pg-bill-pay, .pg-bill-form) p + p { margin-top: 10px; }
/* A first step in identity.js's account dialog, in the rhythm of its own steps (pg-people.css .pg-people-step). */
.pg-bill-task { display: block; margin: 0; }
.pg-bill-task > * + * { margin-top: 12px; }
.pg-bill-task > :is(.pg-callout, .pg-consent) { margin-top: 14px; }
.lk-dialog.pg-dlg .pg-bill-task p strong { color: var(--pg-ink); font-weight: 600; }

/* ---------- 2. Penagihan's pages ---------- */
/* A link inside a lead, a fact or a row's line reads as part of the sentence (Paket). */
.pg-page-lead .pg-btn.pg-link, .pg-row-text .pg-btn.pg-link, .pg-fact .pg-btn.pg-link { display: inline; min-height: 0; font-size: inherit; line-height: inherit; vertical-align: baseline; }
.pg-row-text .pg-btn.pg-link span, .pg-page-lead .pg-btn.pg-link span, .pg-fact .pg-btn.pg-link span { display: inline; }
/* Perlu perhatian (Paket): the payment being confirmed rests where the buttons stand. */
.pg-attn-actions .pg-chip { align-self: center; }
/* Tagih otomatis without a method to charge: the switch rests. */
.pg-bill-auto .pg-toggle:disabled { opacity: .45; cursor: default; }
/* A page of rows: which rows these are, and the two turns. */
.pg-bill-pager-turns { display: flex; flex: none; gap: 6px; }
/* The CRM's pager (styles/styles/redesign.css, through pr20.css) owns a .pg-num of its own: a 32px grid button with a
   border and a hover. In a pg table .pg-num is the money column, so it goes back to being a table cell here (fold
   into pg-app.css for every pg table). */
.pg-table :is(th, td).pg-num { display: table-cell; place-items: normal; min-width: 0; height: auto; border-width: 0; border-radius: 0; cursor: auto; }
.pg-table th.pg-num, .pg-table th.pg-num:hover { padding: 10px; border-bottom: 1px solid var(--pg-rule); background: var(--pg-soft); color: var(--pg-muted); font-size: 11.5px; font-weight: 650; }
.pg-table td.pg-num, .pg-table td.pg-num:hover { padding: 12px 10px; border-top: 1px solid var(--pg-rule); background: transparent; color: var(--pg-ink); font-size: 13px; font-weight: 600; }
.pg-table tr:first-child td.pg-num { border-top: 0; }
.pg-table tr.pg-is-fresh td.pg-num { background: transparent; }
/* Faktur's filters wrap where the column is narrow (a tablet beside the sidebar). */
.pg-bill-filters { flex-wrap: wrap; }
/* Faktur: Bayar beside the PDF. */
.pg-bill-table .pg-act { white-space: nowrap; }
.pg-bill-table .pg-act .pg-btn.pg-sm { margin-right: 2px; }
/* An invoice is one line at the column's width: the period never breaks (a long Business name wraps instead), the
   cells sit a little closer and the state chips are small. */
.pg-bill-table td.pg-line2 { white-space: nowrap; }
.pg-bill-table td.pg-biz { white-space: normal; }
.pg-bill-table .pg-chip { min-height: 20px; padding: 0 7px; font-size: 11px; }
@media (min-width: 721px) {
  .pg-bill-table :is(th, td):not(:first-child), .pg-bill-table :is(th, td).pg-num:hover { padding-left: 8px; }
  .pg-bill-table :is(th, td):not(:last-child), .pg-bill-table :is(th, td).pg-num:hover { padding-right: 8px; }
}
/* Narrower than that (a small laptop's window, a tablet), each invoice takes the phone's three lines (8). */
.pg-card.pg-bill-invoices { container-type: inline-size; }
@container (max-width: 780px) {
  .pg-bill-table, .pg-bill-table tbody, .pg-bill-table td { display: block; }
  .pg-bill-table thead { display: none; }
  .pg-bill-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "biz total" "num status" "period act"; align-items: center; column-gap: 12px; row-gap: 4px; padding: 12px 16px; }
  .pg-bill-table tr + tr { border-top: 1px solid var(--pg-rule); }
  .pg-bill-invoices .pg-bill-table :is(td, td:not(:first-child), td:not(:last-child), td.pg-num, td.pg-num:hover) { padding: 0; border: 0; }
  .pg-bill-table td.pg-biz { grid-area: biz; min-width: 0; font-weight: 600; }
  .pg-bill-table td.pg-num, .pg-bill-table td.pg-num:hover { display: block; grid-area: total; text-align: right; }
  .pg-bill-table td.pg-mono { grid-area: num; width: auto; min-width: 0; color: var(--pg-muted); font-size: 12.5px; }
  .pg-bill-table tr:not(:has(> td.pg-biz)) td.pg-mono { grid-area: biz; color: var(--pg-ink); font-size: 13px; }
  .pg-bill-table td.pg-line2 { grid-area: period; }
  .pg-bill-table td:has(> .pg-chip) { grid-area: status; justify-self: end; width: auto; }
  .pg-bill-table td.pg-act { grid-area: act; justify-self: end; width: auto; }
  .pg-bill-table tr.pg-bill-nomatch { display: block; padding: 0; }
}
.pg-bill-pdf .pg-icon { width: 16px; height: 16px; }
.pg-table-foot .pg-btn.pg-link { min-height: 0; font-size: 12px; }
/* Faktur with nothing matching: the empty state spans the table's body. */
.pg-table tr.pg-bill-nomatch td { padding: 0; }
.pg-table tr.pg-bill-nomatch:hover td { background: transparent; }

/* ---------- 3. Paket ---------- */
.pg-sec:has(> .pg-bill-plan) { container-type: inline-size; }
.pg-bill-plan { --pg-plan-space: 24px; }
/* One card: a quiet price and slots sidebar, with the receipt and billing controls beside it. */
.pg-bill-plan-layout { display: grid; grid-template-columns: minmax(230px, .9fr) minmax(0, 1.6fr); }
.pg-bill-plan-sidebar { min-width: 0; background: var(--pg-soft); border-right: 1px solid var(--pg-line); }
.pg-bill-plan-detail { min-width: 0; }
.pg-bill-plan :is(.pg-bill-plan-summary, .pg-bill-plan-breakdown) { min-width: 0; padding: var(--pg-plan-space); }
.pg-bill-price-head { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 16px; }
.pg-bill-price-head .pg-price { flex-direction: column; align-items: flex-start; flex-wrap: wrap; gap: 6px; min-width: 0; }
.pg-bill-price-head .pg-chip { flex: none; }
.pg-bill-plan-breakdown .pg-lines li:first-child { padding-top: 0; border-top: 0; }
.pg-bill-plan .pg-lines li:last-child { padding-bottom: 0; }
.pg-bill-plan-settings { min-width: 0; border-top: 1px solid var(--pg-line); }
.pg-bill-plan-detail .pg-bill-plan-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pg-bill-plan-detail .pg-bill-plan-settings > .pg-row + .pg-row { border-left: 1px solid var(--pg-rule); }
.pg-bill-plan-settings > .pg-row { min-width: 0; padding: 18px var(--pg-plan-space); flex-direction: column; align-items: flex-start; gap: 12px; }
.pg-bill-plan-settings > .pg-row::before { display: none; }
.pg-bill-plan-settings .pg-row-copy { flex: 1 1 auto; min-width: 0; }
.pg-bill-plan .pg-row-side { max-width: 100%; flex-wrap: wrap; justify-content: flex-end; }
.pg-bill-plan .pg-row-side .pg-btn { max-width: 100%; white-space: normal; text-align: left; }
.pg-bill-plan .pg-bill-plan-settings .pg-row-side { justify-content: flex-start; margin-left: 0; }
/* Keep the cancellation and resume states inside the card's full-width footer. */
.pg-bill-plan-cancel { padding: 20px var(--pg-plan-space); border-top: 1px solid var(--pg-line); }
.pg-bill-plan-cancel .pg-sec-head { margin-bottom: 4px; }
.pg-bill-plan-cancel .pg-card { overflow: visible; border: 0; border-radius: 0; background: transparent; }
.pg-bill-plan-cancel .pg-row { min-height: 36px; padding: 0; }
.pg-bill-plan-cancel .pg-row-title { color: var(--pg-muted); font-size: 12.5px; font-weight: 400; }
.pg-bill-plan-cancel .pg-row-side { margin-top: -24px; }
/* Respond to the section's width, including tablets with the app sidebar still open. */
@container (max-width: 700px) {
  .pg-bill-plan { --pg-plan-space: 20px; }
  .pg-bill-plan-layout { grid-template-columns: minmax(0, 1fr); }
  .pg-bill-plan-sidebar { border-right: 0; border-bottom: 1px solid var(--pg-line); }
  .pg-bill-plan .pg-bill-price-head { flex-direction: row; align-items: center; }
  .pg-bill-plan .pg-bill-price-head .pg-price { flex-direction: row; align-items: baseline; }
}
@container (max-width: 460px) {
  .pg-bill-plan { --pg-plan-space: 16px; }
  .pg-bill-plan .pg-bill-price-head { flex-wrap: wrap; }
  .pg-bill-plan .pg-lines li { flex-wrap: wrap; gap: 4px 12px; }
  .pg-bill-plan .pg-lines li > b { margin-left: auto; }
  .pg-bill-plan .pg-bill-plan-settings > .pg-row .pg-row-side { justify-content: flex-start; margin-left: 0; }
  .pg-bill-plan-cancel .pg-row { flex-direction: column; align-items: flex-start; gap: 14px; }
  .pg-bill-plan .pg-bill-plan-cancel .pg-row-side { justify-content: flex-start; margin: 0; }
  .pg-bill-plan-detail .pg-bill-plan-settings { grid-template-columns: minmax(0, 1fr); }
  .pg-bill-plan-detail .pg-bill-plan-settings > .pg-row + .pg-row { border-left: 0; border-top: 1px solid var(--pg-rule); }
}
.pg-bill-meter { flex-wrap: wrap; row-gap: 4px; }
.pg-bill-meter > span { min-width: 0; }
.pg-bill-meter b { font-weight: 600; }

/* ---------- 4. Ubah paket ---------- */
.pg-bill-slots-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.lk-dialog.pg-dlg .pg-bill-slots-head h4 { margin: 0 0 2px; }
.pg-bill-slots .pg-meter { margin-top: 10px; }
.pg-bill-slots .pg-meter > span { line-height: 1.45; }
.pg-bill-plan-dialog .pg-choices { display: grid; }
.pg-bill-plan-dialog .pg-sec-note { margin-top: 8px; }
.pg-bill-plan-dialog .pg-choice-copy small { overflow-wrap: anywhere; }
.pg-summary .pg-lines li.pg-total b small { color: var(--pg-muted); font-size: 11.5px; font-weight: 500; }
.pg-bill-plan-bills .pg-summary + .pg-summary { margin-top: 12px; }
.lk-dialog.pg-dlg .pg-dlg-foot .pg-note { flex: 1 1 auto; min-width: 0; text-align: center; }

/* ---------- 5. Bayar faktur ---------- */
.pg-bill-pay .pg-kv { margin-bottom: 16px; }
.pg-bill-options .pg-option + .pg-option { margin-top: 8px; }
.pg-bill-options .pg-option .pg-chip { flex: none; }
.pg-bill-options .pg-option .pg-row-copy small { line-height: 1.45; }

/* Detail faktur: values and fields occupy the same positions on the page. */
.pg-bill-details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; margin: 0; padding: 20px; }
.pg-bill-details-grid > div { min-width: 0; }
.pg-bill-details-grid dt { color: var(--pg-muted); font-size: 12.5px; font-weight: 550; }
.pg-bill-details-grid dt small { color: var(--pg-faint); font-size: 11px; font-weight: 500; }
.pg-bill-details-grid dd { min-height: 21px; margin: 6px 0 0; color: var(--pg-ink); font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.pg-bill-details-grid .pg-field + .pg-field { margin-top: 0; }
.pg-bill-details-grid .pg-input, .pg-bill-details-grid .pg-textarea { min-width: 0; }
.pg-bill-details-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--pg-rule); }

/* ---------- 6. The other dialogs ---------- */
/* Tambah Bisnis: the Organization's running trial, a pill under the name. */
.pg-bill-trial { margin-top: 12px; }
.pg-bill-task .pg-consent { line-height: 1.5; }
.pg-bill-task .pg-field + .pg-consent { margin-top: 16px; }

/* ---------- 7. A changed row washes once ---------- */
@keyframes pg-bill-fresh { 0%, 35% { background-color: #fff5d6; } 100% { background-color: transparent; } }
@keyframes pg-bill-fresh-card { 0%, 35% { background-color: #fff5d6; } 100% { background-color: #fff; } }
.pg-row.pg-is-fresh, .pg-table tr.pg-is-fresh td { animation: pg-bill-fresh 1.2s ease-out both; }
.pg-card.pg-is-fresh { animation: pg-bill-fresh-card 1.2s ease-out both; }
@media (prefers-reduced-motion: reduce) { .pg-row.pg-is-fresh, .pg-table tr.pg-is-fresh td, .pg-card.pg-is-fresh { animation: none; } }

/* ---------- 8. Phone (≤720px) ---------- */
@media (max-width: 720px) {
  /* A stacked table's money cell is a block like the others (see the .pg-num note in 2). */
  .pg-table td.pg-num, .pg-table td.pg-num:hover { display: block; padding: 0; border: 0; text-align: left; }
  .pg-bill-pager { flex-wrap: wrap; }
  /* Faktur: three lines an invoice — its Business and total; its number and state; its period with Bayar and the
     PDF. Filtered to one Business, the number takes the Business's place. */
  .pg-bill-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "biz total" "num status" "period act"; align-items: center; column-gap: 12px; row-gap: 4px; }
  .pg-bill-table td.pg-biz { grid-area: biz; min-width: 0; font-weight: 600; }
  .pg-bill-table td.pg-num, .pg-bill-table td.pg-num:hover { grid-area: total; text-align: right; }
  .pg-bill-table td.pg-mono { grid-area: num; min-width: 0; color: var(--pg-muted); font-size: 12.5px; }
  .pg-bill-table tr:not(:has(> td.pg-biz)) td.pg-mono { grid-area: biz; color: var(--pg-ink); font-size: 13px; }
  .pg-bill-table td.pg-line2 { grid-area: period; margin-top: 0; }
  .pg-bill-table td:has(> .pg-chip) { grid-area: status; justify-self: end; }
  .pg-bill-table td.pg-act { grid-area: act; position: static; justify-self: end; }
  .pg-bill-table tr.pg-bill-nomatch { display: block; }
  .pg-bill-slots-head { align-items: flex-start; }
  .lk-dialog.pg-dlg .pg-dlg-foot .pg-note { text-align: center; }
  .pg-bill-details-grid { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .pg-bill-details-actions { padding: 12px 16px; }
  .pg-table tr.pg-bill-nomatch td { display: block; }
}

/* ---------- 9. Langganan: a storefront per Business (billing.js storefrontHtml) ----------
   An awning in the Business's own tile colour (stripes, a scalloped edge) with its tile, name, plan and pill; then its
   price, the next date and the slots used; the action where one is needed. The whole card opens its Paket; its name is
   the keyboard's control for that, the card's ring showing its focus. Tambah Bisnis is the empty box with a +. */
.pg-subs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.pg-sub-card { position: relative; display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--pg-line); border-radius: 14px; background: #fff; transition: border-color var(--pg-m) ease, box-shadow var(--pg-m) ease; }
.pg-sub-card.pg-is-link { cursor: pointer; }
.pg-sub-card.pg-is-link:hover { border-color: #cfd6e2; box-shadow: 0 8px 22px rgba(23, 32, 51, .08); }
.pg-sub-card:has(.pg-sub-open:focus-visible) { outline: 2px solid var(--pg-blue); outline-offset: 2px; }
.pg-sub-card.pg-is-fresh { animation: pg-bill-fresh-card 1.2s ease-out both; }
.pg-sub-loading { padding: 18px; min-height: 172px; }
.pg-sub-id { position: relative; display: grid; flex: 1 1 auto; gap: 2px; min-width: 0; }
.pg-sub-name { display: block; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-size: 16px; font-weight: 650; line-height: 1.3; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-sub-open { cursor: pointer; }
.pg-sub-open:focus-visible { outline: none; }
.pg-sub-plan { font-size: 12.5px; opacity: .78; }
.pg-band-blue { --band: #dfe9f8; --band-ink: #234d87; }
.pg-band-green { --band: #dcf0e5; --band-ink: #12684a; }
.pg-band-purple { --band: #ebe3f8; --band-ink: #5b3c86; }
.pg-band-amber { --band: #f9ebcd; --band-ink: #7e5110; }
.pg-band-slate { --band: #e7ebf1; --band-ink: #4f5968; }
.pg-band-logo { --band: #f3e2e9; --band-ink: #6f2843; }
.pg-sub-band { position: relative; display: flex; align-items: center; gap: 12px; padding: 16px 16px 18px; border-radius: 13px 13px 0 0; background: var(--band); color: var(--band-ink); }
.pg-sub-band::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .34) 0 18px, transparent 18px 36px); pointer-events: none; }
.pg-sub-band::after { content: ""; position: absolute; top: 100%; right: 0; left: 0; height: 9px; background: radial-gradient(circle at 9px 0, var(--band) 8.5px, transparent 9px) 0 0 / 18px 9px repeat-x; pointer-events: none; }
.pg-sub-band .pg-sub-tile { position: relative; width: 54px; height: 54px; border: 3px solid #fff; border-radius: 15px; box-shadow: 0 3px 10px rgba(23, 32, 51, .12); font-size: 15px; }
.pg-sub-band .pg-chip { position: relative; flex: none; background: rgba(255, 255, 255, .9); }
.pg-sub-body { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 14px 20px; padding: 26px 18px 18px; }
.pg-sub-price { display: inline-flex; align-items: baseline; gap: 2px; white-space: nowrap; }
.pg-sub-price b { color: var(--pg-ink); font-size: 21px; font-weight: 650; letter-spacing: -.015em; }
.pg-sub-price small { color: var(--pg-faint); font-size: 13px; }
/* Let the squares wrap before moving the price or renewal date onto another line. */
.pg-sub-facts { display: flex; flex: 1 1 min-content; justify-content: flex-end; gap: 22px; min-width: 0; max-width: 100%; margin: 0; }
.pg-sub-facts > div { min-width: 0; }
.pg-sub-facts > div:first-child { flex: none; }
.pg-sub-facts dt { color: var(--pg-faint); font-size: 11.5px; font-weight: 600; }
.pg-sub-facts dd { display: flex; align-items: center; gap: 7px; margin: 3px 0 0; color: var(--pg-ink); font-size: 13px; font-weight: 600; white-space: nowrap; }
/* The slot boxes keep their width, up to ten a row as on Koneksi; a row too long for the price's side moves the facts
   under the price. */
.pg-sub-facts .pg-meter { flex: none; }
.pg-sub-facts .pg-meter i { flex: none; width: max-content; max-width: 127px; }
.pg-sub-facts dd > span:last-child { flex-shrink: 0; }
.pg-sub-foot { display: flex; padding: 0 18px 18px; }
.pg-sub-foot .pg-btn { position: relative; flex: 1 1 auto; }
.pg-sub-store.pg-is-unpaid { border-color: #efcbc6; }
.pg-sub-store.pg-is-ended .pg-sub-price b { color: var(--pg-muted); }
/* The empty box with a +: Tambah Bisnis here, as the rail's dashed + tile is. */
.pg-add-box { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 172px; padding: 18px; border: 1.5px dashed #cfd3d9; border-radius: 14px; background: transparent; color: #7c7f7a; font: inherit; font-size: 13.5px; font-weight: 650; cursor: pointer; transition: border-color var(--pg-m) ease, color var(--pg-m) ease, background-color var(--pg-m) ease; }
.pg-add-box:hover { border-color: var(--pg-navy-3); color: var(--pg-navy); background: rgba(255, 255, 255, .6); }
.pg-add-box:focus-visible { outline: 2px solid var(--pg-blue); outline-offset: 2px; }
.pg-add-box-plus { display: grid; place-items: center; width: 44px; height: 44px; border: 1.5px dashed currentColor; border-radius: 12px; opacity: .8; }
.pg-add-box-plus .pg-icon { width: 20px; height: 20px; }
@media (max-width: 720px) {
  .pg-subs { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .pg-sub-band { align-items: flex-start; }
  .pg-sub-band .pg-sub-name { white-space: normal; }
  .pg-sub-facts { flex: 0 1 auto; justify-content: flex-start; }
  .pg-add-box { min-height: 120px; }
}
