:root {
  --paper: #f8f5ee;
  --ink: #352c38;
  --muted: #756b76;
  --line: #e2dcd3;
  --purple: #6a428d;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
a { color: inherit; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid #9370b1; outline-offset: 4px; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link:focus { position: fixed; left: 15px; top: 15px; z-index: 100; padding: 12px; background: white; }
.page-header { margin: 0 4vw; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.back-link { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.install-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-top: 10px; font-size: 14px; color: var(--purple); text-underline-offset: 3px; }
main { max-width: 1050px; margin: 32px 640px 80px 4vw; }
h1 { font-size: clamp(32px, 3.5vw, 50px); font-weight: 400; letter-spacing: -.055em; line-height: 1.1; margin: 0 0 25px; }
.orientation { max-width: 560px; margin: 0 0 20px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.request { margin-bottom: 28px; }
#ask-bloom { display: block; max-width: 100%; border: 1px solid #d2bfdf; border-radius: 7px; padding: 13px 17px; background: #f0e8f7; color: #623c83; font-size: 14px; line-height: 1.5; text-align: left; }
#ask-bloom:hover { background: #e7daf1; }
#demo-launch-status { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
#demo-launch-status:empty { display: none; }
.workspace { border: 1px solid #d9d1c7; border-radius: 12px; overflow: hidden; background: #fffefa; box-shadow: 0 12px 40px #51433108; scroll-margin: 20px; }
.workspace-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; border-bottom: 1px solid var(--line); background: #fbf9f4; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 600; letter-spacing: -.035em; }
.brand i { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: #5c426b; color: white; font: 20px Georgia, serif; }
.workspace-header > :last-child { font-size: 11px; color: var(--muted); }
.workspace-layout { display: grid; grid-template-columns: 130px minmax(0, 1fr); }
.workspace-nav { display: flex; flex-direction: column; gap: 5px; padding: 16px 9px; border-right: 1px solid var(--line); background: #f8f5ee; }
.workspace-nav button { display: flex; align-items: center; gap: 9px; border: 1px solid transparent; border-radius: 6px; padding: 11px 9px; background: none; text-align: left; font-size: 12px; color: var(--muted); }
.workspace-nav button > span { font-size: 16px; }
.workspace-nav button:hover { background: #eee9e0; }
.workspace-nav button[aria-current] { background: #eee5f6; border-color: #d9cbe5; color: #67448a; }
.workspace-content { min-width: 0; padding: 23px; }
.section-title h2 { font-size: 23px; line-height: 1.1; font-weight: 500; letter-spacing: -.04em; margin: 0 0 22px; }
.recent-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 8px; }
.recent-heading h3 { font-size: 12px; font-weight: 500; margin: 0; }
.recent-heading button, .filters > button { border: 0; background: none; color: var(--purple); font-size: 12px; padding: 9px 0; min-height: 40px; }
.recent-payments > div { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.recent-payments > div:last-child { border-bottom: 0; }
.recent-payments strong { display: block; font-size: 13px; font-weight: 400; }
.recent-payments small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.recent-payments > div > span:last-child { text-align: right; }
.recent-payments .failed { color: #99462e; }
.filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 14px 12px; margin-bottom: 23px; }
.filters > div { min-width: 0; }
.filters label { display: block; margin-bottom: 7px; font-size: 12px; color: var(--muted); }
.filters :is(select, input) { width: 100%; min-height: 42px; max-width: 100%; border: 1px solid #d6cfc5; border-radius: 5px; background: #fffefa; padding: 8px; font-size: 13px; }
.filters input { min-width: 0; }
.filter-error { margin: -8px 0 16px; color: #91432d; font-size: 13px; line-height: 1.5; }
.filters > button { justify-self: start; min-height: 42px; white-space: nowrap; }
.results-summary { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 12px; font-size: 12px; }
.results-summary strong { font-weight: 500; }
.results-summary > span { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; line-height: 1.5; }
.table-wrap { max-height: 300px; overflow: auto; overscroll-behavior: contain; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 6px 5px; border-bottom: 1px solid #eee8df; font-weight: 400; }
thead th { position: sticky; top: 0; background: #fcfaf5; color: var(--muted); font-size: 11px; }
tbody tr:last-child > * { border-bottom: 0; }
th:first-child { padding-left: 0; }
th:last-child, td:last-child { text-align: right; padding-right: 0; }
td:nth-child(2) { color: var(--muted); font-size: 11px; white-space: nowrap; }
.amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.customer-link { min-height: 40px; border: 0; padding: 2px 0; background: none; text-align: left; font-size: inherit; text-decoration: underline; text-decoration-color: #cdb8dc; text-underline-offset: 3px; }
.customer-link:hover, .customer-link[aria-expanded="true"] { color: var(--purple); }
.badge { display: inline-block; border-radius: 4px; padding: 4px 6px; font-size: 11px; }
.badge.failed { background: #f7e9e0; color: #91432d; }
.badge.paid { background: #eaf0e4; color: #53633a; }
.badge.pending { background: #f5edda; color: #786023; }
.badge.refunded { background: #ece9f2; color: #6c5b80; }
#empty-state { display: grid; place-items: center; min-height: 100px; margin: 0; padding: 20px 12px; text-align: center; font-size: 13px; line-height: 1.5; color: var(--muted); }
.payment-detail { margin-top: 16px; padding: 14px 16px; border: 1px solid #dccbe8; border-radius: 7px; background: #f5eef9; }
.payment-detail header { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.payment-detail h3 { margin: 0; font-size: 12px; font-weight: 400; color: #796087; }
.payment-detail button { border: 0; border-radius: 4px; width: 40px; height: 40px; background: none; color: #796087; font-size: 23px; }
.payment-detail p { margin: 7px 0 0; font-size: 15px; color: #563368; }
@media (max-width: 1150px) and (min-width: 761px) {
  main { margin-right: 365px; margin-left: 25px; }
  .workspace-layout { display: block; }
  .workspace-nav { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--line); padding: 7px 12px; }
  .workspace-content { padding: 18px; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
}
/* Keep the live chat beside Payments where a usable workspace still fits. */
@media (min-width: 1000px) and (max-width: 1150px) {
  main { margin-right: 640px; }
  .workspace-content { padding: 16px; }
}
/* Mid-width side panels need room to scroll the results clear. */
@media (min-width: 761px) and (max-width: 999px) {
  html { scroll-padding-bottom: 360px; }
  main { margin-bottom: 380px; }
}
/* Touch tablets use the widget's bottom sheet, so Payments can use the full width. */
@media (min-width: 761px) and (max-width: 960px) and (pointer: coarse) {
  html { scroll-padding-bottom: 0; }
  main { margin-inline: 25px; margin-bottom: 80px; }
}
@media (max-width: 760px) {
  .page-header { margin-inline: 22px; }
  main { margin: 35px 22px 110px; max-width: none; }
  .request { margin-bottom: 23px; }
  .workspace-layout { display: block; }
  .workspace-header { padding: 14px 16px; }
  .workspace-nav { flex-direction: row; gap: 6px; padding: 6px 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .workspace-nav button { min-height: 42px; }
  .workspace-content { padding: 20px 15px; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .filters :is(select, input) { width: 100%; min-height: 44px; font-size: 16px; }
  .filters > button { justify-self: start; margin: 0; min-height: 44px; }
  table { font-size: 12px; }
  th, td { padding: 6px 4px; }
  td:nth-child(2) { font-size: 11px; }
  .badge { font-size: 11px; padding-inline: 5px; }
  #empty-state { padding-inline-end: 64px; }
}
@media (max-width: 360px) {
  main { margin-inline: 15px; }
  .workspace-content { padding-inline: 12px; }
  .filters :is(select, input) { padding-inline: 5px; }
  .filters > div:has(input[type="date"]) { grid-column: 1 / -1; }
  .brand { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Leave room to scroll and focus the last payment or install link above the open sheet. */
html:has(bloom-widget.compact.open) {
  --demo-sheet-gap: 28px;
  --demo-sheet-room: calc(var(--demo-sheet-height, clamp(315px, 50dvh, 575px)) + max(8px, env(safe-area-inset-bottom)) + var(--demo-sheet-gap));
  scroll-padding-bottom: var(--demo-sheet-room);
}
body:has(bloom-widget.compact.open) main { margin-bottom: 0; padding-bottom: var(--demo-sheet-room); }
body:has(bloom-widget.compact.open) .install-link:focus-visible {
  position: sticky;
  bottom: var(--demo-sheet-room);
  background: var(--paper);
}
@media (orientation: landscape) and (max-height: 420px) {
  html:has(bloom-widget.compact.open) { --demo-sheet-gap: 8px; }
  body:has(bloom-widget.compact.open) .install-link { position: sticky; top: 0; margin-inline-start: 72px; }
}
