:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f7f9;
  color: #1f2933;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

header,
footer {
  padding: 16px 24px;
  background: #ffffff;
  border-bottom: 1px solid #d8dee8;
}

footer {
  border-top: 1px solid #d8dee8;
  border-bottom: 0;
}

.payment-shell {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(320px, 1fr);
  gap: 24px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 20px;
}

.payment-summary,
.checkout-panel,
.terminal-state {
  background: #ffffff;
  border: 1px solid #d8dee8;
  border-radius: 8px;
}

.payment-summary,
.checkout-panel {
  padding: 24px;
}

.payment-kicker {
  margin: 0 0 8px;
  color: #52606d;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0 0 18px;
  letter-spacing: 0;
}

dl {
  display: grid;
  gap: 14px;
  margin: 0;
}

dt {
  color: #52606d;
  font-size: 13px;
}

dd {
  margin: 2px 0 0;
  font-weight: 700;
}

.embedded-checkout {
  min-height: 430px;
}

.checkout-loading,
.simulated-checkout {
  min-height: 360px;
  border: 1px solid #cbd2dc;
  border-radius: 8px;
  padding: 20px;
}

.simulated-checkout {
  display: grid;
  gap: 16px;
  background: #fbfcfe;
}

.simulated-field {
  display: grid;
  gap: 6px;
}

.simulated-field span {
  color: #52606d;
  font-size: 13px;
  font-weight: 700;
}

.simulated-field div {
  min-height: 42px;
  border: 1px solid #cbd2dc;
  border-radius: 6px;
  background: #ffffff;
  padding: 10px 12px;
  color: #7b8794;
}

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

button,
.return-link {
  min-height: 40px;
  border: 1px solid #1f2933;
  border-radius: 6px;
  background: #1f2933;
  color: #ffffff;
  padding: 9px 14px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.return-link {
  display: inline-flex;
  align-items: center;
  margin-top: 16px;
  background: #ffffff;
  color: #1f2933;
}

button.secondary {
  background: #ffffff;
  color: #1f2933;
}

button.secondary-action {
  border-color: #cbd2dc;
  background: #ffffff;
  color: #1f2933;
}

button.danger-action {
  border-color: #9f1d1d;
  background: #ffffff;
  color: #9f1d1d;
}

.terminal-state {
  padding: 20px;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border: 1px solid #cbd2dc;
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}

textarea {
  min-height: unset;
  resize: vertical;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid #e4e7ec;
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #52606d;
  font-size: 12px;
  text-transform: uppercase;
}

.admin-page {
  background: #f4f6f8;
}

.admin-login-page {
  min-height: 100vh;
  background-color: #0c1520;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.055) 1px, transparent 1px);
  background-size: 28px 28px;
}

.login-shell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 100vh;
  padding: 48px 80px 48px 48px;
  width: 100%;
  box-sizing: border-box;
}

.login-panel,
.login-assurance,
.admin-form,
.table-panel {
  background: #ffffff;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  box-shadow: 0 14px 35px rgba(31, 41, 51, 0.08);
}

.login-panel {
  width: 400px;
  max-width: 100%;
  padding: 40px;
  background: #ffffff;
  box-shadow: 0 32px 80px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.06);
}

.login-assurance {
  align-self: center;
  min-height: 360px;
  padding: 32px;
  background: linear-gradient(135deg, #ffffff 0%, #eef7f3 100%);
}

.login-brand,
.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  display: block;
  flex-shrink: 0;
}

.login-form,
.admin-form,
.field-group {
  display: grid;
  gap: 10px;
}

.login-form {
  margin-top: 28px;
}

.field-group label {
  color: #52606d;
  font-size: 13px;
  font-weight: 700;
}

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

.field-row > .field-group {
  min-width: 0;
}

.field-row.compact {
  grid-template-columns: minmax(0, 1fr) 92px 132px;
  gap: 14px;
}

.primary-action {
  justify-self: start;
}

.form-error {
  margin: 0;
  border: 1px solid #f5b5ad;
  border-radius: 6px;
  background: #fff2f0;
  color: #8a241b;
  padding: 10px 12px;
  font-size: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #60707f;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.assurance-list {
  margin-top: 26px;
  border-top: 1px solid #cbd2dc;
  padding-top: 18px;
}

.assurance-list div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid #dfe4ea;
  padding: 12px 0;
}

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

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 22px;
  border-right: 1px solid #d8dee8;
  background: #ffffff;
  padding: 22px;
}

.admin-brand {
  color: #1f2933;
  font-weight: 800;
  text-decoration: none;
}

