:root {
  --app-sidebar-width: 15rem;
  --statement-excluded-bg: #eaeff4;
  --statement-excluded-border: #d6dfe8;
}

body {
  background-color: #f8f9fa;
}

main {
  max-width: 960px;
}

.app-skip-link {
  position: fixed;
  top: .5rem;
  left: .5rem;
  z-index: 1100;
  padding: .75rem;
  background: #fff;
}

.app-header {
  min-height: 60px;
}

.app-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
}

.app-sidebar {
  --bs-offcanvas-width: min(var(--app-sidebar-width), 85vw);
  background: #fff !important;
}

.app-sidebar .offcanvas-header {
  display: flex;
  min-height: 60px;
  border-bottom: 1px solid #dee2e6;
}

.app-sidebar .offcanvas-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
}

.app-sidebar .nav-link {
  min-height: 44px;
  display: flex;
  align-items: center;
}

.app-account {
  border-top: 1px solid #dee2e6;
}

.app-username {
  overflow-wrap: anywhere;
}

@media (min-width: 992px) {
  .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--app-sidebar-width);
    height: 100dvh;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #dee2e6;
  }

  .app-sidebar .offcanvas-body {
    flex-grow: 1;
    min-height: 0;
    padding: 1rem;
    background: #fff !important;
  }

  .app-authenticated .app-content {
    margin-left: var(--app-sidebar-width);
  }

  .app-authenticated .review-totals {
    left: var(--app-sidebar-width);
  }
}

.registration-dialog {
  width: min(calc(100% - 2rem), 30rem);
  max-height: calc(100% - 2rem);
  overflow-y: auto;
  padding: 1.5rem;
  border: 1px solid #cbd5e1;
  border-radius: .75rem;
}

.registration-dialog::backdrop {
  background: rgb(15 23 42 / 45%);
}

.registration-selection {
  max-width: 30rem;
  padding: 1.5rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: .75rem;
}

.registration-choices {
  display: grid;
  gap: .75rem;
}

.registration-choice {
  display: grid;
  gap: .4rem;
  padding: 1rem;
  border: 1px solid #cbd5e1;
  border-radius: .6rem;
  color: #0f172a;
  text-decoration: none;
}

.registration-choice span {
  color: #64748b;
  font-size: .875rem;
}

.registration-choice:hover,
.registration-choice:focus-visible {
  border-color: #0d6efd;
  background: #f8fafc;
  color: #0d6efd;
}

.statement-filters {
  padding: .75rem 1rem;
  border: 1px solid #dee2e6;
  border-radius: .5rem;
  background: #fff;
}

.statement-filters summary {
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
}

.list-filter-field {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: .75rem;
  align-items: center;
}

.statement-list-panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: .8rem;
  box-shadow: 0 1px 2px rgb(15 23 42 / 3%);
}

.statement-list-table {
  --bs-table-bg: #fff;
  --bs-table-border-color: #f1f5f9;
  margin-bottom: 0;
  color: #1e293b;
  font-size: .875rem;
}

.statement-list-table thead th {
  color: #475569;
  border-bottom-color: #e2e8f0;
}

.statement-list-table tbody tr:last-child > * {
  border-bottom: 0;
}

.statement-list-table th,
.statement-list-table td {
  white-space: nowrap;
  padding: .75rem;
}

.statement-list-table th a {
  display: inline-block;
  padding: .35rem 0;
  color: inherit;
  text-decoration: none;
}

.statement-list-table th a:hover {
  color: #0d6efd;
}

.statement-sort-icon {
  width: 15px;
  height: 15px;
  color: #64748b;
  stroke-width: 1.8;
  margin-left: .15rem;
  vertical-align: .05em;
}

.statement-list-table .text-end {
  font-variant-numeric: tabular-nums;
}

#item-forms[data-initialized="true"] .item-delete-fallback,
.item-form[hidden] {
  display: none;
}

.review-totals {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 960px;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: center;
  gap: .5rem 1rem;
  margin: 0 auto;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid #cbd5e1;
  box-shadow: 0 -3px 12px rgb(15 23 42 / 6%);
}

.review-editor {
  padding-bottom: 9rem;
}

.review-section-heading {
  position: sticky;
  top: 0;
  z-index: 5;
  margin-bottom: 1rem;
  padding: .85rem 0;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
}

.review-totals .review-save {
  padding-left: .5rem;
}

