/* Customer dashboard (/sb/dashboard.js), on the StableBread website system (SECSift DESIGN.md, website layer):
   - a cream hero band with the title, then white sections, content 1000px wide
   - Spectral 600 headings in #000, Karla body in #2D2D2D; softer text is the body color at 80%, never a gray
   - the closed type scale (10 12 14 16 18 20 24 30 36) and spacing scale (4 6 8 10 12 16 24 32 48 64)
   - 5px radii; tables in the directory pattern (warm header band, uppercase labels, zebra rows, warm hover)
   - gold for meaning only: the main button, the current tab's rule, focus rings; hovers turn text gold */
[data-sb-dashboard] {
  --sb-head: #000000; --sb-body: #2D2D2D; --sb-hero: #F8EDD3; --sb-band: #FAF9F8; --warm: #FDF9F1;
  --border: #E3E3E6; --border-strong: #D6D6DA; --accent: #E6BF66; --accent-hover: #DAA520; --link: #2C40D0;
  --positive: #1A7A42; --notable: #916B14;
  display: block; width: 100%; text-align: left; font-family: Karla, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--sb-body); font-size: 16px; line-height: 1.5;
}
[data-sb-dashboard] *, [data-sb-dashboard] *::before, [data-sb-dashboard] *::after { box-sizing: border-box; }
[data-sb-dashboard] p { margin: 0 0 12px; font-size: 16px; line-height: 1.5; color: var(--sb-body); }
[data-sb-dashboard] p:last-child { margin-bottom: 0; }
[data-sb-dashboard] p a, .sbd-more, .sbd-back { color: var(--link); font-weight: 400; text-decoration: none; }
[data-sb-dashboard] p a:hover, .sbd-more:hover, .sbd-back:hover { text-decoration: underline; }

/* Hero band: edge to edge under the site header (dashboard.js sets the width), like the site's page heads. */
.sbd-hero { background: var(--sb-hero); padding: 64px 16px; }
.sbd-hero-in { max-width: 768px; margin: 0 auto; text-align: center; }
.sbd-h1 { margin: 0 0 12px; font-family: Spectral, Georgia, serif; font-size: clamp(30px, 5vw, 36px); font-weight: 600; line-height: 1.2; color: var(--sb-head); text-wrap: balance; }
.sbd-h1:last-child { margin-bottom: 0; }
[data-sb-dashboard] .sbd-sub { max-width: 768px; margin: 0 auto 24px; font-size: 20px; font-weight: 500; }
.sbd-hero-signin .sb-signin { max-width: 440px; margin: 0 auto; }
.sbd-hero-signin .sbsi { margin: 0 auto; }

/* Content. */
.sbd { width: 100%; max-width: 1000px; margin: 0 auto; padding: 32px 0 64px; }

/* Buttons: the site's two (the header's "Research" and the dark outline), at the design system's size. */
.sb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 8px 12px; border: 1px solid transparent; border-radius: 5px; background: none; font: inherit; font-size: 14px; font-weight: 600; line-height: 1.2; text-decoration: none !important; white-space: nowrap; cursor: pointer; transition: background-color 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out; }
.sb-btn-main { background-color: var(--accent); border-color: var(--accent); color: #FFFFFF !important; }
.sb-btn-main:hover { background-color: var(--accent-hover); border-color: var(--accent-hover); }
.sb-btn-outline { background-color: transparent; border-color: var(--sb-body); color: var(--sb-body) !important; }
.sb-btn-outline:hover { border-color: var(--accent-hover); color: var(--accent-hover) !important; }
.sb-btn:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 2px; }
.sb-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.sbd-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Tabs: uppercase labels like the site's column labels; the current one carries a gold rule. */
/* The grey rule is an inset shadow, not a border: the bar scrolls sideways on phones, and a scroller clips
   anything drawn over its own border, which is where the current tab's gold rule sits. */
