/* Bhakti House brand layer.
   The single consolidated replacement for the old site's 2,700-line style.css:
   every gold-pill button variant is .btn-brand*, every card recipe is .card-brand*,
   every gradient icon badge is .icon-circle*. Prefer Bootstrap utilities first;
   reach for these classes second; write page-scoped .razor.css only for what is
   genuinely unique to one page. */

/* ================= Base ================= */

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--text-body);
  background: var(--surface-page);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-heading);
}

/* Accessible focus: the old site removed every outline; instead show a gold
   ring only for keyboard focus. */
:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--brand-accent);
  outline-offset: 2px;
}

/* Anchored sections need room under the sticky navbar */
.anchor-offset {
  scroll-margin-top: 120px;
}

/* ================= Typography ================= */

.font-display {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
}

/* Big display title (hero + framed page banners) */
.display-title {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  color: var(--text-heading);
  font-size: 2.2rem;
  line-height: var(--lh-tight);
}

.lead-text {
  font-family: var(--font-body);
  color: var(--text-heading);
  font-size: 1rem;
}

@media (min-width: 768px) {
  .display-title { font-size: 2.8rem; }
  .lead-text { font-size: 1.1rem; }
}

@media (min-width: 992px) {
  .display-title { font-size: 3.5rem; }
  .lead-text { font-size: 1.2rem; }
}

/* Section heading with the signature gold underline bar.
   Centered on mobile, left-aligned from tablet up; add .heading-centered to
   keep it centered at every width. */
.section-heading {
  font-size: 2.5rem;
  font-weight: var(--fw-bold);
  margin-bottom: 1.5rem;
  line-height: var(--lh-tight);
  color: var(--text-heading);
  text-align: center;
  position: relative;
  padding-bottom: 1rem;
}

.section-heading::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 4px;
  background: var(--brand-accent);
  border-radius: 2px;
}

@media (min-width: 768px) {
  .section-heading {
    font-size: 2.8rem;
    text-align: left;
    margin-bottom: 2rem;
  }

  .section-heading::after {
    left: 0;
    transform: translateX(0);
  }

  .section-heading.heading-centered {
    text-align: center;
  }

  .section-heading.heading-centered::after {
    left: 50%;
    transform: translateX(-50%);
  }
}

@media (min-width: 992px) {
  .section-heading {
    font-size: 2.6rem;
    margin-bottom: 2.5rem;
  }

  .section-heading::after {
    width: 120px;
    height: 5px;
  }
}

/* Long-form description copy that sits beside images */
.section-description {
  line-height: var(--lh-body);
  color: var(--ink-600);
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

@media (min-width: 768px) {
  .section-description { font-size: 1.2rem; margin-bottom: 2.5rem; }
}

@media (min-width: 992px) {
  .section-description { font-size: 1.3rem; margin-bottom: 3rem; }
}

/* ================= Page bands ================= */

/* Alternating content bands: default cream, .band-alt off-white, .band-well beige */
.band {
  background: var(--surface-page);
  position: relative;
  border-top: 3px solid var(--line-purple);
  border-bottom: 3px solid var(--line-purple);
  padding: var(--section-pad-y) 0;
}

.band-alt {
  background: var(--surface-page-alt);
}

.band-well {
  background: var(--surface-well);
  border-top: 2px solid var(--line-gold);
  border-bottom: 2px solid var(--line-gold);
}

.band-flush {
  border-top: none;
  border-bottom: none;
}

@media (min-width: 992px) {
  .band { padding: var(--section-pad-y-lg) 0; }
}

/* Bright gold divider bar between major bands */
.section-divider {
  background: var(--brand-accent);
  box-shadow: var(--shadow-divider);
  min-height: 15px;
}

/* Tan page-header band (all inner pages) */
.page-header {
  background: var(--surface-hero);
  padding: 3rem 0 2rem 0;
  text-align: center;
}

.page-header .page-title {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  color: var(--text-heading);
  font-size: 2.5rem;
  line-height: var(--lh-tight);
  margin: 0;
}

@media (min-width: 768px) {
  .page-header { padding: 4rem 0 3rem 0; }
  .page-header .page-title { font-size: 3rem; }
}

@media (min-width: 992px) {
  .page-header { padding: 5rem 0 4rem 0; }
  .page-header .page-title { font-size: 3.5rem; }
}

/* ================= Buttons ================= */

/* Gold gradient pill — the brand's primary action. Inverts to purple on hover. */
.btn-brand {
  display: inline-block;
  background: var(--grad-gold);
  color: var(--brand-primary-strong);
  text-decoration: none;
  border: 2px solid transparent;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-pill);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  transition: var(--transition-base);
}

