:root {
  --page-bg: #ffffff;
  --gray-head: #d9d9d9;
  --gray-border: #ececec;
  --yellow-row: #fff0a8;
  --yellow-row-hover: #ffe88a;
  --green-row: #a9f3b8;
  --green-row-hover: #91eaa4;
  --text: #111111;
  --muted: #666666;
  --danger: #f6b8b8;
}

html, body { min-height: 100%; }
body {
  background: var(--page-bg) !important;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
}

.navbar {
  background: #fff !important;
  border-bottom: 0 !important;
  box-shadow: none !important;
}
.navbar .btn { border-radius: 4px; box-shadow: none; }

main.container-fluid { max-width: 1600px; margin: 0 auto; }

.card {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
.card-header {
  background: transparent !important;
  border: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
.card-body {
  background: transparent;
  padding-left: 0;
  padding-right: 0;
}
.card-header strong,
.section-title {
  display: inline-block;
  background: var(--gray-head);
  border-radius: 9px;
  padding: 7px 16px;
  color: #000;
}

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: transparent;
  border-collapse: separate !important;
  border-spacing: 2px 4px !important;
  margin-bottom: 0;
}
.table > :not(caption) > * > * {
  border-bottom-width: 0 !important;
  padding: 6px 10px;
}
.table thead th {
  background: var(--gray-head) !important;
  color: #000 !important;
  font-weight: 700;
  text-align: center;
  border-radius: 0;
  white-space: nowrap;
}
.table thead th:first-child { border-radius: 9px 0 0 9px; }
.table thead th:last-child { border-radius: 0 9px 9px 0; }

.table tbody tr > td,
.table tbody tr > th,
.table tfoot tr > td,
.table tfoot tr > th {
  background: var(--yellow-row) !important;
  color: #000 !important;
}
.table tbody tr:nth-child(even) > td,
.table tbody tr:nth-child(even) > th {
  background: var(--green-row) !important;
}
.table tbody tr:hover > td,
.table tbody tr:hover > th { background: var(--yellow-row-hover) !important; }
.table tbody tr:nth-child(even):hover > td,
.table tbody tr:nth-child(even):hover > th { background: var(--green-row-hover) !important; }
.table tbody tr > td:first-child,
.table tbody tr > th:first-child,
.table tfoot tr > td:first-child,
.table tfoot tr > th:first-child { border-radius: 9px 0 0 9px; }
.table tbody tr > td:last-child,
.table tbody tr > th:last-child,
.table tfoot tr > td:last-child,
.table tfoot tr > th:last-child { border-radius: 0 9px 9px 0; }
.table .table-light > * { background: var(--gray-head) !important; }
.table-responsive { overflow: visible !important; }

.form-control,
.form-select {
  background: #fff;
  border: 1px solid #999;
  border-radius: 2px;
  color: #000;
  min-height: 32px;
  padding: 4px 8px;
  box-shadow: none !important;
}
.form-control:focus,
.form-select:focus {
  border-color: #4d7ac7;
  box-shadow: 0 0 0 1px #4d7ac7 !important;
}
.form-label { margin-bottom: 3px; color: #111; }

.btn {
  border-radius: 4px;
  font-weight: 500;
  box-shadow: none !important;
}
.btn-warning,
.btn-outline-warning {
  background: var(--yellow-row) !important;
  border-color: #d9c56e !important;
  color: #111 !important;
}
.btn-warning:hover,
.btn-outline-warning:hover { background: var(--yellow-row-hover) !important; }
.btn-success,
.btn-outline-success {
  background: var(--green-row) !important;
  border-color: #75c988 !important;
  color: #111 !important;
}
.btn-success:hover,
.btn-outline-success:hover { background: var(--green-row-hover) !important; }
.btn-outline-secondary {
  background: var(--gray-head) !important;
  border-color: #bcbcbc !important;
  color: #111 !important;
}
.btn-outline-danger {
  background: var(--danger) !important;
  border-color: #d98d8d !important;
  color: #611 !important;
}

.badge { border-radius: 4px; font-weight: 600; }
.badge.text-bg-success { background: var(--green-row) !important; color: #111 !important; }
.badge.text-bg-warning { background: var(--yellow-row) !important; color: #111 !important; }
.badge.text-bg-secondary { background: var(--gray-head) !important; color: #111 !important; }

.alert { border-radius: 8px; }
.alert-success { background: #d8f7df; border-color: #95d7a3; color: #17491f; }
.alert-warning { background: #fff5bd; border-color: #dfcb72; color: #594a00; }
.alert-danger { background: #f8d0d0; border-color: #dc9999; color: #671f1f; }

.chart-wrap {
  height: 360px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 9px;
  padding: 8px;
}

code { color: #2e6b3a; }
.text-body-secondary { color: var(--muted) !important; }

@media (max-width: 768px) {
  body { font-size: 13px; }
  main.container-fluid { padding-left: 10px !important; padding-right: 10px !important; }
  .navbar .container-fluid { padding-left: 10px !important; padding-right: 10px !important; }
  .table > :not(caption) > * > * { padding: 5px 7px; }
}

/* v1.0.14: compact payment filters and mobile two-row payments */
.payment-filter-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.filter-date-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
}
.filter-date-label .form-control { width: 145px; }
.table-filter-link { color: #0645ad; text-decoration: none; }
.table-filter-link:hover { text-decoration: underline; }
.payment-row-mobile { display: none; }
.mobile-label { display: none; }

@media (max-width: 768px) {
  .payment-filter-line {
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .active-filter-note { display: none; }
  .payment-row-desktop { display: none; }
  .payment-row-mobile {
    display: table-row;
  }

  /* Both mobile rows belong to one payment and must share one background. */
  .table tbody tr.payment-row-mobile.payment-pair-yellow > td {
    background: var(--yellow-row) !important;
  }
  .table tbody tr.payment-row-mobile.payment-pair-green > td {
    background: var(--green-row) !important;
  }
  .table tbody tr.payment-row-mobile.payment-pair-yellow:hover > td {
    background: var(--yellow-row-hover) !important;
  }
  .table tbody tr.payment-row-mobile.payment-pair-green:hover > td {
    background: var(--green-row-hover) !important;
  }
  .payment-row-mobile td {
    width: 16.666%;
    min-width: 0;
    padding: 5px 4px !important;
    font-size: 11px;
    text-align: center;
    overflow-wrap: anywhere;
  }
  .payment-row-mobile-top td:first-child { border-radius: 9px 0 0 0 !important; }
  .payment-row-mobile-top td:last-child { border-radius: 0 9px 0 0 !important; }
  .payment-row-mobile-bottom td:first-child { border-radius: 0 0 0 9px !important; }
  .payment-row-mobile-bottom td:last-child { border-radius: 0 0 9px 0 !important; }
  .mobile-label {
    display: block;
    font-size: 9px;
    line-height: 1.1;
    color: #666;
    margin-bottom: 2px;
  }
  .payment-row-mobile form { margin: 0; }
  .payment-row-mobile .btn { padding: 2px 4px; font-size: 10px; }
}
@media (max-width: 768px) {
  .card:has(.payment-row-mobile) thead,
  .payment-total-row { display: none; }
}

/* v1.0.17: compact delete controls and finance day separators */
.btn-delete-compact {
  width: 25px;
  min-width: 25px;
  height: 25px;
  padding: 0 !important;
  line-height: 21px;
  font-size: 17px;
  font-weight: 700;
  border-radius: 5px;
}
.finance-day-separator > th {
  padding: 5px 10px !important;
  background: var(--gray-head) !important;
  color: #444;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  border-top: 6px solid #fff !important;
  border-bottom: 1px solid #bdbdbd !important;
}

.admin-footer { margin-top: 24px; }
.admin-footer .btn { min-width: 92px; }

/* v1.0.24: mobile filter dates and mobile totals */
.filter-date-row {
  display: contents;
}
.payment-total-mobile {
  display: none;
}

@media (max-width: 768px) {
  .payment-filter-line {
    flex-wrap: wrap;
    overflow-x: visible;
    white-space: normal;
  }
  .payment-filter-line > .btn-group {
    overflow-x: auto;
    max-width: 100%;
    white-space: nowrap;
  }
  .filter-date-row {
    display: flex;
    flex: 0 0 100%;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    padding-top: 3px;
  }
  .filter-date-row .filter-date-label {
    flex: 1 1 135px;
  }
  .filter-date-row .filter-date-label .form-control {
    width: 100%;
    min-width: 0;
  }
  .payment-total-mobile {
    display: table-row;
  }
  .table tbody tr.payment-total-mobile > td {
    background: var(--gray-head) !important;
    border-radius: 9px !important;
    padding: 8px !important;
    text-align: left;
  }
  .payment-total-mobile td span {
    display: block;
    margin-top: 3px;
  }
}


/* v1.0.26: highlighted chart totals and white separators on Out */
.chart-summary-metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.chart-summary-metrics > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: 1px solid #d7c66d;
  border-radius: 7px;
  background: #fff4b8;
  color: #3f3a20;
}
.chart-summary-metrics > span:nth-child(2) {
  border-color: #9cc9a6;
  background: #dff3e3;
  color: #244a2d;
}
.chart-summary-metrics > span:nth-child(3) {
  border-color: #c9c9c9;
  background: #f2f2f2;
  color: #404040;
}
.out-page .finance-day-separator > th {
  background: #fff !important;
}
@media (max-width: 768px) {
  .chart-summary-metrics { gap: 5px; }
  .chart-summary-metrics > span {
    width: 100%;
    justify-content: space-between;
    padding: 5px 8px;
  }
}
