/**
 * Petra design system – shared tokens and components for operations and public site.
 * Use with Bootstrap 5.3.3. Material Icons for icons (no Font Awesome).
 */

/* ---------------------------------------------------------------------------/
 * Variables
 * ---------------------------------------------------------------------------/
 */
:root {
  /* Primary palette (operations nav + navigator) */
  --petra-primary: #1a365d;
  --petra-primary-dark: #0f2942;
  --petra-primary-light: #2d4a6b;
  --petra-gradient-dark: #0d2438;
  /* Legacy aliases for nav */
  --nav-primary-color: var(--petra-primary);
  --nav-primary-dark: var(--petra-primary-dark);
  --nav-primary-light: var(--petra-primary-light);
  --nav-gradient-dark: var(--petra-gradient-dark);
  /* Accent (navigator CTA, highlights) */
  --petra-accent: #f2a900;
  /* #967100 — WCAG AA on white for icons and gold text (4.5:1+) */
  --petra-accent-dark: #967100;
  --yellow: var(--petra-accent);
  --yellow-dark: var(--petra-accent-dark);
  /* Public site aliases */
  --primary-color: var(--petra-primary);
  --primary-dark: var(--petra-primary-dark);
  --primary-light: #e8eef5;
  --accent-color: var(--petra-primary);
  --bg-light: var(--petra-bg);
  --text-dark: var(--petra-text);
  /* Body copy on white — meets WCAG 2.1 AA 4.5:1 (not Bootstrap .text-muted) */
  --text-light: var(--petra-text-muted);
  /* Surfaces & text */
  --petra-text: #0f2744;
  --petra-text-muted: #2d4a6f;
  --petra-bg: #f6f8fb;
  --petra-bg-page: linear-gradient(135deg, #f5f7fa 0%, #e8eef5 100%);
  --petra-border: #c5d0de;
  --petra-surface: #ffffff;
  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  /* Radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(15, 39, 68, 0.06);
  --shadow-md: 0 4px 15px rgba(15, 39, 68, 0.1);
  --shadow-lg: 0 8px 32px rgba(15, 39, 68, 0.1);
  --shadow-focus: 0 0 0 4px rgba(26, 54, 93, 0.2);
}

/* ---------------------------------------------------------------------------/
 * Typography & body
 * ---------------------------------------------------------------------------/
 */
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--petra-text);
  background: var(--petra-bg);
  -webkit-font-smoothing: antialiased;
}

body.operations-body {
  background: var(--petra-bg-page);
  min-height: 100vh;
}

h1, .h1 { font-size: 2rem; font-weight: 700; }
h2, .h2 { font-size: 1.5rem; font-weight: 600; }
h3, .h3 { font-size: 1.25rem; font-weight: 600; }

/* ---------------------------------------------------------------------------/
 * Page chrome (operations list/detail pages)
 * ---------------------------------------------------------------------------/
 */
.page-container {
  background: var(--petra-bg-page);
  min-height: calc(100vh - 7.5dvh);
  padding: var(--space-6) 0;
}

@media (max-width: 991.98px) {
  .page-container {
    min-height: calc(100vh - 56px);
  }
}

.page-header {
  background: linear-gradient(135deg, var(--petra-primary) 0%, var(--petra-gradient-dark) 100%);
  color: white;
  border-radius: var(--radius-md);
  padding: var(--space-8);
  margin-bottom: var(--space-8);
  box-shadow: var(--shadow-lg);
}

.page-header-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.page-header-subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
  margin: var(--space-2) 0 0 0;
}

/* ---------------------------------------------------------------------------/
 * Responsive: page chrome + shared utilities (Bootstrap-aligned)
 * sm ≤575.98px, md ≤767.98px, lg ≤991.98px
 * ---------------------------------------------------------------------------/
 */

/* Action clusters in page headers (wraps on narrow viewports, consistent gaps) */
.petra-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  justify-content: flex-end;
}

.petra-action-group .btn-secondary-modern,
.petra-action-group .btn-primary-modern,
.petra-action-group .btn:not(.btn-icon-only) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.petra-action-group .btn-icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-left: var(--space-3);
  padding-right: var(--space-3);
}

.petra-action-group .btn-icon-only .material-icons {
  margin: 0;
}

@media (max-width: 991.98px) {
  .petra-action-group {
    justify-content: flex-start;
  }
}