.sbd-tabs { display: flex; gap: 24px; margin: 0 0 32px; box-shadow: inset 0 -2px 0 var(--border-strong); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.sbd-tabs::-webkit-scrollbar { display: none; }
.sbd-tab { position: relative; display: inline-flex; align-items: baseline; gap: 6px; flex: none; padding: 12px 0 16px; font-size: 14px; font-weight: 600; line-height: 1.2; text-transform: uppercase; letter-spacing: 0; color: var(--sb-body); text-decoration: none !important; white-space: nowrap; transition: color 0.15s ease-out; }
.sbd-tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background-color: transparent; }
.sbd-tab:hover { color: var(--accent-hover); }
.sbd-tab[aria-current="page"] { color: var(--sb-head); }
.sbd-tab[aria-current="page"]::after { background-color: var(--accent-hover); }
.sbd-tab:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 2px; }
.sbd-panel { outline: none; }

/* Sections. */
.sbd-sec + .sbd-sec { margin-top: 48px; }
.sbd-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0 0 12px; }
.sbd-h2 { margin: 0; font-family: Spectral, Georgia, serif; font-size: 24px; font-weight: 600; line-height: 1.2; color: var(--sb-head); }
.sbd-more { font-size: 14px; white-space: nowrap; }
.sbd-soft { opacity: 0.8; }
.sbd-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Tables, the directory pattern. */
.sbd-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sbd-table th { padding: 12px 16px; border-bottom: 2px solid var(--border-strong); background: var(--warm); font-size: 14px; font-weight: 600; line-height: 1.2; letter-spacing: 0; text-transform: uppercase; text-align: left; white-space: nowrap; color: var(--sb-body); }
.sbd-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; line-height: 1.5; vertical-align: middle; color: var(--sb-body); }
.sbd-table tbody tr:nth-child(even) td { background: var(--sb-band); }
.sbd-table tbody tr:hover td { background: var(--warm); }
.sbd-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sbd-table .c-act { width: 1%; text-align: right; white-space: nowrap; }
.sbd-table .c-act .sbd-actions { justify-content: flex-end; flex-wrap: nowrap; }
.sbd-table .c-date, .sbd-table .c-ver, .sbd-table .c-access { white-space: nowrap; }
.sbd-file { display: block; margin-top: 2px; font-size: 12px; opacity: 0.8; overflow-wrap: anywhere; }
.sbd-order-no { color: var(--sb-head) !important; text-decoration: none !important; font-variant-numeric: tabular-nums; transition: color 0.15s ease-out; }
.sbd-order-no:hover { color: var(--accent-hover) !important; }
.sbd-status { white-space: nowrap; font-weight: 600; }
.sbd-status-paid { color: var(--positive); }
.sbd-status-refunded, .sbd-status-partially_refunded { color: var(--notable); }

