@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&family=Vazirmatn:wght@400;500;600;700&display=swap');

/* ===================== DESIGN TOKENS =====================
   Default (:root) = admin backoffice theme: dark slate + teal accent.
   body.public-page = the end-user page: exact palette requested —
   bg #161f28, white, gold #f8c742, green #14624d, red #d12018.
   ============================================================ */

:root {
  --bg: #10151b;
  --surface: #1a212b;
  --surface-2: #212a35;
  --ink: #E7ECF0;
  --ink-soft: #B9C4CE;
  --muted: #8695A4;
  --line: #2A3441;
  --accent: #1F8A70;
  --accent-dark: #17705A;
  --accent-ink: #FFFFFF;
  --warn: #E8A73B;
  --warn-bg: rgba(232, 167, 59, 0.14);
  --alert: #E4573A;
  --alert-bg: rgba(228, 87, 58, 0.14);
  --info: #4C9BE8;
  --info-bg: rgba(76, 155, 232, 0.14);
  --ok-bg: rgba(31, 138, 112, 0.14);
  --radius: 14px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.55);
  --input-bg: #151b23;
}

body.public-page {
  --bg: #161f28;
  --surface: #1D2733;
  --surface-2: #24303D;
  --ink: #FFFFFF;
  --ink-soft: #E7ECF0;
  --muted: rgba(255, 255, 255, 0.64);
  --line: rgba(255, 255, 255, 0.14);
  --accent: #14624d;
  --accent-dark: #0F4C3B;
  --accent-ink: #FFFFFF;
  --warn: #f8c742;
  --warn-bg: rgba(248, 199, 66, 0.16);
  --alert: #d12018;
  --alert-bg: rgba(209, 32, 24, 0.16);
  --ok-bg: rgba(20, 98, 77, 0.22);
  --input-bg: #202b37;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body[dir="rtl"], body.lang-fa {
  font-family: 'Vazirmatn', 'Inter', sans-serif;
  text-align: right;
}
body[dir="rtl"] input, body[dir="rtl"] textarea, body[dir="rtl"] select {
  text-align: right;
}
body[dir="rtl"] input[data-mono], body[dir="rtl"] .mono {
  text-align: left;
  direction: ltr;
}

h1, h2, h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em 0;
  color: var(--ink);
}

/* the step-1 heading gets its own accent — a bit of warm gold so it doesn't blend into the rest
   of the page's headings — a subtle dark shadow keeps it crisp against the dark background */
#step1Heading { color: var(--warn); text-shadow: 0 1px 3px rgba(0,0,0,0.35); }

body.lang-fa h1, body.lang-fa h2, body.lang-fa h3 {
  font-family: 'Vazirmatn', sans-serif;
  font-weight: 700;
}

.mono, .card-number, .tracking, input[data-mono] {
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
}

a { color: var(--warn); }

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 20px 100px;
}

/* thin top/bottom banners — capped height so they never dominate the screen, especially on mobile */
.site-banner {
  width: 100%;
  max-height: 90px;
  overflow: hidden;
  text-align: center;
}
.site-banner img {
  width: 100%;
  height: 100%;
  max-height: 90px;
  object-fit: cover;
  display: block;
}
@media (max-width: 480px) {
  .site-banner, .site-banner img { max-height: 60px; }
}
#topBanner.site-banner { margin-bottom: 20px; border-radius: 10px; overflow: hidden; }

.receipt-thumb {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
}

/* logo sits in the same top row as the language switcher, small enough to share the line */
.brand-row { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; }
.site-logo {
  display: block;
  max-height: 34px;
  max-width: 100%;
  min-width: 0;
  object-fit: contain;
  width: auto;
}
.brand-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}
body.lang-fa .brand-name { font-family: 'Vazirmatn', sans-serif; font-weight: 700; }

.lang-switcher {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 20px 0;
  max-width: 640px;
  margin: 0 auto;
}
.lang-btns { display: flex; gap: 6px; flex-shrink: 0; }
.lang-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12.5px;
  cursor: pointer;
}
.lang-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 10px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-top: 20px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 16px 0 6px;
}
label:first-child { margin-top: 0; }

input, select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--ink);
  background: var(--input-bg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }

input[readonly] { background: var(--surface-2); color: var(--ink-soft); cursor: not-allowed; }