.btn-brand:hover {
  background: var(--brand-primary-strong);
  color: var(--brand-accent);
  transform: var(--lift-hover);
  box-shadow: var(--shadow-purple);
}

.btn-brand-lg {
  padding: 1rem 2rem;
  font-weight: var(--fw-bold);
  font-size: 1.1rem;
  text-transform: uppercase;
}

.btn-brand-sm {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

/* Purple gradient pill — secondary dark action */
.btn-brand-dark {
  display: inline-block;
  background: var(--grad-purple);
  color: var(--on-dark);
  text-decoration: none;
  border: none;
  padding: 0.8rem 1.8rem;
  border-radius: var(--radius-pill);
  font-weight: var(--fw-semibold);
  transition: var(--transition-base);
  box-shadow: var(--shadow-brand-btn);
}

.btn-brand-dark:hover {
  color: var(--on-dark);
  transform: var(--lift-hover);
  box-shadow: var(--shadow-brand-btn-hover);
}

/* Outline pill — inverse secondary (on light surfaces) */
.btn-brand-outline {
  display: inline-flex;
  align-items: center;
  background: none;
  border: 2px solid var(--brand-accent);
  color: var(--brand-accent);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: var(--fw-semibold);
  text-decoration: none;
  letter-spacing: var(--ls-wide);
  border-radius: var(--radius-sm);
  transition: var(--transition-base);
}

.btn-brand-outline:hover {
  background: var(--brand-accent);
  color: var(--brand-primary-strong);
  transform: translateY(-1px);
}

/* Dark outline pill (CTA secondary) */
.btn-brand-outline-dark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--brand-primary-strong);
  border: 2px solid var(--brand-primary-strong);
  padding: 1rem 2rem;
  border-radius: 50px;
  font-weight: var(--fw-semibold);
  text-decoration: none;
  transition: var(--transition-base);
}

.btn-brand-outline-dark:hover {
  background: var(--brand-primary-strong);
  color: var(--on-dark);
  transform: var(--lift-hover);
}

/* Borderless gold text link that slides and reveals an arrow on hover */
.btn-link-arrow {
  background: none;
  border: none;
  color: var(--brand-accent);
  padding: 0;
  font-size: 1.1rem;
  font-weight: var(--fw-semibold);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  letter-spacing: var(--ls-wide);
  transition: var(--transition-base);
}

.btn-link-arrow::after {
  content: '→';
  margin-left: 0.5rem;
  opacity: 0;
  transform: translateX(-10px);
  transition: var(--transition-base);
}

.btn-link-arrow:hover {
  color: var(--brand-accent-bright);
  transform: translateX(5px);
}

.btn-link-arrow:hover::after {
  opacity: 1;
  transform: translateX(0);
}

@media (min-width: 768px) {
  .btn-link-arrow { font-size: 1.2rem; padding-right: 2.5rem; }
}

/* Gold icon/text utility */
.text-gold {
  color: var(--brand-accent);
}

/* Gold inline text link (used on dark and light surfaces) */
.gold-link {
  color: var(--brand-accent);
  text-decoration: none;
  font-weight: var(--fw-semibold);
  transition: color var(--dur-fast) ease;
}

.gold-link:hover {
  color: var(--brand-accent);
  text-decoration: underline;
}

/* Social-colored pill buttons and icon fills */
.btn-social {
  display: inline-block;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: var(--fw-semibold);
  font-size: 0.9rem;
  transition: var(--transition-base);
  color: white;
}

.btn-social:hover {
  transform: var(--lift-hover);
  box-shadow: var(--shadow-social-hover);
  color: white;
}