@media (max-width: 575.98px) {
  .petra-action-group .btn,
  .petra-action-group a.btn {
    flex: 1 1 calc(50% - var(--space-2));
    min-width: 0;
    justify-content: center;
    text-align: center;
  }

  .petra-action-group .btn-icon-only,
  .petra-action-group a.btn-icon-only {
    flex: 0 0 auto;
    min-width: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Card-style stacked rows for grid lists on phones (wrap header + scroll box with this class) */
.petra-stack-sm-accounts > .accounts-table-header,
.petra-stack-sm-cemeteries > .cemeteries-table-header {
  margin-bottom: 0;
}

@media (max-width: 575.98px) {
  .petra-stack-sm-accounts > .accounts-table-header,
  .petra-stack-sm-cemeteries > .cemeteries-table-header {
    display: none;
  }

  .petra-stack-sm-accounts .accounts-table-row,
  .petra-stack-sm-cemeteries .cemeteries-table-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-2);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    align-items: start;
    border: 1px solid var(--petra-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    background: var(--petra-surface);
    transform: none;
  }

  .petra-stack-sm-accounts .accounts-table-row:hover,
  .petra-stack-sm-cemeteries .cemeteries-table-row:hover {
    transform: none;
    box-shadow: var(--shadow-md);
    background: var(--petra-surface);
  }

  .petra-stack-sm-accounts .accounts-table-row > div,
  .petra-stack-sm-cemeteries .cemeteries-table-row > div {
    display: grid;
    grid-template-columns: minmax(0, 104px) 1fr;
    gap: var(--space-2);
    align-items: start;
    padding-bottom: var(--space-2);
    margin: 0;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.9rem;
    line-height: 1.35;
    word-break: break-word;
  }

  .petra-stack-sm-accounts .accounts-table-row > div:last-child,
  .petra-stack-sm-cemeteries .cemeteries-table-row > div:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .petra-stack-sm-accounts .accounts-table-row > div::before,
  .petra-stack-sm-cemeteries .cemeteries-table-row > div::before {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--petra-text-muted);
    line-height: 1.25;
    word-break: break-word;
  }

  .petra-stack-sm-accounts .accounts-table-row > div:nth-child(1)::before {
    content: "Company";
  }

  .petra-stack-sm-accounts .accounts-table-row > div:nth-child(2)::before {
    content: "Email";
  }

  .petra-stack-sm-accounts .accounts-table-row > div:nth-child(3)::before {
    content: "Phone";
  }

  .petra-stack-sm-accounts .accounts-table-row > div:nth-child(4)::before {
    content: "Informant";
  }

  .petra-stack-sm-accounts .accounts-table-row > div:nth-child(5)::before {
    content: "QBO ID";
  }

  .petra-stack-sm-cemeteries .cemeteries-table-row > div:nth-child(1)::before {
    content: "Cemetery";
  }

  .petra-stack-sm-cemeteries .cemeteries-table-row > div:nth-child(2)::before {
    content: "Address";
  }

  .petra-stack-sm-cemeteries .cemeteries-table-row > div:nth-child(3)::before {
    content: "Phone";
  }

  .petra-stack-sm-cemeteries .cemeteries-table-row > div:nth-child(4)::before {
    content: "Sexton";
  }
}

@media (max-width: 767.98px) {
  .page-container {
    padding: var(--space-5) 0;
  }

  .page-header {
    padding: var(--space-5);
    margin-bottom: var(--space-5);
  }

  .page-header-title {
    font-size: 1.375rem;
    line-height: 1.25;
  }

  .page-header-subtitle {
    font-size: 1rem;
  }

  .card-modern {
    padding: var(--space-5);
    margin-bottom: var(--space-4);
  }

  .search-section {
    padding: var(--space-5);
    margin-bottom: var(--space-5);
  }

  .info-card {
    padding: var(--space-4);
    margin-bottom: var(--space-3);
  }

  .summary-value {
    font-size: 1.15rem;
  }

  .order-detail-wrap {
    padding: var(--space-4);
  }

  .form-section-title {
    margin-top: var(--space-5);
    margin-bottom: var(--space-2);
    font-size: 1rem;
  }

  .modal-header {
    padding: var(--space-4);
  }

  .modal-body,
  .modal-footer {
    padding: var(--space-4);
  }

  #desktopNav.operations-nav .navbar-brand img {
    max-height: 28px;
  }

  /* Stage board toolbar: filters full width on tablets */
  .stage-filter-input {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .scroll-controls {
    bottom: var(--space-4);
    right: var(--space-4);
    z-index: 1020;
  }

  .stage-container {
    padding: var(--space-5);
    margin-top: var(--space-5);
  }

  /* Select2 dropdowns shouldn’t spill past viewport */
  .select2-container {
    max-width: 100%;
    min-width: 0 !important;
  }
}

@media (max-width: 575.98px) {
  .page-container {
    padding: var(--space-3) 0;
  }

  .page-header {
    padding: var(--space-4);
    margin-bottom: var(--space-4);
  }

  .page-header-title {
    font-size: 1.2rem;
  }

  .card-modern {
    padding: var(--space-4);
  }

  .search-section {
    padding: var(--space-4);
    margin-bottom: var(--space-4);
  }

  .petra-page-header-actions .btn.btn-primary-modern,
  .petra-page-header-actions .btn.btn-primary,
  .petra-page-header-actions .add-button {
    width: 100%;
    justify-content: center;
  }

  #desktopNav.operations-nav .navbar-toggler {
    min-width: 48px;
    min-height: 48px;
  }

  #desktopNav.operations-nav .nav-link {
    min-height: 44px;
    padding-top: var(--space-3) !important;
    padding-bottom: var(--space-3) !important;
  }

  .stage-container {
    padding: var(--space-4);
    margin-top: var(--space-4);
  }
}

@media (max-width: 991.98px) {
  .modal-dialog.modal-lg,
  .modal-dialog.modal-xl {
    margin: var(--space-3);
    max-width: calc(100vw - 2rem);
  }
}

.modal-dialog.search-results-modal-wide {
  max-width: min(1480px, min(98vw - 2rem, 100vw - 2rem));
}

.monuments-search-results-scroll,
.vaults-search-results-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.monuments-search-results-table thead th,
.vaults-search-results-table thead th {
  font-weight: 600;
  font-size: 0.8125rem;
}

.monuments-search-results-table th:nth-child(1),
.monuments-search-results-table td:nth-child(1),
.monuments-search-results-table th:nth-child(2),
.monuments-search-results-table td:nth-child(2),
.vaults-search-results-table th:nth-child(1),
.vaults-search-results-table td:nth-child(1),
.vaults-search-results-table th:nth-child(2),
.vaults-search-results-table td:nth-child(2) {
  white-space: nowrap;
}

.search-results-modal-row-clickable {
  cursor: pointer;
}
/* ---------------------------------------------------------------------------/
 * Cards
 * ---------------------------------------------------------------------------/
 */