select option { background: var(--surface); color: var(--ink); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 138, 112, 0.18);
}

textarea { resize: vertical; min-height: 70px; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 9px;
  font-weight: 600;
  font-size: 14.5px;
  padding: 12px 20px;
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
}

button:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  width: 100%;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--ink-soft); }

.btn-danger {
  background: var(--alert-bg);
  color: var(--alert);
}
.btn-danger:hover { filter: brightness(1.15); }

.btn-warn {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid transparent;
}
.btn-warn:hover { filter: brightness(1.1); }

.btn-small {
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 7px;
}

.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.req { color: var(--alert); }

.error-box {
  background: var(--alert-bg);
  border: 1px solid var(--alert);
  color: var(--alert);
  padding: 12px 14px;
  border-radius: 9px;
  font-size: 13.5px;
  margin-top: 16px;
}

.success-box {
  background: var(--ok-bg);
  border: 1px solid var(--accent);
  color: var(--ink);
  padding: 12px 14px;
  border-radius: 9px;
  font-size: 13.5px;
  margin-top: 16px;
}

.warn-box {
  background: var(--warn-bg);
  border: 1px solid var(--warn);
  color: var(--warn);
  padding: 12px 14px;
  border-radius: 9px;
  font-size: 13.5px;
  margin-top: 16px;
}

.bank-chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 2px; }
.bank-chip { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 62px; padding: 6px 4px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.bank-chip .bank-logo-badge { width: 30px; height: 30px; background: rgba(255,255,255,0.5); }
.bank-chip .bank-logo-badge { margin: 0; }
.bank-chip .bank-logo-badge.has-logo { width: 38px; height: 38px; background: transparent; }
.bank-chip { font: inherit; color: inherit; cursor: pointer; transition: border-color .15s, background .15s; }
.bank-chip:hover { border-color: var(--accent); }
.bank-chip.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.bank-chip-name { font-size: 10.5px; text-align: center; line-height: 1.25; color: var(--ink-soft); word-break: break-word; }

.bank-info-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  margin: 4px 0 16px;
}

.category-display {
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
}
.category-display.filled { background: var(--ok-bg); color: var(--ink); border-color: var(--accent); }
.category-display.unknown { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }

.notice-box {
  background: var(--warn-bg);
  border: 1px solid var(--warn);
  color: var(--ink);
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  text-align: center;
  margin-bottom: 18px;
}

.timer-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}
.timer-box.warning { background: var(--alert-bg); border-color: var(--alert); color: var(--alert); }
.timer-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.bold-label { font-weight: 700; }
.bold-input {
  font-weight: 700;
  font-size: 16px;
  border-color: var(--ink-soft);
}

/* ---- transfer method selector ---- */
.method-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.method-btn {
  flex: 1;
  min-width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--input-bg);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.method-btn .method-icon { font-size: 22px; }
.method-btn .method-icon.method-icon-text { font-size: 17px; font-weight: 800; letter-spacing: 1px; line-height: 22px; }
.method-btn:not(:disabled):hover { border-color: var(--accent); }
.method-btn.selected {
  border-color: var(--accent);
  background: var(--ok-bg);
  color: var(--ink);
}
.method-btn:disabled { opacity: 0.4; cursor: not-allowed; }

input[type="file"] { padding: 9px 10px; background: var(--input-bg); }

