/* =========================================================
   Tagihan, Pembayaran & Tiket — redesign member (27 Nov 2026)
   Mockup: .docs/mockup-portal/billing.html, invoice.html, pay.html, tickets.html, ticket-detail.html.
   Semua aturan di bawah .tg supaya tidak bentrok dengan p-*.css bidang lain (dimuat di semua layar).
   ========================================================= */
.tg .page-head > .grow, .tg .callout > .grow { flex: 1 1 260px; }
.tg .tg-block { display: block; }
.tg .tg-kpi-sm { font-size: 20px; margin-top: 3px; }

/* ---------- Tagihan & Pesanan (billing.html) ---------- */
.tg .tg-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.tg .tg-chip { border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-2); height: 32px; padding: 0 12px; border-radius: 16px; font: 600 12.5px var(--font); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.tg .tg-chip:hover { background: var(--surface-3); }
.tg .tg-chip[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.tg .tg-chip .n { font-size: 11px; background: var(--surface-3); border-radius: 9px; padding: 0 6px; }
.tg .tg-chip[aria-pressed="true"] .n { background: var(--surface); }
.tg .tg-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.tg .tg-toolbar .input-group { width: 260px; max-width: 100%; }
.tg .tg-toolbar .select { width: auto; }
.tg .tg-row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.tg .tg-row-actions .menu { min-width: 190px; }
.tg .tg-pager { display: flex; align-items: center; gap: 6px; }
.tg .tg-pager .btn { min-width: 32px; padding: 0 8px; }
.tg .tg-pager .btn[aria-current="page"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.tg tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.tg tr.due td:first-child { box-shadow: inset 3px 0 0 var(--warn-mark); }
.tg .table td .sub { display: block; font-size: 12px; color: var(--ink-3); font-weight: 400; }

/* ---------- Detail tagihan (invoice.html) ---------- */
.tg .tg-status-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; padding: 20px; }
.tg .tg-status-head .amount { font-size: 30px; font-weight: 750; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.tg .tg-status-head .facts { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.tg .tg-status-head .facts b { color: var(--ink); display: block; font-size: 14px; }
.tg .tg-doc { padding: 28px; }
.tg .tg-doc-top { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.tg .tg-doc-title { font-size: 13px; letter-spacing: .14em; font-weight: 700; color: var(--ink-3); text-align: right; }
.tg .tg-parties { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-top: 24px; font-size: 13px; color: var(--ink-2); }
.tg .tg-parties b { color: var(--ink); }
.tg .tg-items { width: 100%; border-collapse: collapse; margin-top: 24px; font-size: 13.5px; }
.tg .tg-items th { text-align: left; font-size: 12px; color: var(--ink-3); font-weight: 600; padding: 8px 0; border-bottom: 1.5px solid var(--border-strong); }
.tg .tg-items td { padding: 12px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.tg .tg-items .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 16px; }
.tg .tg-items .desc { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; white-space: pre-line; }
.tg .tg-totals { margin-left: auto; width: min(340px, 100%); margin-top: 16px; }
.tg .tg-saved { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 8px; background: var(--ok-soft); color: var(--ok); font-size: 13px; font-weight: 600; margin-top: 16px; }
.tg .tg-stamp { display: inline-block; border: 2px solid var(--ok); color: var(--ok); font-weight: 800; letter-spacing: .12em; padding: 4px 12px; border-radius: 6px; transform: rotate(-6deg); font-size: 14px; }

/* ---------- Pembayaran (pay.html) ---------- */
.tg .tg-grp { margin-top: 20px; }
.tg .tg-grp:first-child { margin-top: 0; }
.tg .tg-grp h3 { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.tg .tg-grp h3 .hint { font-weight: 400; margin-left: auto; }
.tg .choice label { min-height: 56px; }
.tg .choice label .nm { font-weight: 600; font-size: 13.5px; display: block; }
.tg .choice label .ds { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 400; }
.tg .choice label .ck { margin-left: auto; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); flex: none; }
.tg .choice label:has(input:checked) .ck { border-color: var(--brand); background: radial-gradient(var(--brand) 0 4px, transparent 5px); }
.tg .tg-logo { width: 44px; height: 28px; border-radius: 6px; display: grid; place-items: center; background: #fff; border: 1px solid var(--border); flex: none; overflow: hidden; }
.tg .tg-logo img { max-width: 38px; max-height: 20px; object-fit: contain; }
.tg .tg-countdown { display: inline-flex; gap: 4px; align-items: center; font-variant-numeric: tabular-nums; }
.tg .tg-countdown span { background: var(--surface-3); border-radius: 6px; padding: 4px 8px; font-weight: 700; font-size: 18px; min-width: 40px; text-align: center; }
.tg .tg-big-code { font-size: 26px; letter-spacing: .08em; }
.tg .tg-wait { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.tg .tg-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.tg .tg-qr { width: 240px; height: 240px; padding: 12px; background: #fff; border: 1px solid var(--border); border-radius: 12px; margin: 0 auto; display: grid; place-items: center; }
.tg .tg-qr img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.tg .tg-hero { text-align: center; padding: 32px 20px; }
.tg .tg-hero .tile { margin: 0 auto 14px; width: 72px; height: 72px; border-radius: 50%; }
.tg .tg-hero .tile .ico { width: 36px; height: 36px; }
.tg .tg-hero .kv { max-width: 440px; margin-left: auto; margin-right: auto; text-align: left; grid-template-columns: 140px 1fr; }
.tg .tg-thumb { width: 48px; height: 48px; border-radius: 8px; background: var(--surface-3); border: 1px solid var(--border); display: grid; place-items: center; color: var(--ink-3); flex: none; }
.tg .tg-pay-foot { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.tg .tg-step-no { width: 28px; height: 28px; font-weight: 700; font-size: 13px; }
.tg .grid.side > * { min-width: 0; }
.tg [data-tg-js] { display: none; }
.tg.tg-js [data-tg-js] { display: revert; }
.tg.tg-js [data-tg-nojs] { display: none; }

/* ---------- Tiket (tickets.html, ticket-detail.html) ---------- */
.tg .tg-prio label { flex-direction: column; align-items: flex-start; gap: 2px; }
.tg .choice.tg-cat label { min-height: 48px; }
.tg .tg-thread { display: flex; flex-direction: column; gap: 18px; padding: 18px 16px; }
.tg .tg-msg { display: flex; gap: 12px; align-items: flex-start; }
.tg .tg-msg .bubble { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.tg .tg-msg.agent .bubble { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 22%, transparent); }
.tg .tg-msg .who { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; font-size: 13px; }
.tg .tg-msg .who .meta { font-size: 12px; color: var(--ink-3); }
.tg .tg-msg .text { white-space: pre-line; overflow-wrap: anywhere; }
.tg .tg-att { display: inline-flex; gap: 8px; align-items: center; margin: 10px 8px 0 0; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 12.5px; color: var(--ink); }
.tg .tg-att:hover { text-decoration: none; border-color: var(--brand); }
.tg .tg-att-img { display: block; margin-top: 10px; max-width: min(100%, 360px); border-radius: 8px; border: 1px solid var(--border); }
.tg .tg-sys { text-align: center; font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 10px; }
.tg .tg-sys::before, .tg .tg-sys::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.tg .tg-sys span { max-width: 80%; }
.tg .tg-reply { border-top: 1px solid var(--border); padding: 14px 16px; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.tg .tg-reply .textarea { min-height: 90px; background: var(--surface); }

@media (max-width: 720px) {
  .tg .tg-toolbar .input-group { width: 100%; }
  .tg .table.stack td.acts { justify-content: flex-end; padding-top: 8px; }
  .tg .table.stack td.acts::before { display: none; }
  .tg .table.stack td:not(.lead) { flex-wrap: wrap; }
  .tg .table.stack td:not(.lead) > span:not(.badge) { display: block; }
  .tg .table.stack td .sub { width: 100%; }
  .tg tr.due td:first-child, .tg tr.overdue td:first-child { box-shadow: none; }
  .tg .table.stack tr.due { box-shadow: inset 3px 0 0 var(--warn-mark); }
  .tg .table.stack tr.overdue { box-shadow: inset 3px 0 0 var(--bad); }
  .tg .tg-doc { padding: 18px; }
  .tg .tg-parties { grid-template-columns: 1fr; gap: 12px; }
  .tg .tg-items thead { display: none; }
  .tg .tg-items tr { display: grid; grid-template-columns: 1fr auto; border-bottom: 1px solid var(--border); padding: 10px 0; }
  .tg .tg-items td { border: 0; padding: 0; }
  .tg .tg-items td.qty, .tg .tg-items td.unit { display: none; }
  .tg .tg-status-head .amount { font-size: 24px; }
}
@media (max-width: 1080px) { .tg .sticky { position: static; } .tg .tg-summary { order: -1; } }
@media (max-width: 640px) {
  .tg .tg-wait { flex-wrap: wrap; } .tg .tg-wait .grow { flex: 1 1 200px; } .tg .tg-wait .btn { width: 100%; }
  .tg .tg-big-code { font-size: 18px; letter-spacing: .04em; }
  .tg .tg-qr { width: 210px; height: 210px; }
  .tg .tg-pay-foot .btn { width: 100%; }
  .tg .tg-msg > .avatar { display: none; }
  .tg .tg-thread { padding: 14px 12px; }
}
/* Cetak detail tagihan: hanya dokumen (shell & kolom kanan disembunyikan). */
@media print {
  body:has(.tg-print) .sidebar, body:has(.tg-print) .topbar, body:has(.tg-print) .tabbar, body:has(.tg-print) .flash { display: none !important; }
  body:has(.tg-print) .main { margin: 0 !important; padding: 0 !important; }
  .tg-print .no-print, .tg-print .tg-status-head .btns, .tg-print .grid.side > :last-child, .tg-print .callout { display: none !important; }
  .tg-print .grid.side { grid-template-columns: 1fr; }
  .tg-print .card { box-shadow: none; border: 0; }
}
.tg.tg-js .tg-upload-hide { display: none; }
