/* QuotaPlug account pages: loader, billing, cancel flow, receipts, locked extras. Loaded only on app pages. */

/* Branded loader: logo + name, centered, short. */
.hb-loader { display: grid; justify-items: center; gap: 10px; padding: 72px 0; text-align: center; }
.hb-loader-mark svg { animation: hb-bob 1.1s ease-in-out infinite; transform-origin: 50% 90%; }
.hb-loader-word { font: 700 1.5rem var(--font-display); letter-spacing: -0.01em; }
.hb-loader-bar { width: 120px; height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; border: 1.5px solid var(--ink); }
.hb-loader-bar i { display: block; height: 100%; width: 40%; background: var(--orange); border-radius: 6px; animation: hb-slide 1.1s ease-in-out infinite; }
.hb-loader .msg { margin: 0; }
#bill-msg:empty, #plan-msg:empty { min-height: 0; margin: 0; }
@keyframes hb-bob { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-6px) scale(1.04, .96); } }
@keyframes hb-slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }
.mini-load { color: var(--muted); padding: 18px 0; text-align: center; font-size: .92rem; }
.mini-load::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px; border-radius: 50%; border: 2px solid var(--orange); border-right-color: transparent; animation: hb-spin .7s linear infinite; }
@keyframes hb-spin { to { transform: rotate(360deg); } }

/* Post-payment welcome */
.welcome { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; border-color: var(--orange); background: linear-gradient(120deg, rgba(217,119,87,.18), var(--surface) 60%); animation: hb-pop .5s cubic-bezier(.2,.9,.3,1.3) both; }
.welcome h2 { margin: 0 0 4px; font-size: 1.5rem; }
.welcome p { margin: 0; color: var(--muted); }
.welcome-burst svg { animation: hb-bob 1.6s ease-in-out 3; }
@keyframes hb-pop { from { opacity: 0; transform: scale(.96) translateY(8px); } }