.card-modern {
  background: var(--petra-surface);
  border-radius: var(--radius-md);
  padding: var(--space-8);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--petra-border);
}

.card-modern.card-modern-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

.card-modern.card-modern-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--petra-primary);
}

.quick-link-card {
  background: var(--petra-surface);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--petra-border);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

.quick-link-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--petra-primary);
}

.quick-link-icon {
  font-size: 2rem;
  color: var(--petra-primary);
  margin-bottom: var(--space-2);
}

.quick-link-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--petra-text-muted);
  margin-bottom: var(--space-1);
}

.quick-link-description {
  font-size: 0.9rem;
  color: var(--petra-text-muted);
  opacity: 0.9;
}

/* ---------------------------------------------------------------------------/
 * Data tables
 * ---------------------------------------------------------------------------/
 */
.table-modern-box {
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--petra-border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  background: var(--petra-surface);
}

.table-modern-box::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.table-modern-box::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: var(--radius-sm);
}

.table-modern-box::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: var(--radius-sm);
}

.table-modern-box::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.table-modern-header {
  background: linear-gradient(135deg, var(--petra-primary) 0%, var(--petra-gradient-dark) 100%);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  margin: 0;
  padding: var(--space-4);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.table-modern-row {
  border-bottom: 1px solid #e9ecef;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  padding: var(--space-3);
  margin: 0;
  align-items: center;
  min-height: 50px;
  background: var(--petra-surface);
  color: var(--petra-text);
}

.table-modern-row:hover {
  background: #f8f9fa;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  color: var(--petra-text);
}

.table-modern-cell {
  padding: var(--space-2);
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.table-modern-cell a {
  color: var(--petra-primary);
  text-decoration: none;
  font-weight: 500;
}

.table-modern-cell a:hover {
  text-decoration: underline;
}

/* Row-based tables (Bootstrap row + col) */
.row.table-modern-header {
  background: linear-gradient(135deg, var(--petra-primary) 0%, var(--petra-gradient-dark) 100%);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
  padding: var(--space-4);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

@media (min-width: 992px) {
  .row.table-modern-header .table-modern-cell {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
  }
}

.row.table-modern-row {
  border-bottom: 1px solid #e9ecef;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  padding: var(--space-3);
  margin: 0;
  align-items: center;
  min-height: 50px;
  background: var(--petra-surface);
  color: var(--petra-text);
}

.row.table-modern-row:hover {
  background: #f8f9fa;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  color: var(--petra-text);
}

.row.table-modern-row[tabindex="0"]:focus-visible {
  outline: 2px solid var(--petra-primary);
  outline-offset: 2px;
}

/* Accounts-style grid table */
.accounts-table-header,
.accounts-table-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: var(--space-4) var(--space-2);
  align-items: center;
}

.accounts-table-header {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 1px solid var(--petra-border);
  font-weight: 600;
  color: var(--petra-text-muted);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.accounts-table-row {
  background: var(--petra-surface);
  border-bottom: 1px solid #e9ecef;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.accounts-table-row:hover {
  background: #f8f9fa;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  color: var(--petra-text);
}

/* Cemeteries list (formerly inline in cemeteries.html) */
.cemeteries-table-header,
.cemeteries-table-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: var(--space-4) var(--space-2);
  align-items: center;
}

.cemeteries-table-header {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 1px solid var(--petra-border);
  font-weight: 600;
  color: var(--petra-text-muted);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.cemeteries-table-row {
  background: var(--petra-surface);
  border-bottom: 1px solid #e9ecef;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.cemeteries-table-row:hover {
  background: #f8f9fa;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  color: var(--petra-text);
}

@media (max-width: 991.98px) {
  .accounts-table-header,
  .accounts-table-row {
    font-size: 0.85rem;
  }

  .cemeteries-table-header,
  .cemeteries-table-row {
    font-size: 0.85rem;
    grid-template-columns: minmax(100px, 1fr) minmax(140px, 1.2fr) minmax(96px, 0.85fr) minmax(96px, 0.85fr);
  }
}

/* Line item & payment rows (checkout, payments) */
.line-item-row,
.payment-line {
  border-bottom: 1px dotted #333;
  border-top: 1px dotted #333;
  text-align: center;
  cursor: pointer;
  margin: 0;
  background-color: var(--petra-surface);
  color: #212529;
  font-weight: 500;
}

.line-item-row:hover,
.payment-line:hover {
  background-color: rgba(255, 196, 0, 0.75);
  color: #000;
  font-weight: 600;
}

/* Bootstrap row columns default to min-width:auto; allow long IDs / hashes to wrap */
.line-item-row > [class*="col"],
.line-item-header > [class*="col"] {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.payment-line {
  border-top: none;
}

.line-item-header {
  background-color: rgba(240, 240, 240, 0.9);
  border-bottom: solid 1px #333;
  font-weight: 700;
  margin: 0;
  text-align: center;
}

/* ---------------------------------------------------------------------------/
 * Buttons
 * ---------------------------------------------------------------------------/
 */
.btn-primary-modern,
.btn-secondary-modern {
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-5);
  font-weight: 600;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary-modern {
  background: var(--petra-primary);
  border: 1px solid var(--petra-primary);
  color: white;
}

.btn-primary-modern:hover {
  background: var(--petra-primary-dark);
  border-color: var(--petra-primary-dark);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary-modern {
  background: var(--petra-surface);
  border: 1px solid var(--petra-border);
  color: var(--petra-text);
}

.btn-secondary-modern:hover {
  background: #f8f9fa;
  border-color: var(--petra-primary);
  color: var(--petra-text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.add-button {
  background: var(--petra-surface);
  border: 1px solid var(--petra-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-5);
  color: var(--petra-text);
  font-weight: 600;
  line-height: 1.5;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  vertical-align: middle;
  box-sizing: border-box;
}

.add-button .add-button-icon,
.add-button .material-icons {
  font-size: 1.25rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.add-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  background: #f8f9fa;
  color: var(--petra-text);
  border-color: var(--petra-primary);
}

.add-btn {
  background: var(--petra-primary);
  border: none;
  border-radius: var(--radius-md);
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-md);
  color: white;
}

.add-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
  color: white;
  background: var(--petra-primary-dark);
}

/* ---------------------------------------------------------------------------/
 * Forms
 * ---------------------------------------------------------------------------/
 */
.form-control:focus,
.form-select:focus {
  border-color: var(--petra-primary);
  box-shadow: 0 0 0 4px rgba(26, 54, 93, 0.15);
  outline: none;
}

.form-control,
.form-select {
  border-radius: var(--radius-md);
  border: 1px solid var(--petra-border);
}

/* ---------------------------------------------------------------------------/
 * Modals
 * ---------------------------------------------------------------------------/
 */
.modal-content {
  border-radius: var(--radius-lg);
  border: 1px solid var(--petra-border);
  box-shadow: var(--shadow-lg);
}

.modal-header {
  border-bottom: 1px solid #e9ecef;
  padding: var(--space-5);
}

.modal-title {
  font-weight: 600;
  color: var(--petra-text);
}

.modal-body {
  padding: var(--space-5);
}

.modal-footer {
  border-top: 1px solid #e9ecef;
  padding: var(--space-5);
}

/* ---------------------------------------------------------------------------/
 * Operations nav (desktop + mobile) – sleek, light, single-strip
 * ---------------------------------------------------------------------------/
 */
#desktopNav.operations-nav.navbar {
  background: var(--petra-surface);
  min-height: 64px;
  padding: 0 var(--space-6);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
  display: flex;
  align-items: center;
}

#desktopNav.operations-nav .container-fluid {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#desktopNav.operations-nav .navbar-brand {
  margin-right: var(--space-8);
  padding: 0;
  display: flex;
  align-items: center;
}

#desktopNav.operations-nav .navbar-brand img {
  height: 32px;
  width: auto;
  transition: transform 0.2s ease;
}

#desktopNav.operations-nav .navbar-brand:hover img {
  transform: scale(1.02);
}

#desktopNav.operations-nav .navbar-nav {
  gap: var(--space-1);
}

