/* Admin uses the shared Stripe dashboard shell */
@import url("/dashboard/styles.css");

/* —— Admin login —— */
.admin-auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 46%) 1fr;
  background: var(--bg);
}

/* Brand side */
.admin-auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 36px clamp(28px, 4vw, 56px) 32px;
  color: #fff;
  background:
    radial-gradient(80% 55% at 100% 0%, rgba(255, 255, 255, 0.12), transparent 60%),
    radial-gradient(70% 60% at 0% 100%, rgba(0, 212, 170, 0.14), transparent 65%),
    linear-gradient(155deg, #4a3fdc 0%, #3127b0 50%, #1f1673 100%);
  overflow: hidden;
  isolation: isolate;
}
.ab-top { display: flex; align-items: center; gap: 10px; }
.ab-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 17px;
  background: linear-gradient(135deg, #7a73ff, #635bff);
  box-shadow: 0 6px 18px rgba(99, 91, 255, 0.45);
}
.ab-name { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.ab-tag {
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}
.ab-copy { max-width: 440px; }
.ab-eyebrow {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a5a0ff;
}
.ab-copy h1 {
  margin: 0 0 14px;
  font-size: clamp(28px, 3.1vw, 38px);
  font-weight: 650;
  line-height: 1.12;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.ab-lead {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.7);
}
.ab-features {
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.ab-features li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.ab-ico {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #c8c4ff;
  background: rgba(99, 91, 255, 0.2);
}
.ab-features strong { display: block; font-size: 14px; font-weight: 600; }
.ab-features span:not(.ab-ico) {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.62);
}
.ab-foot { display: grid; gap: 10px; }
.ab-foot p { margin: 0; font-size: 12px; color: rgba(255, 255, 255, 0.42); }
.ab-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
}
.ab-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8792a2;
}
.ab-status.is-ok .ab-dot { background: #3ddc97; box-shadow: 0 0 0 4px rgba(61, 220, 151, 0.18); }
.ab-status.is-down .ab-dot { background: #ff6b81; box-shadow: 0 0 0 4px rgba(255, 107, 129, 0.18); }

/* Form side */
.admin-auth-panel {
  display: flex;
  flex-direction: column;
  padding: 24px clamp(20px, 4vw, 48px);
}
.admin-auth-top { display: flex; justify-content: flex-end; font-size: 13px; }
.admin-auth-top a,
.admin-auth-legal a {
  color: var(--mute);
  font-weight: 500;
  text-decoration: none;
}
.admin-auth-top a:hover,
.admin-auth-legal a:hover { color: var(--purple); }
.admin-auth-card {
  width: 100%;
  max-width: 400px;
  margin: auto;
  padding: 8px 0;
}
.admin-auth-card h2 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.03em;
  color: var(--text);
}
.admin-auth-card .lead {
  margin: 0 0 28px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--mute);
}
.auth-form { display: grid; gap: 18px; }
.auth-field { display: grid; gap: 7px; }
.auth-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.auth-field .optional { margin-left: 4px; font-weight: 400; color: var(--mute); }
.auth-field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: #fff;
  border: 1px solid #d5dbe3;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(10, 37, 64, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-field input::placeholder { color: #a3acb9; }