/* Receipt: a document, so the one boxed thing on the page; it prints on its own. */
.sbd-back { display: inline-block; margin: 0 0 16px; font-size: 14px; }
.sbd-doc { max-width: 768px; padding: 32px; border: 1px solid var(--border); border-radius: 5px; background: #FFFFFF; }
.sbd-doc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin: 0 0 32px; }
.sbd-doc-head img { display: block; width: 150px; height: auto; margin-top: 6px; }
.sbd-doc-title { margin: 0; font-family: Spectral, Georgia, serif; font-size: 30px; font-weight: 600; line-height: 1.2; color: var(--sb-head); text-align: right; }
[data-sb-dashboard] .sbd-doc-ref { margin: 4px 0 0; font-size: 14px; opacity: 0.8; text-align: right; font-variant-numeric: tabular-nums; }
.sbd-doc-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px 24px; margin: 0 0 32px; }
.sbd-doc-info dt { margin: 0 0 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0; opacity: 0.8; }
.sbd-doc-info dd { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.sbd-doc-lines { width: 100%; border-collapse: collapse; font-size: 16px; }
.sbd-doc-lines th { padding: 12px 0; border-bottom: 2px solid var(--border-strong); font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0; text-align: left; color: var(--sb-body); }
.sbd-doc-lines td { padding: 12px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.sbd-doc-lines .num { padding-left: 24px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sbd-doc-lines tfoot td { padding: 6px 0; border-bottom: 0; font-size: 14px; }
.sbd-doc-lines tfoot .sum td { opacity: 0.8; }
.sbd-doc-lines tfoot tr:first-child td { padding-top: 12px; }
.sbd-doc-lines tfoot .total td { padding-top: 12px; border-top: 1px solid var(--sb-body); font-size: 18px; font-weight: 700; color: var(--sb-head); }
[data-sb-dashboard] .sbd-doc-foot { margin: 32px 0 0; font-size: 14px; opacity: 0.8; }
.sbd-doc-actions { margin: 16px 0 0; }

/* Account. */
.sbd-fields { margin: 0 0 24px; border-top: 2px solid var(--border-strong); }
.sbd-field { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.sbd-field:nth-child(even) { background: var(--sb-band); }
.sbd-field dt { font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0; line-height: 1.5; }
.sbd-field dd { margin: 0; overflow-wrap: anywhere; }
.sbd-fields + p { max-width: 768px; margin-bottom: 16px; }

/* Empty states, and the sign-out question in the same block. */
.sbd-empty { padding: 24px 16px; border-top: 2px solid var(--border-strong); border-bottom: 1px solid var(--border); background: var(--sb-band); }
.sbd-empty p { max-width: 768px; margin: 0 0 16px; }

/* Loading outline. */
.sbd-loading { display: flex; flex-direction: column; gap: 32px; }
.sbd-skel { display: block; border-radius: 5px; background: #ECECEE; }
.sbd-skel-tabs { width: 100%; height: 2px; }
.sbd-skel-block { width: 100%; height: 160px; }

@media (max-width: 780px) {
  .sbd-hero { padding: 48px 24px; }
  .sbd { padding: 24px 0 48px; }
  .sbd-tabs { gap: 16px; margin-bottom: 24px; }
  .sbd-sec + .sbd-sec { margin-top: 32px; }
  /* Rows become blocks; the header band stays as a rule. */
  .sbd-table thead { display: none; }
  .sbd-table, .sbd-table tbody { display: block; border-top: 2px solid var(--border-strong); }
  .sbd-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px; border-bottom: 1px solid var(--border); }
  .sbd-table tbody tr:nth-child(even) { background: var(--sb-band); }
  .sbd-table td, .sbd-table tbody tr:nth-child(even) td, .sbd-table tbody tr:hover td { display: block; padding: 0; border: 0; background: none; text-align: left !important; width: auto; }
  .sbd-table .c-name, .sbd-table .c-items { grid-column: 1 / -1; }
  .sbd-table .c-act { grid-column: 1 / -1; margin-top: 8px; }
  .sbd-table .c-act .sbd-actions { justify-content: flex-start; flex-wrap: wrap; }
  .sbd-table .c-ver:empty { display: none; }
  .sbd-table .c-ver:not(:empty)::before { content: "Version "; }
  .sbd-orders .c-no { grid-column: 1; grid-row: 1; } .sbd-orders .c-total { grid-column: 2; grid-row: 1; text-align: right !important; font-weight: 600; }
  .sbd-orders .c-date { grid-column: 1; grid-row: 2; } .sbd-orders .c-status { grid-column: 2; grid-row: 2; text-align: right !important; }
  .sbd-orders .c-items { grid-row: 3; } .sbd-orders .c-act { grid-row: 4; }
  .sbd-doc { padding: 24px 16px; }
  .sbd-doc-head { flex-direction: column-reverse; gap: 16px; }
  .sbd-doc-title, [data-sb-dashboard] .sbd-doc-ref { text-align: left; }
  .sbd-field { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .sb-btn, .sbd-tab, .sbd-more, .sbd-back, .sbd-order-no, [data-sb-dashboard] p a { transition: none; }
}

/* Printing a receipt: only the receipt. */
@media print {
  html.sbd-printing-receipt body * { visibility: hidden !important; }
  html.sbd-printing-receipt .sbd-doc, html.sbd-printing-receipt .sbd-doc * { visibility: visible !important; }
  html.sbd-printing-receipt .sbd-doc { position: absolute; top: 0; left: 0; width: 100%; max-width: none; border: 0; padding: 0; }
}
.sbd-hero.sbd-hero-signin { background: transparent; }
