:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #607089;
  --line: #dce3ee;
  --brand: #0d766e;
  --brand-dark: #085f58;
  --warn: #a15c05;
  --danger: #b42318;
  --ok: #067647;
  --shadow: 0 14px 36px rgba(27, 39, 62, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  align-self: start;
  background: #101827;
  color: #e9eef7;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 18px;
  position: sticky;
  top: 0;
}

.sidebar-head {
  display: block;
}

.brand {
  align-items: center;
  display: flex;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 24px;
  min-width: 0;
}

.brand img {
  flex: 0 0 auto;
  height: 34px;
  width: 120px;
}

.brand span {
  color: #cbd5e1;
  display: block;
  font-size: 12px;
  font-weight: 700;
  max-width: 72px;
  overflow-wrap: anywhere;
}

.mobile-menu-toggle {
  display: none;
}

.mobile-menu-icon {
  border-bottom: 2px solid currentColor;
  border-top: 2px solid currentColor;
  height: 12px;
  position: relative;
  width: 18px;
}

.mobile-menu-icon::before {
  background: currentColor;
  content: "";
  height: 2px;
  left: 0;
  position: absolute;
  right: 0;
  top: 3px;
}

.nav {
  display: grid;
  gap: 10px;
}

.nav-group {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 10px;
  position: relative;
}

.nav-group:first-child {
  border-top: 0;
  padding-top: 0;
}

.nav-toggle {
  align-items: center;
  color: #7dd3c7;
  cursor: pointer;
  display: flex;
  font-size: 11px;
  font-weight: 800;
  justify-content: space-between;
  letter-spacing: 0;
  line-height: 1;
  padding: 4px 12px 7px;
  text-align: left;
  text-transform: uppercase;
  width: 100%;
}

.nav-toggle:hover,
.nav-toggle:focus-visible,
.nav-group.open .nav-toggle {
  color: #b6fff2;
}

.nav-toggle:focus-visible {
  border-radius: 8px;
  outline: 2px solid rgba(125, 211, 199, 0.55);
  outline-offset: 2px;
}

.nav-chevron {
  border-bottom: 2px solid currentColor;
  border-right: 2px solid currentColor;
  height: 7px;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  width: 7px;
}

.nav-group.open .nav-chevron {
  transform: rotate(225deg);
}

.nav-links {
  display: grid;
  gap: 2px;
  list-style: none;
  margin: 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0 0 0 10px;
  pointer-events: none;
  transform: translateY(-4px);
  transition: max-height 0.26s ease, opacity 0.18s ease, transform 0.22s ease;
}