/* ---- receipt upload zone (replaces the browser's native file button) ---- */
.visually-hidden-file, input[type="file"].visually-hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding: 26px 16px;
  border: 2px dashed var(--line);
  border-radius: 14px;
  background: var(--input-bg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-zone:hover, .upload-zone.dragover, .visually-hidden-file:focus + .upload-zone {
  border-color: var(--accent);
  background: var(--ok-bg);
}
.upload-zone .upload-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--ok-bg);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.upload-zone .upload-title { font-weight: 700; font-size: 15px; color: var(--ink); }
.upload-zone .upload-sub { font-size: 12.5px; color: var(--muted); }
.upload-preview {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--input-bg);
}
.upload-preview .receipt-thumb { width: 96px; height: 96px; object-fit: cover; flex-shrink: 0; margin: 0; }
.upload-file-info { min-width: 0; flex: 1; }
.upload-file-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: start; }
.upload-file-size { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---- collapsible "how manual deposit works" intro (item 6) ---- */
.intro-accordion { margin: 10px 0 18px; }
.intro-accordion summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  padding: 8px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.intro-accordion summary::-webkit-details-marker { display: none; }
.intro-accordion summary::before { content: '▸'; display: inline-block; transition: transform 0.15s; font-size: 11px; color: var(--muted); }
.intro-accordion[open] summary::before { transform: rotate(90deg); }
.intro-accordion .intro-steps { white-space: pre-line; color: var(--muted); font-size: 13.5px; line-height: 1.9; padding: 4px 0 4px 4px; }

/* ---- virtual card visual (signature element) ---- */
.bank-card {
  position: relative;
  width: 100%;
  aspect-ratio: 1.586 / 1;
  border-radius: 18px;
  background: linear-gradient(135deg, #12233B 0%, var(--accent) 130%);
  color: white;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow);
  overflow: hidden;
}
body.public-page .bank-card {
  background: linear-gradient(135deg, #0E141B 0%, var(--accent) 140%);
}

.bank-card::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
}

.bank-card .row-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.85;
}

/* number/holder-name/bank-name read as one tight group now (wrapped in .card-body), instead of
   being spread across the full card height — .bank-card's own space-between then settles this
   whole group a little lower in the card, next to row-top, rather than stretched edge-to-edge */
.bank-card .card-number {
  font-size: clamp(20px, 5.5vw, 27px);
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap; /* always one line — user.js fitCardNumber() shrinks the font when it doesn't fit */
  overflow: hidden;
  direction: ltr;
  text-align: center;
}

.bank-card .holder-name {
  text-align: center;
  font-size: clamp(17px, 4.5vw, 21px);
  font-weight: 700;
  margin-top: 8px;
  word-break: break-word;
}

.bank-card .row-bottom {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  font-size: 13px;
  margin-top: 3px;
}

.bank-card .bank-name { opacity: 0.85; }
.bank-card .bic-line { font-size: 11px; opacity: 0.8; margin-top: 4px; text-align: center; direction: ltr; }

.bank-logo-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  margin-right: 8px;
  overflow: hidden;
  vertical-align: middle;
}
.bank-logo-badge img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
/* a logo image is shown as-is (rounded square, no tinted circle behind it) */
.bank-logo-badge.has-logo { width: 40px; height: 40px; border-radius: 8px; background: transparent; }
.bank-logo-badge.has-logo img { padding: 0; border-radius: 8px; }

.copy-btn {
  background: rgba(255,255,255,0.16);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  font-size: 12px;
  padding: 5px 10px;
}
.copy-btn:hover { background: rgba(255,255,255,0.26); }

/* ---- steps ---- */
.steps { display: flex; gap: 8px; margin-bottom: 24px; }
.step-dot { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.step-dot.done { background: var(--accent); }

/* ---- status badges ---- */
.badge { display: inline-block; padding: 5px 14px; border-radius: 20px; font-size: 13.5px; font-weight: 700; letter-spacing: 0.02em; }
.badge-pending { background: var(--warn-bg); color: var(--warn); }
.badge-verified { background: var(--ok-bg); color: var(--accent); }
.badge-rejected { background: var(--alert-bg); color: var(--alert); }
/* PAYA "Waiting for cycle" — cyan, kept clear of pending (amber), verified (green) and rejected (red) */
.badge-awaiting_cycle { background: rgba(34, 184, 207, 0.18); color: #22B8CF; border: 1px solid rgba(34, 184, 207, 0.5); }

/* ---- admin layout ---- */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: #0B0F14;
  color: #B9C4CE;
  padding: 24px 16px;
  flex-shrink: 0;
}
/* pinned sidebar stays put as the page scrolls — sticky (not fixed) so it still
   participates in the flex layout and .admin-main never needs a matching margin */
.admin-shell.sidebar-pinned .sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .brand { font-family: 'Fraunces', serif; font-size: 19px; color: white; margin-bottom: 28px; display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
/* the pin button sits on its own row at the top; the logo goes underneath it, never overlapping */
.sidebar .brand .pin-toggle-btn { align-self: flex-end; }
.sidebar .brand-mark { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; }
.sidebar-logo { display: block; max-height: 44px; max-width: 100%; object-fit: contain; }
.sidebar .nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #93A1AF;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 4px;
}
.sidebar .nav-item:hover { background: rgba(255,255,255,0.06); }
.sidebar .nav-item.active { background: var(--accent); color: white; }
.admin-main { flex: 1; min-width: 0; padding: 32px 36px; max-width: 1180px; }
/* unpinned: sidebar no longer reserves space, so let the content area actually use the extra room */
.admin-shell:not(.sidebar-pinned) .admin-main { max-width: 1500px; }

.nav-badge {
  background: var(--alert);
  color: white;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 20px;
  display: none;
}
.nav-badge.show { display: inline-block; }

.nav-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #93A1AF;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.nav-group-header:hover { background: rgba(255,255,255,0.06); }
.nav-group-arrow { font-size: 10px; transition: transform 0.15s; display: inline-block; }
.nav-group.expanded .nav-group-arrow { transform: rotate(90deg); }
.nav-group-items { display: none; padding-left: 14px; }
.nav-group.expanded .nav-group-items { display: block; }
.nav-group .nav-subitem { font-size: 13px; }

/* ---- collapsible / pinnable sidebar ---- */
.pin-toggle-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: #93A1AF;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.pin-toggle-btn:hover { color: white; border-color: rgba(255,255,255,0.4); }
.pin-toggle-btn.pinned { background: var(--accent); border-color: var(--accent); color: white; }

.sidebar-toggle-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  vertical-align: middle;
  margin-right: 4px;
}