.bg-whatsapp { background: var(--social-whatsapp); }
.bg-facebook { background: var(--social-facebook); }
.bg-youtube  { background: var(--social-youtube); }
.bg-instagram {
  background: var(--grad-instagram);
}

/* ================= Cards ================= */

/* The one brand card recipe: warm-white surface, rounded, soft shadow, lift on
   hover. Modifiers change surface/border; Bootstrap utilities handle padding
   beyond the default. */
.card-brand {
  background: var(--surface-card);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--line-neutral);
  transition: var(--transition-base);
  height: 100%;
}

.card-brand:hover {
  transform: var(--lift-card);
  box-shadow: var(--shadow-card-hover);
}

/* Gold top border (service/schedule/preparation recipe) */
.card-brand-topline {
  background: white;
  border: none;
  border-top: 4px solid var(--brand-accent);
  text-align: center;
}

/* Hairline sand border that turns gold on hover (connect/hours recipe) */
.card-brand-outline {
  border: var(--border-card);
  border-radius: var(--radius-2xl);
}

.card-brand-outline:hover {
  border-color: var(--brand-accent);
}

/* Beige gradient well (schedule list recipe) — hover recolors, no lift */
.card-brand-well {
  background: linear-gradient(135deg, var(--cream-200), var(--cream-50));
  border: 2px solid var(--line-neutral);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card-brand-well:hover {
  transform: none;
  border-color: var(--brand-accent);
  box-shadow: var(--shadow-accent-tint);
}

/* Dark purple gradient info card with gold headings */
.card-brand-dark {
  background: var(--grad-purple);
  color: white;
  border: none;
  box-shadow: var(--shadow-purple);
}

.card-brand-dark:hover {
  transform: none;
  box-shadow: var(--shadow-purple);
}

.card-brand-dark .card-brand-title {
  color: var(--brand-accent);
}

.card-brand-dark p,
.card-brand-dark .info-text {
  color: var(--on-dark-muted);
}

/* Framed feature card (getting-started recipe) */
.card-brand-feature {
  background: linear-gradient(135deg, var(--cream-200), var(--cream-100));
  border: 3px solid var(--brand-accent);
  border-radius: var(--radius-3xl);
  padding: 3rem 2rem;
}

.card-brand-feature:hover {
  transform: none;
  box-shadow: var(--shadow-card);
}

/* Shared card internals */
.card-brand-title {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  color: var(--text-heading);
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.card-brand-text {
  color: var(--text-muted);
  line-height: var(--lh-ui);
}

/* ================= Icon circle ================= */

.icon-circle {
  width: 60px;
  height: 60px;
  background: var(--grad-gold);
  border-radius: var(--radius-round);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--brand-primary-strong);
  flex-shrink: 0;
}

.icon-circle-sm {
  width: 50px;
  height: 50px;
  font-size: 1.25rem;
}

.icon-circle-lg {
  width: 80px;
  height: 80px;
  font-size: 2rem;
}

/* ================= Images ================= */

/* Signature "warm frame": thick gold border on the right + bottom only */
.warm-frame {
  width: 100%;
  min-height: 300px;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-xl);
  border-right: 8px solid var(--brand-accent-bright);
  border-bottom: 8px solid var(--brand-accent-bright);
  transition: transform var(--dur-fast) ease;
}

.warm-frame:hover {
  transform: scale(1.02);
}

.warm-frame-gold {
  border-right-color: var(--brand-accent);
  border-bottom-color: var(--brand-accent);
  border-right-width: 10px;
  border-bottom-width: 10px;
}

/* Image well the frame sits in (also the loading background) */
.image-well {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  background-color: var(--surface-well);
  min-height: 300px;
}

@media (min-width: 768px) {
  .image-well, .warm-frame { min-height: 350px; }
}

@media (min-width: 992px) {
  .image-well, .warm-frame { min-height: 400px; }
}

/* Fully framed featured image (6px gold border all round) */
.featured-frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 6px solid var(--brand-accent);
  box-shadow: var(--shadow-card-hover);
  transition: var(--transition-base);
}

.featured-frame:hover {
  transform: var(--lift-card);
  border-color: var(--brand-accent-bright);
}

.featured-frame img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

