/* Plain form and table layout shared by the admin pages. */
.billing-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-width: 0;
  align-items: start;
}
.generation-date-display {
  display: grid;
  gap: 10px;
  padding-top: 2px;
}
.generation-date-display span {
  font-weight: 600;
}
.generation-date-display strong {
  padding-block: 9px;
  color: var(--color-ink);
  font-size: 0.9rem;
}
.billing-dates > label {
  min-width: 0;
}
@media (max-width: 700px) {
  .billing-dates {
    grid-template-columns: 1fr;
  }
}
/* Keep only the essential columns on phones. Printing retains the full table. */
@media screen and (max-width: 600px) {
  table.mobile-summary-table {
    min-width: 0;
    width: 100%;
    table-layout: auto;
  }
  table.mobile-summary-table th,
  table.mobile-summary-table td {
    padding: 12px 8px;
    font-size: 0.74rem;
    overflow-wrap: anywhere;
  }
  table.mobile-summary-table th {
    white-space: normal;
  }
  .mobile-summary-customers
    tr
    > :not(:nth-child(1)):not(:nth-child(5)):not(:nth-child(6)):not([colspan]),
  .mobile-summary-balances
    tr
    > :not(:nth-child(1)):not(:nth-child(5)):not(:nth-child(6)):not([colspan]),
  .mobile-summary-payments
    tr
    > :not(:nth-child(2)):not(:nth-child(4)):not(:nth-child(7)):not([colspan]),
  .mobile-summary-bills
    tr
    > :not(:nth-child(2)):not(:nth-child(3)):not(:nth-child(11)):not(:nth-child(14)):not([colspan]),
  .mobile-summary-accounts
    tr
    > :not(:nth-child(1)):not(:nth-child(4)):not(:nth-child(5)):not(:nth-child(6)):not([colspan]),
  .mobile-summary-consumption tr > :not(:nth-child(1)):not(:nth-child(3)):not([colspan]) {
    display: none;
  }
  table.mobile-summary-table td[colspan] {
    display: table-cell;
  }
  .mobile-summary-customers .action-edit,
  .mobile-summary-customers .customer-avatar {
    display: none;
  }
  .mobile-summary-table .customer-row-actions {
    flex-wrap: nowrap;
  }
  .mobile-summary-table .btn {
    padding: 8px;
    font-size: 0.7rem;
    white-space: nowrap;
  }
  .mobile-summary-table .payment-status,
  .mobile-summary-table .customer-status {
    font-size: 0.64rem;
    padding: 4px 7px;
  }
}
.skeleton-block {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 5px;
  background: var(--color-border);
}
.admin-content-refresh { margin-left: auto; align-self: center; white-space: nowrap; }
main > .page-header.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
main > .admin-page-header > .admin-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: auto;
}
.admin-header-actions > .admin-content-refresh { margin-left: 0; }
.admin-header-actions > .btn { align-self: center; white-space: nowrap; }
@media (max-width: 700px) {
  main > .page-header.admin-page-header { align-items: flex-start; }
  main > .admin-page-header > .admin-header-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
}
.admin-refresh-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  transform-origin: center;
}
.table-loading-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  color: var(--color-ink-muted, inherit);
}
.table-loading-spinner {
  display: inline-block;
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: admin-refresh-spin .8s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .table-loading-spinner { animation: none; }
}
.admin-refresh-icon svg { display: block; width: 100%; height: 100%; }
.admin-refresh-spinning { animation: admin-refresh-spin .8s linear infinite; }
@keyframes admin-refresh-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .admin-refresh-spinning { animation: none; }
}
.skeleton-block::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, #ffffff60, transparent);
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
.skeleton-heading {
  height: 13px;
  width: 58%;
  margin-bottom: 22px;
}
.skeleton-number {
  height: 30px;
  width: 70%;
  margin-bottom: 14px;
}
.skeleton-caption {
  height: 10px;
  width: 80%;
}
.skeleton-row-text {
  height: 14px;
  width: 85%;
  min-width: 38px;
  margin: 8px 0;
}
.skeleton-plot {
  height: 230px;
  width: 100%;
  margin-bottom: 14px;
}
.skeleton-chart {
  padding: 5px 0;
}
.loading-announcement {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
[data-theme='dark'] .skeleton-block::after {
  background: linear-gradient(90deg, transparent, #ffffff12, transparent);
}
@keyframes skeleton-shimmer {
  to {
    transform: translateX(100%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton-block::after {
    animation: none;
  }
}
.btn.receipt-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 8px;
}
.receipt-icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (max-width: 600px) {
  .mobile-summary-payments tr > :last-child {
    text-align: center;
  }
  .mobile-summary-payments .btn.receipt-icon-button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 10px;
    border-radius: 8px;
  }
  .mobile-summary-payments .receipt-icon-button svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }
}
.section-tabs {
  flex-wrap: wrap;
}
.section-tabs button {
  border: 0;
  font-family: inherit;
  cursor: pointer;
  background: transparent;
  min-width: 0;
}
.section-tab-panel:not([hidden]) {
  animation: billing-content-reveal 0.2s ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .section-tab-panel:not([hidden]) {
    animation: none;
  }
}
@media print {
  .section-tabs {
    display: none !important;
  }
}
.confirmation-dialog.has-preview {
  width: min(850px, 94vw);
  border-radius: 10px;
  background: var(--color-surface);
}
.bill-preview-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
  margin: 20px 0;
  background: var(--table-heading);
  border-radius: 8px;
}
.bill-preview-totals span {
  display: block;
  color: var(--color-ink-muted);
  font-size: 0.75rem;
  margin-bottom: 6px;
}
.bill-preview-totals strong {
  font-size: 0.95rem;
  color: var(--color-ink);
}
.bill-preview-table {
  max-height: 300px;
  overflow: auto;
  margin-bottom: 20px;
}
.bill-preview-table th {
  position: sticky;
  top: 0;
  background: var(--table-heading);
}
.reading-field:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
@media (max-width: 600px) {
  .bill-preview-totals {
    grid-template-columns: 1fr 1fr;
  }
}
.main-content-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.admin-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-left: var(--sidebar-w);
  padding: 18px 40px;
  border-top: 1px solid var(--color-border);
  color: var(--color-ink-muted);
  font-size: 0.75rem;
  line-height: 1.6;
  transition: margin-left 0.3s ease;
}
.admin-footer-office {
  font-size: 0.72rem;
}
@media (max-width: 860px) {
  .admin-footer {
    margin-left: 0;
    padding: 18px 24px;
  }
}
@media (max-width: 500px) {
  .admin-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 16px 20px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .admin-footer {
    transition: none;
  }
}
@media print {
  .admin-footer {
    display: none !important;
  }
}
.payment-search-control {
  display: block;
  position: relative;
}
.payment-search-control > svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 19px;
  height: 19px;
  fill: none;
  stroke: var(--color-ink-muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  pointer-events: none;
}
.payment-search-control > .admin-filter {
  padding-left: 43px;
}
.placeholder-search-toolbar {
  align-items: center;
  gap: 12px;
}
.placeholder-search-toolbar .payment-filter-dropdown {
  margin-top: 0;
}
.placeholder-search-toolbar .admin-filter {
  height: 46px;
}
.placeholder-search-toolbar .payment-filter-dropdown summary {
  height: 46px;
  box-sizing: border-box;
}
.payment-filter-dropdown[open] > summary {
  background: var(--card-tint);
  border-color: var(--color-primary);
  color: var(--color-primary-deep);
}
.filter-panel-heading {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}
.filter-panel-heading strong {
  font-size: 0.9rem;
}
.filter-panel-close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  font: inherit;
  font-size: 1.25rem;
  cursor: pointer;
  background: var(--table-heading);
  color: var(--color-ink-muted);
}
.filter-panel-close:hover {
  background: var(--card-tint);
  color: var(--color-primary-deep);
}
.payment-filter-dropdown[open] .payment-history-filters {
  animation: filter-appear 0.16s ease-out;
  box-shadow: 0 12px 34px #06243820;
}
@keyframes filter-appear {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .payment-filter-dropdown[open] .payment-history-filters {
    animation: none;
  }
}
.receipt-allocation-start {
  border-top: 1px dashed #a6b1ba;
  padding-top: 14px;
  margin-top: 5px;
}
.common-filter-toolbar .payment-history-search .search-control {
  width: 100%;
}
.common-filter-toolbar .payment-history-search .admin-filter {
  min-width: 0;
}
.common-filter-toolbar .payment-history-search .search-control .admin-filter {
  padding-left: 42px;
}
.filters-only .payment-filter-dropdown {
  margin-top: 0;
}
.filters-only {
  justify-content: flex-end;
}
.payment-history-toolbar {
  position: relative;
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}
.payment-history-search {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: min(260px, 100%);
  font-size: 0.8rem;
  font-weight: 600;
}
.payment-history-search .admin-filter {
  max-width: none;
  margin: 0;
}
.payment-filter-dropdown {
  flex: 0 1 auto;
  margin-top: 24px;
}
.payment-filter-dropdown summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--color-border-strong);
  border-radius: 7px;
  background: var(--color-surface);
  color: var(--color-primary-deep);
  cursor: pointer;
  list-style: none;
  font-size: 0.85rem;
  font-weight: 600;
}
.payment-filter-dropdown summary::-webkit-details-marker {
  display: none;
}
.payment-filter-dropdown summary svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.payment-filter-dropdown summary:hover {
  background: var(--card-tint);
}
.payment-filter-dropdown summary:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.filter-chevron {
  transition: transform 0.2s ease;
}
.payment-filter-dropdown[open] .filter-chevron {
  transform: rotate(180deg);
}
.payment-filter-dropdown .payment-history-filters {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 5;
  width: min(420px, 100%);
  box-sizing: border-box;
  padding: 18px;
  margin: 10px 0 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}