.admin-shell:not(.sidebar-pinned) .sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  transform: translateX(-100%);
  transition: transform 0.18s ease;
  z-index: 60;
  box-shadow: var(--shadow);
  overflow-y: auto;
}
.admin-shell:not(.sidebar-pinned).sidebar-open .sidebar { transform: translateX(0); }

.stat-row { display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
  min-width: 140px;
  flex: 1;
}
.stat-card .num { font-family: 'JetBrains Mono', monospace; font-size: 26px; font-weight: 600; color: var(--ink); }
.stat-card .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--ink-soft); }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
tr:hover td { background: var(--surface-2); }

.card-row-line { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); gap: 16px; }
.card-row-line:last-child { border-bottom: none; }

.pill { display: inline-block; background: var(--surface-2); color: var(--ink-soft); font-size: 11.5px; padding: 2px 8px; border-radius: 20px; margin-right: 4px; }

.tabs-row { display: flex; gap: 4px; margin-bottom: 20px; }
.tab-btn { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.tab-btn.active { background: var(--ink); color: var(--bg); }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.checkbox-row input { width: auto; }

.filter-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filter-bar select, .filter-bar input { width: auto; min-width: 160px; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; }
/* transaction review modal: wider on desktop so fields can sit two-per-row instead of one long
   scrolling column — the 1-column table layout was effectively a mobile design admins never use */
#txModal .modal-box { max-width: 860px; }
.tx-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 28px; margin-top: 8px; }
.tx-field { padding: 8px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.tx-field-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 3px; }
.tx-field-value { font-size: 13.5px; color: var(--ink-soft); word-break: break-word; }
.tx-field-value input { width: 100%; }
@media (max-width: 760px) {
  #txModal .modal-box { max-width: 480px; }
  .tx-field-grid { grid-template-columns: 1fr; }
}

/* modals that can be opened on top of another already-open modal need a higher stacking
   context — equal z-index falls back to DOM order, which put this behind the tx detail modal */
#statusMsgModal, #duplicateModal { z-index: 70; }

.top-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #1B4A3E; /* darker, more muted than --accent — deliberately its own color, not
                           shared with buttons/active-states elsewhere */
  border-radius: var(--radius);
  padding: 14px 20px;
  margin: -32px -36px 24px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}