#desktopNav.operations-nav .nav-link {
  color: var(--petra-text);
  font-weight: 500;
  font-size: 0.9rem;
  padding: var(--space-2) var(--space-4) !important;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

#desktopNav.operations-nav .nav-link:hover,
#desktopNav.operations-nav .nav-item.show .nav-link {
  color: var(--petra-primary);
  background-color: rgba(26, 54, 93, 0.05);
}

#desktopNav.operations-nav .dropdown-toggle::after {
  border-top-color: currentColor;
  opacity: 0.5;
  transition: transform 0.2s ease;
}

#desktopNav.operations-nav .nav-item.show .dropdown-toggle::after {
  transform: rotate(180deg);
}

#desktopNav.operations-nav .dropdown-menu {
  border: 1px solid var(--petra-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
  margin-top: var(--space-2);
  background: var(--petra-surface);
  min-width: 200px;
  animation: navDropdownFade 0.2s ease;
}

@keyframes navDropdownFade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

#desktopNav.operations-nav .dropdown-item {
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-4);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--petra-text);
  transition: all 0.15s ease;
}

#desktopNav.operations-nav .dropdown-item:hover {
  background-color: rgba(26, 54, 93, 0.05);
  color: var(--petra-primary);
  padding-left: var(--space-5);
}

/* My Account specific styling */
#desktopNav.operations-nav .nav-account {
  margin-left: var(--space-4);
  padding-left: var(--space-4);
  border-left: 1px solid var(--petra-border);
}

/* Mobile adjustments */
@media (max-width: 991.98px) {
  #desktopNav.operations-nav.navbar {
    padding: 0 var(--space-4);
  }
  
  #desktopNav.operations-nav .navbar-collapse {
    background: var(--petra-surface);
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: var(--space-4);
    border-bottom: 1px solid var(--petra-border);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
  }
  
  #desktopNav.operations-nav .navbar-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
  }
  
  #desktopNav.operations-nav .nav-account {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    border-top: 1px solid var(--petra-border);
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    width: 100%;
  }
}

/* Toggle (used in forms) */
.toggle-checkbox {
  display: none;
}

.toggle-label {
  display: block;
  width: 60px;
  height: 34px;
  position: relative;
  cursor: pointer;
  background-color: #ccc;
  border-radius: 34px;
  transition: background-color 0.2s;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: white;
  transition: left 0.2s;
  border: 1px solid #999;
}

.toggle-checkbox:checked + .toggle-label {
  background-color: #2196f3;
}

.toggle-checkbox:checked + .toggle-label .toggle-slider {
  left: 26px;
}

/* Order contact cards — compact relationship + SMS (avoid full-width badge bars) */
.contact-card .contact-card-relationship {
  font-size: 0.8125rem;
  color: var(--petra-text-muted);
  margin-top: 0.125rem;
}
.contact-card .contact-card-sms-chip {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  line-height: 1.25;
  margin-top: 0.5rem;
  border: 1px solid rgba(25, 135, 84, 0.4);
  border-radius: var(--radius-sm);
  background: var(--petra-surface);
  color: #146c43;
}

.magnify:hover {
  transform: scale(1.15);
  cursor: pointer;
}

/* ---------------------------------------------------------------------------/
 * Navigator (public site)
 * ---------------------------------------------------------------------------/
 */