/* Billing */
.bill-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 8px; }
.bill-tile { display: grid; gap: 4px; align-content: start; padding: 16px; background: var(--bg-deep); border: 1.5px solid var(--line); border-radius: 14px; transition: border-color .18s, transform .18s; }
.bill-tile:hover { border-color: var(--orange); transform: translateY(-2px); }
.bill-tile b { font-size: 1.08rem; }
.bill-tile small { color: var(--faint); min-height: 1.2em; }
.bill-tile .btn { justify-self: start; margin-top: 8px; }
.bill-k { font: 600 .72rem var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.bill-panel { margin-top: 16px; padding: 18px; border: 1.5px dashed var(--line); border-radius: 14px; animation: hb-pop .25s ease both; }
.bill-panel h3 { margin: 0 0 12px; }
#b-resume { border-style: solid; border-color: #e8b44e; background: rgba(232,180,78,.08); display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
#b-resume p { margin: 0; }
.bill-foot { margin: 14px 0 0; text-align: right; }
.linkish { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkish:hover { color: var(--text); }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); }
.switch-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.switch-opt { display: grid; gap: 2px; text-align: left; padding: 14px; border-radius: 12px; background: var(--surface); color: var(--text); border: 2px solid var(--line); font: inherit; cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; }
.switch-opt:hover:not(:disabled) { border-color: var(--orange); transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.switch-opt.picked { border-color: var(--orange); background: var(--orange-soft); }
.switch-opt.current { opacity: .6; cursor: default; }
.switch-opt b { font: 700 1.1rem var(--font-display); }
.switch-opt small { color: var(--faint); }
.switch-confirm { margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--bg-deep); }
.switch-confirm p { margin: 0; }
.card-mount { min-height: 120px; margin: 12px 0; }
.inv-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.inv-list li { display: grid; grid-template-columns: 1fr auto auto auto; gap: 14px; align-items: center; padding: 10px 14px; background: var(--bg-deep); border: 1.5px solid var(--line); border-radius: 12px; transition: border-color .15s; }
.inv-list li:hover { border-color: var(--muted); }
.inv-amt { font: 600 .95rem var(--font-mono); }
.inv-st { font: 700 .72rem var(--font-body); padding: 2px 8px; border-radius: 999px; background: var(--green); color: var(--ink); }
.inv-st[data-st="open"] { background: #e8b44e; }
.inv-st[data-st="uncollectible"] { background: var(--surface-2); color: var(--muted); }
.quota-full { color: #e8b44e; font-weight: 700; }

/* Locked extras: names visible, content blurred, one upgrade button. */
.locked { position: relative; overflow: hidden; }
.locked-inner { filter: blur(5px); opacity: .55; pointer-events: none; user-select: none; }
.locked-inner .kpi { font-size: 1.25rem; }
.locked-cta { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; text-align: center; padding: 16px; }
.locked-cta b { font: 700 1.2rem var(--font-display); }
.locked-cta b::before { content: ""; display: inline-block; width: 14px; height: 16px; margin-right: 8px; vertical-align: -1px; background: var(--orange); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 16'%3E%3Cpath d='M3 7V5a4 4 0 0 1 8 0v2h1a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h1zm2 0h4V5a2 2 0 0 0-4 0v2z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 16'%3E%3Cpath d='M3 7V5a4 4 0 0 1 8 0v2h1a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h1zm2 0h4V5a2 2 0 0 0-4 0v2z'/%3E%3C/svg%3E") center / contain no-repeat; }

/* Sheets (cancel flow, receipt) */
.sheet { width: min(560px, calc(100vw - 32px)); max-height: calc(100svh - 32px); overflow: auto; padding: 26px; border-radius: 18px; background: var(--surface); color: var(--text); border: 2px solid var(--ink); box-shadow: var(--shadow-lg); }
.sheet::backdrop { background: rgba(20,20,19,.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.sheet[open] { animation: hb-pop .22s ease both; }
.sheet h2 { font-size: 1.45rem; margin: 6px 0 8px; }
.cf-mascot svg { display: block; margin: 0 auto; }
.cf-step > h2, .cf-step > .fine:first-of-type, .cf-step[data-step=offer] > p, .cf-step[data-step=done] > p { text-align: center; }
.cf-step .row-btns { justify-content: center; }
.cf-reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
@media (max-width: 560px) { .cf-reasons { grid-template-columns: 1fr; } }
.cf-reason { font-size: .92rem; display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.cf-reason:hover { border-color: var(--muted); }
.cf-reason:has(input:checked) { border-color: var(--orange); background: var(--orange-soft); }
.cf-reason input { accent-color: var(--orange); }
#cf-help p, .cf-impact { color: var(--muted); }
.cf-impact { padding-left: 20px; display: grid; gap: 6px; }
.cf-offer { font: 700 1.3rem var(--font-display); color: var(--orange-hi); text-align: center; margin: 10px 0; }
.sheet textarea { width: 100%; resize: vertical; margin-top: 6px; }
.rf-reasons { grid-template-columns: 1fr; }
.rf-check { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; font-size: .9rem; color: var(--muted); cursor: pointer; }
.rf-check input { margin-top: 3px; accent-color: var(--orange); }
.rf-count { text-align: right; margin: 4px 0 0; }
.rf-step .row-btns { justify-content: center; }
.rf-step > h2 { text-align: center; }
.bill-foot { display: flex; gap: 18px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
@media (max-width: 760px) { .bill-foot { justify-content: center; } }

/* Receipt */
.receipt-sheet { width: min(640px, calc(100vw - 32px)); }
.receipt { color: var(--text); }
.r-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; border-bottom: 1.5px solid var(--line); padding-bottom: 14px; }
.r-brand { display: flex; gap: 8px; align-items: center; font: 700 1.2rem var(--font-display); }
.r-head h2 { margin: 0; text-align: right; }
.r-head .fine { margin: 4px 0 0; text-align: right; }
.r-lines { width: 100%; margin: 14px 0; border-collapse: collapse; }
.r-lines td { padding: 10px 0; border-bottom: 1px solid var(--line); }
.r-lines td:last-child { text-align: right; font-family: var(--font-mono); white-space: nowrap; padding-left: 16px; }
.r-lines small { display: block; color: var(--faint); }
.r-sum { display: grid; grid-template-columns: 1fr auto; gap: 6px 18px; margin: 0 0 0 auto; max-width: 300px; }
.r-sum dt { color: var(--muted); }
.r-sum dd { margin: 0; text-align: right; font-family: var(--font-mono); }
.r-sum dt:nth-last-child(2), .r-sum dd:last-child { font-weight: 700; color: var(--text); }
.r-foot { margin-top: 18px; }

@media (max-width: 760px) {
  .bill-grid, .switch-list { grid-template-columns: 1fr; }
  .welcome { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .bill-tile { justify-items: center; text-align: center; }
  .bill-tile .btn { justify-self: center; }
  .bill-foot { text-align: center; }
  .row-btns { flex-direction: column; }
  .row-btns .btn { width: 100%; justify-content: center; }
  .inv-list li { grid-template-columns: 1fr auto; }
  .r-head h2, .r-head .fine { text-align: left; }
  .locked .grid.g3 > :not(:first-child) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hb-loader-mark svg, .hb-loader-bar i, .welcome, .welcome-burst svg, .bill-panel, .sheet[open], .mini-load::before { animation: none; }
}

@media print {
  body * { visibility: hidden; }
  .receipt-sheet, .receipt-sheet * { visibility: visible; }
  .receipt-sheet { position: absolute; inset: 0; width: 100%; max-height: none; border: 0; box-shadow: none; background: #fff; color: #141413; padding: 24px; }
  .receipt, .r-sum dt, .r-sum dd, .r-lines small, .receipt .fine { color: #141413 !important; }
  .r-lines td, .r-head { border-color: #ccc; }
  .no-print { display: none !important; }
}
