/* ==========================================================================
   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: #1a1300; 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: #1a1300; }
.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: #1a1300; }

.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: #1a1300; 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: #1a1300 !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: #1a1300; }

.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: #1a1300; 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; } }