.auth-field input:hover { border-color: #b8c1cc; }
.auth-field input:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 4px rgba(99, 91, 255, 0.14);
}
.auth-field input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(223, 27, 65, 0.1);
}
.input-reveal { position: relative; }
.input-reveal input { padding-right: 50px; font-family: var(--font); }
.input-reveal input[type="text"] {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  letter-spacing: 0.01em;
}
.reveal-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--mute);
  cursor: pointer;
}
.reveal-btn:hover { color: var(--text); background: #f1f4f8; }
.reveal-btn:focus-visible { outline: 2px solid var(--purple); outline-offset: 1px; }
.reveal-btn .eye-closed { display: none; }
.reveal-btn[aria-pressed="true"] .eye-open { display: none; }
.reveal-btn[aria-pressed="true"] .eye-closed { display: block; }
.field-note { margin: 0; font-size: 12px; color: #b76e00; }
.field-hint { margin: -2px 0 2px; font-size: 13px; color: var(--mute); }
.otp-input {
  max-width: 200px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace !important;
  font-size: 18px !important;
  letter-spacing: 0.45em;
}
.auth-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff0f2;
  border: 1px solid #ffd3da;
  color: #b4123a;
  font-size: 13px;
  line-height: 1.45;
}
.auth-submit {
  width: 100%;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 10px;
  font-size: 15px;
}
.auth-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.8s linear infinite;
}
.auth-submit.is-loading .auth-spinner { display: inline-block; }
.auth-submit.is-loading { pointer-events: none; opacity: 0.85; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
.auth-help {
  margin-top: 22px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  font-size: 13px;
  color: var(--body);
}
.auth-help summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--mute);
  list-style: none;
}
.auth-help summary::-webkit-details-marker { display: none; }
.auth-help summary::before { content: "+ "; color: var(--purple); font-weight: 700; }
.auth-help[open] summary::before { content: "– "; }
.auth-help p { margin: 10px 0 0; line-height: 1.55; }
.auth-help code {
  font-size: 12px;
  background: #eef2f7;
  padding: 0.1em 0.4em;
  border-radius: 4px;
}
.admin-auth-legal { margin: 0; text-align: center; font-size: 12px; }

@media (max-width: 900px) {
  .admin-auth { grid-template-columns: 1fr; }
  .admin-auth-brand { gap: 20px; padding: 24px 20px; }
  .ab-copy h1 { font-size: 24px; }
  .ab-lead { font-size: 14px; }
  .ab-features,
  .ab-foot p { display: none; }
  .admin-auth-panel { padding: 16px 16px 28px; }
  .ab-status { border-radius: 12px; }
  .admin-auth-card { margin: 24px auto; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-spinner { animation-duration: 2.4s; }
}

/* KYC queue + dossier */
.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--purple);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  line-height: 1;
}
.nav-link .nav-badge { flex-shrink: 0; }
.status-pill.submitted {
  background: #fff4e5;
  color: #b76e00;
}
.kyc-modal-card {
  width: min(720px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  padding: 22px 22px 18px;
}
.kyc-dossier-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.kyc-section {
  margin: 0 0 16px;
  padding: 14px 14px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbff;
}
.kyc-section h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.kyc-grid {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: minmax(60px, auto);
  gap: 8px;
}
/* Every field in the same box, same height per row; long values span the row. */
.kyc-kv {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-height: 60px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface, #fff);
}
.kyc-kv.wide { grid-column: 1 / -1; }
.kyc-kv dt {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8792a2;
  line-height: 1.2;
}
.kyc-kv dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
}
.kyc-kv .kyc-doc-btn { width: auto; margin-left: 10px; padding: 4px 10px; font-size: 12px; vertical-align: middle; }
/* Buttons side by side share one size, whatever their colour (soft variants are 32px by default). */
.kyc-modal-actions .btn { height: 40px; padding: 0 16px; font-size: var(--fs-sm, 13px); }
td.actions .btn { height: 28px; padding: 0 10px; font-size: 12px; }

.kyc-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
  .kyc-grid { grid-template-columns: 1fr; }
  .kyc-modal-actions .btn { width: 100%; }
}

