/* ==========================================================================
   PayGuard — Royal Gold theme (loaded after styles.css and cards.css)
   Dark-first black + gold, with a matching light theme. Overrides tokens and
   restyles the shell, cards and overview. Status colours stay distinct from
   gold: amount problems are orange, never yellow.
   ========================================================================== */

@font-face { font-family: "Jakarta"; src: url("/fonts/jakarta.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("/fonts/jakarta-italic.woff2") format("woff2"); font-weight: 200 800; font-style: italic; font-display: swap; }

:root {
  --canvas: #f4f4f7;
  --surface: #ffffff;
  --surface-2: #f7f6fa;
  --surface-3: #f1eff5;
  --line: #e9e7ef;
  --line-strong: #d9d5e2;
  --ink: #13111a;
  --ink-2: #5d5868;
  --ink-3: #7a7585;

  --gold: #f5b700;
  --gold-2: #f97316;
  --brand: #f5b700;
  --brand-hover: #e6aa00;
  --brand-ink: #9a6700;
  --brand-tint: rgba(245, 183, 0, 0.16);
  --brand-line: rgba(245, 183, 0, 0.45);
  --focus: #e0a200;
  --on-brand: #1a1300;
  --gold-grad: linear-gradient(135deg, #ffcf33 0%, #f5b700 45%, #f97316 100%);

  --match: #15803d;  --match-bg: #e7f8ee;  --match-fill: #22c55e;
  --wait: #1d4ed8;   --wait-bg: #e8efff;   --wait-fill: #3b82f6;
  --hold: #c2410c;   --hold-bg: #fff1e6;   --hold-fill: #f97316;
  --risk: #be123c;   --risk-bg: #fde8ee;   --risk-fill: #e11d48;
  --neutral: #5d5868; --neutral-bg: #f1eff5;
  --diff-bg: #fff4e8;

  --t-green: linear-gradient(135deg, #4ade80, #16a34a);
  --t-orange: linear-gradient(135deg, #fdba74, #f97316);
  --t-red: linear-gradient(135deg, #fb7185, #e11d48);
  --t-gold: linear-gradient(135deg, #fde047, #f5b700);
  --t-blue: linear-gradient(135deg, #7cb1ff, #2563eb);
  --t-slate: linear-gradient(135deg, #94a3b8, #475569);
  --t-teal: linear-gradient(135deg, #5eead4, #0d9488);

  --shadow-sm: 0 1px 2px rgba(20, 16, 30, 0.04), 0 8px 24px -12px rgba(20, 16, 30, 0.12);
  --shadow-md: 0 16px 40px -16px rgba(20, 16, 30, 0.28);
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;
  --font: "Jakarta", "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", "Noto Sans Bengali", sans-serif;
}

html[data-theme="dark"] {
  --canvas: #0a090e;
  --surface: #14121a;
  --surface-2: #1b1923;
  --surface-3: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --ink: #f6f4f1;
  --ink-2: #aaa4b6;
  --ink-3: #8a8497;

  --brand: #f5b700;
  --brand-hover: #ffc61a;
  --brand-ink: #facc15;
  --brand-tint: rgba(245, 183, 0, 0.13);
  --focus: #facc15;

  --match: #4ade80;  --match-bg: rgba(74, 222, 128, 0.12);  --match-fill: #22c55e;
  --wait: #7cb1ff;   --wait-bg: rgba(96, 165, 250, 0.13);   --wait-fill: #3b82f6;
  --hold: #fb923c;   --hold-bg: rgba(251, 146, 60, 0.13);   --hold-fill: #f97316;
  --risk: #fb7185;   --risk-bg: rgba(251, 113, 133, 0.13);  --risk-fill: #e11d48;
  --neutral: #aaa4b6; --neutral-bg: rgba(255, 255, 255, 0.06);
  --diff-bg: rgba(251, 146, 60, 0.10);
  --overlay: rgba(5, 4, 8, 0.6);
  --shadow-sm: none;
  --shadow-md: 0 16px 40px -12px rgba(0, 0, 0, 0.7);
}

html { font-family: var(--font); }
h1 { font-weight: 800; letter-spacing: -0.03em; }
h2, .card__title { font-weight: 800; letter-spacing: -0.02em; }

/* ---------- Wordmark ---------- */
.brand { flex-direction: column; align-items: flex-start; gap: 8px; padding: 22px 22px 14px; }
.brand .logo { display: none; }
.wordmark { font-size: 26px; font-weight: 800; font-style: italic; letter-spacing: -0.04em; line-height: 1; color: var(--ink); }
.wordmark b { color: var(--gold); font-weight: 800; }
.verify-pill { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--gold-grad); color: var(--on-brand); font-size: 10.5px; font-weight: 800; letter-spacing: 0.14em; font-style: normal; }
.login-card .brand { padding: 0 0 8px; }

/* ---------- Shell: floating sidebar and topbar ---------- */
.shell { gap: 16px; padding: 16px; }
.sidebar { width: 256px; border: 1px solid var(--line); border-radius: var(--r-lg); height: calc(100vh - 32px); top: 16px; box-shadow: var(--shadow-sm); }
#nav { padding: 0 12px 12px; }
.nav-group { padding: 14px 10px 6px; }
.nav-link { gap: 12px; padding: 6px 10px; min-height: 42px; border-radius: 14px; border: 1px solid transparent; color: var(--ink); font-size: 14px; }
.nav-link:hover { background: var(--surface-2); }
.nav-tile { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); flex: none; }
.nav-tile .nav-ico { width: 15px; height: 15px; }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-link.active { background: var(--brand-tint); border-color: var(--brand-line); color: var(--ink); font-weight: 700; }
.nav-link.active .nav-tile { background: var(--t-gold); color: var(--on-brand); }
.nav-link.danger .nav-tile { color: var(--risk); }
.nav-link.danger.active .nav-tile { background: var(--t-red); color: #fff; }
.nav-count { background: var(--brand-tint); color: var(--brand-ink); font-weight: 700; }
.nav-link.active .nav-count { background: var(--surface); color: var(--brand-ink); }
.sidebar-foot { border-top: 1px solid var(--line); }
.avatar { background: var(--t-gold); color: var(--on-brand); }

.main { gap: 16px; }
.topbar { height: 68px; padding: 0 14px 0 20px; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); top: 16px; }
.topbar h1 { font-size: 20px; }
.view { padding: 0; gap: 20px; }

/* ---------- Controls ---------- */
.btn { border-radius: 12px; }
.btn.primary { background: var(--gold-grad); border-color: transparent; color: var(--on-brand); font-weight: 800; }
.btn.primary:hover { background: var(--gold-grad); filter: brightness(1.05); }
input, select, textarea { border-radius: 12px; background: var(--surface-2); border-color: var(--line); }
.pill { height: 34px; border-radius: 99px; }
.badge { border-radius: 99px; padding: 0 10px; height: 24px; font-weight: 700; }

/* ---------- Cards ---------- */
.card { border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card--sm { border-radius: 18px; }
.stat-card { --card-py: 20px; --card-px: 20px; gap: 6px; }
.stat-card__ico { position: static; width: 46px; height: 46px; border-radius: 14px; border: 0; background: var(--t-gold); color: #fff; margin-bottom: 10px; }
.stat-card__ico svg { width: 20px; height: 20px; }
.stat-card__value { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 36px; }
.tile-green .stat-card__ico, .g-green { background: var(--t-green); }
.tile-orange .stat-card__ico, .g-orange { background: var(--t-orange); }
.tile-red .stat-card__ico, .g-red { background: var(--t-red); }
.tile-gold .stat-card__ico, .g-gold { background: var(--t-gold); color: var(--on-brand) !important; }
.tile-blue .stat-card__ico, .g-blue { background: var(--t-blue); }
.tile-slate .stat-card__ico, .g-slate { background: var(--t-slate); }
.tile-teal .stat-card__ico, .g-teal { background: var(--t-teal); }
.tile-gold .stat-card__ico { color: var(--on-brand); }

.health-ico { width: 42px; height: 42px; border-radius: 13px; border: 0; color: #fff; }
.health-ico svg { width: 18px; height: 18px; }
.health-rows li { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 8px 14px; padding: 14px 0; }
.health-name { font-weight: 700; }

/* ---------- Overview (Royal Gold layout) ---------- */
.ov-hello h1 { font-size: 30px; line-height: 1.15; }
.ov-hello p { margin: 4px 0 0; color: var(--ink-2); }
.ov-top { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.15fr); }
.ov-trend { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; }
.ov-trend__head { display: flex; align-items: center; gap: 12px; }
.ov-trend__tile { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; flex: none; }
.ov-trend__tile svg { width: 20px; height: 20px; }
.ov-trend__title { font-weight: 700; font-size: 15px; }
.ov-trend__value { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.ov-trend__value b { font-size: 34px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; }
.delta { padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 700; }
.delta.up { background: var(--match-bg); color: var(--match); }
.delta.down { background: var(--hold-bg); color: var(--hold); }
.delta.flat { background: var(--surface-3); color: var(--ink-2); }
.ov-trend__sub { color: var(--ink-2); font-size: 13px; }
.spark { width: 100%; height: 64px; margin-top: auto; display: block; }

.ov-gold { text-decoration: none; position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 22px 24px; color: var(--on-brand); background: var(--gold-grad); display: flex; flex-direction: column; gap: 6px; min-height: 230px; }
.ov-gold::after { content: ""; position: absolute; inset: -40% -20% auto auto; width: 70%; height: 120%; background: radial-gradient(closest-side, rgba(255, 255, 255, 0.35), transparent); pointer-events: none; }
.ov-gold__label { font-weight: 700; opacity: 0.85; }
.ov-gold__value { font-size: 38px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; }
.ov-gold__sub { font-size: 13px; font-weight: 600; opacity: 0.8; }
.ov-gold__bars { display: flex; align-items: flex-end; gap: 5px; height: 64px; margin-top: auto; }
.ov-gold__bars i { flex: 1; min-height: 3px; border-radius: 4px 4px 2px 2px; background: rgba(26, 19, 0, 0.22); }
.ov-gold__bars i.now { background: rgba(26, 19, 0, 0.7); }
.ov-gold__split { display: flex; gap: 8px; font-size: 13px; font-weight: 700; }
.ov-gold__split span { flex: 1; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.32); }
.ov-gold__split b { font-size: 16px; display: block; }

.ov-two { display: grid; gap: 20px; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.ov-list { list-style: none; margin: 0 calc(var(--card-px, 24px) * -1) calc(var(--card-py, 24px) * -1); padding: 0; }
.ov-list a, .ov-list .ov-li { display: flex; align-items: center; gap: 14px; padding: 14px var(--card-px, 24px); border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.ov-list a:hover { background: var(--surface-2); }
.ov-list .tile { width: 42px; height: 42px; flex: none; border-radius: 13px; display: grid; place-items: center; color: #fff; }
.ov-list .tile svg { width: 18px; height: 18px; }
.ov-list .txt { flex: 1; min-width: 0; }
.ov-list .txt b { display: block; font-weight: 700; }
.ov-list .txt span { display: block; font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-list .age { width: 64px; white-space: nowrap; text-align: right; color: var(--ink-3); font-size: 13px; flex: none; }
.ov-empty { padding: 18px var(--card-px, 24px); border-top: 1px solid var(--line); color: var(--ink-2); }

@media (max-width: 1180px) {
  .ov-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ov-gold { grid-column: 1 / -1; }
  .ov-two { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .ov-list .badge { display: none; }
}
@media (max-width: 900px) {
  .shell { padding: 0; gap: 0; }
  .sidebar { height: 100vh; top: 0; border-radius: 0 var(--r-lg) var(--r-lg) 0; }
  .main { gap: 12px; padding: 12px; }
  .topbar { top: 8px; height: 60px; }
  .ov-top { grid-template-columns: minmax(0, 1fr); }
  .ov-hello h1 { font-size: 24px; }
  .ov-trend__value b, .ov-gold__value { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Payment method chips (per-phone methods) ---------- */
.m-bkash { --m: #e2136e; } .m-nagad { --m: #f26522; } .m-rocket { --m: #8c3494; } .m-upay { --m: #1f6fd1; }
html[data-theme="dark"] .m-bkash { --m: #ff5fa2; } html[data-theme="dark"] .m-nagad { --m: #ff8a4c; }
html[data-theme="dark"] .m-rocket { --m: #c77ddb; } html[data-theme="dark"] .m-upay { --m: #6aa8ff; }
.mpick { display: flex; flex-wrap: wrap; gap: 8px; }
.mchip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; }
.mchip:hover { border-color: var(--m); color: var(--ink); }
.mchip svg { width: 14px; height: 14px; }
.mchip.on { background: color-mix(in srgb, var(--m) 14%, transparent); border-color: color-mix(in srgb, var(--m) 55%, transparent); color: var(--m); }
.mchip:disabled { cursor: default; opacity: 1; }
.mchip:disabled:not(.on) { opacity: .55; }
.device-card__methods { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.device-card__label { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.field { display: grid; gap: 8px; margin-top: 16px; }
.field__label { font-weight: 600; font-size: 13px; }

/* ---------- Wallets ---------- */
.device-card__wallets { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.wgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.wcell { display: grid; gap: 6px; }
.wrow { display: grid; gap: 8px; padding: 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.wrow__head { display: flex; align-items: center; gap: 8px; }
.wrow__name { font-weight: 800; color: var(--m); flex: 1; }
.wrow__nums { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wrow__nums > div { display: grid; gap: 1px; min-width: 0; }
.wrow__nums span:first-child { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.wrow__nums b { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.wbar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.wbar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--m); }
.wbar.hot i { background: var(--hold-fill); }

/* ---------- Customer history ---------- */
.cstats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.cstat { display: grid; gap: 2px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.cstat b { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cstat span { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.cstat.ok b { color: var(--match); } .cstat.warn b { color: var(--hold); } .cstat.bad b { color: var(--risk); }
.keybox { display: flex; align-items: center; gap: 8px; word-break: break-all; font-size: 15px; letter-spacing: normal; text-align: left; justify-content: space-between; }
@media (max-width: 640px) { .cstats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
details.advanced { margin-top: 16px; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
details.advanced summary { cursor: pointer; font-weight: 700; color: var(--ink-2); }
details.advanced[open] summary { margin-bottom: 12px; }

/* Trial banner, brand swatches, withdrawals, phone approval */
.banner.trial { background: var(--brand-tint); color: var(--ink); border-bottom: 1px solid var(--brand-line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner.trial b { color: var(--brand-ink); }
.brand-sub { display: block; font-size: 11px; font-weight: 600; color: var(--ink-3); letter-spacing: 0; margin-top: 2px; }
.swatches { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px 10px; max-width: 520px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--ink-3); cursor: pointer; font: inherit; }
.swatch__chip { width: 100%; aspect-ratio: 1; border-radius: 14px; box-shadow: 0 0 0 2px var(--surface); }
.swatch[aria-pressed="true"] { color: var(--ink); }
.swatch[aria-pressed="true"] .swatch__chip { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.swatch__hex { font-family: ui-monospace, Menlo, monospace; font-size: 11px; font-weight: 700; }
.swatch-edit { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 14px; }
.swatch-edit .preview-chip { width: 48px; height: 48px; border-radius: 14px; flex: none; }
.swatch-edit input { font-family: ui-monospace, Menlo, monospace; text-transform: uppercase; max-width: 140px; }
.brand-preview { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 18px; background: var(--surface-2, rgba(255,255,255,.04)); border: 1px solid var(--line); margin-top: 14px; max-width: 520px; }
.brand-preview__logo { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; }
.brand-preview__btn { margin-left: auto; padding: 9px 16px; border-radius: 12px; font-weight: 800; }
.wd-tabs { display: inline-grid; grid-auto-flow: column; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2, rgba(255,255,255,.04)); border: 1px solid var(--line); }
.wd-tabs button { border: 0; background: transparent; color: var(--ink-3); font: inherit; font-weight: 800; padding: 9px 16px; border-radius: 10px; cursor: pointer; }
.wd-tabs button[aria-selected="true"] { background: var(--gold-grad); color: var(--on-brand); }
.wd-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.wd { display: flex; flex-direction: column; gap: 10px; }
.wd__top { display: flex; align-items: center; gap: 12px; }
.wd__amt { margin-left: auto; white-space: nowrap; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.wd__to { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2, rgba(255,255,255,.04)); }
.wd__num { font-family: ui-monospace, Menlo, monospace; font-size: 17px; font-weight: 800; letter-spacing: .02em; }
.wd__note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; font-weight: 600; }
.wd__note.warn { color: var(--hold); } .wd__note.ok { color: var(--match); } .wd__note.wait { color: var(--wait); }
.wd__note svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.lock-pill { display: inline-flex; gap: 5px; align-items: center; padding: 4px 9px; border-radius: 9px; font-size: 12px; font-weight: 800; background: rgba(255,255,255,.06); color: var(--ink-3); }
.lock-pill svg { width: 13px; height: 13px; }
.steps3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 6px 0 14px; }
.steps3 i { display: block; height: 5px; border-radius: 99px; background: var(--line); }
.steps3 i.on { background: var(--brand); } .steps3 i.done { background: var(--match-fill); }
.steps3 span { display: block; margin-top: 5px; font-size: 12px; font-weight: 800; color: var(--ink-3); }
.steps3 span.now { color: var(--ink); }
.warnbox { border: 1px solid var(--hold); background: var(--hold-bg, rgba(251,146,60,.1)); border-radius: 16px; padding: 14px 16px; }
.warnbox h3 { margin: 0 0 8px; }
.warnbox ul { margin: 0 0 12px; padding-left: 18px; display: grid; gap: 4px; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.timeline li { display: grid; grid-template-columns: 110px 1fr; gap: 10px; font-size: 13px; }
.timeline time { color: var(--ink-3); }
.approve-card { border-color: var(--brand-line); background: var(--brand-tint); }
.match-big { font-size: 46px; font-weight: 800; letter-spacing: .06em; line-height: 1; color: var(--brand-ink); font-variant-numeric: tabular-nums; }
.match-big b { color: var(--gold-2, #f97316); }
.wd__to .grow { flex: 1; }
#drawer-body > div:not(.drawer-inner), #drawer-body > form { padding: 24px; overflow-y: auto; flex: 1; }
#drawer-body > div:not(.drawer-inner) > h2:first-child, #drawer-body > form > h2:first-child { padding-right: 48px; margin-top: 0; }
@media (max-width: 720px) { #drawer-body > div:not(.drawer-inner), #drawer-body > form { padding: 16px; } }