/* Plain rounded photo with soft shadow (no gold frame) */
.photo-soft {
  width: 100%;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-brand-soft);
  transition: transform var(--dur-fast) ease;
}

.photo-soft:hover {
  transform: scale(1.02);
}

/* ================= Callout ================= */

/* Left gold accent box over a faint gold tint */
.callout {
  background: var(--tint-accent-soft);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--brand-accent);
}

.callout-item {
  display: flex;
  align-items: center;
  color: var(--text-heading);
  font-weight: var(--fw-medium);
}

.callout-item i {
  color: var(--brand-accent);
  width: 24px;
  font-size: 1.1rem;
}

/* ================= Schedule ================= */

.schedule-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line-neutral);
}

.schedule-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.schedule-item .time {
  font-weight: var(--fw-semibold);
  color: var(--brand-primary);
  font-size: var(--text-sm);
  min-width: 120px;
  flex-shrink: 0;
}

.schedule-item .activity {
  color: var(--text-heading);
  font-size: var(--text-sm);
  flex: 1;
  margin-top: 0.25rem;
}

@media (min-width: 768px) {
  .schedule-item {
    flex-direction: row;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .schedule-item .activity {
    margin-left: 1rem;
    margin-top: 0;
  }
}

/* Gold time pill used on centered schedule cards */
.schedule-time-pill {
  background: var(--grad-gold);
  color: var(--brand-primary-strong);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-pill);
  font-weight: var(--fw-semibold);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* ================= Mantra ticker ================= */

.mantra-ticker {
  position: absolute;
  left: 0;
  right: 0;
  font-size: 0.7rem;
  color: var(--brand-accent);
  text-shadow: var(--text-shadow-mantra);
  white-space: nowrap;
  z-index: 0;
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-mantra);
  font-family: var(--font-body);
  width: 200%;
  pointer-events: none;
}

.mantra-ticker-top {
  top: 10px;
  animation: mantra-scroll-left 60s linear infinite;
}

.mantra-ticker-bottom {
  bottom: 10px;
  animation: mantra-scroll-right 60s linear infinite;
}