.navbar.navigator-navbar {
  background: var(--petra-surface);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4) 0;
}

.navigator-navbar .navbar-brand {
  font-weight: 700;
  color: var(--petra-primary);
}

.navigator-navbar .nav-link {
  color: var(--petra-text);
  font-weight: 500;
  position: relative;
}

.navigator-navbar .nav-link:hover {
  color: var(--petra-primary);
}

.navigator-navbar .nav-link::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: var(--petra-accent);
  transition: width 0.2s ease;
}

.navigator-navbar .nav-link:hover::after {
  width: 100%;
}

.petra-footer {
  background: var(--petra-primary-dark);
  color: white;
  padding: var(--space-8) 0;
  margin-top: 0;
}

.petra-footer .footer-link {
  color: #d8e5ea;
  text-decoration: none;
}

.petra-footer .footer-link:hover {
  color: var(--petra-accent);
}

.petra-footer .footer-description {
  color: #d8e5ea;
}

/* Accessible muted copy on marketing / auth pages (avoids Bootstrap #6c757d edge cases) */
.navigator-muted,
.legal-page p,
.legal-page li,
.legal-page .last-updated {
  color: var(--petra-text-muted);
}

/* Auth split-layout sidebar — replaces Bootstrap text-white-50 (fails contrast on navy) */
.auth-sidebar-muted {
  color: #cbd5e0;
}

/* Gold icons and accents on light backgrounds */
.icon-accent-on-light {
  color: var(--petra-accent-dark);
}

/* ---------------------------------------------------------------------------/
 * Focus & accessibility
 * ---------------------------------------------------------------------------/
 */
.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus-visible {
  position: fixed;
  top: var(--space-4);
  left: var(--space-4);
  width: auto;
  height: auto;
  margin: 0;
  padding: var(--space-3) var(--space-4);
  overflow: visible;
  clip: auto;
  clip-path: none;
  white-space: normal;
  z-index: 10000;
  background: var(--petra-primary);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  outline: 2px solid var(--petra-accent);
  outline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--petra-primary);
  outline-offset: 2px;
}

.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
  box-shadow: 0 0 0 4px rgba(26, 54, 93, 0.25);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Search section (operations list pages) */
.search-section {
  background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
  border-radius: var(--radius-md);
  padding: var(--space-8);
  margin-bottom: var(--space-8);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.search-input {
  border-radius: var(--radius-md);
  border: 2px solid #e9ecef;
  padding: var(--space-3) var(--space-5);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--petra-primary);
  box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.15);
  outline: none;
}

.search-btn {
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--petra-primary) 0%, var(--petra-gradient-dark) 100%);
  border: none;
  padding: var(--space-3) var(--space-6);
  color: white;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
}

.search-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: white;
}

