:root {
  --fg: #fff;
  --muted: #fff;
  --accent: #fff;
  --lighter-blue-black: #04293c;
  --light-blue-black: #053d58;
  --gradient-blend: #021e2c;
  --action: #288691;
  --bright-green: #16f59c;
  --bright-blue: #3b82f6;
  --restoration-blue: #60a5fa;
  --status-gray: #374151;
  --dashboard-surface-radius: 20px;
  --panel: rgba(255, 255, 255, 0.14);
  --panel-subtle: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.13);
  --positive: #fff;
  --negative: #fff;
  --noise-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='matrix' values='0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 12 -5'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

html,
body {
  margin: 0;
  padding: 0;
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

html { background: var(--gradient-blend); }

body {
  position: relative;
  min-height: 100vh;
  background: transparent;
}

.backdrop {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 70% at 20% 25%, rgba(0, 0, 0, 0.7) 0%, transparent 70%),
    radial-gradient(ellipse 95% 75% at 80% 80%, rgba(5, 61, 88, 0.7) 0%, transparent 70%),
    linear-gradient(to bottom right, #000, var(--light-blue-black));
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 15%, #000 85%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 15%, #000 85%, transparent 100%);
}

.backdrop::after {
  position: absolute;
  inset: 0;
  background-image: var(--noise-image);
  content: "";
  mix-blend-mode: soft-light;
  pointer-events: none;
}

body > *:not(.backdrop) { position: relative; z-index: 1; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button,
input { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(96, 165, 250, 0.9);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  margin: -1px;
  clip: rect(0 0 0 0);
  overflow: hidden;
  white-space: nowrap;
}

.container {
  display: flex;
  flex-direction: column;
  width: min(100%, 1240px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 34px 28px 24px;
}

.page-content {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  width: 100%;
}

.logo {
  display: block;
  width: min(52vw, 200px);
  max-width: 200px;
  height: auto;
  padding: 8px 8px 0;
}

.panel,
.state-panel {
  border-radius: 30px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28), 0 2px 10px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.auth-panel {
  --auth-control-inset: 8px;
  --auth-control-radius: var(--dashboard-surface-radius);
  width: min(100%, 530px);
  min-width: 0;
  max-width: 530px;
  margin: 24px auto;
}

.not-found-panel {
  padding: 30px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  margin-bottom: 24px;
  padding: 0 5px;
}

.auth-panel .logo {
  width: min(42%, 184px);
  margin: 0;
  padding: 0;
}

.portal-label {
  flex: 1;
  margin: 0;
  padding: 0;
  color: #fff;
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -0.01em;
  line-height: 1.2;
  text-align: right;
}

.eyebrow {
  margin-bottom: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
p { margin-top: 0; }

h1 {
  margin-bottom: 12px;
  color: #fff;
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 4px;
  color: #fff;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.lead {
  max-width: 420px;
  padding: 0 5px;
  margin-bottom: 26px;
  color: #fff;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.4;
}

.email-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 8px;
  border-radius: var(--auth-control-radius);
}

input {
  min-width: 0;
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: calc(var(--auth-control-radius) - var(--auth-control-inset));
  color: #fff;
  background: transparent;
  box-shadow: none;
}

input::placeholder { color: #9aa0a6; }

.primary-action,
.secondary-action,
.provider-button,
.text-button {
  border: 0;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
  transition: filter 0.15s ease, transform 0.05s ease, background 0.15s ease;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 20px;
  border-radius: calc(var(--auth-control-radius) - var(--auth-control-inset));
  white-space: nowrap;
  --bento-color: var(--action);
  background-color: var(--bento-color);
  background-image: linear-gradient(to bottom, color-mix(in srgb, var(--bento-color) 88%, #000 12%), var(--bento-color));
}

.email-row .primary-action {
  align-self: center;
  min-height: 38px;
  --bento-color: var(--bright-green);
  color: #000;
  font-size: 18px;
}

a.primary-action:hover { text-decoration: none; }

.primary-action:hover,
.secondary-action:hover,
.provider-button:hover { filter: brightness(1.15); }

.primary-action:active,
.secondary-action:active,
.provider-button:active { transform: translateY(1px); }

button:disabled { cursor: wait; filter: saturate(0.5); opacity: 0.65; }

.provider-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.provider-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  border: 0;
  border-radius: var(--auth-control-radius);
  --bento-color: var(--action);
  background-image:
    linear-gradient(
      to bottom,
      color-mix(in srgb, var(--bento-color) 88%, #000 12%),
      var(--bento-color)
    );
  background-color: var(--bento-color);
  font-size: 20px;
}

.primary-action,
.provider-button {
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.5),
    inset 0 8px 16px rgba(255, 255, 255, 0.35);
}

.provider-icon {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.apple-icon {
  width: 20px;
  height: 20px;
}

.inline-status {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(117, 224, 189, 0.25);
  border-radius: 12px;
  color: #fff;
  background: rgba(15, 92, 70, 0.24);
  font-size: 14px;
}

.inline-status.error,
.state-panel.error {
  border: 1px solid rgba(255, 155, 155, 0.28);
  color: #fff;
  background: rgba(113, 36, 44, 0.3);
}

#auth-status,
#auth-status.error {
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--dashboard-surface-radius);
  color: #fff;
  background: var(--panel);
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.2),
    0 2px 10px rgba(0, 0, 0, 0.14);
}

.state-panel {
  width: min(100%, 580px);
  margin: 24px auto;
  padding: 34px;
  text-align: center;
}

.state-panel.compact { margin: 60px auto; }
.state-panel.error p { margin-bottom: 18px; }

#initial-loading,
#dashboard-loading {
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #9fe7eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.state-panel .spinner + p { margin: 12px 0 0; }

@keyframes spin { to { transform: rotate(360deg); } }

.text-button {
  padding: 8px 12px;
  color: #fff;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-button:hover { color: #fff; }

#dashboard-view {
  align-self: flex-start;
  width: 100%;
  text-align: center;
}

.dashboard-state {
  position: fixed;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: min(calc(100% - 40px), 580px);
  margin: 0;
  transform: translate(-50%, -50%);
  text-align: center;
}

.dashboard-state.state-panel.compact {
  margin: 0;
}

.dashboard-heading {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  margin-bottom: 28px;
}

.dashboard-brand-row {
  display: grid;
  align-items: flex-start;
  grid-template-columns: auto 1fr;
  gap: 4px 20px;
}

.dashboard-brand-row .logo {
  width: min(38vw, 180px);
  padding: 0;
}

.dashboard-brand-row .portal-label {
  flex: none;
  white-space: nowrap;
}

.dashboard-brand-line,
.dashboard-account-line {
  display: contents;
}

.dashboard-account-line .text-button {
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  padding: 3px 18px;
  border-radius: 999px;
  --bento-color: var(--lighter-blue-black);
  background-color: var(--bento-color);
  background-image:
    linear-gradient(
      to bottom,
      color-mix(in srgb, var(--bento-color) 88%, #000 12%),
      var(--bento-color)
    );
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.5),
    inset 0 6px 12px rgba(255, 255, 255, 0.2);
  text-decoration: none;
}

.dashboard-meta {
  display: flex;
  align-items: flex-start;
  flex-direction: row;
  justify-content: center;
  gap: 12px;
  overflow-wrap: anywhere;
  text-align: left;
  white-space: nowrap;
}

.account-label { margin-bottom: 0; color: var(--muted); font-size: 13px; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.dashboard-surface {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--dashboard-surface-radius);
  background: var(--panel);
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.2),
    0 2px 10px rgba(0, 0, 0, 0.14);
}

.metric-card { min-height: 155px; padding: 23px; }

.metric-card {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
}
.metric-label { color: #fff; font-size: 22px; font-weight: 700; line-height: 1.2; }
.metric-value { color: #fff; font-size: 44px; line-height: 1; letter-spacing: -0.04em; }
.metric-note { color: #fff; font-size: 15px; line-height: 1.3; }

.activity-section { margin-top: 28px; }

.section-heading {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
  padding: 0 8px;
  text-align: left;
}

.section-heading h2 { margin: 0; }

.table-wrap { width: 100%; overflow-x: auto; }
.wide-table table { min-width: 880px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th {
  padding: 10px 8px;
  color: #fff;
  background: rgba(0, 18, 28, 0.38);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
  white-space: nowrap;
}

td {
  padding: 9px 8px;
  color: #fff;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.activity-table th,
.activity-table td,
.activity-table .secondary-value {
  color: #fff;
}

.activity-table tbody tr + tr {
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

td.numeric, th.numeric { text-align: left; }

.activity-table th:last-child,
.activity-table td:last-child {
  width: 1%;
  text-align: left;
  white-space: nowrap;
}
.secondary-value { color: #fff; }
.positive { color: var(--positive); }
.negative { color: var(--negative); }

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

.country-flag-frame {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 1em;
  flex: 0 0 24px;
}

.country-flag {
  position: absolute;
  font-size: 24px;
  line-height: 1;
}

.status-badge {
  display: inline-block;
  padding: 3px 9px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  --bento-color: var(--status-gray);
  background-color: var(--bento-color);
  background-image:
    linear-gradient(
      to bottom,
      color-mix(in srgb, var(--bento-color) 88%, #000 12%),
      var(--bento-color)
    );
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.5),
    inset 0 6px 12px rgba(255, 255, 255, 0.2);
  font-size: 13px;
  font-weight: 650;
  text-transform: capitalize;
  white-space: nowrap;
}

.status-badge.commission,
.status-badge.paid {
  --bento-color: var(--bright-green);
  color: #000;
}

.status-badge.reversal,
.status-badge.rejected,
.status-badge.failed,
.status-badge.reversed {
  --bento-color: #ef4444;
}

.status-badge.restoration {
  --bento-color: var(--restoration-blue);
}

.status-badge.pending,
.status-badge.pending-approval {
  --bento-color: var(--bright-blue);
}

.secondary-action {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.09);
}

.statement-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 3px 12px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  --bento-color: var(--lighter-blue-black);
  background-color: var(--bento-color);
  background-image:
    linear-gradient(
      to bottom,
      color-mix(in srgb, var(--bento-color) 88%, #000 12%),
      var(--bento-color)
    );
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.5),
    inset 0 6px 12px rgba(255, 255, 255, 0.2);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
}

.statement-button-arrow {
  font-size: 18px;
  line-height: 1;
}

.statement-button:hover { filter: brightness(1.15); }
.statement-button:active { transform: translateY(1px); }

.load-more { display: block; min-width: 130px; margin: 20px auto 0; }

.empty-state {
  padding: 34px 12px;
  color: var(--muted);
  text-align: center;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-top: auto;
  padding-top: 52px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.site-footer a { color: inherit; white-space: nowrap; }

.noscript {
  margin: 20px;
  padding: 14px;
  border-radius: 12px;
  color: #fff;
  background: #6d2730;
  text-align: center;
}

@media (max-width: 900px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .dashboard-brand-row {
    display: flex;
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .dashboard-brand-line,
  .dashboard-account-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-width: 0;
    width: 100%;
  }

  .dashboard-brand-row .portal-label {
    flex: 1;
    min-width: 0;
    font-size: clamp(18px, 4vw, 28px);
    white-space: normal;
  }

  .dashboard-account-line .text-button {
    flex: 0 0 auto;
  }

  .dashboard-meta {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 2px 12px;
    min-width: 0;
    text-align: left;
    white-space: normal;
  }

  .dashboard-meta .account-label {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 640px) {
  .container { padding: 24px 16px 20px; }
  .auth-panel {
    width: 100%;
    margin: 22px auto;
  }
  .email-row { grid-template-columns: 1fr; }
  .email-row .primary-action { width: 100%; }
  .summary-grid { grid-template-columns: 1fr; }
  .dashboard-heading { align-items: center; flex-direction: column; gap: 5px; margin-bottom: 0; }
  .metric-card { min-height: 128px; }
  .activity-section { margin-top: 24px; }
  .table-wrap { overflow: hidden; }
  .table-wrap table, .wide-table table { min-width: 0; }
  table, thead, tbody, tr, td { display: block; width: 100%; }
  thead { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  tbody { display: grid; gap: 0; }
  tr {
    display: grid;
    grid-template-columns: minmax(max-content, 1fr) minmax(0, 1fr);
    column-gap: 12px;
    padding: 9px 13px;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  tbody tr:nth-child(even) { background: rgba(0, 18, 28, 0.38); }
  td,
  td.numeric {
    display: grid;
    align-items: baseline;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    justify-items: start;
    min-height: 30px;
    padding: 5px 2px;
    text-align: left;
    white-space: normal;
  }
  td::before {
    color: #fff;
    content: attr(data-label);
    font-size: inherit;
    font-weight: 700;
    justify-self: stretch;
    letter-spacing: 0;
    text-align: right;
    text-transform: none;
  }

  td .status-badge,
  td .country-value {
    justify-self: start;
  }

  .activity-table th:last-child,
  .activity-table td:last-child {
    width: auto;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
  .spinner { animation-duration: 1.5s; }
}
