/* Client statements */
.statements-page {
  --statement-ink: #172334;
  --statement-muted: #596679;
  --statement-border: #e0e5ed;
  --statement-surface: #f5f7fa;
  --statement-brand: #a91b34;
  color: var(--statement-ink);
}
.statements-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin: 5px 0 24px;
}
.statements-intro h2 {
  margin: 0 0 6px;
  font-size: clamp(28px, 3.5vw, 40px);
  font-weight: 780;
  line-height: 1.08;
  letter-spacing: -.045em;
}
.statements-intro p { margin: 0; color: var(--statement-muted); font-size: 14px; }
.statement-workspace {
  display: grid;
  grid-template-columns: minmax(245px, 295px) minmax(0, 1fr);
  gap: clamp(16px, 2.2vw, 28px);
  align-items: start;
}
.client-picker, .statement-card, .statement-invoice-panel, .statement-empty {
  border: 1px solid var(--statement-border);
  border-radius: 16px;
  background: white;
  box-shadow: 0 3px 10px rgba(22, 35, 54, .035);
}
.client-picker { overflow: hidden; }
.client-picker-header { padding: 20px 18px 12px; }
.client-picker-header h3 { margin: 0 0 12px; font-size: 18px; letter-spacing: -.025em; }
.client-search {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  border: 1px solid var(--statement-border);
  border-radius: 9px;
  color: var(--statement-muted);
  background: var(--statement-surface);
}
.client-search:focus-within { outline: 2px solid var(--statement-brand); outline-offset: 2px; }
.client-search input {
  width: 100%;
  min-width: 0;
  min-height: 43px;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--statement-ink);
  background: transparent;
  font-size: 14px;
}
.statement-button svg, .client-search svg, .statement-invoice-pdf svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}
.client-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin-top: 13px;
  padding: 3px;
  border-radius: 9px;
  background: var(--statement-surface);
}
.client-filters button {
  min-height: 37px;
  padding: 5px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--statement-muted);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.client-filters button[aria-pressed="true"] {
  border-color: var(--statement-border);
  color: var(--statement-ink);
  background: white;
  box-shadow: 0 1px 2px rgba(22, 35, 54, .06);
}
.client-result-count { margin: 0; padding: 0 18px 7px; color: var(--statement-muted); font-size: 12px; }
.client-result-count:empty { display: none; }
.client-results {
  display: grid;
  align-content: start;
  gap: 2px;
  max-height: clamp(300px, 58vh, 630px);
  padding: 0 8px 9px;
  overflow: auto;
  scrollbar-width: thin;
}
.client-result {
  display: grid;
  grid-template-columns: 35px minmax(0, 1fr) 15px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 62px;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: white;
  text-align: left;
  cursor: pointer;
}
.client-result:hover { background: var(--statement-surface); }
.client-result[aria-current="true"] {
  border-color: #f1d4db;
  background: #fcf1f3;
  box-shadow: inset 2px 0 0 var(--statement-brand);
}
.client-initials, .statement-client-avatar {
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #48566b;
  background: #ecf0f5;
  font-weight: 750;
  letter-spacing: .01em;
}
.client-initials { width: 35px; height: 35px; font-size: 12px; }
.client-result[aria-current="true"] .client-initials { color: var(--statement-brand); background: #f6dfe5; }
.client-result-copy strong, .client-result-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
.client-result-copy strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--statement-ink);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.client-result-copy small {
  margin-top: 3px;
  color: var(--statement-muted);
  font-size: 11px;
  white-space: nowrap;
}
.client-result-arrow { color: #6a788d; }
.client-result-arrow svg { display: block; width: 15px; height: 15px; }
.client-list-message { margin: 0; padding: 15px 10px 20px; color: var(--statement-muted); font-size: 13px; }
.statement-main { min-width: 0; }
.statement-button.statement-back { display: none; }
.statement-empty {
  display: grid;
  min-height: 365px;
  justify-items: center;
  align-content: center;
  padding: 30px;
  color: var(--statement-muted);
  text-align: center;
}
.statement-empty-icon {
  display: grid;
  width: 77px;
  height: 77px;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid #f1d4db;
  border-radius: 24px;
  color: var(--statement-brand);
  background: #fcf1f3;
}
.statement-empty-icon svg { width: 41px; height: 41px; }
.statement-empty h3 { margin: 0 0 7px; color: var(--statement-ink); font-size: 22px; letter-spacing: -.025em; }
.statement-empty p { max-width: 290px; margin: 0; font-size: 14px; line-height: 1.55; }
.statement-card { overflow: hidden; }
.statement-client { display: flex; align-items: flex-start; gap: 15px; padding: 24px 25px 20px; }
.statement-client-avatar { width: 48px; height: 48px; flex: 0 0 48px; font-size: 16px; }
.statement-client > div { min-width: 0; }
.statement-account-number { margin: 0 0 3px; color: var(--statement-muted); font-size: 12px; font-weight: 650; }
.statement-client h3 {
  margin: 0;
  font-size: clamp(21px, 3vw, 28px);
  line-height: 1.17;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}
.statement-client h3:focus { outline: none; }
.statement-contacts { display: flex; flex-wrap: wrap; gap: 4px 15px; margin-top: 7px; color: var(--statement-muted); font-size: 13px; }
.statement-contacts span { min-width: 0; overflow-wrap: anywhere; }
.statement-balance {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
  margin: 0 24px;
  padding: 21px 22px;
  border-radius: 12px;
  background: #162233;
  color: white;
}
.statement-balance-label { display: block; color: #d7dfeb; font-size: 13px; font-weight: 650; }
.statement-balance strong {
  display: block;
  margin: 3px 0 0;
  font-size: clamp(25px, 4.6vw, 43px);
  line-height: 1.12;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.statement-balance p { margin: 7px 0 0; color: #c0ccdb; font-size: 12px; }
.statement-past-due { padding: 8px 12px; border: 1px solid #715047; border-radius: 9px; background: #392d31; color: #ffd2be; }
.statement-past-due span { display: block; font-size: 11px; font-weight: 600; }
.statement-past-due b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.statement-review-note { margin: 13px 24px 0; padding: 10px 12px; border-radius: 8px; color: #74431c; background: #fff5e7; font-size: 13px; }
.statement-actions { display: flex; flex-wrap: wrap; gap: 9px; padding: 17px 24px 21px; }
.statement-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid var(--statement-border);
  border-radius: 9px;
  color: var(--statement-ink);
  background: white;
  font-size: 13px;
  font-weight: 680;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.statement-button:hover { border-color: #b3bfcd; background: var(--statement-surface); }
.statement-button:disabled { opacity: .55; cursor: wait; }
.statement-button-quiet { color: var(--statement-muted); }
.statement-button-primary { border-color: var(--statement-brand); color: white; background: var(--statement-brand); }
.statement-button-primary:hover { border-color: #851329; background: #851329; }
.statements-page :is(button, a):focus-visible { outline: 2px solid var(--statement-brand); outline-offset: 2px; }
.client-result:focus-visible { outline-offset: -2px !important; }
.statement-invoice-panel { margin-top: 17px; overflow: hidden; }
.statement-invoice-tabs { display: flex; gap: 18px; padding: 0 20px; border-bottom: 1px solid var(--statement-border); }
.statement-invoice-tabs button {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 52px;
  padding: 8px 2px 6px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--statement-muted);
  background: transparent;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.statement-invoice-tabs button[aria-pressed="true"] { border-bottom-color: var(--statement-brand); color: var(--statement-ink); }
.statement-invoice-tabs button span { padding: 1px 7px; border-radius: 20px; color: var(--statement-muted); background: #edf1f5; font-size: 11px; }
.statement-list-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 18px; }
.statement-list-tools p { margin: 0; color: var(--statement-muted); font-size: 12px; }
.statement-invoices { width: 100%; border-collapse: collapse; font-size: 13px; }
.statement-invoices th {
  padding: 10px 8px;
  border-bottom: 1px solid var(--statement-border);
  color: var(--statement-muted);
  background: var(--statement-surface);
  font-size: 11px;
  font-weight: 680;
  text-align: left;
  white-space: nowrap;
}
.statement-invoices th:first-child, .statement-invoices td:first-child { padding-left: 20px; }
.statement-invoices th:last-child, .statement-invoices td:last-child { padding-right: 18px; }
.statement-invoices td { padding: 12px 8px; border-bottom: 1px solid var(--statement-border); vertical-align: middle; }
.statement-invoices tr:last-child td { border-bottom: 0; }
.statement-invoices td small { display: block; margin-top: 3px; color: var(--statement-muted); font-size: 11px; overflow-wrap: anywhere; }
.statement-invoice-link { padding: 0; border: 0; color: #263d5d; background: transparent; font-size: inherit; font-weight: 720; text-align: left; cursor: pointer; }
.statement-invoice-link:hover { text-decoration: underline; }
.statement-invoice-date { color: var(--statement-muted); font-size: 12px; }
.statement-invoice-date.is-overdue, .statement-invoice-date.is-overdue small { color: #a42836; }
.statement-number { font-variant-numeric: tabular-nums; white-space: nowrap; }
.statement-row-due { font-weight: 750; }
.statement-cell-label { display: none; }
.statement-invoice-pdf a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  border: 1px solid var(--statement-border);
  border-radius: 7px;
  color: #485970;
  font-size: 11px;
  font-weight: 650;
  text-decoration: none;
}
.statement-invoice-pdf a:hover { color: var(--statement-brand); background: var(--statement-surface); }
.statement-invoice-pdf svg { width: 14px; height: 14px; flex-basis: 14px; }
.statement-invoice-empty { padding: 30px 20px; color: var(--statement-muted); text-align: center; }
.statement-invoice-empty strong { color: var(--statement-ink); font-size: 14px; }
.statement-invoice-empty p { margin: 4px 0 0; font-size: 13px; }
.statement-home-link { text-align: left; cursor: pointer; }
.statement-home-link:hover { border-color: #bac4d2; }
.metric-card.statement-home-link > strong { font-size: 21px; }

@media (max-width: 1080px) {
  .statement-workspace { grid-template-columns: minmax(0, 1fr); }
  .statement-workspace:not(.has-statement) .statement-main { display: none; }
  .statement-workspace.has-statement .client-picker { display: none; }
  .statement-button.statement-back { display: inline-flex; margin-bottom: 12px; }
  .client-results { max-height: none; }
}
@media (max-width: 640px) {
  .statements-intro { align-items: flex-start; margin: 2px 0 16px; gap: 8px; }
  .statements-intro h2 { font-size: 29px; }
  .statements-intro p { font-size: 13px; }
  .client-search input { font-size: 16px; }
  .statement-client { gap: 11px; padding: 16px 15px; }
  .statement-client-avatar { width: 39px; height: 39px; flex-basis: 39px; font-size: 13px; }
  .statement-balance { margin: 0 14px; padding: 15px 14px; }
  .statement-past-due { padding: 5px 7px; }
  .statement-past-due b { font-size: 13px; }
  .statement-review-note { margin-inline: 14px; }
  .statement-actions { padding: 13px 14px 16px; }
  .statement-button { min-height: 44px; }
  .statement-actions .statement-button-primary { flex: 1 1 100%; }
  .statement-actions button { flex: 1; }
  .statement-invoice-tabs { justify-content: space-around; padding: 0 10px; gap: 7px; }
  .statement-invoices, .statement-invoices tbody { display: block; }
  .statement-invoices thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .statement-invoices tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px 10px;
    padding: 13px 14px;
    border-bottom: 1px solid var(--statement-border);
  }
  .statement-invoices tr:last-child { border-bottom: 0; }
  .statement-invoices td, .statement-invoices td:first-child, .statement-invoices td:last-child { padding: 0; border: 0; }
  .statement-invoice-title { grid-column: 1 / 3; }
  .statement-invoice-date { grid-column: 1 / -1; }
  .statement-invoice-pdf { grid-column: 3; grid-row: 1; justify-self: end; }
  .statement-invoice-pdf a { min-height: 38px; }
  .statement-cell-label { display: block; color: var(--statement-muted); font-size: 10px; font-weight: 650; }
  .statement-number { white-space: normal; overflow-wrap: anywhere; }
}
@media (max-width: 400px) {
  .statement-refresh-label { display: none; }
  #refreshBalances { width: 44px; flex: 0 0 44px; padding: 0; }
}
