/* Merchant portal — white & gold (scoped; avoids .panel collision with home tabs) */

body.portal {
  --p-bg: #fffcf7;
  --p-panel: #ffffff;
  --p-panel-2: #faf6ee;
  --p-line: #e8dfc8;
  --p-ink: #1a1612;
  --p-muted: #6b6258;
  --p-accent: #c9a227;
  --p-accent-2: #9a7b1a;
  --p-green: #1a7a4a;
  --p-amber: #9a6b0a;
  background: var(--p-bg);
  color: var(--p-ink);
  min-height: 100%;
}

body.portal a { color: var(--p-accent-2); }

body.portal .gate {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  background: radial-gradient(900px 500px at 50% -10%, rgba(212, 175, 55, .14), transparent 60%);
}

body.portal .gate .card {
  max-width: 420px; width: 100%; background: var(--p-panel);
  border: 1px solid var(--p-line); border-radius: 20px; padding: 28px 22px;
  box-shadow: 0 12px 40px rgba(26, 22, 18, .08);
}

body.portal .gate h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.03em; color: var(--p-ink); }
body.portal .gate .sub { color: var(--p-muted); font-size: 14px; margin: 0 0 22px; line-height: 1.55; }
body.portal .gate label { color: var(--p-muted); font-size: 13px; font-weight: 600; }
body.portal .gate input {
  background: var(--p-panel-2); border: 1px solid var(--p-line); color: var(--p-ink);
  border-radius: 12px; padding: 14px; width: 100%; font-family: var(--mono); font-size: 16px; min-height: 48px;
}
body.portal .gate input:focus {
  border-color: var(--p-accent); outline: none; box-shadow: 0 0 0 3px rgba(201, 162, 39, .2);
}
body.portal .gate .btn {
  width: 100%; margin-top: 14px;
  background: linear-gradient(135deg, #d4af37, #c9a227);
  border: none; color: #fff; min-height: 52px; font-size: 16px; font-weight: 700;
}
body.portal .gate-err {
  display: none; margin-bottom: 14px; padding: 12px 14px; border-radius: 12px;
  background: #fbe9e7; border: 1px solid #f0c4c0; color: #b3261e; font-size: 14px; line-height: 1.45;
}
body.portal .gate-err.show { display: block; }
body.portal .gate .sign-mode-btn {
  flex: 1; font-size: 12.5px; font-weight: 700; padding: 8px 10px; border-radius: 999px;
  border: 1px solid var(--p-line); background: var(--p-panel-2); color: var(--p-muted);
  cursor: pointer; font-family: inherit;
}
body.portal .gate .sign-mode-btn.active {
  background: linear-gradient(135deg, #d4af37, #c9a227); color: #fff; border-color: var(--p-accent);
}
body.portal .gate #emailIn,
body.portal .gate #passIn { font-family: inherit; }

body.portal .shell {
  max-width: 1180px; margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(48px, env(safe-area-inset-bottom));
}

body.portal .top {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding-bottom: 20px; border-bottom: 1px solid var(--p-line); margin-bottom: 22px;
}
body.portal .top .brand {
  font-weight: 800; font-size: 18px; letter-spacing: -.03em;
  display: flex; align-items: center; gap: 10px; color: var(--p-ink); text-decoration: none;
}
body.portal .top .brand .orb {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--p-ink); position: relative;
}
body.portal .top .brand .orb::after {
  content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%;
  background: var(--p-accent); top: -3px; right: -2px;
}
body.portal .top .who { font-size: 13px; color: var(--p-muted); }
body.portal .top .who b { color: var(--p-ink); }
body.portal .top .spacer { flex: 1; }
body.portal .mode-pill {
  font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--p-line); color: var(--p-muted); background: var(--p-panel-2);
}
body.portal .mode-pill.live { border-color: var(--p-accent); color: var(--p-accent-2); background: #faf3e0; }
body.portal .btn.ghost { background: transparent; border: 1px solid var(--p-line); color: var(--p-muted); }

body.portal .hero {
  background: linear-gradient(135deg, #faf3e0 0%, #fff9ee 45%, #ffffff 100%);
  border: 1px solid var(--p-line); border-radius: 20px; padding: 28px 30px; margin-bottom: 18px;
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: center;
}
body.portal .hero .lbl { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--p-muted); }
body.portal .hero .bal {
  font-size: clamp(32px, 10vw, 46px); font-weight: 800; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums; margin: 6px 0; color: var(--p-ink); transition: color .4s;
}
body.portal .hero .bal.flash { color: var(--p-accent-2); }
body.portal .hero .stats { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--p-muted); }
body.portal .hero .stats b { color: var(--p-ink); display: block; font-size: 17px; margin-top: 2px; }