.admin-nav {
  display: grid;
  gap: 6px;
}

.admin-nav a,
.logout-link {
  display: flex;
  align-items: center;
  min-height: 38px;
  border-radius: 6px;
  color: #354150;
  padding: 8px 10px;
  text-decoration: none;
  font-weight: 700;
}

.admin-nav a:hover,
.logout-link:hover,
.admin-nav a.is-active {
  background: #eef2f6;
}

.admin-nav a.is-active {
  color: #163b34;
}

.sidebar-meta {
  align-self: end;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  padding: 12px;
}

.sidebar-meta span,
.admin-summary span,
.domain-count {
  color: #60707f;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.sidebar-meta strong {
  display: block;
  margin-top: 4px;
}

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

.admin-topbar,
.domain-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.admin-topbar {
  margin-bottom: 28px;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(86px, 1fr));
  gap: 10px;
}

.admin-summary div {
  min-height: 68px;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.admin-summary strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
}

.admin-domain {
  scroll-margin-top: 24px;
  margin-bottom: 34px;
  display: none;
}

.admin-domain.is-active {
  display: block;
}

.domain-header {
  margin-bottom: 14px;
}

.domain-grid {
  display: grid;
  grid-template-columns: minmax(340px, 440px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-form,
.table-panel {
  padding: 18px;
}

.admin-form h3 {
  margin: 0 0 6px;
}

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

.form-toggle {
  justify-self: start;
}

.table-panel {
  overflow-x: auto;
}

.table-input {
  width: 100%;
  min-width: 130px;
  min-height: 36px;
  padding: 7px 9px;
  font-size: 13px;
}

.code-input {
  min-width: 118px;
}

.wide-input {
  min-width: 220px;
}

.amount-input {
  min-width: 110px;
}

.currency-input {
  min-width: 74px;
  max-width: 82px;
}

.vat-input {
  min-width: 112px;
}

.stacked-input {
  margin-top: 8px;
}

.toggle-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.toggle-cell input {
  min-height: auto;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 136px;
}

.small-action {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.muted-cell {
  color: #60707f;
  max-width: 280px;
  overflow-wrap: anywhere;
}

[data-record-row].is-selected {
  background: #eef7f3;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #edf2f7;
  color: #354150;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.is-active {
  background: #dff3e8;
  color: #17613f;
}

.status-pill.is-muted {
  background: #f2e7d8;
  color: #73510d;
}

.status-pill--sm {
  min-height: 18px;
  padding: 1px 6px;
  font-size: 10px;
  vertical-align: middle;
}


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

.status-strip span {
  border: 1px solid #d8dee8;
  border-radius: 999px;
  background: #ffffff;
  padding: 6px 10px;
  color: #52606d;
  font-size: 13px;
}

.empty-state {
  color: #60707f;
  text-align: center;
}

.lang-tabs {
  border: 1px solid #d8dee8;
  border-radius: 8px;
  overflow: hidden;
}

.lang-tab-bar {
  display: flex;
  background: #f4f6f8;
  border-bottom: 1px solid #d8dee8;
}

.lang-tab {
  flex: 1;
  min-height: 36px;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #52606d;
  font-size: 13px;
  font-weight: 700;
  padding: 0 12px;
  cursor: pointer;
}

.lang-tab.is-active {
  border-bottom-color: #163b34;
  color: #163b34;
  background: #ffffff;
}

.lang-panel {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}

.lang-panel.is-active {
  display: flex;
}

.required-mark {
  color: #9f1d1d;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

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

  .admin-layout,
  .domain-grid,
  .field-row,
  .field-row.compact {
    grid-template-columns: 1fr;
  }

  .login-shell {
    justify-content: center;
    padding: 32px 16px;
  }

  .admin-sidebar {
    position: static;
    height: auto;
    grid-template-rows: none;
  }

  .admin-main {
    padding: 20px 14px;
  }

  .admin-topbar,
  .domain-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-summary {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Payment detail overlay ────────────────────────────────────────────── */

tr.payment-request-row {
  cursor: pointer;
}
tr.payment-request-row:hover td {
  background: var(--row-hover, #f1f5f9);
}

.payment-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 200;
  display: flex;
  justify-content: flex-end;
}

.payment-overlay[hidden] { display: none; }

.payment-overlay-panel {
  width: 420px;
  max-width: 100vw;
  height: 100%;
  background: #fff;
  border-left: 1px solid #d8dee8;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.2s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.payment-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #d8dee8;
  flex-shrink: 0;
}

.payment-overlay-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.overlay-close-btn {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
  padding: 0 4px;
}

.overlay-close-btn:hover { color: #1f2933; }

.payment-overlay-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.overlay-loading,
.overlay-error {
  color: #64748b;
  font-size: 13px;
  padding: 12px 0;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.detail-table th,
.detail-table td {
  padding: 7px 6px;
  vertical-align: top;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
}

.detail-table th {
  color: #64748b;
  font-weight: 500;
  white-space: nowrap;
  width: 38%;
}

.detail-table td { color: #1f2933; word-break: break-all; }

.url-value {
  font-size: 11px;
  color: #475569;
  word-break: break-all;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-pending   { background: #fef9c3; color: #854d0e; }
.status-paid      { background: #dcfce7; color: #166534; }
.status-failed    { background: #fee2e2; color: #991b1b; }
.status-cancelled { background: #f1f5f9; color: #475569; }
.status-expired   { background: #f1f5f9; color: #475569; }

.payment-detail-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}
.payment-detail-link:hover { text-decoration: underline; }

/* ── Website hover tooltip ─────────────────────────────────────────────── */

.website-hover {
  cursor: default;
  border-bottom: 1px dashed #94a3b8;
}

.website-tooltip {
  position: absolute;
  z-index: 300;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12px;
  min-width: 220px;
  max-width: 320px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  pointer-events: auto;
}

.website-tooltip[hidden] { display: none; }

.tooltip-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 8px;
  display: flex;
  gap: 6px;
  align-items: center;
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.tooltip-row span:first-child { color: #94a3b8; white-space: nowrap; }
.tooltip-row span:last-child  { color: #e2e8f0; word-break: break-all; text-align: right; }

.tooltip-loading { color: #94a3b8; font-size: 12px; }

.badge-active   { background: #166534; color: #dcfce7; padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 600; }
.badge-inactive { background: #475569; color: #f1f5f9; padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 600; }

/* ── Event type tooltip ─────────────────────────────────────────────────── */

.event-type-hover {
  cursor: default;
  text-decoration: underline dotted #94a3b8;
  text-underline-offset: 3px;
}

.event-type-tooltip {
  position: absolute;
  z-index: 300;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 12px;
  max-width: 280px;
  line-height: 1.5;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  pointer-events: none;
}

.event-type-tooltip[hidden] { display: none; }

/* ── Help overlay ───────────────────────────────────────────────────────── */

.help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-height: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #d8dee8;
  border-radius: 50%;
  background: #ffffff;
  color: #60707f;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}

.help-btn:hover {
  background: #eef2f6;
  color: #1f2933;
  border-color: #b0bac6;
}

.domain-header-end {
  display: flex;
  align-items: center;
  gap: 10px;
}

.help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-overlay[hidden] { display: none; }

.help-overlay-panel {
  width: 50vw;
  height: 80vh;
  background: #ffffff;
  border: 1px solid #d8dee8;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  animation: helpFadeIn 0.18s ease;
}

@keyframes helpFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

.help-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid #d8dee8;
  flex-shrink: 0;
}

.help-overlay-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.help-overlay-body {
  padding: 24px 28px;
  overflow-y: auto;
  flex: 1;
}

.help-section {
  margin-bottom: 28px;
}

.help-section:last-child {
  margin-bottom: 0;
}

.help-section h4 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #52606d;
}

.help-field-list {
  display: grid;
  gap: 0;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  overflow: hidden;
}

.help-field {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0;
  border-bottom: 1px solid #e4e7ec;
}

.help-field:last-child {
  border-bottom: none;
}

.help-field-name {
  padding: 10px 14px;
  background: #f8f9fb;
  font-size: 13px;
  font-weight: 700;
  color: #354150;
  border-right: 1px solid #e4e7ec;
}

.help-field-desc {
  padding: 10px 14px;
  font-size: 13px;
  color: #52606d;
  line-height: 1.55;
}

.help-note {
  margin-top: 14px;
  padding: 12px 14px;
  background: #f4f6f8;
  border-left: 3px solid #163b34;
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  color: #354150;
  line-height: 1.55;
}

.help-note strong {
  display: block;
  margin-bottom: 4px;
  color: #163b34;
}

@media (max-width: 760px) {
  .help-overlay-panel {
    width: 94vw;
    height: 88vh;
  }

  .help-field {
    grid-template-columns: 1fr;
  }

  .help-field-name {
    border-right: none;
    border-bottom: 1px solid #e4e7ec;
  }
}