@keyframes mantra-scroll-right {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes mantra-scroll-left {
  0%   { transform: translateX(-50%); }
  100% { transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .mantra-ticker { animation: none; }
}

/* ================= Data grid =================
   Markup comes from bhio-ui's <DataGrid>. Below the md breakpoint every row folds into its
   own card: the header row goes away, each cell carries its column name in data-label, and
   sorting moves to the select in .data-grid-sortbar because there are no headers left to
   click. .table-stacked at the bottom gives the same fold to a plain table that is too small
   to want a grid around it. */

.data-grid-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.data-grid-search {
  position: relative;
  flex: 1 1 16rem;
  max-width: 24rem;
}

.data-grid-search > i {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.data-grid-search .form-control {
  padding-left: 2.4rem;
}

.data-grid-pagesize {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0 auto;
  color: var(--text-muted);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.data-grid-pagesize .form-select {
  width: auto;
}

.data-grid-scroll {
  overflow-x: auto;
}

.data-grid thead th {
  white-space: nowrap;
  color: var(--text-heading);
  font-weight: var(--fw-semibold);
  font-size: var(--text-sm);
  border-bottom: 2px solid var(--divider);
}

.dg-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.dg-sort:hover {
  color: var(--brand-accent);
}

.dg-sort > i {
  font-size: 0.8em;
}

/* Idle columns keep their arrows, faintly: the affordance is the point. */
.dg-sort .dg-sort-idle {
  opacity: 0.3;
}

.data-grid th.text-end .dg-sort {
  width: 100%;
  justify-content: flex-end;
}

.data-grid th.text-center .dg-sort {
  width: 100%;
  justify-content: center;
}

.data-grid-empty td {
  padding: 1.5rem 0.5rem;
  text-align: center;
}

/* Waiting on the server. The rows you were reading stay put and stay legible — a page that
   blanks itself between pages is harder to use than one that dims for a moment. Pointer events
   go so a second click cannot queue a second query. */
.data-grid-busy .data-grid-scroll {
  opacity: 0.55;
  transition: opacity 120ms ease-in;
}

.data-grid-busy .data-grid-scroll,
.data-grid-busy .data-grid-pager {
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .data-grid-busy .data-grid-scroll {
    transition: none;
  }
}

.data-grid-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.data-grid-count {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.data-grid .page-link {
  color: var(--brand-primary);
  cursor: pointer;
}

.data-grid .page-item.active .page-link {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: var(--on-dark);
}

/* Only useful once the headers are gone, so it is hidden until the cards appear. */
.data-grid-sortbar {
  display: none;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.data-grid-sortbar .form-select {
  flex: 1 1 auto;
  width: auto;
}

/* ---- Touch sizing, for the kiosk ---- */

.data-grid-touch .form-control,
.data-grid-touch .form-select {
  min-height: 3rem;
  font-size: var(--text-base);
}

.data-grid-touch .page-link {
  min-width: 3rem;
  min-height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-base);
}

.data-grid-touch .dg-sort,
.data-grid-touch .data-grid-count {
  font-size: var(--text-base);
}

/* ---- Cards below md ---- */

@media (max-width: 767.98px) {
  .data-grid-sortbar {
    display: flex;
  }

  .data-grid-scroll {
    overflow-x: visible;
  }

  .data-grid table,
  .data-grid tbody,
  .data-grid tfoot,
  .data-grid tr,
  .data-grid td {
    display: block;
    width: 100%;
  }

  .data-grid thead {
    display: none;
  }

  .data-grid tbody tr {
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
    border: var(--border-card);
    border-radius: var(--radius-lg);
    background: var(--surface-card);
    box-shadow: var(--shadow-xs);
  }

  .data-grid tbody td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.3rem 0;
    border: 0;
    text-align: right;
  }

  .data-grid tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    max-width: 45%;
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    text-align: left;
  }

  .data-grid tbody td:not([data-label])::before {
    content: none;
  }

  /* Bootstrap's alignment classes are for columns; in a card the value always sits right. */
  .data-grid tbody td.text-center {
    text-align: right;
  }

  /* The row's own name — a card heading, not a labelled field. */
  .data-grid td.dg-primary {
    display: block;
    margin-bottom: 0.4rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--divider);
    font-family: var(--font-display);
    font-size: var(--text-h4);
    font-weight: var(--fw-semibold);
    color: var(--text-heading);
    text-align: left;
  }

  .data-grid td.dg-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.4rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--divider);
  }

  .data-grid .dg-hide-sm {
    display: none !important;
  }

  .data-grid-empty td {
    border: 0;
    background: none;
  }

  .data-grid tfoot td,
  .data-grid tfoot th {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    border: 0;
    padding: 0.3rem 1rem;
    text-align: right;
  }

  .data-grid tfoot td::before,
  .data-grid tfoot th::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    text-align: left;
  }

  .data-grid-pager,
  .data-grid-toolbar {
    justify-content: center;
  }

  .data-grid-pagesize {
    margin-left: 0;
  }
}

/* ---- .table-stacked: the same fold, for a table too small to want a grid ---- */

@media (max-width: 767.98px) {
  .table-stacked,
  .table-stacked tbody,
  .table-stacked tfoot,
  .table-stacked tr,
  .table-stacked td {
    display: block;
    width: 100%;
  }

  .table-stacked thead {
    display: none;
  }

  .table-stacked tbody tr {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--divider);
  }

  .table-stacked tbody tr:last-child {
    border-bottom: 0;
  }

  .table-stacked tbody td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.2rem 0;
    border: 0;
    text-align: right;
  }

  .table-stacked tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    text-align: left;
  }

  .table-stacked tbody td:not([data-label])::before {
    content: none;
  }

  .table-stacked tbody td.text-center {
    text-align: right;
  }

  .table-stacked td.dg-primary {
    display: block;
    font-weight: var(--fw-semibold);
    color: var(--text-heading);
    text-align: left;
  }

  .table-stacked td.dg-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 0.4rem;
  }

  .table-stacked .dg-hide-sm {
    display: none !important;
  }

  /* A totals row reads as one more labelled line, not as a stray colspan. */
  .table-stacked tfoot td,
  .table-stacked tfoot th {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.4rem 0;
    border: 0;
    text-align: right;
  }

  .table-stacked tfoot td:empty,
  .table-stacked tfoot th:empty {
    display: none;
  }
}

