/* =============================================================================
   Trusted Payers Manager — Frontend Design System
   Primary: #10b550  |  Black: #0a0a0a  |  White: #ffffff
   ============================================================================= */

/* ── Reset & tokens ─────────────────────────────────────────────────────── */
.tpm-wrap *,
.tpm-wrap *::before,
.tpm-wrap *::after {
  box-sizing: border-box;
}

:root {
  --tpm-green:        #10b550;
  --tpm-green-dark:   #0d9440;
  --tpm-green-light:  #e8f5ee;
  --tpm-green-mid:    #d1edd9;
  --tpm-black:        #0a0a0a;
  --tpm-ink:          #1a1a1a;
  --tpm-ink-soft:     #4a4a4a;
  --tpm-muted:        #717171;
  --tpm-border:       #e4e4e4;
  --tpm-border-light: #f0f0f0;
  --tpm-surface:      #ffffff;
  --tpm-bg:           #f7f8f7;
  --tpm-danger:       #dc2626;
  --tpm-danger-bg:    #fef2f2;
  --tpm-warning:      #d97706;
  --tpm-warning-bg:   #fffbeb;
  --tpm-radius:       10px;
  --tpm-radius-sm:    6px;
  --tpm-shadow-sm:    0 1px 3px rgba(0,0,0,.06);
  --tpm-shadow:       0 4px 16px rgba(0,0,0,.08);
  --tpm-shadow-lg:    0 8px 32px rgba(0,0,0,.12);
  --tpm-font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --tpm-transition:   .18s cubic-bezier(.4,0,.2,1);
}

/* ── Outer wrap ─────────────────────────────────────────────────────────── */
.tpm-wrap {
  font-family: var(--tpm-font);
  color: var(--tpm-ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  width: 100%;
}

/* ── Section header ─────────────────────────────────────────────────────── */
.tpm-section-header {
  margin-bottom: 28px;
}

.tpm-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--tpm-green);
  margin-bottom: 8px;
}

.tpm-eyebrow::before {
  content: '';
  display: block;
  width: 16px;
  height: 2px;
  background: var(--tpm-green);
  border-radius: 2px;
  flex-shrink: 0;
}

.tpm-section-title {
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 800;
  color: var(--tpm-black);
  margin: 0 0 6px;
  line-height: 1.2;
  letter-spacing: -.02em;
}

.tpm-section-subtitle {
  font-size: .9rem;
  color: var(--tpm-muted);
  margin: 0;
  max-width: 520px;
}

/* ── Card shell ─────────────────────────────────────────────────────────── */
.tpm-card {
  background: var(--tpm-surface);
  border: 1px solid var(--tpm-border);
  border-radius: var(--tpm-radius);
  box-shadow: var(--tpm-shadow-sm);
  overflow: hidden;
}

.tpm-card-padded {
  padding: clamp(20px, 4vw, 36px);
}

/* ── Form layout ────────────────────────────────────────────────────────── */
.tpm-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tpm-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

.tpm-form-grid .tpm-field-full {
  grid-column: 1 / -1;
}

@media (max-width: 600px) {
  .tpm-form-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Field ──────────────────────────────────────────────────────────────── */
.tpm-field {
  padding: 12px 0;
  border-bottom: 1px solid var(--tpm-border-light);
}

.tpm-field:last-of-type {
  border-bottom: none;
}

.tpm-field label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--tpm-ink-soft);
  margin-bottom: 7px;
}

.tpm-req {
  color: var(--tpm-danger);
  font-size: .9em;
  line-height: 1;
}

.tpm-field-hint {
  font-size: .75rem;
  color: var(--tpm-muted);
  margin-top: 5px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

/* ── Inputs ─────────────────────────────────────────────────────────────── */
.tpm-field input[type="text"],
.tpm-field input[type="number"],
.tpm-field input[type="email"],
.tpm-field textarea,
.tpm-field select {
  width: 100%;
  padding: 11px 14px;
  font-size: .9rem;
  font-family: var(--tpm-font);
  color: var(--tpm-ink);
  background: var(--tpm-surface);
  border: 1.5px solid var(--tpm-border);
  border-radius: var(--tpm-radius-sm);
  transition: border-color var(--tpm-transition), box-shadow var(--tpm-transition);
  outline: none;
  appearance: none;
}

.tpm-field input[type="text"]:focus,
.tpm-field input[type="number"]:focus,
.tpm-field input[type="email"]:focus,
.tpm-field textarea:focus,
.tpm-field select:focus {
  border-color: var(--tpm-green);
  box-shadow: 0 0 0 3px rgba(16,181,80,.13);
}

.tpm-field input::placeholder,
.tpm-field textarea::placeholder {
  color: #b0b0b0;
}

.tpm-field textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.6;
}