.btn.action-receipt {
  color: #075880;
  background: #e4f3ff;
  border-color: #9ccde9;
}
.btn.action-receipt:hover {
  background: #cce9fc;
  border-color: #4c9dc9;
}
[data-theme='dark'] .btn.action-receipt {
  color: #a6ddff;
  background: #173b52;
  border-color: #376882;
}
[data-theme='dark'] .btn.action-receipt:hover {
  background: #22516e;
}
.sidebar-collapse {
  position: absolute;
  top: 28px;
  right: -15px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 5px;
  border: 1px solid #45657a;
  border-radius: 50%;
  color: #d8edfa;
  background: var(--sidebar-bg-hover);
  cursor: pointer;
  box-shadow: 0 3px 10px #0003;
  transition:
    background 0.2s,
    box-shadow 0.2s;
}
.sidebar-collapse:hover {
  background: #087bb5;
  border-color: #7dd3fc;
  color: #fff;
  box-shadow:
    0 0 0 4px #38bdf826,
    0 3px 14px #0005;
}
.sidebar-collapse svg {
  transition: transform 0.3s ease;
}
.sidebar-tooltip {
  position: fixed;
  z-index: 100;
  max-width: min(260px, 75vw);
  padding: 9px 13px;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: 0 6px 22px #0002;
  font-size: 0.8rem;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-5px) translateY(-50%);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
}
.sidebar-tooltip.is-visible {
  opacity: 1;
  transform: translateX(0) translateY(-50%);
}
.sidebar-collapse svg,
.sidebar-tools .btn svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-tools .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.sidebar-collapse:focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: 3px;
}
@media (min-width: 861px) {
  html.theme-teal .sidebar {
    transition:
      width 0.3s ease,
      transform 0.28s ease;
  }
  html.theme-teal .main-content {
    transition: margin-left 0.3s ease;
  }
  html.theme-teal .sidebar-brand {
    padding-right: 30px;
  }
  html.theme-teal.sidebar-compact {
    --sidebar-w: 80px;
  }
  .sidebar-compact .sidebar .brand-text,
  .sidebar-compact .sidebar-menu-item span,
  .sidebar-compact .sidebar-tool-label,
  .sidebar-compact .sidebar-foot {
    display: none;
  }
  html.sidebar-compact .sidebar-brand {
    padding: 22px 12px 20px;
    justify-content: center;
  }
  .sidebar-compact .sidebar-collapse svg {
    transform: rotate(180deg);
  }
  html.sidebar-compact .sidebar-menu {
    padding-inline: 10px;
  }
  html.sidebar-compact .sidebar-menu-item {
    justify-content: center;
    padding: 14px 10px;
  }
  .sidebar-compact .sidebar-tools {
    padding: 12px 10px;
  }
  .sidebar-compact .sidebar-tools .btn {
    padding: 12px 8px;
  }
}
@media (max-width: 860px) {
  .sidebar-collapse {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  html.theme-teal .sidebar,
  html.theme-teal .main-content,
  .sidebar-collapse,
  .sidebar-collapse svg,
  .sidebar-tooltip {
    transition: none;
  }
}
.btn.action-edit {
  background: #fff4db;
  border-color: #e8c577;
  color: #805300;
}
.btn.action-view,
#profileApplication,
#profilePayments {
  background: #e4f3ff;
  border-color: #9ccde9;
  color: #075880;
}
.btn.action-edit:hover {
  background: #ffe8b4;
  border-color: #c39332;
}
.btn.action-view:hover,
#profileApplication:hover,
#profilePayments:hover {
  background: #cce9fc;
  border-color: #4c9dc9;
}
.payment-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.payment-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-paid {
  color: #176641;
  background: #e0f4e9;
}
.status-unpaid {
  color: #805300;
  background: #fff0cd;
}
.status-overdue {
  color: #a32632;
  background: #ffe4e7;
}
[data-theme='dark'] .btn.action-edit {
  color: #ffe1a0;
  background: #44351b;
  border-color: #806532;
}
[data-theme='dark'] .btn.action-view,
[data-theme='dark'] #profileApplication,
[data-theme='dark'] #profilePayments {
  color: #a6ddff;
  background: #173b52;
  border-color: #376882;
}
[data-theme='dark'] .btn.action-edit:hover {
  background: #594523;
}
[data-theme='dark'] .btn.action-view:hover,
[data-theme='dark'] #profileApplication:hover,
[data-theme='dark'] #profilePayments:hover {
  background: #22516e;
}
[data-theme='dark'] .status-paid {
  color: #9be4bb;
  background: #193e30;
}
[data-theme='dark'] .status-unpaid {
  color: #ffdb8a;
  background: #44351b;
}
[data-theme='dark'] .status-overdue {
  color: #ffb1ba;
  background: #512934;
}
.payment-customer-search {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}
.payment-customer-search .admin-filter {
  max-width: none;
  margin: 0;
}
.customer-search-results {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  display: grid;
  gap: 8px;
}
.customer-search-results:empty {
  display: none;
}
.customer-result-button {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  background: var(--color-surface);
  color: var(--color-ink);
}
.customer-result-button span {
  color: var(--color-ink-muted);
  font-size: 0.75rem;
}
.customer-result-button:hover {
  background: var(--card-tint);
  border-color: var(--color-primary);
}
.customer-result-button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.payment-history-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.payment-history-summary > div {
  background: var(--color-surface);
  padding: 22px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
}
.payment-history-summary span,
.payment-history-summary small {
  display: block;
  color: var(--color-ink-muted);
  font-size: 0.8rem;
}
.payment-history-summary strong {
  display: block;
  margin: 8px 0;
  color: var(--color-primary-deep);
  font-size: 1.6rem;
  overflow-wrap: anywhere;
}
.payment-history-summary small {
  font-size: 0.7rem;
}
.payment-history-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
  align-items: end;
}
.payment-history-filters label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 0;
}
.payment-history-filters .admin-filter {
  margin: 0;
  max-width: none;
}
.receipt-dialog {
  width: min(540px, 94vw);
}
.payment-receipt {
  background: #fff;
  color: #202b35;
  padding: 28px;
  border: 1px solid #d4dce2;
  border-radius: 8px;
  max-height: 90vh;
  overflow-y: auto;
  font-family: 'Courier New', Courier, monospace;
  box-shadow: 0 24px 80px #0005;
}
.payment-receipt::backdrop {
  background: #081c30a6;
}
.payment-receipt .receipt-heading h2 {
  font-family: Georgia, 'Times New Roman', serif;
  color: #202b35;
}
.payment-receipt .receipt-heading p,
.payment-receipt .receipt-details dt {
  color: #53616a;
}
.payment-receipt .receipt-details {
  border-block: 1px dashed #a6b1ba;
  padding-block: 20px;
}
.receipt-state {
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}
.receipt-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}
.receipt-feedback {
  color: #a02020;
  font-size: 0.85rem;
  margin-bottom: 16px;
}
.receipt-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}
.receipt-heading img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
}
.receipt-heading h2 {
  font-size: 1.2rem;
}
.receipt-heading p {
  font-size: 0.8rem;
  color: var(--color-ink-muted);
}
.receipt-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px 18px;
  margin: 20px 0;
  font-size: 0.85rem;
}
.receipt-details dt {
  color: var(--color-ink-muted);
}
.receipt-details dd {
  margin: 0;
  text-align: right;
  font-weight: 600;
  overflow-wrap: anywhere;
}
@media (max-width: 600px) {
  .payment-history-summary,
  .payment-history-filters {
    grid-template-columns: 1fr;
  }
}
@media print {
  @page {
    margin: 0;
  }
  body.printing-receipt {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff;
  }
  body.printing-receipt > :not(#receiptDialog) {
    display: none !important;
  }
  body.printing-receipt > #receiptDialog {
    display: block !important;
    position: static;
    width: 100%;
    max-height: none;
    margin: 0;
    padding: 20px;
    border: 0;
    box-shadow: none;
    background: white;
    color: black;
  }
  body.printing-receipt .receipt-actions {
    display: none !important;
  }
  body.printing-receipt a {
    display: none !important;
  }
  body.printing-receipt a::after {
    content: none !important;
  }
  body.printing-receipt > #receiptDialog {
    box-sizing: border-box;
    max-width: 160mm;
    margin: 0 auto;
    padding: 12mm;
    font-family: 'Courier New', Courier, monospace;
  }
  body.printing-receipt .receipt-details dt,
  body.printing-receipt .receipt-heading p {
    color: #444;
  }
}
.payment-customer-picker {
  margin-bottom: 26px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
}
.payment-customer-picker h3,
.payment-step-title {
  font-size: 1rem;
  color: var(--color-primary-deep);
  margin-bottom: 18px;
}
.payment-customer-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 20px;
  margin: 16px 0;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--table-heading);
}
.payment-customer-card span {
  display: block;
  color: var(--color-ink-muted);
  font-size: 0.75rem;
  margin-bottom: 6px;
}
.payment-customer-card strong {
  display: block;
  color: var(--color-ink);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}