.top-bar .who { font-size: 13.5px; color: rgba(255,255,255,0.92); display: flex; align-items: center; }
.top-bar .sidebar-toggle-btn { border-color: rgba(255,255,255,0.35); color: #fff; }

.top-bar-widgets { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.top-bar .iran-clock, .top-bar .active-accounts-widget, .top-bar .fx-widget {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.22);
  color: rgba(255,255,255,0.92);
}
.top-bar .iran-clock .time, .top-bar .active-accounts-widget .aa-summary, .top-bar .fx-widget .fx-value { color: #fff; }
.top-bar .btn-ghost.btn-small { border-color: rgba(255,255,255,0.35); color: #fff; }
.top-bar .btn-ghost.btn-small:hover { border-color: #fff; }

.header-icon-btn {
  position: relative;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  color: #fff;
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 15px;
  line-height: 1;
}
.header-icon-btn:hover { background: rgba(255,255,255,0.24); }
.header-icon-btn.muted { opacity: 0.5; }
.notif-badge {
  position: absolute; top: -5px; right: -5px;
  background: var(--alert); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1;
  padding: 3px 5px; border-radius: 20px;
  min-width: 16px; text-align: center;
}

.fx-widget { display: flex; align-items: center; gap: 6px; }
.fx-widget .fx-label { font-size: 11px; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.05em; }
.fx-widget .fx-value { font-family: 'JetBrains Mono', monospace; font-weight: 600; }

.iran-clock {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 12.5px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.iran-clock .time { font-family: 'JetBrains Mono', monospace; font-weight: 600; color: var(--ink); }

.active-accounts-widget {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 12.5px;
  color: var(--ink-soft);
  cursor: default;
}
.active-accounts-widget .aa-summary { font-weight: 600; color: var(--ink); }
.active-accounts-widget:hover .aa-dropdown { display: block; }
.active-accounts-widget .aa-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 10px 14px;
  min-width: 220px;
  max-height: 260px;
  overflow-y: auto;
  z-index: 40;
}
.active-accounts-widget .aa-dropdown .aa-group { margin-bottom: 8px; }
.active-accounts-widget .aa-dropdown .aa-group:last-child { margin-bottom: 0; }
.active-accounts-widget .aa-dropdown .aa-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 3px; }
.active-accounts-widget .aa-dropdown .aa-item { font-size: 12.5px; color: var(--ink-soft); padding: 2px 0; }

.pill-info { background: var(--info-bg); color: var(--info); }

/* "Not Received" action button — same slate-blue as its flag, filled so it reads as its own decision */
.btn-slate { background: #6B7A99; color: #fff; border: 1px solid #6B7A99; }
.btn-slate:hover { filter: brightness(1.12); }
.btn-cycle { background: #22B8CF; color: #062a31; border: 1px solid #22B8CF; font-weight: 700; }
.btn-cycle:hover { filter: brightness(1.1); }

/* the two amounts on a mismatched transaction (receipt vs user-reported) */
.amt-mismatch { color: var(--alert); font-weight: 700; }

/* bank-cycle reminder banner (PAYA) */
.cycle-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin: 0 0 16px; border-radius: 12px; background: rgba(34, 184, 207, 0.16); border: 1px solid #22B8CF; color: var(--ink); font-size: 13.5px; font-weight: 600; }
.cycle-banner .cb-text { flex: 1; min-width: 220px; }
.cycle-banner button, .cycle-banner a { font-size: 12px; }

/* totals row under the transactions table */
.tx-total-row td { border-top: 2px solid var(--line); font-weight: 600; vertical-align: top; }

/* ---- flag colors: deliberately kept out of the green/amber/red family so a flag is never
   mistaken for a status (pending = amber, verified = green, rejected = red) ---- */
.flag-blue    { background: rgba(61, 142, 240, 0.16);  color: #5AA0F5; --flag-c: #5AA0F5; }
.flag-purple  { background: rgba(155, 93, 229, 0.18);  color: #B084EE; --flag-c: #B084EE; }
.flag-indigo  { background: rgba(91, 107, 223, 0.18);  color: #7F8EF0; --flag-c: #7F8EF0; }
.flag-magenta { background: rgba(194, 71, 154, 0.18);  color: #DB6FB9; --flag-c: #DB6FB9; }
.flag-sky     { background: rgba(42, 157, 201, 0.18);  color: #46B4DC; --flag-c: #46B4DC; }
.flag-slate   { background: rgba(107, 122, 153, 0.22); color: #9AA8C4; --flag-c: #9AA8C4; }
/* full-width variant used for the explanation lines inside the transaction detail modal */
.flag-box { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--flag-c); font-size: 13px; margin: 8px 0; }
.pill-clickable { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 2px; }

.col-settings-wrap { position: relative; display: inline-block; }
.col-settings-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 5px 9px;
  font-size: 13px;
  border-radius: 7px;
}
.col-settings-btn:hover { color: var(--ink); border-color: var(--ink-soft); }
.col-settings-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 10px;
  min-width: 220px;
  z-index: 40;
}
.col-settings-panel.open { display: block; }
.col-settings-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 4px; font-size: 12.5px; color: var(--ink-soft); }
.col-settings-row .cs-name { display: flex; align-items: center; gap: 6px; }
.col-settings-row input[type="checkbox"] { width: auto; }
/* drag-to-reorder rows inside the ⚙ Columns panel */
.col-settings-row.draggable { cursor: grab; border-radius: 6px; }
.col-settings-row.draggable:active { cursor: grabbing; }
.col-settings-row .cs-drag-handle { color: var(--muted); font-size: 14px; line-height: 1; padding: 0 2px; flex-shrink: 0; }
.col-settings-row.cs-dragging { opacity: 0.35; }
.col-settings-row.cs-drag-over { box-shadow: inset 0 2px 0 var(--accent); }

.filter-toggle-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 10px; flex-wrap: wrap; }
.advanced-filters {
  display: none;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}
.advanced-filters.open { display: grid; }
.advanced-filters label { margin: 0 0 4px; font-size: 11.5px; }
.advanced-filters .af-field { display: flex; flex-direction: column; }
.advanced-filters .af-range { display: flex; gap: 6px; }

.pagination-row { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.pagination-row .page-size-select { width: auto; min-width: 0; padding: 6px 8px; font-size: 12.5px; }
.pagination-row .page-nav { display: flex; align-items: center; gap: 6px; }
.pagination-row .page-nav button { padding: 5px 10px; font-size: 12.5px; }
.pagination-row .page-nav button:disabled { opacity: 0.4; cursor: not-allowed; }

.receipt-toggle-btn { width: auto; }
.duplicate-modal-box table { margin-top: 10px; }

/* ---- card/bank/PAYA modal: detected-bank preview + custom background upload (item 13) ---- */
.bank-preview-card {
  border-radius: 12px; padding: 16px 18px; margin-top: 10px;
  background-size: cover; background-position: center;
  color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  box-shadow: var(--shadow);
}
.bank-preview-card .bp-hint { font-weight: 400; font-size: 11.5px; opacity: 0.85; }
.bg-upload-preview-wrap { margin-top: 8px; }
.bg-upload-preview { width: 100%; max-height: 130px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
/* logo preview: round, small, checkerboard-free background so a transparent PNG logo reads clearly */
.logo-upload-preview { width: 64px; height: 64px; object-fit: contain; border-radius: 50%; border: 1px solid var(--line); background: #fff; display: block; padding: 6px; }

/* ---- language switcher ---- */
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.lang-switch button {
  background: transparent;
  color: var(--muted);
  border-radius: 0;
  padding: 6px 12px;
  font-size: 12.5px;
}
.lang-switch button.active { background: var(--accent); color: var(--accent-ink); }

/* ---- floating action row: cancel + live support ---- */
.floating-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  justify-content: center;
}
.floating-actions button {
  width: auto;
  padding: 9px 16px;
  font-size: 12.5px;
}

/* ---- backoffice light theme — toggled via a data-theme attribute on <body>, not
   prefers-color-scheme, since this is a deliberate per-admin light/dark switch (persisted
   per-browser in localStorage), not a system-setting follow. Dark (the values in :root)
   stays the default. ---- */
body.admin-page[data-theme="light"] {
  --bg: #F4F6F8;
  --surface: #FFFFFF;
  --surface-2: #EEF1F4;
  --ink: #1A212B;
  --ink-soft: #3E4854;
  --muted: #6B7684;
  --line: #DDE3E8;
  --accent: #1F8A70;
  --accent-dark: #17705A;
  --accent-ink: #FFFFFF;
  --warn: #A5691A;
  --warn-bg: rgba(165, 105, 26, 0.12);
  --alert: #C23B24;
  --alert-bg: rgba(194, 59, 36, 0.10);
  --info: #2B6CB0;
  --info-bg: rgba(43, 108, 176, 0.10);
  --ok-bg: rgba(31, 138, 112, 0.10);
  --shadow: 0 8px 24px -12px rgba(20, 30, 40, 0.16);
  --input-bg: #FFFFFF;
}
/* the sidebar stays dark in both themes (its own fixed color, not a variable) — deliberate,
   common "dark rail + themeable content" pattern */

/* ---- backoffice runs smaller text than the public page (scoped here, not via zoom —
   zoom scaled fixed-position/flex layout inconsistently and broke the sidebar drawer) ---- */
body.admin-page { font-size: 13px; }
body.admin-page h1 { font-size: 24px; }
body.admin-page h2 { font-size: 19px; }
body.admin-page h3 { font-size: 15px; }
body.admin-page .eyebrow { font-size: 10.5px; }
body.admin-page label { font-size: 11.5px; }
body.admin-page input, body.admin-page select, body.admin-page textarea { font-size: 13px; }
body.admin-page button { font-size: 13px; }
body.admin-page .btn-small { font-size: 11.5px; }
body.admin-page .hint { font-size: 11px; }
body.admin-page .error-box, body.admin-page .success-box, body.admin-page .warn-box { font-size: 12px; }
/* deliberately NOT shrunk down with the rest of the admin-page compact sizing — the owner
   specifically wants status badges to stand out clearly in the transactions table */
body.admin-page .badge { font-size: 12.5px; padding: 4px 12px; }
body.admin-page .sidebar .brand { font-size: 17px; }
body.admin-page .sidebar .nav-item { font-size: 12.5px; }
body.admin-page .nav-group-header { font-size: 12.5px; }
body.admin-page .nav-group .nav-subitem { font-size: 11.5px; }
body.admin-page .stat-card .num { font-size: 22px; }
body.admin-page .stat-card .label { font-size: 10.5px; }
body.admin-page table { font-size: 12px; }
body.admin-page th { font-size: 10px; }
body.admin-page .pill { font-size: 10px; }
body.admin-page .top-bar .who { font-size: 12px; }
body.admin-page .iran-clock { font-size: 11px; }
body.admin-page .active-accounts-widget { font-size: 11px; }
body.admin-page .active-accounts-widget .aa-dropdown .aa-item { font-size: 11px; }
body.admin-page .col-settings-row { font-size: 11px; }
body.admin-page .pagination-row { font-size: 11px; }
body.admin-page .pagination-row .page-size-select { font-size: 11px; }

@media (max-width: 760px) {
  .admin-shell.sidebar-pinned { flex-direction: column; }
  .admin-shell.sidebar-pinned .sidebar {
    width: 100%; display: flex; align-items: center; padding: 14px 16px; gap: 8px; flex-wrap: wrap;
    /* on mobile the pinned sidebar is a horizontal bar, not a side column — undo the sticky/100vh column treatment */
    position: static; height: auto; overflow-y: visible;
  }
  .admin-shell.sidebar-pinned .sidebar .brand { margin: 0 12px 0 0; flex-direction: row; align-items: center; }
  .admin-shell.sidebar-pinned .sidebar .nav-item { margin-bottom: 0; }
  .admin-main { padding: 20px 16px; }
  .top-bar { margin: -20px -16px 20px; padding: 12px 16px; }

  /* unpinned: still a proper vertical drawer on small screens, not the wrapped horizontal bar above */
  .admin-shell:not(.sidebar-pinned) .sidebar { width: 260px; max-width: 80vw; }
}

/* ---- backoffice fits the way Chrome's 80% page zoom does, so the owner can browse at 100% and
   still see more columns without side-scrolling. Desktop only (phones keep full size). CSS `zoom`
   also scales viewport units — vh becomes 0.8× — so every 100vh-based height below is
   compensated by 1/0.8 = 1.25 to keep the sidebar, shell and modals filling the screen. ---- */
@media (min-width: 761px) {
  body.admin-page { zoom: 0.8; }
  body.admin-page .admin-shell { min-height: 125vh; }
  body.admin-page .admin-shell.sidebar-pinned .sidebar,
  body.admin-page .admin-shell:not(.sidebar-pinned) .sidebar { height: 125vh; }
  body.admin-page .modal-box { max-height: 110vh; }
  /* use the extra room the smaller scale frees up, instead of stopping at the old max width */
  body.admin-page .admin-main,
  body.admin-page .admin-shell:not(.sidebar-pinned) .admin-main { max-width: 2400px; }
}

/* ---- clean spinning indicator for the waiting screen (item 7) — no percentage, just a smooth
   rotating ring so it plainly reads as "still in progress" ---- */
.review-spinner { display: flex; justify-content: center; margin: 18px 0; }
/* waiting loader: a glowing crescent moon (the brand) inside a sweeping ring, with a little gold coin orbiting it */
.moon-loader { position: relative; width: 92px; height: 92px; }
.moon-loader svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.moon-ring { animation: moon-spin 1.8s linear infinite; }
.moon-orbit { animation: moon-spin-rev 3.4s linear infinite; }
.moon-icon { animation: moon-float 2.6s ease-in-out infinite; filter: drop-shadow(0 0 7px rgba(248, 199, 66, 0.55)); }
.moon-star { animation: moon-twinkle 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.moon-star.s2 { animation-delay: 0.5s; }
.moon-star.s3 { animation-delay: 1s; }
@keyframes moon-spin { to { transform: rotate(360deg); } }
@keyframes moon-spin-rev { to { transform: rotate(-360deg); } }
@keyframes moon-float { 0%, 100% { transform: translateY(2px) scale(0.97); } 50% { transform: translateY(-2px) scale(1.03); } }
@keyframes moon-twinkle { 0%, 100% { opacity: 0.25; transform: scale(0.7); } 50% { opacity: 1; transform: scale(1.25); } }
@media (prefers-reduced-motion: reduce) {
  .moon-ring { animation-duration: 6s; }
  .moon-orbit { animation-duration: 10s; }
  .moon-icon, .moon-star { animation: none; }
}


/* ---- waiting-room mini quiz ---- */
.quiz-card { margin: 18px 0 8px; padding: 14px 14px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-align: center; }
.quiz-heading { font-weight: 700; font-size: 15px; color: var(--warn); margin-bottom: 8px; }
.quiz-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.quiz-meta b { color: var(--ink); }
.quiz-img { display: block; margin: 6px auto 10px; max-width: 190px; max-height: 150px; width: auto; height: auto; background: #fff; border-radius: 10px; padding: 6px; object-fit: contain; }
.quiz-q { font-size: 14.5px; font-weight: 600; color: var(--ink); margin: 4px 0 10px; line-height: 1.7; }
.quiz-options { display: grid; grid-template-columns: 1fr; gap: 8px; }
.quiz-opt { font: inherit; font-size: 14px; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.quiz-opt:hover:not(:disabled) { border-color: var(--accent); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt.correct { border-color: var(--accent); background: var(--ok-bg); }
.quiz-opt.wrong { border-color: var(--alert); background: var(--alert-bg); }
.quiz-feedback { margin-top: 10px; font-size: 13.5px; color: var(--ink-soft); line-height: 1.7; }
.quiz-feedback b { display: block; color: var(--ink); margin-bottom: 2px; }
.quiz-next { margin-top: 10px; font: inherit; font-size: 13.5px; color: var(--accent-ink); background: var(--accent); border: 0; border-radius: 10px; padding: 9px 18px; cursor: pointer; }
.quiz-credit { margin-top: 10px; font-size: 11px; color: var(--muted); }

/* ---- final result of the review (replaces the "we got it / under review" header) ---- */
#step4.decided .step4-title, #step4.decided #waitingMessage, #step4.decided #whatHappenedBtn { display: none !important; }
.result-card { margin: 6px 0 14px; padding: 22px 16px 20px; border-radius: var(--radius); border: 2px solid var(--line); text-align: center; animation: result-in 0.45s ease-out both; }
.result-card.result-verified { border-color: var(--accent); background: var(--ok-bg); }
.result-card.result-rejected { border-color: var(--alert); background: var(--alert-bg); }
.result-icon { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 800; color: #fff; animation: result-pop 0.5s 0.15s cubic-bezier(.2, 1.6, .4, 1) both; }
.result-verified .result-icon { background: var(--accent); box-shadow: 0 0 0 8px rgba(31, 138, 112, 0.2); }
.result-rejected .result-icon { background: var(--alert); box-shadow: 0 0 0 8px rgba(228, 87, 58, 0.2); }
.result-title { font-size: 21px; font-weight: 800; color: var(--ink); margin-bottom: 6px; }
.result-msg { font-size: 14.5px; line-height: 1.9; color: var(--ink-soft); }
@keyframes result-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes result-pop { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.result-card.static, .result-card.static .result-icon { animation: none; }