/* Postcode uppercase visual */
.tpm-uppercase { text-transform: uppercase; }

/* ── File input ─────────────────────────────────────────────────────────── */
.tpm-file-zone {
  border: 2px dashed var(--tpm-border);
  border-radius: var(--tpm-radius-sm);
  padding: 18px 20px;
  text-align: center;
  background: var(--tpm-bg);
  cursor: pointer;
  transition: border-color var(--tpm-transition), background var(--tpm-transition);
  position: relative;
}

.tpm-file-zone:hover {
  border-color: var(--tpm-green);
  background: var(--tpm-green-light);
}

.tpm-file-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.tpm-file-icon {
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: 6px;
}

.tpm-file-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--tpm-ink-soft);
}

.tpm-file-label span {
  color: var(--tpm-green);
  font-weight: 700;
}

.tpm-file-types {
  font-size: .72rem;
  color: var(--tpm-muted);
  margin-top: 3px;
}

/* ── Form footer / submit row ───────────────────────────────────────────── */
.tpm-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 20px;
  margin-top: 8px;
  border-top: 1px solid var(--tpm-border-light);
}

.tpm-form-footer-note {
  font-size: .78rem;
  color: var(--tpm-muted);
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.tpm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 28px;
  font-size: .88rem;
  font-weight: 700;
  font-family: var(--tpm-font);
  letter-spacing: .02em;
  border: none;
  border-radius: var(--tpm-radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--tpm-transition), box-shadow var(--tpm-transition), transform .1s;
  white-space: nowrap;
}

.tpm-btn:active { transform: translateY(1px); }

.tpm-btn-primary {
  background: var(--tpm-green);
  color: #fff;
}

.tpm-btn-primary:hover {
  background: var(--tpm-green-dark);
  box-shadow: 0 4px 14px rgba(16,181,80,.35);
  color: #fff;
}

.tpm-btn-ghost {
  background: transparent;
  color: var(--tpm-ink);
  border: 1.5px solid var(--tpm-border);
}

.tpm-btn-ghost:hover {
  border-color: var(--tpm-ink);
  background: var(--tpm-bg);
}

.tpm-btn:disabled,
.tpm-btn.is-loading {
  opacity: .6;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Spinner ─────────────────────────────────────────────────────────────── */
@keyframes tpm-spin { to { transform: rotate(360deg); } }

.tpm-spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: tpm-spin .55s linear infinite;
  flex-shrink: 0;
}

/* ── Alert messages ─────────────────────────────────────────────────────── */
.tpm-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--tpm-radius-sm);
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.5;
  margin: 16px 0;
  border: 1px solid transparent;
}

.tpm-alert-icon {
  font-size: 1rem;
  line-height: 1.5;
  flex-shrink: 0;
}

.tpm-alert-success {
  background: var(--tpm-green-light);
  border-color: var(--tpm-green-mid);
  color: #0a5c28;
}

.tpm-alert-error {
  background: var(--tpm-danger-bg);
  border-color: #fecaca;
  color: #991b1b;
}

.tpm-alert-info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

.tpm-alert-warning {
  background: var(--tpm-warning-bg);
  border-color: #fed7aa;
  color: #92400e;
}

/* ── Notice (static, no icon) ───────────────────────────────────────────── */
.tpm-notice {
  padding: 14px 20px;
  border-radius: var(--tpm-radius-sm);
  font-size: .875rem;
  background: var(--tpm-bg);
  border: 1px solid var(--tpm-border);
  color: var(--tpm-ink-soft);
  border-left: 4px solid var(--tpm-green);
}

/* ── Search form ─────────────────────────────────────────────────────────── */
.tpm-search-bar {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  background: var(--tpm-surface);
  border: 1px solid var(--tpm-border);
  border-radius: var(--tpm-radius);
  padding: 20px 24px;
  box-shadow: var(--tpm-shadow-sm);
}