#recordPaymentButton:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
@media (max-width: 600px) {
  .payment-customer-card {
    grid-template-columns: 1fr;
  }
}
.sidebar-tools .logout-button {
  margin-top: 8px;
  width: 100%;
  background: transparent;
  color: var(--sidebar-text);
  border-color: #45657a;
}
.confirmation-dialog {
  width: min(460px, 92vw);
  padding: 28px;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
}
.confirmation-dialog h2 {
  font-size: 1.2rem;
  margin-bottom: 14px;
  color: var(--color-primary-deep);
}
.confirmation-dialog p {
  white-space: pre-line;
  color: var(--color-ink-muted);
  line-height: 1.7;
  font-size: 0.9rem;
}
.confirmation-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
}
@media (prefers-reduced-motion: no-preference) {
  .confirmation-dialog[open] {
    animation: billing-content-reveal 0.18s ease-out;
  }
}
.billing-navigation,
.profile-tabs {
  display: flex;
  gap: 8px;
  padding: 0 6px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--color-border);
}
:is(.billing-navigation :is(a, button), .profile-tabs button) {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px 20px 17px;
  border-radius: 8px 8px 0 0;
  text-decoration: none;
  color: var(--color-ink-muted);
  font-size: 0.85rem;
  font-weight: 600;
  transition:
    color 0.2s ease,
    background 0.2s ease;
}
:is(.billing-navigation :is(a, button), .profile-tabs button) svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
:is(.billing-navigation :is(a, button), .profile-tabs button):hover {
  background: var(--card-tint);
  color: var(--color-ink);
}
:is(
  .billing-navigation [aria-current='page'],
  .billing-navigation button[aria-selected='true'],
  .profile-tabs [aria-selected='true']
) {
  color: var(--color-primary-deep);
  background: var(--card-tint);
  font-weight: 800;
}
:is(.billing-navigation :is(a, button), .profile-tabs button)::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 16px;
  right: 16px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--color-primary);
  transform: scaleX(0);
  transform-origin: center;
  opacity: 0;
  transition:
    transform 0.24s ease,
    opacity 0.24s ease;
}
:is(.billing-navigation :is(a, button), .profile-tabs button):hover::after,
:is(.billing-navigation :is(a, button), .profile-tabs button):focus-visible::after {
  transform: scaleX(0.55);
  opacity: 0.45;
}
:is(
  .billing-navigation :is(a, button)[aria-current='page'],
  .billing-navigation button[aria-selected='true'],
  .profile-tabs button[aria-selected='true']
)::after {
  transform: scaleX(1);
  opacity: 1;
  animation: billing-tab-reveal 0.3s ease-out;
}
:is(.billing-navigation :is(a, button), .profile-tabs button) svg {
  transition: transform 0.2s ease;
}
:is(.billing-navigation :is(a, button), .profile-tabs button):hover svg {
  transform: translateY(-2px);
}
:is(.billing-navigation :is(a, button), .profile-tabs button):active svg {
  transform: scale(0.92);
}
.billing-page > .panel {
  animation: billing-content-reveal 0.3s ease-out;
}
@keyframes billing-tab-reveal {
  from {
    transform: scaleX(0.3);
    opacity: 0.3;
  }
  to {
    transform: scaleX(1);
    opacity: 1;
  }
}
@keyframes billing-content-reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  :is(.billing-navigation :is(a, button), .profile-tabs button),
  :is(.billing-navigation :is(a, button), .profile-tabs button)::after,
  :is(.billing-navigation :is(a, button), .profile-tabs button) svg,
  .billing-page > .panel {
    animation: none;
    transition: none;
  }
  :is(.billing-navigation :is(a, button), .profile-tabs button):hover svg,
  :is(.billing-navigation :is(a, button), .profile-tabs button):active svg {
    transform: none;
  }
}
:is(.billing-navigation :is(a, button), .profile-tabs button):focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}
.record-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px 0;
  color: var(--color-ink-muted);
  font-size: 0.8rem;
}
.pager-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
html body :is(.pager-controls .btn, .step-navigation-button, .customer-step-navigation .btn) {
  min-height: 30px;
  min-width: 0;
  height: auto;
  padding: 5px 10px;
  gap: 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  line-height: 1.3;
}
html body :is(.pager-controls .btn, .step-navigation-button, .customer-step-navigation .btn) :is(i, svg) {
  width: 14px;
  height: 14px;
  font-size: 14px;
}
.pager-controls > span {
  font-size: 0.75rem;
}
.pager-controls .btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.billing-filters {
  margin-top: 20px;
}
.billing-submit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}
.billing-submit p {
  color: var(--color-ink-muted);
  font-size: 0.85rem;
}
.active-cycle-display {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}
.active-cycle-display > span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-ink-muted);
}
.active-cycle-display strong {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--color-primary-deep);
}
.active-cycle-display small {
  color: var(--color-ink-muted);
  font-size: 0.75rem;
}
@media (max-width: 600px) {
  .billing-navigation,
  .profile-tabs {
    gap: 4px;
    padding: 0;
  }
  :is(.billing-navigation :is(a, button), .profile-tabs button) {
    flex: 1;
    flex-direction: column;
    gap: 7px;
    text-align: center;
    padding: 12px 6px 15px;
    font-size: 0.7rem;
  }
  :is(.billing-navigation [aria-current='page'], .profile-tabs [aria-selected='true'])::after {
    left: 8px;
    right: 8px;
  }
  .record-pagination {
    align-items: flex-start;
  }
  .pager-controls {
    flex-wrap: wrap;
  }
}
.breadcrumbs {
  margin-bottom: 20px;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  font-size: 0.85rem;
}
.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.breadcrumbs li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-ink-muted);
}
.breadcrumbs li + li::before {
  content: '›';
  color: var(--color-ink-faint);
}
.breadcrumbs a {
  color: var(--color-primary-deep);
  text-decoration: none;
}
.breadcrumbs a:hover {
  text-decoration: underline;
}
.breadcrumbs [aria-current='page'] {
  color: var(--color-ink);
  font-weight: 700;
}
.admin-note {
  padding: 12px 16px;
  margin-bottom: 20px;
  background: var(--color-warning-bg);
  border-radius: 7px;
}
.admin-body {
  padding: 20px 24px;
}
.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.admin-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}
.admin-form input,
.admin-form select,
.admin-form textarea,
.admin-filter {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--color-border-strong);
  border-radius: 7px;
  font: inherit;
  background: white;
  color: var(--color-ink);
}
.admin-form .wide {
  grid-column: 1 / -1;
}
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.admin-filter {
  max-width: 320px;
  margin: 0 10px 12px 0;
}
.admin-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 20px;
}
.admin-summary strong {
  font-size: 1.4rem;
  display: block;
}
#pageMessage {
  margin-bottom: 16px;
  white-space: pre-line;
}
dialog {
  margin: auto;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 24px;
  width: min(600px, 92vw);
  max-height: 90vh;
  overflow: auto;
  color: var(--color-ink);
}
dialog::backdrop {
  background: rgba(8, 36, 48, 0.5);
}
.reading-field {
  width: 100px;
  padding: 8px;
}
.notice-list {
  white-space: pre-wrap;
}
[hidden] {
  display: none !important;
}
@media print {
  .sidebar,
  .mobile-topbar,
  .sidebar-overlay,
  .admin-actions,
  .admin-note,
  #pageMessage {
    display: none !important;
  }
  .main-content {
    margin: 0;
    padding: 0;
  }
  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: revert;
  }
  td::before {
    content: none !important;
  }
}
@media (max-width: 600px) {
  .admin-form {
    grid-template-columns: 1fr;
  }
  .admin-body {
    padding: 16px;
  }
}

