.card-page {
  display: grid;
  gap: 1rem;
}

.card-summary {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.1rem;
}

.card-summary h2 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}

.card-summary .metric {
  font-family: var(--font-display);
  font-size: 1.5rem;
}

.card-chips,
.card-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-chip,
.card-filter {
  min-height: 48px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  font: inherit;
}

.card-chip.is-active,
.card-filter.is-active {
  background: #084955;
  color: #fff;
  border-color: #084955;
}

.card-search {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  font: inherit;
}

.card-txn-list {
  display: grid;
  gap: 0.75rem;
}

.card-txn {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  display: grid;
  gap: 0.45rem;
}

.card-txn-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: start;
}

.card-txn-amount {
  font-weight: 600;
  white-space: nowrap;
}

.card-txn-amount.is-credit {
  color: #0b7a3b;
}

.card-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.85rem;
}

.card-status.missing {
  background: #fde8e8;
  color: #9b1c1c;
}

.card-status.uploaded {
  background: #e7f6ec;
  color: #146c2e;
}

.card-status.not_required,
.card-status.undetermined {
  background: #eef2f4;
  color: #44555a;
}

.card-txn-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-txn-actions .btn,
.card-sheet .btn,
.card-page .btn {
  min-height: 48px;
}

/* Freeze the page without overflow:hidden. That property blocks the iPhone photo library. */
body.card-sheet-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: visible;
}

.card-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 20, 24, 0.45);
  z-index: 70;
}

.card-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 71;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  display: grid;
  gap: 0.75rem;
  max-height: 90vh;
  overflow: auto;
}

.card-sheet h3 {
  margin: 0;
}

.card-preview {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  background: #f4f6f7;
  border-radius: 12px;
}

.card-sheet .card-source {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: #e7eef0;
  color: #16323a;
  text-align: center;
}

.card-sheet .card-source.btn-primary {
  background: linear-gradient(135deg, var(--sea), var(--sea-deep));
  color: #fff;
}

.card-file-input {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
}

.card-progress {
  height: 8px;
  background: #e6ecee;
  border-radius: 999px;
  overflow: hidden;
}

.card-progress > span {
  display: block;
  height: 100%;
  background: #084955;
}

.card-table-wrap {
  overflow-x: auto;
}

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

.card-table th,
.card-table td {
  text-align: left;
  padding: 0.7rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.card-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.card-metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem;
}

.card-metric .value {
  font-family: var(--font-display);
  font-size: 1.4rem;
}

.card-banner {
  background: #fff7e6;
  border: 1px solid #efd39a;
  border-radius: 12px;
  padding: 0.8rem 1rem;
}

.card-banner-error {
  background: #fde8e8;
  border-color: #f0b4b4;
  color: #9b1c1c;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.card-banner-error p {
  margin: 0;
}

.card-date-range h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.card-selected-range {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: baseline;
  margin: 0.75rem 0 0;
}

.card-range-kicker {
  font-weight: 600;
}

.card-custom-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.card-custom-dates label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.9rem;
}

.card-custom-dates input[type='date'] {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  font: inherit;
}

.nav-missing-badge {
  display: inline-flex;
  min-width: 1.4rem;
  justify-content: center;
  margin-left: 0.35rem;
  border-radius: 999px;
  background: #c0392b;
  color: #fff;
  font-size: 0.72rem;
  padding: 0.05rem 0.35rem;
}

@media (max-width: 800px) {
  .card-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .card-table {
    min-width: 680px;
  }
}

@media (max-width: 430px) {
  .card-page,
  .card-txn,
  .card-summary {
    overflow-x: hidden;
  }
}