@media (max-width: 860px) {
  .admin-auth-card { padding: 24px 18px 22px; }
  .admin-auth-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* Condition / alert rows (live rail checks, "À traiter") */
.activation-conditions .cond {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.activation-conditions .cond:last-child { border-bottom: 0; }
.activation-conditions .cond strong { flex: none; }
.activation-conditions .cond span { color: var(--mute); text-align: right; }
.activation-conditions .cond.ok span { color: var(--ok); }
.activation-conditions .cond.ko span { color: var(--danger); }

#admin-volume-chart { width: 100%; height: 180px; display: block; }
.chart-legend .lg-out { background: #e5484d; }
.dir-in { color: var(--ok); font-weight: 600; }
.dir-out { color: #c2410c; font-weight: 600; }

#activity-body td { white-space: nowrap; }

/* Merchant checkout theme editor */
.brand-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.brand-color div { display: flex; gap: 6px; align-items: center; }
.brand-color input[type="color"] { width: 38px; height: 38px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; }
.brand-color input:not([type="color"]) { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.brand-preview { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px; border: 1px dashed var(--brand-line, #e4e0fb); border-radius: 10px; }
.bp-chip { padding: 8px 12px; border: 1.5px solid; border-radius: 8px; font-size: 13px; font-weight: 600; }
.bp-btn { height: 38px; padding: 0 22px; border: 0; border-radius: 8px; font-weight: 600; cursor: default; }
@media (max-width: 640px) { .brand-grid { grid-template-columns: 1fr 1fr; } }

/* Provider chip (FreshPay / AvadaPay / internal rows) */
.rail-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: #eef2f7;
  color: var(--mute, #5b6474);
}
.rail-tag.rail-instantpay { background: #e8f1ff; color: #1f5fbf; }
.rail-tag.rail-avadapay { background: #fff1e6; color: #b45309; }
.rail-tag.rail-balance,
.rail-tag.rail-escrow { background: #f1ecff; color: #6941c6; }
#pv-totals .stat small { display: block; margin-top: 4px; font-size: 12px; line-height: 1.4; }
#pv-body .status-pill { white-space: nowrap; }

/* Payinstant logo in the brand square: white tile, image fills it. */
.ab-logo { display: inline-flex !important; align-items: center; width: auto !important; height: 38px !important; padding: 0 8px; background: #fff !important; overflow: hidden; }
.ab-logo img { height: 28px; width: auto; max-width: none; display: block; }
.account-avatar.has-logo { display: inline-flex; align-items: center; width: auto; height: 28px; padding: 0 4px; background: #fff !important; border: 1px solid var(--border); overflow: hidden; }
.account-avatar.has-logo img { height: 22px; width: auto; max-width: none; display: block; }

/* Merchant sheet: key figures, then one tab at a time. */
.md-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0 0 14px; }
#merchant-modal .kyc-modal-card { width: min(980px, 100%); }
#merchant-modal .table-scroll td { white-space: nowrap; }
.md-stat small { font-size: 11px; color: #8792a2; line-height: 1.3; }
.md-stat { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-height: 64px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface, #fff); box-shadow: inset 0 2px 0 var(--purple, #635bff); }
.md-stat span { font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: #8792a2; line-height: 1.25; white-space: nowrap; }
.md-stat strong { font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: var(--text); white-space: nowrap; }
.md-tabs { display: flex; gap: 4px; margin: 0 0 14px; padding: 4px; border-radius: 10px; background: #eef1f6; overflow-x: auto; }
.md-tabs button { flex: 1 0 auto; height: 34px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; color: var(--mute, #697386); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.md-tabs button[aria-selected="true"] { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(10, 37, 64, .12); }
.md-tabs button[hidden] { display: none; }
.kyc-section.hidden { display: none; }
/* Colour fields stay inside their column. */
.brand-color div { min-width: 0; }
.brand-color input:not([type="color"]) { width: auto !important; }
.brand-color input[type="color"] { flex: 0 0 38px; }
@media (max-width: 760px) { .md-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.md-products { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.md-product { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface, #fff); cursor: pointer; }
.md-product input { margin-top: 3px; flex: none; }
.md-product span { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.md-product strong { font-size: 13px; color: var(--text); }
.md-product small { font-size: 12px; line-height: 1.45; color: var(--mute, #697386); }
.md-product:has(input:checked) { border-color: var(--purple, #635bff); background: #f6f5ff; }
@media (max-width: 760px) { .md-products { grid-template-columns: 1fr; } }

.md-lock { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.md-lock .cselect, .md-lock select { min-width: 260px; }
.md-lock .field { margin: 0; min-width: 260px; }
.md-lock { align-items: flex-end; }