/* Water palette used by every admin page. */
:root {
  --radius-lg: 10px;
  --radius-md: 7px;
  color-scheme: light;
  --color-bg: #eef7fc;
  --color-surface: #ffffff;
  --color-ink: #15364d;
  --color-ink-muted: #557389;
  --color-ink-faint: #6d8798;
  --color-primary: #087bb5;
  --color-primary-deep: #075985;
  --color-primary-light: #0b88c2;
  --color-border: #d6e8f2;
  --color-border-strong: #b4cfdf;
  --color-warning-bg: #fff4db;
  --sidebar-bg: #072c45;
  --sidebar-bg-hover: #104660;
  --sidebar-active: #087bb5;
  --sidebar-text: #b4d7e9;
  --table-heading: #edf7fc;
  --row-hover: #f2f9fd;
  --card-tint: #e4f5ff;
  --card-icon: #087bb5;
  --shadow-sm: 0 2px 8px rgba(7, 65, 96, 0.04);
  --shadow-md: 0 8px 24px rgba(7, 65, 96, 0.08);
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --color-bg: #0b1824;
  --color-surface: #132838;
  --color-ink: #e2f2fb;
  --color-ink-muted: #a6c2d4;
  --color-ink-faint: #8fadc0;
  --color-primary: #38bdf8;
  --color-primary-deep: #7dd3fc;
  --color-primary-light: #64ceff;
  --color-border: #284659;
  --color-border-strong: #45657a;
  --color-warning-bg: #3a3021;
  --sidebar-bg: #07131e;
  --sidebar-bg-hover: #16364b;
  --sidebar-active: #075985;
  --sidebar-text: #b0cede;
  --table-heading: #183448;
  --row-hover: #1b3548;
  --card-tint: #163e55;
  --card-icon: #7dd3fc;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.16);
}
body {
  background: var(--color-bg);
  color: var(--color-ink);
}
.panel {
  box-shadow: var(--shadow-md);
}
.panel-header {
  background: var(--table-heading);
}
.admin-note {
  color: var(--color-ink);
  border: 1px solid var(--color-border);
}
.admin-form input,
.admin-form select,
.admin-form textarea,
.admin-filter,
.admin-body input,
.admin-body select,
dialog {
  background: var(--color-surface);
  color: var(--color-ink);
  border-color: var(--color-border-strong);
}
.admin-body select {
  padding: 9px;
  border-radius: 7px;
  font: inherit;
  max-width: 100%;
}
input::placeholder,
textarea::placeholder {
  color: var(--color-ink-faint);
}
thead th {
  background: var(--table-heading);
  color: var(--color-ink-muted);
}
tbody tr:hover {
  background: var(--row-hover);
}
.btn {
  text-decoration: none;
  justify-content: center;
}
.btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.btn-primary:hover {
  background: #066898;
  border-color: #066898;
}
[data-theme='dark'] .btn-primary {
  color: #062438;
}
[data-theme='dark'] .btn-primary:hover {
  background: #7dd3fc;
  border-color: #7dd3fc;
}
.theme-toggle {
  background: var(--color-surface);
  white-space: nowrap;
  padding: 10px 16px;
  box-shadow: var(--shadow-sm);
}
.admin-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.record-card {
  padding: 20px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.record-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}