.review-totals > div {
  text-align: right;
  overflow-wrap: anywhere;
}

.review-totals span {
  display: block;
  color: #64748b;
  font-size: .75rem;
}

.review-totals strong {
  font-variant-numeric: tabular-nums;
  font-size: clamp(.95rem, 2.5vw, 1.25rem);
}

.review-totals small {
  margin-left: .25rem;
  color: #64748b;
}

.review-totals > p,
.review-totals > noscript {
  grid-column: 1 / -1;
}

.review-total-toggle {
  border: 0;
  padding: 0 .25rem;
  background: transparent;
  color: #0d6efd;
  text-decoration: underline;
  min-height: 2rem;
}

.review-totals .review-total-details {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding-top: .5rem;
  border-top: 1px solid #e2e8f0;
  font-size: .8rem;
}

.review-totals [hidden] {
  display: none !important;
}

@media (max-width: 575.98px) {
  .review-totals {
    gap: .4rem .5rem;
    padding: .65rem .75rem calc(.65rem + env(safe-area-inset-bottom));
  }
  .review-totals span {
    font-size: .65rem;
  }
  .review-totals strong {
    display: inline-block;
    max-width: 100%;
    font-size: 1.013rem;
    white-space: nowrap;
  }
  .review-totals small {
    display: inline;
    margin-left: .15rem;
    font-size: .65rem;
  }
  .review-totals > .review-total-earning,
  .review-totals > .review-total-deduction,
  .review-totals > .review-total-net {
    white-space: nowrap;
  }
  .review-totals .review-save {
    padding-left: .5rem;
  }
  .review-save .btn {
    min-height: 44px;
    min-width: 64px;
    padding: .4rem .9rem;
    font-size: .85rem;
    white-space: nowrap;
  }
  .review-totals.is-compact {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .review-totals.is-compact > .review-total-earning,
  .review-totals.is-compact > .review-total-deduction {
    display: none;
  }
  .review-totals.is-compact .review-total-net strong {
    white-space: normal;
  }
  .review-totals.is-compact > .review-total-net {
    white-space: normal;
  }
  .review-total-details strong {
    display: inline;
    white-space: normal;
  }
  .review-editor {
    padding-bottom: 12rem;
  }
}

.item-field-row {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: .4rem .75rem;
  align-items: center;
}

.item-field-row .form-label,
.item-field-row .form-check-label {
  margin: 0;
  font-size: .875rem;
}

.item-field-row .form-switch {
  padding-left: 0;
}

.item-field-row .form-switch .form-check-input {
  margin-left: 0;
}

.item-field-row > [role="alert"] {
  grid-column: 2;
}

.item-field-row > .field-help {
  grid-column: 2;
}

.item-field-row[hidden] {
  display: none;
}

.save-confirmation-dialog {
  width: min(calc(100% - 2rem), 36rem);
  max-height: calc(100% - 2rem);
  overflow-y: auto;
  padding: 1.5rem;
  border: 1px solid #cbd5e1;
  border-radius: .75rem;
}

.save-confirmation-dialog::backdrop {
  background: rgb(15 23 42 / 45%);
}

.save-confirmation-summary > div {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: .75rem;
  margin-bottom: .5rem;
}

.save-confirmation-summary > div[hidden] {
  display: none;
}

.save-confirmation-summary dt {
  font-size: .875rem;
  font-weight: normal;
}

.save-confirmation-summary dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 359.98px) {
  .item-field-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .item-field-row > [role="alert"] {
    grid-column: 1;
  }
  .item-field-row > .field-help {
    grid-column: 1;
  }
}

.statement-items th {
  font-weight: 400;
}

.statement-items th,
.statement-items td {
  padding: .65rem .75rem;
  vertical-align: middle;
}

.statement-item-value {
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.statement-items .statement-item-excluded > * {
  --bs-table-bg: var(--statement-excluded-bg);
  color: #526070;
}

.statement-items tfoot > tr > * {
  border-top: 2px solid #adb5bd;
  border-bottom: 0;
  padding-top: .85rem;
  font-weight: 600;
}

.statement-excluded-key {
  display: inline-block;
  width: .85rem;
  height: .85rem;
  margin-right: .4rem;
  background: var(--statement-excluded-bg);
  border: 1px solid #cbd3dc;
  vertical-align: -.1rem;
}