.tpm-search-bar .tpm-field {
  padding: 0;
  border: none;
}

.tpm-search-bar .tpm-field:last-of-type {
  border: none;
}

@media (max-width: 640px) {
  .tpm-search-bar {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* ── Count bar ──────────────────────────────────────────────────────────── */
.tpm-count-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 12px;
}

.tpm-count-label {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--tpm-muted);
}

.tpm-count-num {
  background: var(--tpm-green-light);
  color: var(--tpm-green-dark);
  font-weight: 800;
  font-size: .75rem;
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid var(--tpm-green-mid);
}

/* ── Report cards (search results) ─────────────────────────────────────── */
.tpm-results-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.tpm-report-card {
  background: var(--tpm-surface);
  border: 1px solid var(--tpm-border);
  border-radius: var(--tpm-radius);
  border-left: 4px solid var(--tpm-green);
  padding: 20px 24px;
  box-shadow: var(--tpm-shadow-sm);
  transition: box-shadow var(--tpm-transition), border-left-color var(--tpm-transition);
}

.tpm-report-card:hover {
  box-shadow: var(--tpm-shadow);
  border-left-color: var(--tpm-green-dark);
}

.tpm-report-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.tpm-report-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--tpm-black);
  letter-spacing: -.01em;
}

.tpm-report-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tpm-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.tpm-tag-postcode {
  background: var(--tpm-bg);
  border-color: var(--tpm-border);
  color: var(--tpm-ink-soft);
  font-family: 'Courier New', monospace;
  font-size: .76rem;
  letter-spacing: .08em;
}

.tpm-tag-amount {
  background: var(--tpm-danger-bg);
  border-color: #fecaca;
  color: var(--tpm-danger);
  font-size: .8rem;
}

.tpm-report-desc {
  font-size: .875rem;
  color: var(--tpm-ink-soft);
  line-height: 1.65;
  margin-bottom: 14px;
}

.tpm-report-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 20px;
  padding-top: 12px;
  border-top: 1px solid var(--tpm-border-light);
}

.tpm-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  color: var(--tpm-muted);
}

.tpm-meta-item strong {
  color: var(--tpm-ink-soft);
  font-weight: 600;
}

.tpm-meta-divider {
  width: 3px;
  height: 3px;
  background: var(--tpm-border);
  border-radius: 50%;
  flex-shrink: 0;
}

.tpm-evidence-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--tpm-green);
  text-decoration: none;
  padding: 3px 10px;
  border: 1px solid var(--tpm-green-mid);
  border-radius: 5px;
  background: var(--tpm-green-light);
  transition: background var(--tpm-transition), box-shadow var(--tpm-transition);
}

.tpm-evidence-link:hover {
  background: var(--tpm-green-mid);
  box-shadow: 0 2px 8px rgba(16,181,80,.18);
  color: var(--tpm-green-dark);
}

/* ── Table (reports list + my reports) ─────────────────────────────────── */
.tpm-table-shell {
  border: 1px solid var(--tpm-border);
  border-radius: var(--tpm-radius);
  overflow: hidden;
  box-shadow: var(--tpm-shadow-sm);
  background: var(--tpm-surface);
  margin-top: 16px;
}

.tpm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}

.tpm-table thead tr {
  background: var(--tpm-black);
}

.tpm-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: rgba(255,255,255,.7);
  white-space: nowrap;
}

.tpm-table th:first-child {
  border-left: 4px solid var(--tpm-green);
  color: #fff;
}

.tpm-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--tpm-border-light);
  color: var(--tpm-ink);
  vertical-align: top;
}

.tpm-table td:first-child {
  border-left: 4px solid transparent;
  font-weight: 700;
}

.tpm-table tbody tr:last-child td { border-bottom: none; }

.tpm-table tbody tr:hover td { background: var(--tpm-bg); }
.tpm-table tbody tr:hover td:first-child { border-left-color: var(--tpm-green); }

.tpm-table .tpm-col-desc {
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--tpm-ink-soft);
}

.tpm-table .tpm-col-amount {
  font-weight: 700;
  color: var(--tpm-danger);
  white-space: nowrap;
}