.record-card h3 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-ink-muted);
}
.record-card svg {
  width: 38px;
  height: 38px;
  padding: 9px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--card-tint);
  stroke: var(--card-icon);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.record-card strong {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 1.6vw, 1.75rem);
  color: var(--color-ink);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.record-card p {
  font-size: 0.75rem;
  color: var(--color-ink-muted);
  margin-top: 7px;
}
@media (max-width: 1180px) {
  .admin-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 480px) {
  .admin-summary {
    grid-template-columns: 1fr;
  }
  .record-card {
    padding: 18px;
  }
}
@media print {
  .theme-toggle {
    display: none !important;
  }
  :root[data-theme] {
    --color-bg: #fff;
    --color-surface: #fff;
    --color-ink: #111;
    --color-ink-muted: #444;
    --table-heading: #eee;
    --color-border: #ccc;
    color-scheme: light;
  }
}

/* Filters share one row, with labels above their controls. */
.filter-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
  align-items: end;
}
.filter-row > label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  font-weight: 600;
}
.filter-row .admin-filter {
  max-width: none;
  width: 100%;
  min-width: 0;
  margin: 0;
  height: 46px;
}
html[data-page='reports'] .filter-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.sidebar-tools {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-tools .theme-toggle {
  width: 100%;
  background: var(--sidebar-bg-hover);
  color: #e5f5ff;
  border-color: #45657a;
  box-shadow: none;
}
.brand-mark {
  background: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
}
.brand-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 50%;
}
.customer-dialog {
  width: min(880px, 94vw);
  padding: 28px;
}
.customer-dialog h2 {
  margin-bottom: 12px;
}
.customer-section {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 18px;
  margin: 20px 0;
  min-width: 0;
}
.customer-section legend {
  font-family: var(--font-display);
  color: var(--color-primary-deep);
  font-weight: 800;
  padding: 0 8px;
}
.form-help,
.admin-form small {
  color: var(--color-ink-muted);
  font-size: 0.85rem;
  font-weight: 400;
}
.customer-section .admin-form input,
.customer-section .admin-form select {
  min-width: 0;
}
.admin-form label.checkbox-field {
  flex-direction: row;
  align-items: center;
  font-size: 0.9rem;
}
.admin-form .checkbox-field input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--color-primary);
}
.estimate-total {
  padding: 14px;
  background: var(--card-tint);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.estimate-total output {
  font-size: 1.3rem;
  font-weight: 800;
}
.customer-form-actions {
  position: sticky;
  bottom: -28px;
  padding: 16px 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}
.customer-form-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.customer-page-form .customer-form-actions {
  bottom: 0;
  z-index: 1;
}
.customer-page-form .customer-section:first-of-type {
  margin-top: 20px;
}
input[readonly] {
  background: var(--table-heading);
  color: var(--color-ink-muted);
}
.date-control {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--color-border-strong);
  border-radius: 9px;
  overflow: hidden;
  background: var(--color-surface);
}
.admin-form .date-control input {
  border: 0;
  border-radius: 0;
  min-width: 0;
  flex: 1;
  width: 100%;
}
.date-control input::-webkit-calendar-picker-indicator {
  display: none;
}
.date-picker-button {
  border: 0;
  border-left: 1px solid var(--color-border);
  background: var(--card-tint);
  color: var(--card-icon);
  width: 46px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.date-picker-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.calendar-dialog {
  width: min(360px, 92vw);
  padding: 20px;
}
.calendar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.calendar-heading h2 {
  font-size: 1rem;
}
.calendar-heading .btn {
  padding: 5px 13px;
  font-size: 1.3rem;
}
.calendar-weekdays,
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  text-align: center;
}
.calendar-weekdays {
  color: var(--color-ink-muted);
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.calendar-day {
  height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  font-size: 0.85rem;
}
.calendar-day:hover:not(:disabled) {
  background: var(--card-tint);
}
.calendar-day[aria-current='date'] {
  border-color: var(--color-primary);
}
.calendar-day.selected {
  background: var(--color-primary);
  color: #fff;
}
[data-theme='dark'] .calendar-day.selected {
  color: #062438;
}
.calendar-day:disabled {
  opacity: 0.35;
  cursor: default;
}
.calendar-actions {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-top: 18px;
}
.calendar-actions .btn {
  font-size: 0.8rem;
  padding: 7px 12px;
}
.calendar-actions .btn:disabled {
  opacity: 0.4;
  cursor: default;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.calendar-day:focus-visible,
.date-picker-button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
@media (max-width: 600px) {
  .filter-row,
  html[data-page='reports'] .filter-row {
    grid-template-columns: 1fr;
  }
  .customer-dialog {
    padding: 18px;
  }
  .customer-form-actions {
    bottom: -18px;
  }
}

/* Keep wide tables inside their own container instead of widening the page. */
@media screen {
  html.theme-teal .main-content-wrap {
    width: 100%;
    min-width: 0;
  }
  html.theme-teal .main-content {
    box-sizing: border-box;
    width: calc(100% - var(--sidebar-w));
    max-width: none;
  }
  .main-content .panel,
  .main-content .admin-body {
    min-width: 0;
  }
  .main-content .table-scroll,
  .main-content .table-wrap,
  .bill-preview-table {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }
  .main-content table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
  }
  .main-content th,
  .main-content td {
    overflow-wrap: anywhere;
  }
  .main-content thead th {
    white-space: normal;
  }
  #meterRows input {
    width: 100%;
    min-width: 90px;
    max-width: 130px;
    box-sizing: border-box;
  }
  .main-content table:has(#billRows) {
    min-width: 1120px;
  }
  .main-content table:has(#meterRows) {
    min-width: 920px;
  }
}
@media screen and (max-width: 860px) {
  html.theme-teal .main-content {
    width: 100%;
    margin-left: 0;
  }
  .main-content table {
    font-size: 0.78rem;
  }
  .main-content thead th,
  .main-content tbody td {
    padding: 12px 10px;
  }
}
@media screen and (max-width: 600px) {
  .main-content table.mobile-summary-table {
    min-width: 0;
    table-layout: fixed;
  }
  .main-content table.mobile-summary-table th,
  .main-content table.mobile-summary-table td {
    padding: 11px 7px;
    font-size: 0.72rem;
  }
  .main-content .mobile-summary-customers .customer-identity {
    min-width: 0;
  }
  .main-content .mobile-summary-customers .customer-identity > div {
    min-width: 0;
  }
  .main-content .mobile-summary-customers .customer-row-actions {
    flex-wrap: wrap;
  }
  .main-content .mobile-summary-table .payment-status,
  .main-content .mobile-summary-table .customer-status {
    white-space: normal;
  }
  .main-content .mobile-summary-payments tr > :last-child {
    width: 65px;
  }
  .main-content .mobile-summary-customers tr > :last-child {
    width: 90px;
  }
}

