/* admin.css — shared stylesheet for both /admin and /merchant areas.
   Brown palette:
     espresso  #2b1d12   primary text + topbar
     saddle    #8b5a2b   primary action
     walnut    #5e3a1c   primary hover
     tan       #c9925b   accent
     cream     #fbf6f0   page background
     parchment #f3ebde   panel hover / subtle fill
     border    #e8ddd0
     muted     #8a7864
     success   #5a8a3a   olive
     warn      #c9921e   honey
     danger    #a83e2b   terracotta
*/

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #2b1d12;
  background: #ffffff;
}

a { color: #8b5a2b; text-decoration: none; }
a:hover { text-decoration: underline; color: #5e3a1c; }

code { font: 12px/1.4 ui-monospace, Consolas, "SFMono-Regular", Menlo, monospace;
       background: #f5f1ea; padding: 1px 5px; border-radius: 3px; color: #5e3a1c; }

/* --- App shell with left sidebar (merchant area) ---------------------- */
body.has-sidebar { background: #fbf6f0; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 240px; z-index: 40;
  background: #2b1d12; color: #fbf6f0;
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(201,146,91,.15);
}
/* Current project + merchant ID header at the very top of the sidebar */
.sidebar-current {
  padding: 14px 18px 12px;
  border-bottom: 1px solid rgba(201,146,91,.15);
}
.sidebar-current-name {
  display: block; color: #fbf6f0; text-decoration: none;
  font-size: 14px; font-weight: 700; letter-spacing: -.2px; line-height: 1.3;
  word-break: break-word;
  transition: color .12s;
}
.sidebar-current-name:hover { color: #c9925b; text-decoration: none; }

.sidebar-proj {
  padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
  border-bottom: 1px solid rgba(201,146,91,.15);
}
.sidebar-proj .proj-switch { width: 100%; margin: 0; }
.sidebar-proj .proj-switch select { width: 100%; max-width: none; }
.sidebar-merchant-id {
  display: block; margin-top: 4px; padding: 0; background: transparent; border: 0;
  font: 500 10.5px/1.3 ui-monospace, Consolas, "SFMono-Regular", Menlo, monospace;
  color: rgba(201,146,91,.85); word-break: break-all;
  cursor: pointer; transition: color .12s;
  position: relative;
}
.sidebar-merchant-id:hover { color: #c9925b; }
.sidebar-merchant-id.copied::after {
  content: 'copied'; margin-left: 6px; font-size: 9.5px; font-weight: 700;
  color: #5a8a3a; text-transform: uppercase; letter-spacing: .4px;
}
.btn-new-proj {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 8px 12px;
  background: rgba(201,146,91,.22); color: #fbf6f0;
  border: 1px solid rgba(201,146,91,.5); border-radius: 8px;
  cursor: pointer; white-space: nowrap; font: 600 13px/1 inherit; transition: .12s;
}
.btn-new-proj:hover { background: rgba(201,146,91,.38); border-color: #c9925b; }
.btn-new-proj .plus {
  display: inline-grid; place-items: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: #c9925b; color: #2b1d12; font-weight: 800; font-size: 14px; line-height: 1;
}

.sidebar-nav {
  padding: 12px 10px; flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 8px;
  color: rgba(251,246,240,.78); text-decoration: none; font-weight: 600; font-size: 14px;
  transition: .12s;
}
.sidebar-nav a:hover { background: rgba(201,146,91,.15); color: #fbf6f0; text-decoration: none; }
.sidebar-nav a.active { background: rgba(201,146,91,.22); color: #fbf6f0; box-shadow: inset 3px 0 0 #c9925b; }
.sidebar-nav .nav-ic { width: 18px; text-align: center; color: #c9925b; font-size: 14px; }
.sidebar-nav .nav-cta { background: rgba(90,138,58,.18); color: #d9ebc6; margin-top: 12px; }
.sidebar-nav .nav-cta:hover { background: rgba(90,138,58,.3); color: #fff; }

.sidebar-footer {
  padding: 14px 18px; font-size: 11px; color: rgba(251,246,240,.4);
  border-top: 1px solid rgba(201,146,91,.15);
}

.sidebar-scrim {
  display: none; position: fixed; inset: 0; background: rgba(43,29,18,.55);
  z-index: 35; backdrop-filter: blur(2px);
}

.appshell {
  margin-left: 240px; min-height: 100vh;
  display: flex; flex-direction: column;
  background: #fbf6f0;
}

/* --- Top bar inside the app shell (light, sticky) -------------------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  background: #ffffff; color: #2b1d12;
  padding: 14px 28px;
  border-bottom: 1px solid #e8ddd0;
  position: sticky; top: 0; z-index: 20;
}
.sidebar-toggle {
  display: none; background: transparent; border: 0; cursor: pointer;
  padding: 8px; border-radius: 6px; flex-direction: column; gap: 4px;
}
.sidebar-toggle span { display: block; width: 20px; height: 2px; background: #2b1d12; border-radius: 2px; }
.sidebar-toggle:hover { background: #f5f1ea; }

.page-head { flex: 1; min-width: 0; }
.page-title { margin: 0; font-size: 20px; letter-spacing: -.3px; color: #2b1d12; font-weight: 800; }
.page-sub { margin: 2px 0 0; font-size: 12px; color: #8a7864; text-transform: capitalize; }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
/* the mode-toggle on a LIGHT bar needs a light background */
.topbar-actions .mode-toggle {
  background: #f5f1ea; border-color: rgba(139,90,43,.25);
}
.topbar-actions .mode-toggle a { color: #8a7864; }
.topbar-actions .mode-toggle a:hover { color: #2b1d12; }
.topbar-actions .mode-toggle a.on { background: #c9925b; color: #2b1d12; }
.topbar-actions .mode-toggle a.on:last-child { background: #5a8a3a; color: #fbf6f0; }

.topbar-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 8px;
  color: #2b1d12; font-weight: 600; font-size: 13px; text-decoration: none;
  border: 1px solid #e8ddd0; background: #fff; transition: .12s;
}
.topbar-link:hover { border-color: #c9925b; color: #5e3a1c; text-decoration: none; background: #fafafa; }
.topbar-link.signout { color: #8a2e1a; border-color: #f0c0b3; }
.topbar-link.signout:hover { background: #fbe7e2; }
.topbar-avatar {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #c9925b, #8b5a2b);
  color: #fff; font-weight: 800; font-size: 12px;
}

.pill {
  display: inline-block; background: #c9925b; color: #2b1d12;
  font-size: 11px; padding: 1px 7px; border-radius: 10px; margin-left: 4px;
  font-weight: 700;
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: 8px 0 30px rgba(43,29,18,.3); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-scrim { display: block; }
  .appshell { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .topbar-link .topbar-link-text { display: none; }
  .topbar-link.signout { padding: 6px 10px; }
  .page-sub { display: none; }
  .topbar { padding: 12px 16px; }
}

/* --- Footer ---------------------------------------------------------- */
.botbar {
  margin-top: 48px; padding: 16px 24px; text-align: center;
  font-size: 12px; color: #8a7864; border-top: 1px solid #e8ddd0;
}

/* --- Layout ---------------------------------------------------------- */
.content { max-width: 1200px; margin: 0 auto; padding: 24px; }
.appshell .content { max-width: none; padding: 28px; flex: 1; }
@media (max-width: 900px) { .appshell .content { padding: 18px; } }
.h1 { font-size: 22px; margin: 0 0 16px; letter-spacing: -.3px; color: #2b1d12; }
.h1 small.muted { font-weight: 400; }
.muted { color: #8a7864; }

/* --- Panels ---------------------------------------------------------- */
.panel {
  background: #fff; border: 1px solid #e8ddd0; border-radius: 8px;
  margin-bottom: 20px; overflow: hidden;
  box-shadow: 0 1px 0 rgba(43,29,18,.04);
}
.panel > header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid #e8ddd0;
  background: #fafafa;
}
.panel > header h2 { margin: 0; font-size: 13px; text-transform: uppercase;
  letter-spacing: .6px; color: #5e3a1c; font-weight: 700; }
.panel > p, .panel > .empty, .panel > .ok-card, .panel > .prose { padding: 18px; margin: 0; }
.empty { color: #8a7864; }
.prose { white-space: pre-wrap; }

.ok-card { background: #f4f8ec; border-left: 4px solid #5a8a3a; }

/* --- Two-column grid ------------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

/* --- Stat cards ------------------------------------------------------ */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.stat {
  background: #fff; border: 1px solid #e8ddd0; border-radius: 8px;
  padding: 16px 18px;
  box-shadow: 0 1px 0 rgba(43,29,18,.04);
}
.stat label { display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: .6px; color: #8a7864; font-weight: 600; }
.stat strong { display: block; font-size: 24px; margin: 6px 0 4px;
  letter-spacing: -.5px; color: #2b1d12; }
.stat span { font-size: 12px; color: #8a7864; }
.stat.warn { background: #fdf6e7; border-color: #ecd9a0; }
.stat.warn strong { color: #7d5800; }

/* Balance cards on the dashboard get an accent stripe + bigger number */
.balance-card { position: relative; padding: 18px 18px 18px 22px; overflow: hidden; }
.balance-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, #c9925b, #8b5a2b);
}
.balance-card strong { font-size: 22px; letter-spacing: -.4px; }
.balance-card.pending::before  { background: linear-gradient(180deg, #ecd9a0, #c9921e); }
.balance-card.pending strong   { color: #7d5800; }
.balance-card.revenue::before  { background: linear-gradient(180deg, #b8d595, #5a8a3a); }
.balance-card.revenue strong   { color: #355820; }
.balance-card.withdraw::before { background: linear-gradient(180deg, #d6c4ac, #8a7864); }
.balance-card.withdraw strong  { color: #5e3a1c; opacity: .65; }

/* --- Tables ---------------------------------------------------------- */
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 10px 18px;
  border-top: 1px solid #f3ebde; vertical-align: top; }
table.data thead th {
  background: #fafafa; font-size: 11px; text-transform: uppercase;
  letter-spacing: .6px; color: #5e3a1c; border-top: 0; font-weight: 700;
}
table.data tbody tr:hover { background: #fafafa; }

table.kv { width: 100%; border-collapse: collapse; }
table.kv th, table.kv td { padding: 8px 18px; border-bottom: 1px solid #f3ebde;
  vertical-align: top; font-size: 13px; }
table.kv th { width: 35%; color: #8a7864; font-weight: 500; text-align: left; }

/* --- Tags ------------------------------------------------------------ */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 700; background: #e8ddd0; color: #5e3a1c;
  text-transform: uppercase; letter-spacing: .4px;
}
.tag-active, .tag-succeeded { background: #d9ebc6; color: #355820; }
.tag-pending, .tag-processing, .tag-more_info { background: #fbe9bf; color: #7d5800; }
.tag-suspended, .tag-failed, .tag-cancelled, .tag-rejected { background: #f5cfc7; color: #6a2418; }
.tag-closed, .tag-expired { background: #e8ddd0; color: #5e3a1c; }
.tag-refunded, .tag-partially_refunded { background: #e5d2e9; color: #5e2a68; }
.tag-test { background: #d8e7f0; color: #1c4762; }
.tag-live { background: #d9ebc6; color: #355820; }

/* --- Buttons --------------------------------------------------------- */
.btn, .btn-sm, .btn-ghost {
  display: inline-block; padding: 8px 14px; border-radius: 6px;
  border: 1px solid #e8ddd0; background: #fff; color: #2b1d12;
  font: 600 13px/1 -apple-system, "Segoe UI", Roboto, sans-serif;
  cursor: pointer; text-decoration: none; transition: .12s;
}
.btn:hover, .btn-sm:hover { text-decoration: none; border-color: #c9925b; background: #fafafa; }
.btn.primary { background: #8b5a2b; color: #fff; border-color: #8b5a2b; }
.btn.primary:hover { background: #5e3a1c; border-color: #5e3a1c; }
.btn.warn    { background: #fdf6e7; color: #7d5800; border-color: #ecd9a0; }
.btn.warn:hover { background: #fbe9bf; }
.btn.danger  { background: #fbe7e2; color: #8a2e1a; border-color: #f0c0b3; }
.btn.danger:hover { background: #f5cfc7; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-ghost {
  background: transparent; color: rgba(251,246,240,.85);
  border-color: rgba(201,146,91,.4);
}
.topbar .btn-ghost:hover { background: rgba(201,146,91,.18); color: #fbf6f0; border-color: rgba(201,146,91,.7); }

/* --- Filter bar ------------------------------------------------------ */
.filterbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-bottom: 16px;
}
.filterbar input, .filterbar select {
  padding: 7px 10px; border: 1px solid #e8ddd0; border-radius: 6px; font-size: 13px;
  background: #fff; color: #2b1d12;
}
.filterbar input[type="text"] { min-width: 260px; }
.filterbar input:focus, .filterbar select:focus { outline: none; border-color: #8b5a2b; box-shadow: 0 0 0 3px rgba(139,90,43,.15); }

/* --- Tabs ------------------------------------------------------------ */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid #e8ddd0; }
.tabs a {
  padding: 8px 14px; color: #8a7864; font-weight: 600; font-size: 13px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  text-transform: capitalize;
}
.tabs a:hover { color: #2b1d12; text-decoration: none; }
.tabs a.active { color: #8b5a2b; border-bottom-color: #8b5a2b; }

/* --- Auth shell (login / setup / register) -------------------------- */
/* Legacy single-card layout kept for backwards compatibility. */
.auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #8b5a2b 0%, #2b1d12 100%);
  padding: 24px;
}
.auth-card {
  background: #ffffff; border-radius: 12px; padding: 32px;
  width: 100%; max-width: 460px;
  box-shadow: 0 16px 50px rgba(43,29,18,.4);
  border-top: 4px solid #c9925b;
}

/* New split-screen layout: brand panel left, form right. */
.auth-split {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  background: #ffffff;
}
@media (max-width: 900px) { .auth-split { grid-template-columns: 1fr; } }

/* --- LEFT: branded marketing panel --- */
.auth-brand {
  position: relative; overflow: hidden;
  padding: 48px 56px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: #fbf6f0;
  background:
    radial-gradient(circle at 90% 10%, rgba(201,146,91,.3),  transparent 50%),
    radial-gradient(circle at 10% 90%, rgba(139,90,43,.35),  transparent 55%),
    linear-gradient(135deg, #5e3a1c 0%, #2b1d12 100%);
}
.auth-brand::before {
  content: ''; position: absolute; inset: 0; opacity: .15; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.55) 1px, transparent 1px);
  background-size: 22px 22px;
}
@media (max-width: 900px) {
  .auth-brand { padding: 32px 28px; min-height: 220px; }
  .auth-brand .auth-brand-bottom { display: none; }
}
.auth-brand > * { position: relative; z-index: 1; }
.auth-brand .logo {
  display: inline-flex; align-items: center; gap: 12px;
  font-weight: 800; font-size: 20px; color: #fbf6f0; text-decoration: none;
}
.auth-brand .logo-img {
  height: 48px; width: auto; display: block;
  object-fit: contain;
  filter: brightness(0) invert(1);
}
.auth-brand .logo .mark {
  width: 36px; height: 36px; border-radius: 9px;
  background: linear-gradient(135deg, #c9925b, #8b5a2b);
  display: grid; place-items: center; font-size: 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.auth-brand h2 {
  font-size: clamp(26px, 3vw, 36px); line-height: 1.15;
  letter-spacing: -.6px; margin: 0 0 18px; color: #fbf6f0; font-weight: 800;
}
.auth-brand h2 .accent {
  background: linear-gradient(90deg, #c9925b, #fbf6f0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-brand .tagline { color: rgba(251,246,240,.78); font-size: 16px; line-height: 1.6; max-width: 440px; margin: 0; }
.auth-brand .auth-feat { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.auth-brand .auth-feat li {
  display: flex; align-items: flex-start; gap: 12px;
  color: rgba(251,246,240,.92); font-size: 14.5px;
}
.auth-brand .auth-feat .check {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(201,146,91,.25); color: #c9925b;
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
  margin-top: 1px;
}
.auth-brand-bottom {
  font-size: 13px; color: rgba(251,246,240,.55);
  border-top: 1px solid rgba(251,246,240,.12); padding-top: 18px;
}

/* --- RIGHT: form panel --- */
.auth-form {
  display: flex; align-items: center; justify-content: center;
  padding: 48px 24px;
}
.auth-form-inner {
  width: 100%; max-width: 420px;
}
.auth-back {
  display: inline-flex; align-items: center; gap: 6px;
  color: #8a7864; font-size: 13px; font-weight: 500;
  text-decoration: none; margin-bottom: 28px;
}
.auth-back:hover { color: #5e3a1c; text-decoration: none; }
.auth-form h1 {
  font-size: 28px; margin: 0 0 6px;
  letter-spacing: -.5px; color: #2b1d12; font-weight: 800;
}
.auth-form .subtitle { color: #8a7864; margin: 0 0 28px; font-size: 15px; }
.auth-form form { display: grid; gap: 16px; }
.auth-form label { display: block; font-size: 13px; font-weight: 600; color: #5e3a1c; }
.auth-form label small { font-weight: 400; color: #8a7864; }
.auth-form input, .auth-form select, .auth-form textarea {
  width: 100%; padding: 12px 14px; font-size: 15px; border-radius: 8px;
  border: 1px solid #d6c4ac; margin-top: 6px;
  background: #fff; color: #2b1d12; font-family: inherit;
  transition: .12s;
}
.auth-form input:focus, .auth-form select:focus, .auth-form textarea:focus {
  outline: none; border-color: #8b5a2b; box-shadow: 0 0 0 4px rgba(139,90,43,.12);
}
.auth-form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 500px) { .auth-form .row2 { grid-template-columns: 1fr; } }
.auth-form .btn.primary {
  width: 100%; padding: 13px; font-size: 15px; margin-top: 8px;
  background: #8b5a2b; color: #fbf6f0; border: 0; border-radius: 8px;
  font-weight: 700; cursor: pointer; transition: .15s;
}
.auth-form .btn.primary:hover { background: #5e3a1c; transform: translateY(-1px); box-shadow: 0 8px 20px rgba(139,90,43,.25); }
.auth-form .divider {
  display: flex; align-items: center; gap: 14px;
  margin: 28px 0 20px; color: #8a7864; font-size: 12px; text-transform: uppercase; letter-spacing: 1px;
}
.auth-form .divider::before, .auth-form .divider::after {
  content: ''; flex: 1; height: 1px; background: #e8ddd0;
}
.auth-form .switch { text-align: center; font-size: 14px; color: #8a7864; margin-top: 24px; }
.auth-form .switch a { font-weight: 600; }
.auth-card h1 { margin: 0 0 8px; font-size: 22px; color: #2b1d12; }
.auth-card p { margin: 0 0 18px; color: #8a7864; }
.auth-card form { display: grid; gap: 14px; }
.auth-card label { display: block; font-size: 13px; font-weight: 600; color: #5e3a1c; }
.auth-card label small { font-weight: 400; color: #8a7864; }
.auth-card input, .auth-card select, .auth-card textarea {
  width: 100%; padding: 10px 12px; font-size: 14px; border-radius: 6px;
  border: 1px solid #d6c4ac; margin-top: 4px;
  background: #fff; color: #2b1d12; font-family: inherit;
}
.auth-card input:focus, .auth-card select:focus, .auth-card textarea:focus {
  outline: none; border-color: #8b5a2b; box-shadow: 0 0 0 3px rgba(139,90,43,.15);
}
.auth-card .btn { padding: 12px; font-size: 14px; }
.auth-card .switch { margin-top: 16px; text-align: center; font-size: 13px; color: #8a7864; }

/* --- Alerts ---------------------------------------------------------- */
.alert { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; }
.alert.err  { background: #fbe7e2; color: #8a2e1a; border: 1px solid #f0c0b3; }
.alert.info { background: #f3ebde; color: #5e3a1c; border: 1px solid #e0d0b6; }
.alert.ok   { background: #d9ebc6; color: #355820; border: 1px solid #b8d595; }

/* --- Action bar / decision form ------------------------------------- */
.actionbar { display: flex; gap: 8px; flex-wrap: wrap; padding: 18px; }
.decision { padding: 18px; display: grid; gap: 14px; }
.decision label { font-size: 13px; font-weight: 600; color: #5e3a1c; }
.decision textarea {
  width: 100%; padding: 10px; border: 1px solid #d6c4ac; border-radius: 6px;
  font: inherit; resize: vertical; margin-top: 4px;
}

/* --- Pager ----------------------------------------------------------- */
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 16px; }

/* --- Docs list (live review) ---------------------------------------- */
.docs { padding: 0 18px 18px 36px; }
.docs li { margin-bottom: 4px; font-size: 13px; }

/* --- Audit meta cell ------------------------------------------------- */
code.meta {
  font-size: 11px; white-space: pre-wrap; word-break: break-all;
  background: #fafafa; padding: 4px 6px; border-radius: 4px;
  display: inline-block; max-width: 360px; color: #5e3a1c;
}

/* --- Form rows used by merchant settings/forms ---------------------- */
.form-grid { padding: 18px; display: grid; gap: 14px; }
.form-grid label { font-size: 13px; font-weight: 600; color: #5e3a1c; }
.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%; padding: 10px 12px; font-size: 14px; border-radius: 6px;
  border: 1px solid #d6c4ac; margin-top: 4px; background: #fff;
  color: #2b1d12; font-family: inherit;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  outline: none; border-color: #8b5a2b; box-shadow: 0 0 0 3px rgba(139,90,43,.15);
}
.form-grid .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .form-grid .row2 { grid-template-columns: 1fr; } }

/* --- Mode badge (test/live indicator in topbar) --------------------- */
.mode-badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; margin-left: 6px;
}
.mode-badge.test { background: #c9925b; color: #2b1d12; }
.mode-badge.live { background: #5a8a3a; color: #fbf6f0; }

/* Stripe-style test/live segmented toggle in the topbar */
.mode-toggle {
  display: inline-flex; margin-left: 10px;
  border: 1px solid rgba(201,146,91,.5); border-radius: 999px;
  padding: 2px; background: rgba(0,0,0,.15);
}
.mode-toggle a {
  padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
  color: rgba(251,246,240,.7); text-decoration: none; line-height: 1.6;
  text-transform: uppercase; letter-spacing: .4px; transition: .12s;
}
.mode-toggle a:hover { color: #fbf6f0; text-decoration: none; }
.mode-toggle a.on { background: #c9925b; color: #2b1d12; }
.mode-toggle a.on:last-child { background: #5a8a3a; color: #fbf6f0; }
.mode-toggle a.locked::after { content: ' \1F512'; font-size: 10px; }

/* Project switcher in the merchant topbar */
.proj-switch { display: inline-block; margin: 0; }
.proj-switch select {
  background: rgba(255,255,255,.08); color: #fbf6f0;
  border: 1px solid rgba(201,146,91,.5); border-radius: 8px;
  padding: 6px 28px 6px 12px; font: 600 13px/1 inherit; cursor: pointer;
  max-width: 220px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #c9925b 50%), linear-gradient(135deg, #c9925b 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 10px) 50%;
  background-size: 4px 4px, 4px 4px; background-repeat: no-repeat;
}
.proj-switch select:hover { border-color: #c9925b; }
.proj-switch select option { color: #2b1d12; background: #fff; }

/* --- Settings tabs (multi-section settings page) ------------------- */
.settings-tabs { flex-wrap: wrap; gap: 2px 16px; margin-bottom: 24px; }
.settings-tabs a { padding: 10px 4px; font-size: 14px; }

/* --- Modal (used by the topbar Create-project button) -------------- */
.dp-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.dp-modal[hidden] { display: none; }
.dp-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(43,29,18,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: dpFadeIn .18s ease;
}
.dp-modal-card {
  position: relative; background: #fff; border-radius: 14px;
  padding: 32px 32px 28px; max-width: 480px; width: 100%;
  box-shadow: 0 30px 80px rgba(43,29,18,.4);
  border-top: 4px solid #c9925b;
  animation: dpModalIn .22s cubic-bezier(.22,.9,.3,1.2);
}
@keyframes dpFadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes dpModalIn { from { opacity: 0; transform: translateY(-10px) scale(.98) } to { opacity: 1; transform: none } }
.dp-modal-close {
  position: absolute; top: 10px; right: 12px;
  background: transparent; border: 0; cursor: pointer;
  font-size: 26px; line-height: 1; color: #8a7864; padding: 4px 8px; border-radius: 6px;
}
.dp-modal-close:hover { background: #f5f1ea; color: #2b1d12; }
.dp-modal h2 { margin: 0 0 6px; font-size: 22px; color: #2b1d12; letter-spacing: -.3px; }
.dp-modal-sub { margin: 0 0 22px; color: #8a7864; font-size: 14px; line-height: 1.55; }
.dp-modal label { display: block; font-size: 13px; font-weight: 600; color: #5e3a1c; margin-top: 14px; }
.dp-modal label small { font-weight: 400; color: #8a7864; }
.dp-modal input {
  width: 100%; padding: 11px 14px; font-size: 14px;
  border: 1px solid #d6c4ac; border-radius: 8px; margin-top: 6px;
  background: #fff; color: #2b1d12; font-family: inherit; transition: .12s;
}
.dp-modal input:focus { outline: none; border-color: #8b5a2b; box-shadow: 0 0 0 3px rgba(139,90,43,.15); }
.dp-modal-actions { margin-top: 24px; display: flex; gap: 10px; justify-content: flex-end; }
.dp-modal-actions .btn { padding: 10px 18px; }

/* --- API key cells with inline copy / reveal ----------------------- */
.keys-table td { vertical-align: middle; }
.key-cell { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; }
.key-cell .key-text {
  font: 12px/1.4 ui-monospace, Consolas, "SFMono-Regular", Menlo, monospace;
  word-break: break-all; padding: 4px 8px; border-radius: 5px;
  background: #f5f1ea; color: #2b1d12; max-width: 360px;
}
.key-cell .key-text.muted { background: #fafafa; color: #8a7864; }
.key-cell .key-text.key-masked { cursor: pointer; letter-spacing: 1px; user-select: none; }
.key-copy {
  cursor: pointer; border: 1px solid #e8ddd0; background: #fff;
  padding: 4px 10px; border-radius: 6px; font: 700 11.5px/1 inherit;
  color: #5e3a1c; text-transform: uppercase; letter-spacing: .5px; transition: .12s;
}
.key-copy:hover { border-color: #c9925b; background: #fafafa; color: #2b1d12; }
.key-copy.copied { background: #d9ebc6; border-color: #b8d595; color: #355820; }

/* --- Full-screen loader (shown ~2s when switching project) ---------- */
.dp-loader {
  position: fixed; inset: 0; z-index: 9999;
  display: none; align-items: center; justify-content: center;
  background: rgba(43,29,18,.92); color: #fbf6f0;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.dp-loader.show { display: flex; animation: dpFadeIn .2s ease; }
.dp-loader-inner { text-align: center; padding: 32px; }
.dp-loader-spinner {
  width: 56px; height: 56px; border-radius: 50%;
  border: 4px solid rgba(201,146,91,.25); border-top-color: #c9925b;
  margin: 0 auto 22px; animation: dpRotate 1s linear infinite;
}
.dp-loader-title { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.2px; }
.dp-loader-sub   { margin: 8px 0 0; font-size: 14px; color: rgba(251,246,240,.7); }
.dp-loader-sub strong { color: #c9925b; font-weight: 700; }
@keyframes dpRotate { to { transform: rotate(360deg); } }

/* --- Reveal-once secret box ----------------------------------------- */
.secret-box {
  background: #fdf6e7; border: 1px solid #ecd9a0; border-left: 4px solid #c9921e;
  padding: 16px 18px; margin: 18px; border-radius: 6px;
}
.secret-box h3 { margin: 0 0 8px; color: #7d5800; font-size: 14px; }
.secret-box code {
  display: block; padding: 10px 12px; background: #fff;
  border: 1px solid #ecd9a0; border-radius: 4px;
  font-size: 13px; word-break: break-all; color: #5e3a1c;
  margin-top: 6px;
}

/* --- PSP cards (psp_config + checkout selector) --------------------- */
.psp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px; padding: 18px; }
.psp-card { border: 1px solid #e8ddd0; border-radius: 8px; padding: 14px;
  background: #fff; transition: .12s; display: flex; flex-direction: column; gap: 8px; }
.psp-card.enabled { border-color: #8b5a2b; box-shadow: 0 0 0 1px #8b5a2b inset; }
.psp-card h3 { margin: 0; font-size: 15px; color: #2b1d12; }
.psp-card .meta { font-size: 12px; color: #8a7864; }
.psp-card .row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }

/* --- Live-mode merchant type cards ---------------------------------- */
.live-type-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 18px; }
@media (max-width: 600px) { .live-type-cards { grid-template-columns: 1fr; } }
.live-card {
  border: 2px solid #e8ddd0; border-radius: 12px; padding: 26px 20px;
  cursor: pointer; transition: border-color .2s, box-shadow .2s; text-align: center; background: #fff;
}
.live-card:hover { border-color: #c9925b; box-shadow: 0 4px 16px rgba(139,90,43,.12); }
.live-card.selected { border-color: #8b5a2b; box-shadow: 0 0 0 3px rgba(139,90,43,.15); }
.live-card-icon { font-size: 38px; display: block; margin-bottom: 12px; }
.live-card h3 { margin: 0 0 8px; font-size: 17px; color: #2b1d12; }
.live-card p { margin: 0 0 8px; font-size: 14px; color: #5a4632; line-height: 1.55; }
.live-card-note { font-size: 12px !important; color: #8a7864 !important; font-weight: 700 !important;
  border-top: 1px solid #f0e8de; padding-top: 10px; margin-top: 10px !important; }

/* --- Startup policy box --------------------------------------------- */
.policy-box { border: 1px solid #e8ddd0; border-radius: 10px; overflow: hidden; margin: 4px 18px 18px; }
.policy-header {
  background: linear-gradient(90deg, #5e3a1c, #8b5a2b);
  padding: 14px 20px; color: #fff; font-size: 15px; font-weight: 700;
}
.policy-body { max-height: 360px; overflow-y: auto; padding: 20px; background: #faf4ec; }
.policy-lang h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1px;
  color: #8b5a2b; border-bottom: 1px solid #e8ddd0; padding-bottom: 6px; margin: 0 0 12px;
}
.policy-lang > p { font-size: 14px; color: #2b1d12; line-height: 1.65; margin: 0 0 10px; }
.policy-lang ul { margin: 0; padding-left: 20px; }
.policy-lang li { font-size: 14px; line-height: 1.7; color: #2b1d12; margin-bottom: 7px; }
.policy-divider { height: 1px; background: #d6c4ac; margin: 18px 0; }
.policy-agree {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px 20px; border-top: 1px solid #e8ddd0; cursor: pointer; background: #fff;
  font-size: 14px; color: #2b1d12; line-height: 1.5;
}
.policy-agree input[type="checkbox"] { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; accent-color: #8b5a2b; }
.policy-footer { padding: 14px 20px; background: #fafafa; border-top: 1px solid #f0e8de; display: flex; gap: 10px; align-items: center; }
.startup-badge {
  display: inline-block; background: #e8f5da; color: #4a7a2e;
  border: 1px solid #b8d595; border-radius: 12px; padding: 2px 10px;
  font-size: 11px; font-weight: 700; letter-spacing: .3px; vertical-align: middle;
}

/* Fast-approval badge (passport provided) */
.fast-badge {
  display: inline-block; background: #fff8e1; color: #b45309;
  border: 1px solid #fcd34d; border-radius: 12px; padding: 2px 10px;
  font-size: 11px; font-weight: 700; letter-spacing: .3px; vertical-align: middle;
}

/* Passport / fast-track notice box inside go_live form */
.id-doc-fast-note {
  display: flex; align-items: center; gap: 10px;
  background: #fff8e1; border: 1px solid #fcd34d; border-radius: 8px;
  padding: 10px 14px; margin-bottom: 12px; font-size: 13px; color: #92400e;
  font-weight: 600;
}

/* --- Checkbox toggle ------------------------------------------------- */
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle input[type="checkbox"] { width: 16px; height: 16px; accent-color: #8b5a2b; }

/* --- Auth sidebar photo background ----------------------------------- */
/* Add class "has-bg" to .auth-brand + add <div class="auth-bg"></div> as first child */
.auth-brand.has-bg { background: #1a0f08; }
.auth-brand.has-bg::before { display: none; }
.auth-brand .auth-bg {
  position: absolute; inset: 0; z-index: 0;
  background: url('../img/baner_merchant.jpg') center / cover no-repeat;
  filter: blur(6px) brightness(.45);
  transform: scale(1.08);
}

/* --- OTP verification form ------------------------------------------- */
.otp-box { text-align: center; }
.otp-box .otp-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg,#c9925b,#8b5a2b);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px; font-size: 24px; color: #fff;
}
.otp-email-hint {
  display: inline-block; background: #f5f0ea; border-radius: 6px;
  padding: 5px 14px; font-size: 13px; color: #5e3a1c; font-weight: 600;
  margin: 6px 0 20px; word-break: break-all;
}
.otp-input {
  width: 100%; padding: 16px 14px; font-size: 28px; font-weight: 700;
  text-align: center; letter-spacing: 14px; border: 2px solid #d6c4ac;
  border-radius: 10px; color: #2b1d12; background: #fff;
  font-family: ui-monospace,Consolas,monospace; transition: .12s;
  margin-bottom: 6px;
}
.otp-input:focus { border-color: #8b5a2b; box-shadow: 0 0 0 4px rgba(139,90,43,.12); outline: none; }
.otp-hint { font-size: 12px; color: #8a7864; margin-bottom: 16px; }
.otp-resend { text-align: center; font-size: 13px; color: #8a7864; margin-top: 10px; }
.otp-resend button {
  background: none; border: none; color: #8b5a2b; font-weight: 600;
  cursor: pointer; padding: 0; font-size: 13px; text-decoration: underline;
}
.otp-back { display: block; text-align: center; font-size: 13px; color: #8a7864; margin-top: 14px; }
.otp-back a { color: #8a7864; }

/* --- Auth card animated corner brackets on hover -------------------- */
.auth-form-inner { position: relative; }
.auth-corner {
  position: absolute; width: 22px; height: 22px; opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease, transform .35s ease;
}
.auth-corner.tl {
  top: -5px; left: -5px;
  border-top: 2.5px solid #8b5a2b; border-left: 2.5px solid #8b5a2b;
  border-radius: 6px 0 0 0; transform: translate(-7px, -7px);
}
.auth-corner.tr {
  top: -5px; right: -5px;
  border-top: 2.5px solid #8b5a2b; border-right: 2.5px solid #8b5a2b;
  border-radius: 0 6px 0 0; transform: translate(7px, -7px);
}
.auth-corner.bl {
  bottom: -5px; left: -5px;
  border-bottom: 2.5px solid #8b5a2b; border-left: 2.5px solid #8b5a2b;
  border-radius: 0 0 0 6px; transform: translate(-7px, 7px);
}
.auth-corner.br {
  bottom: -5px; right: -5px;
  border-bottom: 2.5px solid #8b5a2b; border-right: 2.5px solid #8b5a2b;
  border-radius: 0 0 6px 0; transform: translate(7px, 7px);
}
/* Trigger from the wider .auth-form panel = "near" proximity feel */
.auth-form:hover .auth-corner { opacity: 1; transform: translate(0, 0); }

/* --- Registration step-line form ------------------------------------ */
.reg-steps { display: flex; flex-direction: column; }
.reg-step   { display: flex; gap: 14px; align-items: stretch; }
.step-left  { display: flex; flex-direction: column; align-items: center; width: 42px; flex-shrink: 0; }
.step-circle {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #c9925b 0%, #8b5a2b 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff; box-shadow: 0 3px 10px rgba(139,90,43,.28);
  transition: background .3s, box-shadow .3s;
}
.step-circle svg { width: 18px; height: 18px; }
.step-circle .sc-icon  { display: flex; }
.step-circle .sc-check { display: none; }
.step-circle.done {
  background: linear-gradient(135deg, #68a84a 0%, #4a7a2e 100%);
  box-shadow: 0 3px 10px rgba(74,122,46,.28);
}
.step-circle.done .sc-icon  { display: none; }
.step-circle.done .sc-check { display: flex; }
.step-line {
  width: 2px; flex: 1; min-height: 16px;
  background: linear-gradient(to bottom, #c9925b 0%, #e8ddd0 100%);
  margin: 4px 0;
}
.reg-step:last-child .step-line { display: none; }
.step-body { flex: 1; padding-bottom: 20px; min-width: 0; }
.step-body > label { display: block; font-size: 13px; font-weight: 600; color: #5e3a1c; }
.step-body > label small { font-weight: 400; color: #8a7864; }
.step-body input, .step-body select {
  width: 100%; padding: 12px 14px; font-size: 15px; border-radius: 8px;
  border: 1px solid #d6c4ac; margin-top: 6px; box-sizing: border-box;
  background: #fff; color: #2b1d12; font-family: inherit; transition: .12s;
}
.step-body input:focus, .step-body select:focus {
  outline: none; border-color: #8b5a2b; box-shadow: 0 0 0 4px rgba(139,90,43,.12);
}
.step-body .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .step-body .row2 { grid-template-columns: 1fr; } }