/* ================= Summary cards (DataGrid opt-in) =================
   A grid that names a Summary role, DetailContent or RowHref folds each row into a short card on
   a phone - headline, value, one muted line - and opens the rest on a tap. Everything here is
   keyed off .dg-summary-mode or a dg- class only those grids render, so a grid that has not
   opted in (including the kiosk's) folds exactly as before. */

.dg-summary {
  display: none;
}

.data-grid .dg-toggle-cell {
  width: 1%;
  white-space: nowrap;
  padding-right: 0;
}

.dg-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}

.dg-toggle:hover {
  background: var(--surface-well);
  color: var(--text-heading);
}

.dg-toggle > i,
.dg-summary-chevron {
  transition: transform 0.15s ease;
}

.dg-expanded .dg-toggle > i,
.dg-expanded .dg-summary-chevron {
  transform: rotate(180deg);
}

.dg-row-link {
  color: inherit;
  font-weight: var(--fw-semibold);
  text-decoration: none;
}

.dg-row-link:hover {
  color: var(--brand-accent);
  text-decoration: underline;
}

.data-grid tr.dg-detail-row > td.dg-detail {
  background: var(--surface-well);
  padding: 0.75rem 1rem 1rem;
}

/* A desktop keeps the row's actions in their own column. */
.dg-detail-actions {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .dg-toggle > i,
  .dg-summary-chevron {
    transition: none;
  }
}

@media (min-width: 768px) {
  .data-grid tr.dg-detail-row-phone {
    display: none;
  }
}

@media (max-width: 767.98px) {
  /* Every cell is hidden until the card is opened; the summary cell stands in for them. */
  .data-grid.dg-summary-mode tbody td {
    display: none;
  }

  .data-grid.dg-summary-mode tbody tr.data-grid-empty td {
    display: block;
  }

  .data-grid.dg-summary-mode tbody td.dg-summary {
    display: block;
    position: relative;
    padding: 0;
    text-align: left;
  }

  .data-grid.dg-summary-mode tbody tr.dg-expanded td.dg-summary {
    margin-bottom: 0.4rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--divider);
  }

  .data-grid.dg-summary-mode tbody tr.dg-expanded td.dg-detail-cell {
    display: flex;
  }

  /* The opened part of a card is its own table row, drawn as the bottom half of the same card. */
  .data-grid.dg-summary-mode tbody tr.dg-has-detail {
    margin-bottom: 0;
    padding-bottom: 0.25rem;
    border-bottom: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .data-grid.dg-summary-mode tbody tr.dg-detail-row {
    padding-top: 0;
    border-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }

  .data-grid.dg-summary-mode tbody tr.dg-detail-row > td.dg-detail {
    display: block;
    padding: 0.5rem 0 0;
    background: none;
    text-align: left;
  }

  .dg-detail-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--divider);
  }

  .dg-detail-content + .dg-detail-actions {
    margin-top: 1rem;
  }
}

.dg-summary-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.dg-summary-title {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-heading);
  font-weight: var(--fw-semibold);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.dg-summary-value {
  flex: 0 0 auto;
  color: var(--text-heading);
  font-weight: var(--fw-semibold);
  text-align: right;
  white-space: nowrap;
}

.dg-summary-chevron {
  flex: 0 0 auto;
  align-self: center;
  color: var(--text-muted);
  font-size: 0.8em;
}

.dg-summary-meta {
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.dg-meta-item + .dg-meta-item::before {
  content: "\00B7";
  margin: 0 0.4rem;
}

/* The whole summary is one hit target, reaching out over the card's padding. Links and buttons
   inside the summary sit above it so they stay usable. */
.dg-summary-hit {
  position: absolute;
  top: -0.85rem;
  right: -1rem;
  bottom: 0;
  left: -1rem;
  z-index: 1;
  display: block;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: transparent;
  cursor: pointer;
}

.dg-summary-hit:active {
  background: var(--tint-accent-soft);
}

.dg-summary-hit:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: -2px;
}

.dg-summary a:not(.dg-summary-hit),
.dg-summary button:not(.dg-summary-hit) {
  position: relative;
  z-index: 2;
}