/* On phones, expand filters below the toolbar instead of over the table. */
@media screen and (max-width: 600px) {
  .payment-history-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px 8px;
  }
  .payment-history-toolbar .payment-history-search {
    min-width: 0;
    width: 100%;
  }
  .payment-history-toolbar .payment-history-search input {
    min-width: 0;
    width: 100%;
    height: 46px;
    font-size: 16px;
    box-sizing: border-box;
  }
  .payment-history-toolbar .payment-filter-dropdown {
    display: contents;
  }
  .payment-history-toolbar .payment-filter-dropdown > summary {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    height: 46px;
    box-sizing: border-box;
    padding: 10px;
    gap: 6px;
    white-space: nowrap;
  }
  .payment-history-toolbar .payment-filter-dropdown .payment-history-filters {
    position: static;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 14px;
    box-shadow: none;
  }
  .payment-filter-dropdown .payment-history-filters label {
    min-width: 0;
  }
  .payment-filter-dropdown .payment-history-filters input,
  .payment-filter-dropdown .payment-history-filters select {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    min-height: 46px;
    box-sizing: border-box;
    font-size: 16px;
  }
  .payment-filter-dropdown .payment-history-filters .btn {
    min-height: 44px;
    width: 100%;
  }
  .payment-filter-dropdown .filter-panel-close {
    min-width: 40px;
    min-height: 40px;
  }
  .payment-filter-dropdown .calendar-field {
    min-width: 0;
    max-width: 100%;
  }
}

.monthly-billing-panel {
  overflow: visible;
}
.monthly-billing-header {
  border-radius: 10px 10px 0 0;
  gap: 12px;
  flex-wrap: wrap;
}
.period-menu {
  position: relative;
  margin-left: auto;
}
.period-menu > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: 7px;
  background: var(--color-surface);
  color: var(--color-primary-deep);
  font-size: 0.8rem;
  cursor: pointer;
  list-style: none;
}
.period-menu > summary::-webkit-details-marker {
  display: none;
}
.period-menu summary svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}
.period-menu[open] summary {
  background: var(--card-tint);
}
.period-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 10;
  width: 250px;
  max-width: 75vw;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}