.nav-group.open .nav-links {
  max-height: 560px;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.nav-links::before {
  background: rgba(125, 211, 199, 0.22);
  bottom: 6px;
  content: "";
  left: 12px;
  position: absolute;
  top: 36px;
  width: 1px;
}

.nav-links li {
  display: block;
  width: 100%;
}

.nav a {
  align-items: center;
  color: #cbd5e1;
  border-radius: 8px;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 8px 12px 8px 18px;
  position: relative;
  text-decoration: none;
  width: 100%;
}

.nav a > span:first-child {
  min-width: 0;
}

.nav-count {
  background: #fef3c7;
  border: 1px solid rgba(251, 191, 36, 0.55);
  border-radius: 999px;
  color: #92400e;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  min-width: 24px;
  padding: 4px 6px;
  text-align: center;
}

.nav-group .nav-links li {
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.nav-group.open .nav-links li {
  opacity: 1;
  transform: translateX(0);
  transition-delay: calc(var(--nav-item-index, 0) * 35ms);
}

.nav-group .nav-links a::before {
  background: rgba(125, 211, 199, 0.6);
  border-radius: 999px;
  content: "";
  height: 4px;
  left: 4px;
  opacity: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
}

.nav-group .nav-links a.active::before,
.nav-group .nav-links a:hover::before {
  opacity: 1;
}

.nav a.active,
.nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.content {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 16px;
}

.cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
}

.card {
  padding: 16px;
}

.metric {
  font-size: 28px;
  font-weight: 800;
  margin-top: 6px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actions-cell {
  min-width: 280px;
  white-space: normal;
}

.bank-search-cell {
  min-width: 260px;
}

.inline-form {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  margin: 0;
  vertical-align: middle;
}

.actions-cell select {
  min-width: 190px;
  max-width: 280px;
  padding: 7px 9px;
}

.bank-match-form {
  align-items: center;
  flex-wrap: wrap;
}

.bank-match-search-label {
  color: #35445c;
  display: inline-grid;
  font-size: 12px;
  font-weight: 800;
  gap: 3px;
}

.bank-match-select-search {
  min-width: 220px;
  max-width: 260px;
  padding: 8px 10px;
  width: 100%;
}

.bank-match-search-count {
  font-size: 12px;
  min-width: 48px;
}

.bank-transactions-table {
  table-layout: fixed;
  width: 100%;
}

.bank-transactions-table th,
.bank-transactions-table td {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}

.bank-transactions-table th:nth-child(1),
.bank-transactions-table td:nth-child(1) {
  width: 44px;
}

.bank-transactions-table th:nth-child(2),
.bank-transactions-table td:nth-child(2) {
  width: 132px;
}

.bank-transactions-table th:nth-child(4),
.bank-transactions-table td:nth-child(4) {
  width: 118px;
}

.bank-transactions-table th:nth-child(6),
.bank-transactions-table td:nth-child(6) {
  width: 96px;
}

.bank-transactions-table th:nth-child(7),
.bank-transactions-table td:nth-child(7) {
  display: none;
}

.bank-transactions-table th:nth-child(8),
.bank-transactions-table td:nth-child(8) {
  width: 150px;
}

.bank-transactions-table .bank-date-column {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.4;
  white-space: nowrap;
}

.bank-transactions-table .bank-description-column {
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  width: 40%;
}

.bank-select-cell {
  text-align: center;
}

.bank-select-cell input[type="checkbox"] {
  height: 18px;
  margin: 0;
  width: 18px;
}

.bank-bulk-actions {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  display: none;
  gap: 12px;
  justify-content: flex-end;
  margin: 12px 0;
  padding: 10px 12px;
}

.bank-bulk-actions.active {
  display: flex;
}

.bank-bulk-actions span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin-right: auto;
}

.bank-transactions-table .amount {
  white-space: normal;
}

.bank-transactions-table .bank-search-cell,
.bank-transactions-table .actions-cell {
  min-width: 0;
}

.bank-transactions-table .bank-match-form {
  align-items: stretch;
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(0, 1fr);
  max-width: 100%;
}

.bank-transactions-table .bank-match-search-label,
.bank-transactions-table .inline-form,
.bank-transactions-table .bank-match-form select,
.bank-transactions-table .bank-match-select-search,
.bank-transactions-table .bank-match-search-count {
  min-width: 0;
  max-width: 100%;
}

.bank-transactions-table .bank-match-form select,
.bank-transactions-table .bank-match-select-search {
  width: 100%;
}

.bank-match-row {
  cursor: pointer;
}

.bank-match-row:hover,
.bank-match-row.open {
  background: #f8fbfc;
}

.bank-match-row:focus {
  outline: 2px solid rgba(13, 118, 110, 0.28);
  outline-offset: -2px;
}

.bank-match-detail {
  display: none;
}

.bank-match-detail.open {
  animation: bankDrawerIn 0.18s ease;
  background: #fff;
  bottom: 0;
  box-shadow: -18px 0 42px rgba(16, 24, 39, 0.22);
  display: block;
  max-width: 100vw;
  overflow-y: auto;
  position: fixed;
  right: 0;
  top: 0;
  width: min(720px, calc(100vw - 24px));
  z-index: 120;
}

@keyframes bankDrawerIn {
  from {
    opacity: 0.92;
    transform: translateX(28px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.bank-match-detail td {
  background: #fff;
  padding: 0;
}

.bank-match-detail.open td {
  border: 0;
  display: block;
  min-height: 100%;
}

.bank-drawer-backdrop {
  background: rgba(16, 24, 39, 0.42);
  bottom: 0;
  left: 0;
  opacity: 0;
  position: fixed;
  right: 0;
  top: 0;
  transition: opacity 0.18s ease;
  z-index: 110;
}

.bank-drawer-backdrop.open {
  opacity: 1;
}

body.bank-drawer-active {
  overflow: hidden;
}

.bank-pagination {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
}

.bank-pagination-summary {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.bank-pagination-summary > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.bank-pagination-summary form,
.bank-pagination-summary label {
  align-items: center;
  display: flex;
  gap: 7px;
}

.bank-pagination-summary label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.bank-pagination-summary select {
  min-width: 76px;
  padding: 7px 28px 7px 9px;
}

.bank-pagination-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bank-pagination-links .button {
  justify-content: center;
  min-width: 38px;
  padding: 8px 10px;
}

.bank-suggestions {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  margin-top: 2px;
  padding: 12px;
}

.bank-suggestions-head {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}

.bank-nearest-matches {
  scroll-margin-top: 14px;
}

.bank-suggestions-head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.bank-drawer-close {
  flex: 0 0 auto;
}

.bank-match-detail.open .bank-suggestions {
  border: 0;
  border-radius: 0;
  margin: 0;
  min-height: 100vh;
  padding: 18px;
}

.bank-match-detail.open .bank-option-grid,
.bank-match-detail.open .bank-create-grid {
  grid-template-columns: 1fr;
}

.bank-match-detail.open .bank-expanded-controls {
  grid-template-columns: minmax(0, 1fr) auto;
}

.bank-transaction-summary {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  padding: 12px;
}

.bank-transaction-summary div {
  display: grid;
  gap: 3px;
}

.bank-transaction-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.bank-transaction-summary .wide {
  grid-column: 1 / -1;
}

.bank-drawer-tabs {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(16, 24, 39, 0.08);
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 6px;
  position: sticky;
  top: 0;
  z-index: 4;
}

.bank-drawer-tab {
  background: #f8fbfc;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--ink);
  font-weight: 800;
  min-height: 40px;
  padding: 9px 10px;
}

.bank-drawer-tab.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.bank-drawer-tab:focus-visible {
  outline: 2px solid rgba(13, 118, 110, 0.3);
  outline-offset: 2px;
}

.bank-drawer-section {
  background: #f8fbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 12px;
}

.bank-drawer-section[hidden] {
  display: none !important;
}

.bank-drawer-section-manual {
  background: #fffaf2;
}

.bank-section-title {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 3px;
  padding-bottom: 10px;
}

.bank-section-title h3 {
  font-size: 16px;
  margin: 0;
}

.bank-match-transaction-grid,
.bank-manual-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

.bank-option-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(280px, 1.4fr) minmax(240px, 1fr) minmax(220px, 0.8fr);
}

.bank-option-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.bank-option-card h3 {
  font-size: 15px;
  margin: 0;
}

.bank-option-card p {
  margin: 0;
}

.bank-categorize-form {
  display: grid;
  gap: 8px;
}

.party-combo {
  position: relative;
}

.party-combo-input {
  width: 100%;
}

.party-combo-list {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  left: 0;
  max-height: 260px;
  overflow-y: auto;
  padding: 5px;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 180;
}

.party-combo-option {
  background: transparent;
  border-radius: 6px;
  color: var(--ink);
  display: block;
  font-weight: 700;
  justify-content: flex-start;
  min-height: 34px;
  padding: 7px 9px;
  text-align: left;
  width: 100%;
}

.party-combo-option:hover,
.party-combo-option.active {
  background: #eef7f5;
  color: var(--brand-dark);
}

.party-combo-option mark {
  background: #fff1a6;
  border-radius: 3px;
  color: inherit;
  padding: 0 1px;
}

.party-combo-option.active mark {
  background: rgba(255, 255, 255, 0.75);
}

.party-combo-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 9px;
}

.bank-create-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bank-create-links span {
  flex-basis: 100%;
  font-size: 12px;
  font-weight: 800;
}

.bank-create-links .button {
  min-height: 32px;
  padding: 7px 10px;
}

.bank-create-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.bank-create-grid form {
  background: #f8fbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.bank-expanded-search {
  display: grid;
  gap: 10px;
}

.bank-expanded-controls {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(180px, 1fr) auto auto;
}

.bank-fx-panel {
  background: #f8fbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.bank-fx-panel h4 {
  font-size: 13px;
  margin: 0;
}

.bank-fx-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bank-fx-summary {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.bank-fx-summary span {
  background: #eef7f5;
  border: 1px solid #c8e5df;
  border-radius: 999px;
  color: #35524d;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  padding: 4px 8px;
}

.bank-fx-summary .bank-fx-result.gain {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: var(--ok);
}

.bank-fx-summary .bank-fx-result.loss {
  background: #fee2e2;
  border-color: #fecaca;
  color: var(--danger);
}

.bank-suggestion-list {
  display: grid;
  gap: 8px;
}

.bank-suggestion {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px;
}

.bank-suggestion-title {
  font-weight: 800;
}

.bank-suggestion-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.bank-current-split-list {
  display: grid;
  gap: 5px;
}

.bank-current-split-list span {
  color: var(--muted);
  font-size: 13px;
}

.bank-split-match-form {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding-top: 12px;
}

.bank-split-match-head {
  display: grid;
  gap: 3px;
}

.bank-split-match-head strong,
.bank-split-match-head span {
  display: block;
}

.bank-split-match-list {
  display: grid;
  gap: 8px;
}

.bank-split-search-results {
  background: #f8fbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.bank-split-search-results-title {
  font-size: 13px;
}

.bank-split-search-options {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.bank-split-search-summary {
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding-top: 8px;
}

.bank-split-search-summary span {
  color: var(--muted);
  font-size: 13px;
}

.bank-split-search-summary strong {
  color: var(--ink);
}

.bank-split-search-option {
  align-items: flex-start;
  cursor: pointer;
  display: flex;
  font-size: 13px;
  font-weight: 700;
  gap: 8px;
  line-height: 1.35;
}

.bank-split-search-option input {
  flex: 0 0 auto;
  margin-top: 2px;
  width: auto;
}

.bank-split-match-item {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) minmax(116px, 150px) auto;
  padding: 10px;
}

.bank-split-match-choice {
  align-items: flex-start;
  display: flex;
  gap: 8px;
  min-width: 0;
}

.bank-split-match-choice input {
  flex: 0 0 auto;
  margin-top: 3px;
  width: auto;
}

.bank-split-match-choice span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.bank-split-match-choice small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.bank-split-match-amount {
  font-size: 12px;
  min-width: 0;
}

.bank-split-match-amount input {
  min-width: 0;
  padding: 8px 9px;
}

.bank-split-match-item > a {
  font-size: 13px;
  font-weight: 800;
}

.bank-split-match-footer {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  justify-content: space-between;
}

.bank-split-match-footer > span {
  font-size: 13px;
}

.bank-split-match-footer button {
  margin-left: auto;
}

.subscription-form {
  flex-wrap: wrap;
}

.subscription-form input,
.subscription-form select {
  width: auto;
  min-width: 120px;
}

.check-inline {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.check-inline input {
  width: auto;
}

.tds-summary {
  align-self: end;
  background: #eef7f5;
  border: 1px solid #c8e5df;
  border-radius: 8px;
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 10px 12px;
}

.tds-summary span {
  color: var(--muted);
  font-size: 13px;
}

.tds-summary strong {
  font-size: 18px;
}

.list-search {
  align-items: end;
  background: #f8fbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1fr) 150px 150px auto;
  margin-bottom: 14px;
  padding: 12px;
}

.contact-search {
  grid-template-columns: minmax(220px, 1fr) 160px 150px 150px auto;
}

.bank-transaction-search {
  grid-template-columns: minmax(240px, 2fr) minmax(130px, 1fr) minmax(130px, 1fr) minmax(170px, 1fr);
}

.audit-search {
  grid-template-columns: minmax(220px, 1.2fr) 150px 150px minmax(180px, .9fr) auto;
}

.list-search-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

button,
.button {
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 13px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

button:hover,
.button:hover {
  background: var(--brand-dark);
  text-decoration: none;
}

.button.secondary,
button.secondary {
  background: #e8eef7;
  color: var(--ink);
}

.button.danger,
button.danger {
  background: var(--danger);
}

.button.link,
button.link {
  background: transparent;
  color: var(--brand);
  min-height: auto;
  padding: 0 4px;
}

button.link.danger {
  color: var(--danger);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 10px 11px;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: #35445c;
  font-size: 14px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.full {
  grid-column: 1 / -1;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 9px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #41516b;
  font-size: 13px;
}

.amount {
  text-align: right;
  white-space: nowrap;
}

.badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
  text-transform: uppercase;
}

.badge.paid {
  background: #dcfce7;
  color: var(--ok);
}

.badge.sent,
.badge.partial {
  background: #fef3c7;
  color: var(--warn);
}

.badge.draft,
.badge.unpaid {
  background: #eef2ff;
  color: #4338ca;
}

.badge.matched {
  background: #dcfce7;
  color: var(--ok);
}

.badge.active {
  background: #dcfce7;
  color: var(--ok);
}

.badge.accountant {
  background: #dcfce7;
  color: var(--ok);
}

.badge.owner {
  background: #e0f2fe;
  color: #0369a1;
}

.badge.user {
  background: #eef2ff;
  color: #4338ca;
}

.badge.system {
  background: #f2f4f7;
  color: #475467;
}

.badge.trial {
  background: #e0f2fe;
  color: #0369a1;
}

.badge.suspended,
.badge.expired {
  background: #fee2e2;
  color: var(--danger);
}

.badge.suggested {
  background: #fef3c7;
  color: var(--warn);
}

.badge.unmatched {
  background: #f2f4f7;
  color: #475467;
}

.badge.excluded {
  background: #fef3c7;
  color: #92400e;
}

.notice {
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 12px 14px;
}

.notice.error {
  background: #fee4e2;
  color: var(--danger);
}

.notice.success {
  background: #dcfce7;
  color: var(--ok);
}

.auth-wrap {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 22px;
}

.auth-panel {
  width: min(460px, 100%);
}

.business-choice-panel {
  width: min(760px, 100%);
}

.business-choice-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.business-choice {
  align-items: center;
  background: #f8fbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  padding: 12px;
}

.business-choice strong,
.business-choice span {
  display: block;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-top: 14px;
}

.legal-copy {
  color: #35445c;
  display: grid;
  font-size: 14px;
  gap: 10px;
  line-height: 1.55;
  max-height: 56vh;
  overflow-y: auto;
}

.legal-checks {
  display: grid;
  gap: 10px;
}

.legal-checks label {
  align-items: start;
  display: grid;
  font-weight: 600;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr);
  line-height: 1.35;
}

.legal-checks input {
  margin-top: 3px;
  width: auto;
}

.invoice-lines {
  display: grid;
  gap: 8px;
}

.invoice-line {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 88px 120px 100px;
  gap: 8px;
}

.print-only {
  display: none;
}

.chatbot {
  bottom: 20px;
  position: fixed;
  right: 20px;
  z-index: 50;
}

.chatbot-toggle {
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(13, 118, 110, 0.28);
  gap: 8px;
  min-width: 58px;
}

.chatbot-toggle span:first-child {
  align-items: center;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  display: inline-flex;
  font-weight: 900;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.chatbot-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  bottom: 58px;
  box-shadow: 0 18px 46px rgba(23, 32, 51, 0.18);
  display: none;
  overflow: hidden;
  position: absolute;
  right: 0;
  width: min(360px, calc(100vw - 32px));
}

.chatbot.open .chatbot-panel {
  display: block;
}

.chatbot-header {
  align-items: center;
  background: #101827;
  color: #fff;
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
}

.chatbot-header span {
  color: #cbd5e1;
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.chatbot-close {
  background: transparent;
  color: #fff;
  min-height: 30px;
  padding: 4px 8px;
}

.chatbot-messages {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding: 12px;
}

.chatbot-message {
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  padding: 9px 10px;
}

.chatbot-message.bot {
  background: #eef6f5;
  color: #193c38;
  justify-self: start;
}

.chatbot-message.user {
  background: #172033;
  color: #fff;
  justify-self: end;
}

.chatbot-suggestions {
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
}

.chatbot-suggestions button {
  background: #e8eef7;
  color: var(--ink);
  font-size: 12px;
  min-height: 30px;
  padding: 6px 9px;
}

.chatbot-form {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 12px;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
    max-height: none;
    overflow: visible;
    padding: 12px 14px;
    position: sticky;
    top: 0;
    z-index: 80;
  }

  .sidebar-head {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
  }

  .brand {
    margin-bottom: 0;
  }

  .mobile-menu-toggle {
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    display: inline-flex;
    flex: 0 0 auto;
    gap: 8px;
    min-height: 36px;
    padding: 8px 10px;
  }

  .mobile-menu-toggle[aria-expanded="true"] {
    background: var(--brand);
  }

  .nav {
    display: none;
    gap: 6px;
    margin-top: 12px;
    max-height: calc(100vh - 72px);
    overflow-y: auto;
    padding-top: 10px;
  }

  .sidebar.menu-open .nav {
    display: grid;
  }

  .nav-group {
    padding-top: 6px;
  }

  .nav-toggle {
    padding: 5px 8px 6px;
  }

  .nav a {
    padding: 7px 10px 7px 18px;
  }

  .content {
    padding: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .cards,
  .two,
  .form-grid,
  .list-search,
  .contact-search,
  .bank-transaction-search {
    grid-template-columns: 1fr;
  }

  .invoice-line {
    grid-template-columns: 1fr 1fr;
  }

  .bank-suggestion {
    grid-template-columns: 1fr;
  }

  .business-choice {
    grid-template-columns: 1fr;
  }

  .bank-suggestion-actions {
    justify-content: flex-start;
  }

	  .bank-transaction-summary,
	  .bank-option-grid,
	  .bank-manual-grid,
	  .bank-create-grid,
	  .bank-expanded-search,
	  .bank-expanded-controls,
	  .bank-fx-grid,
	  .bank-split-match-item {
	    grid-template-columns: 1fr;
	  }

	  .bank-split-match-footer {
	    align-items: stretch;
	    flex-direction: column;
	  }

	  .bank-split-match-footer button {
	    margin-left: 0;
	  }

  .chatbot {
    bottom: 14px;
    right: 14px;
  }

  .chatbot-toggle-label {
    display: none;
  }
}

@media (max-width: 760px) {
  .bank-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .bank-pagination-links {
    justify-content: flex-start;
  }

  .bank-transactions-table {
    border-collapse: separate;
    border-spacing: 0 10px;
  }

  .bank-transactions-table thead {
    display: none;
  }

  .bank-transactions-table tbody,
  .bank-transactions-table .bank-match-row {
    display: block;
    width: 100%;
  }

  .bank-transactions-table .bank-match-row {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
  }

  .bank-transactions-table .bank-match-row > td {
    border-bottom: 0;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    padding: 6px 4px;
    width: 100% !important;
  }

  .bank-transactions-table .bank-match-row > td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
  }

  .bank-transactions-table .bank-match-row > .amount {
    text-align: left;
  }

  .bank-transactions-table .bank-match-row > .bank-search-cell,
  .bank-transactions-table .bank-match-row > .actions-cell {
    grid-template-columns: minmax(0, 1fr);
  }

  .bank-transactions-table .bank-match-row > .bank-search-cell::before,
  .bank-transactions-table .bank-match-row > .actions-cell::before {
    margin-bottom: 2px;
  }

  .bank-transactions-table .bank-match-row > .bank-select-cell {
    align-items: center;
    display: flex;
    justify-content: space-between;
  }

  .bank-transactions-table .bank-match-row > .bank-description-column {
    font-size: 14px;
    line-height: 1.5;
    width: 100% !important;
  }

  .bank-bulk-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .bank-bulk-actions span {
    margin-right: 0;
  }
}

.bill-view-shell {
  background: #f5f7f9;
  border: 1px solid var(--line);
  min-height: 680px;
}

.bill-view-topbar {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  min-height: 70px;
  padding: 12px 18px;
}

.bill-view-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.bill-view-back {
  color: #51606f;
  font-size: 30px;
  line-height: 1;
  text-decoration: none;
}

.bill-view-number {
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
}

.bill-view-actions {
  flex-wrap: nowrap;
}

.bill-more-menu {
  position: relative;
}

.bill-more-menu summary {
  cursor: pointer;
  list-style: none;
}

.bill-more-menu summary::-webkit-details-marker {
  display: none;
}

.bill-more-menu > div {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(25, 39, 52, .12);
  display: grid;
  min-width: 150px;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
}

.bill-more-menu > div a,
.bill-more-menu > div button {
  background: transparent;
  border: 0;
  color: var(--text);
  display: block;
  font: inherit;
  padding: 9px 10px;
  text-align: left;
  text-decoration: none;
  width: 100%;
}

.bill-more-menu > div a:hover,
.bill-more-menu > div button:hover {
  background: #f3f6f8;
}

.bill-view-tabs {
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  padding: 0 20px;
}

.bill-view-tabs button {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: #5d6a77;
  padding: 13px 2px 11px;
}

.bill-view-tabs button.active {
  border-bottom-color: #168c8c;
  color: #0b6666;
}

.bill-view-layout {
  align-items: start;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1fr) 280px;
  padding: 24px;
}

.bill-document {
  background: #fff;
  border: 1px solid #d8dee4;
  box-shadow: 0 2px 9px rgba(32, 45, 58, .06);
  min-width: 0;
  padding: 42px 44px;
}

.bill-document-title {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
}

.bill-business-name {
  color: #1d2b36;
  font-size: 20px;
  font-weight: 800;
}

.bill-document-title > div:last-child {
  text-align: right;
}

.bill-document-title h1 {
  color: #263746;
  font-size: 28px;
  margin: 0 0 5px;
}

.bill-document-parties {
  border-top: 1px solid #e1e6ea;
  display: grid;
  gap: 40px;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 34%);
  margin-top: 28px;
  padding-top: 26px;
}

.bill-document-parties p {
  color: #5f6c78;
  font-size: 12px;
  line-height: 1.5;
  margin: 5px 0 0;
}

.bill-field-label {
  color: #7b8792;
  display: block;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 7px;
  text-transform: uppercase;
}

.bill-document-parties dl,
.bill-summary-list {
  margin: 0;
}

.bill-document-parties dl div,
.bill-summary-list div {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 5px 0;
}

.bill-document-parties dt,
.bill-summary-list dt {
  color: #697682;
}

.bill-document-parties dd,
.bill-summary-list dd {
  font-weight: 700;
  margin: 0;
  text-align: right;
}

.bill-items-wrap {
  margin: 34px -44px 0;
  overflow-x: hidden;
}

.bill-items-table {
  min-width: 560px;
  table-layout: fixed;
  width: 100%;
}

.bill-items-table th:nth-child(1) { width: 6%; }
.bill-items-table th:nth-child(2) { width: 28%; }
.bill-items-table th:nth-child(3) { width: 22%; }
.bill-items-table th:nth-child(4) { width: 8%; }
.bill-items-table th:nth-child(5) { width: 18%; }
.bill-items-table th:nth-child(6) { width: 18%; }

.bill-items-table td {
  overflow-wrap: anywhere;
}

.bill-items-table thead th {
  background: #334b5c;
  color: #fff;
  font-size: 11px;
  padding: 11px 12px;
  text-transform: uppercase;
}

.bill-items-table td {
  padding: 16px 12px;
  vertical-align: top;
}

.bill-items-table th:first-child,
.bill-items-table td:first-child {
  padding-left: 44px;
}

.bill-items-table th:last-child,
.bill-items-table td:last-child {
  padding-right: 44px;
}

.bill-document-bottom {
  display: grid;
  gap: 30px;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 40%);
  padding-top: 28px;
}

.bill-document-bottom p {
  color: #5c6873;
  font-size: 12px;
  line-height: 1.5;
}

.bill-total-table th,
.bill-total-table td {
  border: 0;
  padding: 7px 8px;
}

.bill-total-table th {
  color: #52606c;
  font-weight: 600;
}

.bill-total-table td {
  text-align: right;
}

.bill-total-row th,
.bill-total-row td {
  border-top: 1px solid #ccd4db;
  font-size: 15px;
  font-weight: 800;
  padding-top: 12px;
}

.bill-balance-row {
  background: #eef7f7;
  color: #0b6666;
  font-size: 15px;
}

.bill-detail-rail {
  display: grid;
  gap: 16px;
}

.bill-detail-rail section {
  background: #fff;
  border: 1px solid var(--line);
  padding: 18px;
}

.bill-detail-rail h3 {
  align-items: center;
  display: flex;
  font-size: 14px;
  justify-content: space-between;
  margin: 0 0 14px;
}

.bill-detail-rail h3 span {
  background: #edf1f4;
  border-radius: 50%;
  font-size: 11px;
  min-width: 22px;
  padding: 4px;
  text-align: center;
}

.bill-summary-list div {
  border-bottom: 1px solid #edf0f2;
  font-size: 12px;
  padding: 8px 0;
}

.bill-summary-list .bill-summary-balance {
  border-bottom: 0;
  color: #0b6666;
  font-size: 14px;
  padding-top: 13px;
}

.bill-attachment-form {
  display: grid;
  gap: 8px;
}

.bill-attachment-form input,
.bill-attachment-form button {
  max-width: 100%;
  width: 100%;
}

.bill-attachment-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.bill-attachment-list a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bill-tab-panel {
  border-radius: 0;
  margin: 24px;
}

.bill-activity-list > div {
  align-items: start;
  display: grid;
  gap: 12px;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  padding: 10px 0;
}

.bill-activity-list > div > span {
  background: #168c8c;
  border-radius: 50%;
  height: 8px;
  margin-top: 5px;
  width: 8px;
}

.bill-activity-list p,
.bill-activity-list small {
  display: block;
  margin: 0;
}

.bill-activity-list small,
.bill-activity-list time {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1050px) {
  .bill-view-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .bill-detail-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .bill-view-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .bill-view-actions {
    flex-wrap: wrap;
  }

  .bill-view-tabs {
    gap: 16px;
    overflow-x: auto;
  }

  .bill-view-tabs button {
    flex: 0 0 auto;
  }

  .bill-view-layout {
    padding: 10px;
  }

  .bill-document {
    padding: 24px 18px;
  }

  .bill-document-parties,
  .bill-document-bottom,
  .bill-detail-rail {
    grid-template-columns: minmax(0, 1fr);
  }

  .bill-items-wrap {
    margin-left: -18px;
    margin-right: -18px;
    overflow-x: auto;
  }

  .bill-items-table {
    min-width: 650px;
    table-layout: auto;
  }

  .bill-items-table th:first-child,
  .bill-items-table td:first-child {
    padding-left: 18px;
  }

  .bill-items-table th:last-child,
  .bill-items-table td:last-child {
    padding-right: 18px;
  }

  .bill-tab-panel {
    margin: 10px;
  }
}

.reports-centre {
  align-items: start;
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  margin-bottom: 20px;
  min-height: 620px;
}

.reports-categories {
  align-self: stretch;
  background: #f7f9fb;
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  position: sticky;
  top: 72px;
}

.reports-search-label {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin: 0 6px 7px;
  text-transform: uppercase;
}

.reports-search {
  background: #fff;
  margin-bottom: 16px;
  width: 100%;
}

.reports-categories nav {
  display: grid;
  gap: 2px;
}

.reports-categories nav a {
  border-left: 3px solid transparent;
  color: var(--text);
  display: block;
  font-size: 13px;
  font-weight: 650;
  padding: 10px 11px;
  text-decoration: none;
}

.reports-categories nav a:hover,
.reports-categories nav a.active {
  background: #e8f3f3;
  border-left-color: #168c8c;
  color: #0b6666;
}

.reports-directory {
  min-width: 0;
  padding: 26px 30px 34px;
}

.reports-directory-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 4px;
  padding-bottom: 18px;
}

.reports-directory-header h2 {
  font-size: 22px;
  margin: 0 0 4px;
}

.reports-directory-header p {
  color: var(--muted);
  margin: 0;
}

.report-directory-group {
  border-bottom: 1px solid var(--line);
  padding: 23px 0 18px;
  scroll-margin-top: 84px;
}

.report-directory-group:last-of-type {
  border-bottom: 0;
}

.report-directory-group h3 {
  color: #243447;
  font-size: 14px;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.report-directory-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.report-directory-link {
  align-items: center;
  border-bottom: 1px solid #edf0f2;
  color: var(--text);
  display: grid;
  gap: 12px;
  grid-template-columns: 9px minmax(0, 1fr) 16px;
  min-height: 70px;
  padding: 10px 14px 10px 4px;
  text-decoration: none;
}

.report-directory-link:nth-child(odd) {
  margin-right: 22px;
}

.report-directory-link:hover {
  background: #f6fbfb;
  color: #0b6666;
}

.report-directory-link strong,
.report-directory-link small {
  display: block;
}

.report-directory-link strong {
  font-size: 14px;
  margin-bottom: 4px;
}

.report-directory-link small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.report-directory-mark {
  background: #168c8c;
  border-radius: 50%;
  height: 7px;
  width: 7px;
}

.report-directory-arrow {
  color: #8b98a6;
  font-size: 20px;
  text-align: right;
}

.reports-no-results {
  padding: 42px 0;
  text-align: center;
}

.report-detail-anchor {
  scroll-margin-top: 84px;
}

@media (max-width: 900px) {
  .reports-centre {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .reports-directory {
    padding: 22px;
  }

  .report-directory-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .report-directory-link:nth-child(odd) {
    margin-right: 0;
  }
}

@media (max-width: 680px) {
  .reports-centre {
    display: block;
  }

  .reports-categories {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    position: static;
  }

  .reports-categories nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .reports-categories nav a {
    border-bottom: 3px solid transparent;
    border-left: 0;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .reports-categories nav a:hover,
  .reports-categories nav a.active {
    border-bottom-color: #168c8c;
    border-left-color: transparent;
  }

  .reports-directory {
    padding: 18px 14px 26px;
  }

  .reports-directory-header {
    align-items: stretch;
    flex-direction: column;
  }
}

@media print {
  .sidebar,
  .topbar .actions,
  .no-print,
  .button,
  button {
    display: none !important;
  }

  .shell {
    display: block;
  }

  .content {
    padding: 0;
  }

  .panel,
  .card {
    box-shadow: none;
    border-color: #cbd5e1;
  }

  .print-only {
    display: block;
  }
}