.tpm-table .tpm-col-postcode {
  font-family: 'Courier New', monospace;
  font-size: .8rem;
  font-weight: 700;
  color: var(--tpm-ink-soft);
  letter-spacing: .06em;
}

/* Responsive table: stack on mobile */
@media (max-width: 700px) {
  .tpm-table-shell { border-radius: 0; margin-left: -16px; margin-right: -16px; }

  .tpm-table thead { display: none; }

  .tpm-table tbody tr {
    display: block;
    border-bottom: 1px solid var(--tpm-border);
    padding: 14px 16px;
    border-left: 4px solid var(--tpm-green);
  }

  .tpm-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 4px;
    padding: 5px 0;
    border: none;
    font-size: .82rem;
  }

  .tpm-table td:first-child {
    border-left: none;
    font-size: .95rem;
    padding-bottom: 8px;
  }

  .tpm-table td::before {
    content: attr(data-label);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--tpm-muted);
    flex-shrink: 0;
    padding-top: 1px;
  }

  .tpm-table td:first-child::before { display: none; }
  .tpm-table td.tpm-col-desc { max-width: 100%; white-space: normal; }
}

/* ── Status badges ──────────────────────────────────────────────────────── */
.tpm-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tpm-status::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tpm-status-live {
  background: var(--tpm-green-light);
  color: #0a5c28;
  border: 1px solid var(--tpm-green-mid);
}
.tpm-status-live::before { background: var(--tpm-green); }

.tpm-status-pending {
  background: var(--tpm-warning-bg);
  color: #92400e;
  border: 1px solid #fed7aa;
}
.tpm-status-pending::before { background: var(--tpm-warning); }

.tpm-status-rejected {
  background: var(--tpm-danger-bg);
  color: #991b1b;
  border: 1px solid #fecaca;
}
.tpm-status-rejected::before { background: var(--tpm-danger); }

/* ── Table link ─────────────────────────────────────────────────────────── */
.tpm-dl-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--tpm-green);
  text-decoration: none;
}
.tpm-dl-link:hover { color: var(--tpm-green-dark); text-decoration: underline; }
.tpm-dl-link svg { width: 13px; height: 13px; }

/* ── Pagination ─────────────────────────────────────────────────────────── */
.tpm-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 28px;
}

.tpm-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 1.5px solid var(--tpm-border);
  border-radius: var(--tpm-radius-sm);
  font-size: .85rem;
  font-weight: 600;
  color: var(--tpm-ink-soft);
  text-decoration: none;
  background: var(--tpm-surface);
  transition: all var(--tpm-transition);
}

.tpm-pagination .page-numbers:hover,
.tpm-pagination .page-numbers.current {
  background: var(--tpm-green);
  border-color: var(--tpm-green);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16,181,80,.3);
}

.tpm-pagination .page-numbers.dots {
  border: none;
  box-shadow: none;
  background: none;
  cursor: default;
}

/* ── Empty state ────────────────────────────────────────────────────────── */
.tpm-empty {
  text-align: center;
  padding: 52px 24px;
}

.tpm-empty-icon {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 14px;
  opacity: .4;
}

.tpm-empty-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--tpm-ink);
  margin-bottom: 6px;
}

.tpm-empty-desc {
  font-size: .85rem;
  color: var(--tpm-muted);
  max-width: 340px;
  margin: 0 auto;
}

/* ── Verified badge on submit form ─────────────────────────────────────── */
.tpm-form-trust {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  color: var(--tpm-muted);
}

.tpm-form-trust svg {
  width: 15px;
  height: 15px;
  color: var(--tpm-green);
  flex-shrink: 0;
}

/* ── Intro bar (dispute) ────────────────────────────────────────────────── */
.tpm-intro-bar {
  background: var(--tpm-green-light);
  border: 1px solid var(--tpm-green-mid);
  border-radius: var(--tpm-radius-sm);
  padding: 14px 18px;
  font-size: .85rem;
  color: #0a5c28;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}

/* ── Utility ─────────────────────────────────────────────────────────────── */
.tpm-text-muted { color: var(--tpm-muted); }
.tpm-dash { color: var(--tpm-border); }

/* ── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .tpm-spinner { animation: none; }
  .tpm-btn, .tpm-report-card, .tpm-evidence-link { transition: none; }
}