.period-menu-panel .btn {
  display: flex;
  width: 100%;
  justify-content: flex-start;
  margin-bottom: 8px;
  font-size: 0.8rem;
}
.period-menu-panel .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.period-menu-panel p {
  color: var(--color-ink-muted);
  font-size: 0.72rem;
  line-height: 1.5;
}
#billingProgressBar {
  width: min(240px, 100%);
  height: 7px;
  margin-top: 9px;
  accent-color: var(--color-primary);
}
.period-reason {
  display: grid;
  gap: 8px;
  font-size: 0.85rem;
  margin: 18px 0;
}
.period-reason textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: 7px;
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  resize: vertical;
}
@media (max-width: 600px) {
  .period-menu > summary {
    min-height: 44px;
  }
  .period-reason textarea {
    font-size: 16px;
  }
}

.water-rates-table tr > :nth-child(3) {
  border-left: 1px solid var(--color-border-strong);
}

.table-customer strong {
  display: block;
  font-size: 0.83rem;
}
.table-customer small {
  display: block;
  margin-top: 5px;
  font-size: 0.7rem;
  color: var(--color-ink-muted);
}

/* Tabular, ledger-style digits for currency amounts. */
:root {
  --font-money: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
}
.money-value,
.record-card strong.money-value,
#selectedCustomerBalance,
#profileBalance,
#profilePaid,
#collectedToday,
#collectedTotal,
#installationTotal,
#paymentForm input[name='amount'],
.rate-money-field input,
.rate-money-field > span,
#setupRate,
.receipt-details dd {
  font-family: var(--font-money);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.025em;
}

/* Always-visible filters beside each table search. */
.inline-record-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  align-items: start;
  gap: 14px;
  padding: 16px 0;
}
.inline-record-filter-fields {
  display: contents;
}
.inline-record-toolbar label {
  display: grid;
  gap: 8px;
  min-width: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-ink-muted);
  align-content: start;
  line-height: 1.5;
}
.inline-record-toolbar .admin-filter {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  min-height: 46px;
  height: 46px;
  border-radius: 7px;
}
.inline-record-toolbar .payment-history-search {
  grid-column: auto;
  width: auto;
  max-width: none;
}
.inline-record-toolbar .btn {
  min-height: 44px;
}
.inline-record-toolbar .date-control {
  width: 100%;
  min-width: 0;
  height: 46px;
  box-sizing: border-box;
  border-radius: 7px;
}
.inline-record-toolbar .date-control input {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
}
.inline-record-toolbar label > small {
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.5;
}
@media (max-width: 1000px) {
  .inline-record-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .inline-record-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }
  .inline-record-toolbar .admin-filter {
    font-size: 16px;
  }
}

/* Colored summary icons with neutral card surfaces. */
.record-card:nth-child(4n + 1) .record-card-top :is(svg, .bi) {
  color: #1685ba;
}
.record-card:nth-child(4n + 2) .record-card-top :is(svg, .bi) {
  color: #8b65cc;
}
.record-card:nth-child(4n + 3) .record-card-top :is(svg, .bi) {
  color: #c18122;
}
.record-card:nth-child(4n) .record-card-top :is(svg, .bi) {
  color: #238768;
}
.profile-summary > div:nth-child(1) .profile-icon {
  color: #c18122;
}
.profile-summary > div:nth-child(2) .profile-icon {
  color: #238768;
}
.profile-summary > div:nth-child(3) .profile-icon {
  color: #1685ba;
}
.profile-summary > div:nth-child(4) .profile-icon {
  color: #8b65cc;
}
.customer-metric:nth-child(1) .metric-symbol {
  color: #1685ba;
}
.customer-metric:nth-child(2) .metric-symbol {
  color: #238768;
}
.customer-metric:nth-child(3) .metric-symbol {
  color: #c18122;
}
.payment-history-summary .summary-label-with-icon {
  display: flex;
  align-items: center;
  gap: 8px;
}
.summary-label-with-icon svg {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
}
.payment-history-summary > div:nth-child(1) svg {
  color: #1685ba;
}
.payment-history-summary > div:nth-child(2) svg {
  color: #238768;
}
.payment-history-summary > div:nth-child(3) svg {
  color: #8b65cc;
}
[data-theme='dark'] .record-card-top :is(svg, .bi),
[data-theme='dark'] .summary-label-with-icon svg,
[data-theme='dark'] .profile-summary .profile-icon {
  filter: brightness(1.35);
}

.navigation-icon-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
}
.navigation-icon-control svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
@media print {
  .navigation-icon-control {
    display: none !important;
  }
}

.billing-navigation.section-tabs button svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Blue/teal secondary tones replace gray in the admin interface. */
:root {
  --color-ink-muted: #356c8b;
  --color-ink-faint: #427c9c;
  --color-border: #cce6f3;
  --color-border-strong: #94c5df;
}
:root[data-theme='dark'] {
  --color-ink-muted: #a3d7ef;
  --color-ink-faint: #88c5e1;
  --color-border: #225270;
  --color-border-strong: #377da1;
}
input::placeholder,
textarea::placeholder {
  color: var(--color-ink-muted);
  opacity: 1;
}
.pager-controls .btn:disabled,
.customer-form-actions .btn:disabled,
#recordPaymentButton:disabled {
  opacity: 1;
  color: var(--color-primary-deep);
  background: var(--card-tint);
  border-color: var(--color-border);
  box-shadow: none;
}
input[readonly] {
  background: var(--table-heading);
  color: var(--color-primary-deep);
}

/* One size and palette for table action icons. */
html body table .btn:has(svg) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  width: 40px;
  height: 40px;
  padding: 9px;
  color: var(--color-primary-deep);
  background: var(--card-tint);
  border: 1px solid var(--color-border-strong);
  border-radius: 7px;
}
html body table .btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
html body table .btn:has(svg):hover {
  color: var(--color-primary-deep);
  background: var(--table-heading);
  border-color: var(--color-primary);
}
@media (max-width: 600px) {
  html body table .btn:has(svg) {
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
  }
}

/* Shared sidebar icon font, including collapsed navigation. */
.sidebar-menu-item > .bi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  font-size: 20px;
  line-height: 1;
  color: inherit;
}