/* ---- Inside an opened row: labelled facts and the lines of a transaction ---- */

.detail-list {
  display: grid;
  grid-template-columns: minmax(6rem, max-content) 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
  font-size: var(--text-sm);
}

.detail-list dt {
  color: var(--text-muted);
  font-weight: var(--fw-semibold);
}

.detail-list dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.line-items {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
}

.line-items li {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--divider);
}

.line-items li:last-child {
  border-bottom: 0;
}

.line-items .line-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.line-items .line-qty {
  flex: 0 0 auto;
  font-weight: var(--fw-semibold);
  color: var(--text-heading);
}

.line-items .line-note {
  display: block;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.line-items .line-amount {
  flex: 0 0 auto;
  font-weight: var(--fw-semibold);
  text-align: right;
  white-space: nowrap;
}

/* ================= Sheet ================= */

body:has(.sheet) {
  overflow: hidden;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1041;
  background: rgba(0, 0, 0, 0.45);
}

.sheet {
  position: fixed;
  z-index: 1042;
  display: flex;
  flex-direction: column;
  background: var(--surface-card);
  color: var(--text-body);
  box-shadow: var(--shadow-xl);
  outline: none;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--divider);
}

.sheet-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: var(--fw-semibold);
}

.sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.25rem;
}

.sheet-footer,
.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--divider);
  background: var(--surface-card);
}

/* Inside a form in the body: stays pinned to the bottom of the sheet while the fields scroll. */
.sheet-actions {
  position: sticky;
  bottom: -1.25rem;
  margin: 1.25rem -1.25rem -1.25rem;
}

@media (max-width: 767.98px) {
  .sheet {
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* The grab handle: says "this slid up, and it will slide away". */
  .sheet::before {
    content: "";
    display: block;
    width: 2.5rem;
    height: 4px;
    margin: 0.5rem auto 0;
    border-radius: 2px;
    background: var(--divider);
  }

  .sheet-actions .btn,
  .sheet-footer .btn {
    flex: 1 1 auto;
  }
}

@media (min-width: 768px) {
  .sheet {
    top: 0;
    right: 0;
    bottom: 0;
    width: min(32rem, 100vw);
    border-left: 1px solid var(--divider);
  }
}

/* ================= Loading, filters, view tabs ================= */

.loading-state {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.5rem 0;
  color: var(--text-muted);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* A chip is a button in FilterChips, or a link where the page is static SSR and each filter is
   its own address (the notification inbox). The two look the same. */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--line-neutral);
  border-radius: 999px;
  background: var(--surface-card);
  color: var(--text-body);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.filter-chip:hover {
  border-color: var(--brand-accent);
  color: var(--brand-accent);
}

.filter-chip.active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: var(--on-dark);
}

.filter-chip-count,
.view-tab-count {
  font-size: var(--text-xs);
  opacity: 0.75;
}

.view-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: var(--radius-lg);
  background: var(--surface-well);
}

.view-tab {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  cursor: pointer;
}

.view-tab:hover {
  color: var(--text-heading);
}

.view-tab.active {
  background: var(--surface-card);
  color: var(--brand-accent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* ================= Page toolbar extras ================= */

.page-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  margin-bottom: 0.25rem;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  text-decoration: none;
}

.page-back:hover {
  color: var(--brand-accent);
}

.page-toolbar-text {
  min-width: 0;
  flex: 1 1 20rem;
}

.page-help {
  margin-top: 0.5rem;
  font-size: var(--text-sm);
}

.page-help > summary {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--text-link);
  font-weight: var(--fw-medium);
  cursor: pointer;
}

.page-help-body {
  max-width: 44rem;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--border-accent);
  border-radius: var(--radius-md);
  background: var(--surface-well);
  color: var(--text-body);
}

.page-help-body p:last-child,
.page-help-body ul:last-child {
  margin-bottom: 0;
}

/* ================= Floating status ================= */

.status-floating {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  z-index: 1035;
  width: min(36rem, calc(100vw - 2rem));
  transform: translateX(-50%);
  pointer-events: none;
}

.status-floating .alert {
  margin: 0;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
}