/* Info card (detail pages) */
.info-card {
  background: linear-gradient(135deg, var(--petra-surface) 0%, #f8f9fa 100%);
  border: 1px solid var(--petra-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.summary-value {
  font-size: 1.4rem;
  font-weight: 700;
}

.amount-cell {
  font-weight: 600;
  font-family: inherit;
  text-align: right;
}

.unpaid-amount {
  color: #dc3545;
  font-weight: 700;
}

/* Accounts grid – tablet: fluid columns with horizontal scroll via .table-modern-box */
@media (max-width: 991.98px) {
  .accounts-table-header,
  .accounts-table-row {
    grid-template-columns: minmax(120px, 1.1fr) minmax(140px, 1.2fr) minmax(104px, 0.95fr) minmax(112px, 1fr) minmax(72px, 0.65fr);
  }
}

@media (max-width: 767.98px) {
  .accounts-table-header,
  .accounts-table-row {
    grid-template-columns: minmax(110px, 1fr) minmax(120px, 1.05fr) minmax(92px, 0.85fr) minmax(104px, 0.95fr) minmax(64px, 0.65fr);
  }

  .row.table-modern-header,
  .row.table-modern-row {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
  }

  .row.table-modern-row {
    align-items: flex-start !important;
  }

  .row.table-modern-row .table-modern-cell {
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
  }
}

/* Stage/Kanban (monuments) */
.stage-container {
  background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
  border-radius: var(--radius-md);
  padding: var(--space-8);
  margin-top: var(--space-8);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.stage-column {
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin: 0 var(--space-2);
  box-shadow: var(--shadow-md);
  min-height: 400px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stage-column:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stage-title {
  color: var(--petra-text);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
  text-align: center;
  font-weight: 600;
  font-size: 1.1rem;
  border-bottom: 2px solid var(--petra-primary);
}

.scroll-controls {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  display: flex;
  gap: var(--space-2);
  z-index: 10;
}

.scroll-button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--petra-border);
  background: var(--petra-surface);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.scroll-button:hover {
  background: var(--petra-primary);
  color: white;
  border-color: var(--petra-primary);
}

.monument-box {
  border: 1px solid #e9ecef;
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  color: var(--petra-text);
}

.monument-box:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  border-color: var(--petra-primary);
  color: var(--petra-text);
}

.monument-box h6,
.monument-box .monument-box-h6 {
  color: var(--petra-primary);
  font-weight: 700;
  margin-bottom: var(--space-2);
  font-size: 1rem;
}

.monument-box p,
.monument-box .monument-box-p {
  color: var(--petra-text-muted);
  font-size: 0.85rem;
  margin-bottom: var(--space-1);
  line-height: 1.5;
  font-weight: 500;
}

.monument-box[style*="background-color"] h6,
.monument-box[style*="background-color"] .monument-box-h6 {
  color: #212529;
  font-weight: 800;
}

.monument-box[style*="background-color"] p,
.monument-box[style*="background-color"] .monument-box-p {
  color: #212529;
  font-weight: 600;
}

/* Order detail (vault/monument) page */
.order-detail-wrap {
  background: var(--petra-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  border: 1px solid var(--petra-border);
  box-shadow: var(--shadow-md);
}

.order-detail-wrap.order-detail-locked {
  background: rgba(212, 237, 218, 0.3);
  border: 2px solid #28a745;
}

.order-detail-sidebar {
  border-left: 1px solid var(--petra-border);
  padding-left: var(--space-5);
}

@media (max-width: 991.98px) {
  .order-detail-sidebar {
    border-left: none;
    border-top: 1px solid var(--petra-border);
    padding-left: 0;
    padding-top: var(--space-5);
    margin-top: var(--space-5);
  }
}

.sidebar-card {
  background: var(--petra-surface);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  border: 1px solid var(--petra-border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.sidebar-card h4,
.sidebar-card h5 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-3);
  color: var(--petra-text);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sidebar-card .material-icons {
  font-size: 1.25rem;
  color: var(--petra-primary);
}

.drop-zone {
  border: 2px dashed var(--petra-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.drop-zone:hover,
.drop-zone.highlight {
  border-color: var(--petra-primary);
  background: rgba(26, 54, 93, 0.06);
}

.form-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--petra-text);
  margin: var(--space-6) 0 var(--space-3) 0;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--petra-border);
}

.form-section-title:first-child {
  margin-top: 0;
}

.line-items-box {
  border: 1px solid var(--petra-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--petra-surface);
}

.totals-block {
  padding: var(--space-4);
  background: #f8f9fa;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-size: 0.95rem;
}

.totals-block p {
  margin-bottom: var(--space-1);
}

/* Row with inline background (e.g. stage color) - keep text readable */
.row.table-modern-row[style*="background-color"] .table-modern-cell,
.row.table-modern-row[style*="background-color"] {
  color: #212529;
}

.row.table-modern-row[style*="background-color"] .table-modern-cell a {
  color: #004085;
  font-weight: 600;
}

.row.table-modern-row[style*="background-color"] .table-modern-cell span.fw-semibold.text-primary {
  color: #004085;
}

/* Full-row open order detail (vault / monument search modal results) */
.vault-monument-order-row-clickable {
  cursor: pointer;
  border-radius: var(--radius-md);
  margin-bottom: 2px;
  transition: background-color 0.15s ease;
}

.vault-monument-order-row-clickable:hover {
  background-color: rgba(0, 0, 0, 0.045);
}

.vault-monument-order-row-clickable:focus-visible {
  outline: 2px solid var(--petra-primary);
  outline-offset: 2px;
}

/* Shared stage-process board (monuments + vaults) */
.stage-process-shell {
  background: linear-gradient(180deg, #f2f4f6 0%, #eceff1 100%);
  border-radius: 14px;
  padding: 16px;
  border: 1px solid #dde3e8;
}

.stage-scroll-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: var(--petra-primary);
  color: #fff;
  box-shadow: 0 0 8px rgba(26, 54, 93, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage-scroll-btn:hover {
  background: var(--petra-primary-dark);
  color: #fff;
}

.stage-board-column {
  width: 290px;
  min-height: 330px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #dde5ed;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.06);
}

.stage-column-title {
  font-size: 0.96rem;
  font-weight: 600;
  color: #1f2a32;
}

.stage-column-line {
  height: 2px;
  border-radius: 2px;
  opacity: 0.75;
}

.stage-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.stage-filter-input {
  width: 260px;
  border-radius: 10px;
  border: 1px solid #cfd8e3;
  padding: 9px 12px;
  background: #fff;
}

.stage-action-btn {
  border-radius: 10px;
  border: 1px solid #c8d3dd;
  background: #fff;
  color: #2e3a45;
  padding: 8px 12px;
  font-size: .85rem;
}

.stage-action-btn.active {
  background: var(--petra-primary);
  color: #fff;
  border-color: var(--petra-primary);
}

.stage-count-pill {
  background: rgba(26, 54, 93, 0.12);
  color: var(--petra-primary-dark);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: .75rem;
  font-weight: 600;
}

.stage-board-viewport {
  overflow-x: auto;
  cursor: grab;
}

.stage-board-viewport.dragging {
  cursor: grabbing;
}

.stage-empty {
  border: 1px dashed #c5cfda;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  color: #6f7b87;
  font-size: .84rem;
  background: #ffffffb3;
}

.stage-loading {
  height: 88px;
  border-radius: 10px;
  background: linear-gradient(90deg, #eef2f6 25%, #f8fbfe 37%, #eef2f6 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s infinite linear;
  border: 1px solid #dce5ee;
}

.stage-order-card {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(24, 43, 60, 0.1);
  border-left: 6px solid #8ea4b9;
  background: #eef4fb;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transition: transform .18s ease, box-shadow .18s ease;
}

.stage-order-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.14);
}

.stage-order-card.status-pending {
  background: #fdeeee;
  border-left-color: #d98989;
}

.stage-order-card.status-in-progress {
  background: #e9f1ff;
  border-left-color: #7f9edd;
}

.stage-order-card.status-completed {
  background: #e8f7ec;
  border-left-color: #73b38b;
}

.stage-order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stage-order-status {
  font-size: .7rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.75);
  color: #2f3a46;
  border: 1px solid rgba(36, 50, 66, 0.2);
}

.stage-order-rmv {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 800;
  color: #102332;
  letter-spacing: .2px;
}

.stage-order-thumb {
  position: relative;
  margin-top: 10px;
  height: 240px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(24, 43, 60, 0.15);
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage-order-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.stage-order-thumb-expandable {
  cursor: zoom-in;
}

.stage-order-thumb-expandable:hover {
  opacity: 0.96;
}

.stage-order-thumb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(16, 35, 50, 0.25);
  background: rgba(255, 255, 255, 0.85);
  color: #1f2a32;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.stage-order-thumb-nav.prev {
  left: 6px;
}

.stage-order-thumb-nav.next {
  right: 6px;
}

.stage-order-thumb-nav .material-icons {
  font-size: 16px;
}

.stage-order-thumb-count {
  position: absolute;
  right: 8px;
  bottom: 6px;
  font-size: .7rem;
  padding: 2px 6px;
  border-radius: 999px;
  color: #243444;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(36, 52, 68, 0.2);
}

.stage-order-content {
  margin-top: 10px;
}

.stage-order-name {
  margin: 0;
  font-size: .97rem;
  line-height: 1.25;
  color: #122333;
  font-weight: 700;
}

.stage-order-meta {
  margin: 4px 0 0 0;
  font-size: .81rem;
  color: #546477;
}

.stage-card-footer {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.stage-card-link {
  flex: 1;
  text-align: center;
  font-size: .78rem;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid #274e3b;
  color: #214b38;
  background: transparent;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.stage-card-link:hover {
  background: #214b38;
  color: #fff;
  border-color: #214b38;
}

.stage-board.compact .stage-order-thumb,
.stage-board.compact .stage-order-meta {
  display: none;
}

/* Lightbox-style image preview (dimmed page, framed photo, yellow circular close) */
body:has(.monument-image-modal.show) .modal-backdrop {
  --bs-backdrop-opacity: 0.82;
  background-color: #0b0f14;
}

/* Bootstrap modal tokens: avoid white “paper” behind a transparent shell */
.monument-image-modal.modal {
  --bs-modal-bg: transparent;
  --bs-modal-border-width: 0;
  --bs-modal-border-color: transparent;
}

/* Full-width dialog row so flex centering actually centers the preview */
.monument-image-modal.modal .modal-dialog.monument-image-lightbox-dialog {
  max-width: none;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-4) var(--space-3);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: min(100vh, 100dvh);
}

.monument-image-lightbox-shell.modal-content {
  /* Kill default flex column + full-height stretch (that caused empty white strip) */
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  align-self: center;
  flex-shrink: 0;
  position: relative;
  background: transparent !important;
  border: none !important;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  outline: none;
}

/* Shrink-wrap to image (up to caps) so no fixed empty letterbox band */
.monument-image-lightbox-frame {
  position: relative;
  display: inline-block;
  max-width: min(92vw, 1120px);
  max-height: min(85vh, calc(100dvh - 4rem));
  margin: 0;
  line-height: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #141820;
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.45),
    0 24px 80px rgba(0, 0, 0, 0.38);
}

.monument-image-lightbox-img {
  display: block;
  max-width: min(92vw, 1120px);
  max-height: min(85vh, calc(100dvh - 4rem));
  width: auto;
  height: auto;
  object-fit: contain;
}

.monument-image-lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  min-width: 44px;
  max-width: 44px;
  flex: 0 0 44px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  background: var(--petra-primary, #1a365d);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.monument-image-lightbox-close:hover {
  background: var(--petra-primary-dark, #0f2942);
  color: #fff;
}

.monument-image-lightbox-close:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.95);
  outline-offset: 2px;
}

.monument-image-lightbox-close-x {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1;
  margin-top: -2px;
}

@media (max-width: 575.98px) {
  .monument-image-lightbox-close {
    top: 8px;
    right: 8px;
    width: 40px;
    height: 40px;
    min-width: 40px;
    max-width: 40px;
    flex-basis: 40px;
  }

  .monument-image-lightbox-frame {
    max-width: calc(100vw - 1.5rem);
    max-height: min(78vh, calc(100dvh - 3rem));
    border-radius: 12px;
  }

  .monument-image-lightbox-img {
    max-width: calc(100vw - 1.5rem);
    max-height: min(78vh, calc(100dvh - 3rem));
  }
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ===================================================================
   Payment Popout Modal
   =================================================================== */
.payment-popout-dialog {
  max-width: min(96vw, 1200px);
  width: 100%;
}

.payment-popout-content {
  border-radius: 14px;
  overflow: hidden;
}

.payment-popout-header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: .9rem 1.5rem;
}

.payment-popout-header .modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1f2937;
}

.payment-popout-badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: .15rem .55rem;
  margin-left: .35rem;
}

.payment-popout-body {
  padding: 0 1.5rem 1.5rem;
  background: #f9fafb;
}

.payment-popout-footer {
  background: #fff;
  border-top: 1px solid #e5e7eb;
  padding: .75rem 1.5rem;
}

.pd-section {
  background: #fff;
  border: 1px solid #e0e5ef;
  border-left: 3px solid var(--petra-primary, #1a365d);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  margin-top: 1rem;
}

.pd-section-title {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .92rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: .75rem;
}

.pd-section-title .material-icons {
  font-size: 1.1rem;
  color: var(--petra-primary, #1a365d);
}

.pd-section-subtitle {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .85rem;
  font-weight: 700;
  color: #1a5e2c;
  margin-bottom: .5rem;
}

.pd-label {
  font-size: .72rem;
  font-weight: 600;
  color: #5a6884;
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: .15rem;
  display: block;
}

/* Line-items table */
.pd-table-wrap {
  overflow-x: auto;
}

.pd-table {
  font-size: .82rem;
}

.pd-table thead th {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #5a6884;
  border-bottom: 2px solid #d0d7e6;
  padding: .4rem .5rem;
  white-space: nowrap;
}

.pd-table tbody td,
.pd-table tfoot td {
  padding: .4rem .5rem;
  vertical-align: middle;
}

.pd-total-row td {
  border-top: 2px solid var(--petra-primary);
  font-weight: 700;
}

/* Collect / Record: aligned rows share gutters; action buttons equal height */
.pd-collect-align-row .pd-terminal-field {
  min-width: 0;
}

.pd-refresh-link {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--petra-primary, #1a365d);
  white-space: nowrap;
}

.pd-refresh-link:hover {
  color: #0f2744;
}

.pd-label--spacer {
  display: block;
  margin-bottom: 0.1rem;
  min-height: 0;
  max-height: 0.85rem;
  padding: 0;
  line-height: 1;
  font-size: 0.72rem;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}

.pd-collect-terminal-actions {
  margin-top: 0;
  padding-top: 0;
}

.pd-collect-terminal-actions .btn,
.pd-collect-align-row .btn {
  border-radius: 8px;
  margin-top: 0;
}

.pd-btn-clear {
  min-width: 6.5rem;
  padding-left: 1.15rem;
  padding-right: 1.15rem;
}

.pd-btn-send-terminal {
  min-width: 0;
}

/* Match key action buttons to form-select-sm control height */
.pd-btn-clear,
.pd-btn-send-terminal,
.pd-record-primary-btn {
  height: calc(1.8125rem + 2px);
  min-height: calc(1.8125rem + 2px);
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.pd-collect-action-row .pd-action-btn {
  min-height: 2.5rem;
  border-radius: 8px;
  font-weight: 600;
}

.pd-record-primary-btn {
  min-height: 2.5rem;
  border-radius: 8px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 0;
}

.pd-record-row-1 .pd-label--spacer {
  max-height: 0.75rem;
  margin-bottom: 0.08rem;
}

.pd-record-row-1 .form-select,
.pd-record-row-1 .form-control {
  border-radius: 8px;
}

/* Collect Payment action buttons */
.pd-action-btn {
  font-size: .78rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
}

.pd-action-link {
  background: #1a5e2c;
  border-color: #1a5e2c;
  color: #fff;
}

.pd-action-link:hover {
  background: #145224;
  border-color: #145224;
  color: #fff;
}

/* Partial payment box */
.pd-partial-box {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-md, 10px);
  padding: .85rem 1rem;
  margin-top: .75rem;
}

/* Waiting-on-payment box */
.pd-waiting-box {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md, 10px);
  padding: .75rem 1rem;
  margin-top: .75rem;
}

/* Payment history */
.pd-history-row:hover {
  background: #f3f6fb;
}

.pd-history-detail {
  background: #f9fafb;
}

.pd-history-detail.pd-detail-collapsed {
  display: none;
}

.pd-detail-cell {
  padding: .75rem 1rem !important;
}

.pd-detail-actions {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}

.pd-detail-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  font-weight: 600;
  padding: .5rem 1.1rem;
  border-radius: 8px;
  border: 2px solid;
  background: #fff;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .2s, transform .1s;
  user-select: none;
}

.pd-detail-btn .material-icons {
  font-size: 1.05rem;
}

.pd-detail-btn:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  transform: translateY(-1px);
}