.sidebar-collapse .bi,
.sidebar-tools .btn .bi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  font-size: 19px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}
.sidebar-compact .sidebar-collapse .bi {
  transform: rotate(180deg);
}
.record-card-top > .bi,
.profile-summary .profile-icon,
.summary-label-with-icon > .bi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 8px;
  font-size: 21px;
  line-height: 1;
}
.record-card:nth-child(4n + 1) .record-card-top > .bi,
.profile-summary > div:nth-child(1) .profile-icon,
.summary-label-with-icon > .bi {
  color: #087de0;
  background: #e0f2ff;
}
.record-card:nth-child(4n + 2) .record-card-top > .bi,
.profile-summary > div:nth-child(2) .profile-icon {
  color: #8545e6;
  background: #f0e7ff;
}
.record-card:nth-child(4n + 3) .record-card-top > .bi,
.profile-summary > div:nth-child(3) .profile-icon {
  color: #e87808;
  background: #fff0d5;
}
.profile-summary > div:nth-child(3) .profile-icon {
  color: #087de0;
  background: #e1f2ff;
}
.record-card:nth-child(4n) .record-card-top > .bi,
.profile-summary > div:nth-child(4) .profile-icon {
  color: #079650;
  background: #ddf8e9;
}
[data-theme='dark'] .record-card-top > .bi,
[data-theme='dark'] .profile-summary .profile-icon,
[data-theme='dark'] .summary-label-with-icon > .bi {
  background: #153b50;
  filter: brightness(1.35);
}
@media (prefers-reduced-motion: reduce) {
  .sidebar-collapse .bi {
    transition: none;
  }
}

.payment-history-summary > div:nth-child(1) .bi {
  color: #079650;
  background: #ddf8e9;
}
.payment-history-summary > div:nth-child(2) .bi {
  color: #087de0;
  background: #e0f2ff;
}
.payment-history-summary > div:nth-child(3) .bi {
  color: #8545e6;
  background: #f0e7ff;
}

/* Compact dashboard overview heading. */
html[data-page='dashboard'] .dashboard-records-heading {
  padding: 14px 20px;
  min-height: 0;
}
html[data-page='dashboard'] .dashboard-records-heading h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.4;
}
@media (max-width: 600px) {
  html[data-page='dashboard'] .dashboard-records-heading {
    padding: 12px 16px;
  }
}

/* Consistent compact panel headings throughout the admin website. */
html.theme-teal .panel-header {
  padding: 14px 20px;
  min-height: 0;
}
html.theme-teal .panel-header h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.4;
}
.customer-overview .metric-symbol {
  color: #087de0;
  background: #e0f2ff;
}
.customer-overview .metric-symbol.verified {
  color: #079650;
  background: #ddf8e9;
}
.customer-overview .metric-symbol.pending {
  color: #db7308;
  background: #fff0d5;
}
.metric-symbol > .bi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 23px;
  line-height: 1;
}
#registryTitle > .bi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #087de0;
  background: #e0f2ff;
  font-size: 20px;
  flex-shrink: 0;
}
[data-theme='dark'] .customer-overview .metric-symbol,
[data-theme='dark'] #registryTitle > .bi {
  background: #153b50;
  filter: brightness(1.35);
}
@media (max-width: 600px) {
  html.theme-teal .panel-header {
    padding: 12px 16px;
  }
}

.billing-navigation :is(a, button) > .bi,
.profile-tabs [role='tab'] > .bi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  font-size: 18px;
  line-height: 1;
  color: inherit;
}

.btn > .bi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
}
html body table .btn:has(> .bi) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  color: var(--color-primary);
  background: var(--card-tint);
  border-color: var(--color-border-strong);
}
html body table .btn > .bi { font-size: 20px; }
@media (max-width: 600px) {
  html body table .btn:has(> .bi) {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }
}

/* Destructive actions remain distinct from view and edit controls. */
html body table .btn:is(.action-delete, :has(.bi-trash), :has(.bi-trash-fill)) {
  color: #dc2626;
  background: #fff1f2;
  border-color: #fecdd3;
}
html body table .btn:is(.action-delete, :has(.bi-trash), :has(.bi-trash-fill)):hover {
  color: #b91c1c;
  background: #ffe4e6;
  border-color: #fb7185;
}
html[data-theme='dark'] body table .btn:is(.action-delete, :has(.bi-trash), :has(.bi-trash-fill)) {
  color: #ff8c98;
  background: #45212d;
  border-color: #a94356;
}

/* View actions use teal to distinguish them from blue edit actions. */
html body table .btn:is(.action-view, .action-receipt, :has(> .bi-eye)) {
  color: #0f766e;
  background: #e6f7f5;
  border-color: #99d8d1;
}
html body table .btn:is(.action-view, .action-receipt, :has(> .bi-eye)):hover {
  color: #115e59;
  background: #ccfbf1;
  border-color: #5ebdb1;
}
html[data-theme='dark'] body table .btn:is(.action-view, .action-receipt, :has(> .bi-eye)) {
  color: #99f6e4;
  background: #123b39;
  border-color: #317b74;
}
html[data-theme='dark'] body table .btn:is(.action-view, .action-receipt, :has(> .bi-eye)):hover {
  color: #ccfbf1;
  background: #19504b;
  border-color: #5ebdb1;
}

/* Shared color for pagination and form navigation. */
html body :is(.pager-controls .btn, .step-navigation-button) {
  color: #ffffff;
  background: #087fb5;
  border: 1px solid #087fb5;
  opacity: 1;
}
html body :is(.pager-controls .btn, .step-navigation-button):hover:not(:disabled) {
  color: #ffffff;
  background: #06658f;
  border-color: #06658f;
}
html body :is(.pager-controls .btn, .step-navigation-button):disabled {
  color: #316e92;
  background: #dceefa;
  border-color: #a9d1e9;
  opacity: 1;
  cursor: not-allowed;
}
html[data-theme='dark'] body :is(.pager-controls .btn, .step-navigation-button):disabled {
  color: #94c8e7;
  background: #193e55;
  border-color: #38647e;
}

html body :is(.pager-controls .btn, .step-navigation-button):disabled,
html[data-theme='dark'] body :is(.pager-controls .btn, .step-navigation-button):disabled {
  color: #ffffff;
  background: #438cb3;
  border-color: #438cb3;
  opacity: 1;
  cursor: not-allowed;
}