body.portal .p-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 16px; align-items: start; }

body.portal .p-card {
  background: var(--p-panel); border: 1px solid var(--p-line); border-radius: 18px;
  padding: 22px 24px; box-shadow: 0 4px 20px rgba(26, 22, 18, .04);
}
body.portal .p-card h2 { margin: 0 0 4px; font-size: 16px; color: var(--p-ink); }
body.portal .p-card .p-sub { font-size: 13px; color: var(--p-muted); margin: 0 0 18px; }
body.portal .p-card label { color: var(--p-muted); font-size: 13px; font-weight: 600; }
body.portal .p-card input, body.portal .p-card select {
  background: var(--p-panel-2); border: 1px solid var(--p-line); color: var(--p-ink);
  border-radius: 11px; padding: 13px; width: 100%; font-size: 16px; min-height: 48px;
}
body.portal .p-card input:focus, body.portal .p-card select:focus {
  border-color: var(--p-accent); outline: none; box-shadow: 0 0 0 3px rgba(201, 162, 39, .18);
}
body.portal .field { margin-bottom: 14px; }
body.portal .note { font-size: 12.5px; color: var(--p-muted); margin-top: 6px; }
body.portal .note.ok { color: var(--p-green); }
body.portal .btn.withdraw {
  background: linear-gradient(135deg, #d4af37, #c9a227); border: none; color: #fff;
  font-weight: 700; width: 100%; margin-top: 6px; min-height: 52px; font-size: 16px;
}
body.portal .btn.withdraw:disabled { opacity: .45; cursor: not-allowed; }
body.portal .btn.max {
  flex: 0 0 auto; padding: 11px 14px; font-size: 12px;
  background: var(--p-panel-2); border: 1px solid var(--p-line); color: var(--p-muted);
}
body.portal .amt-row { display: flex; gap: 8px; align-items: stretch; }
body.portal .amt-row input { flex: 1; }

body.portal .toast {
  border-radius: 12px; padding: 12px 16px; font-size: 13.5px; margin-bottom: 14px; display: none;
}
body.portal .toast.show { display: block; }
body.portal .toast.ok { background: #e8f5ee; border: 1px solid #b8e0c8; color: var(--p-green); }
body.portal .toast.err { background: #fbe9e7; border: 1px solid #f0c4c0; color: #b3261e; }
body.portal .toast.proc { background: #faf0da; border: 1px solid #e8d4a8; color: var(--p-amber); }

body.portal .activity { list-style: none; margin: 0; padding: 0; }
body.portal .activity li {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 13px 0; border-bottom: 1px solid var(--p-line); font-size: 13.5px;
}
body.portal .activity li:last-child { border-bottom: none; }
body.portal .activity .kind { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
body.portal .activity .kind.in { color: var(--p-green); }
body.portal .activity .kind.out { color: var(--p-amber); }
body.portal .activity .ref { font-family: var(--mono); font-size: 11px; color: var(--p-muted); }
body.portal .activity .amt { font-weight: 700; font-variant-numeric: tabular-nums; }

body.portal .badge { font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 600; text-transform: none; }
body.portal .badge.success { background: #e8f5ee; color: var(--p-green); }
body.portal .badge.processing, body.portal .badge.pending { background: #faf0da; color: var(--p-amber); }
body.portal .badge.failed { background: #fbe9e7; color: #b3261e; }

body.portal .proc-overlay {
  position: fixed; inset: 0; background: rgba(26, 22, 18, .45); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
body.portal .proc-overlay.show { display: flex; }
body.portal .proc-box {
  background: var(--p-panel); border: 1px solid var(--p-line); border-radius: 18px;
  padding: 28px; max-width: 380px; width: 100%; text-align: center;
  box-shadow: 0 16px 48px rgba(26, 22, 18, .12);
}
body.portal .proc-spin {
  width: 44px; height: 44px; margin: 0 auto 16px; border-radius: 50%;
  border: 3px solid var(--p-line); border-top-color: var(--p-accent); animation: spin 1s linear infinite;
}
body.portal .trust { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
body.portal .trust span {
  font-size: 11px; font-weight: 600; padding: 5px 10px; border-radius: 999px;
  background: var(--p-panel-2); border: 1px solid var(--p-line); color: var(--p-muted);
}
body.portal .trust span.ok { border-color: #b8e0c8; color: var(--p-green); background: #e8f5ee; }
body.portal .banner {
  background: #faf0da; border: 1px solid #e8d4a8; border-radius: 12px;
  padding: 12px 16px; font-size: 13px; color: var(--p-amber); margin-bottom: 14px; display: none;
}
body.portal .banner.show { display: block; }
body.portal .confirm-box { text-align: left; }
body.portal .confirm-box .row2 {
  display: flex; justify-content: space-between; padding: 8px 0;
  border-bottom: 1px solid var(--p-line); font-size: 14px;
}
body.portal .confirm-box .row2:last-child { border: none; font-weight: 700; font-size: 16px; padding-top: 12px; }
body.portal .wd-list { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow-y: auto; }
body.portal .wd-list li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--p-line); font-size: 13px;
}
body.portal .wd-list li:last-child { border-bottom: none; }
body.portal .limits-note { font-size: 12px; color: var(--p-muted); margin-top: 10px; line-height: 1.5; }

/* ---- collect a payment ---- */
body.portal .quick-amts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
body.portal .quick-amts button {
  border: 1px solid var(--p-line); background: var(--p-panel-2); color: var(--p-accent-2);
  font: inherit; font-size: 13px; font-weight: 700; padding: 8px 13px; border-radius: 999px;
  cursor: pointer; transition: border-color .12s, background .12s;
  -webkit-tap-highlight-color: transparent;
}
body.portal .quick-amts button:hover { border-color: var(--p-accent); background: #faf3e0; }
body.portal .quick-amts button.on { border-color: var(--p-accent); background: #faf3e0; box-shadow: 0 0 0 1px var(--p-accent) inset; }
body.portal .col-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
body.portal .col-amt { font-size: 26px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
body.portal .acct-box {
  background: var(--p-panel-2); border: 1px solid var(--p-line); border-radius: 14px;
  padding: 16px; margin: 12px 0 4px; text-align: center;
}
body.portal .acct-lbl { font-size: 13px; color: var(--p-muted); font-weight: 600; }
body.portal .acct-num {
  font-size: clamp(24px, 6vw, 32px); font-weight: 800; letter-spacing: 3px;
  font-variant-numeric: tabular-nums; color: var(--p-accent-2); margin: 6px 0;
  font-family: var(--mono); overflow-wrap: anywhere;
}
body.portal .acct-box .btn.slim {
  width: auto; margin-top: 10px;
  background: linear-gradient(135deg, #d4af37, #c9a227); border: none; color: #fff;
}
body.portal .link-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--p-line);
  border-radius: 12px;
  background: var(--p-panel-2);
}
body.portal .link-row .btn.slim {
  flex-shrink: 0;
  margin-top: 0;
  width: auto;
}
body.portal .col-wait {
  display: flex; align-items: center; gap: 10px; margin-top: 14px;
  font-size: 13.5px; color: var(--p-amber); font-weight: 600;
}
body.portal .proc-spin.small {
  width: 18px; height: 18px; margin: 0; border-width: 2px;
  border-color: var(--p-line); border-top-color: var(--p-amber);
}
body.portal .col-done {
  margin-top: 14px; font-size: 14.5px; font-weight: 700; color: var(--p-green);
  background: #e8f5ee; border: 1px solid #b8e0c8; border-radius: 12px; padding: 12px 14px;
}
body.portal #colResult .btn.ghost.slim { width: 100%; }

@media (max-width: 800px) { body.portal .hero { grid-template-columns: 1fr; } }
@media (max-width: 900px) { body.portal .p-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  body.portal .shell { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  body.portal .p-card { padding: 18px 16px; }
  body.portal .top .who { width: 100%; order: 3; }
}

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