.pd-detail-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
}

/* Receipt & Statement — outlined with dark/purple icon */
.pd-detail-btn-dark {
  color: #374151;
  border-color: #d1d5db;
  background: #fff;
}
.pd-detail-btn-dark .material-icons {
  color: var(--petra-primary);
}
.pd-detail-btn-dark:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

/* Email — green outlined with tinted background */
.pd-detail-btn-green {
  color: #15803d;
  border-color: #86efac;
  background: #f0fdf4;
}
.pd-detail-btn-green .material-icons {
  color: #16a34a;
}
.pd-detail-btn-green:hover {
  background: #dcfce7;
  border-color: #4ade80;
}

/* Mark Bounced — solid pink/coral fill */
.pd-detail-btn-bounced {
  color: #fff;
  border-color: #e88b98;
  background: #e88b98;
}
.pd-detail-btn-bounced:hover {
  background: #dc6b7c;
  border-color: #dc6b7c;
  box-shadow: 0 2px 8px rgba(232,139,152,.4);
}
.pd-detail-btn-bounced:disabled {
  opacity: .65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Delete — red outlined */
.pd-detail-btn-red {
  color: #dc2626;
  border-color: #fca5a5;
  background: #fff;
}
.pd-detail-btn-red .material-icons {
  color: #dc2626;
}
.pd-detail-btn-red:hover {
  background: #fef2f2;
  border-color: #f87171;
}

.pd-status {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: .2rem .5rem;
  border-radius: 999px;
}

.pd-status-paid {
  background: #dcfce7;
  color: #166534;
}

.pd-status-pending {
  background: #fef3c7;
  color: #92400e;
}

.pd-status-unpaid {
  background: #fee2e2;
  color: #991b1b;
}

/* ---------------------------------------------------------------------------/
 * Legal / info pages (eula, accessibility, privacy, terms)
 * These render directly on the tinted body background (--petra-bg #f6f8fb),
 * where Bootstrap's default link (#0d6efd) and code (#d63384) colors drop to
 * 4.23:1 contrast and fail WCAG 2.1 AA. Override with brand-tuned colors that
 * pass AA on the tinted background (link 6.05:1, code 6.89:1). Underline keeps
 * links distinguishable without relying on color alone (1.4.1).
 * ---------------------------------------------------------------------------/
 */
.legal-page a {
  color: #0a58ca;
  text-decoration: underline;
}
.legal-page a:hover {
  color: var(--petra-primary-dark);
}
.legal-page code {
  color: #9d2463;
}
