@font-face { font-family: "Vazirmatn"; src: url("fonts/Vazirmatn-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("fonts/Vazirmatn-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f232c;
  --line: #2a2f3a;
  --text: #e9ecf2;
  --muted: #8b93a3;
  --accent: #d4af5a;      /* gold */
  --buy: #2fbf71;         /* 🟢 customer buys */
  --sell: #e5534b;        /* 🔴 customer sells */
  --warn: #e0a43a;
  --radius: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: "Vazirmatn", system-ui, sans-serif;
  font-size: 15px; line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }

#app { min-height: 100%; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 16px; background: rgba(15,17,21,.92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.brand-mark { color: var(--accent); font-size: 18px; }

.view { flex: 1; padding: 16px 16px calc(84px + var(--safe-bottom)); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
}
.card h2 { margin: 0 0 4px; font-size: 17px; }
.card p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.hello { font-size: 20px; font-weight: 700; margin: 0 0 2px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 999px; font-size: 12px;
  background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap;
}
.chip-ok { color: var(--buy); border-color: rgba(47,191,113,.35); }
.chip-warn { color: var(--warn); border-color: rgba(224,164,58,.4); }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; text-align: right; cursor: pointer;
}
.tile .ic { font-size: 22px; display: block; margin-bottom: 4px; }
.tile .t { font-weight: 700; display: block; }
.tile .s { color: var(--muted); font-size: 12px; }
.tile:active { background: var(--surface-2); }

.state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 8px; gap: 12px; }
.state .big { font-size: 40px; }
.state p { margin: 0; max-width: 320px; }

.btn {
  display: inline-block; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); cursor: pointer;
}
.btn-primary { background: var(--accent); color: #1a1406; border-color: transparent; font-weight: 700; }

.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 10;
  display: grid; grid-template-columns: repeat(6, 1fr);
  padding: 6px 4px calc(6px + var(--safe-bottom));
  background: rgba(23,26,33,.96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  background: none; border: 0; padding: 4px 0; font-size: 10.5px; color: var(--muted); cursor: pointer;
}
.tab .ic { font-size: 18px; line-height: 1.4; filter: grayscale(1) opacity(.7); }
.tab.is-active { color: var(--accent); }
.tab.is-active .ic { filter: none; }

/* ---------- phase 2: rates / balance / history ---------- */
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.center { text-align: center; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.page-head h1 { margin: 0; font-size: 19px; }
.page-head p { margin: 2px 0 0; }
.icon-btn {
  flex: none; width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); font-size: 18px; cursor: pointer;
}
.icon-btn.spin { animation: spin .8s linear infinite; }
.banner { border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; }
.banner.warn { background: rgba(224,164,58,.1); border: 1px solid rgba(224,164,58,.35); color: var(--warn); }
.soon { font-size: 10px; font-weight: 400; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; }

h2.group { font-size: 14px; color: var(--muted); margin: 18px 4px 8px; font-weight: 700; }
.card.rate { padding: 12px 14px; }
.rate-title { font-weight: 700; margin-bottom: 8px; }
.prices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.price {
  display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 10px;
  background: var(--surface-2); border-right: 3px solid var(--line);
}
.price.buy { border-right-color: var(--buy); }
.price.sell { border-right-color: var(--sell); }
.price .plabel { font-size: 12px; color: var(--muted); }
.price .num { font-size: 16px; font-weight: 700; text-align: right; }
.price .closed { font-size: 13px; color: var(--warn); }

.kv { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--line); }
.card h2 { margin: 0 0 8px; }
.net { font-weight: 700; font-size: 14px; white-space: nowrap; }
.net.neg { color: var(--sell); }
.net.pos { color: var(--buy); }
.net.zero { color: var(--muted); }
.qty, .mv { padding: 8px 0; border-top: 1px solid var(--line); }
.qty:first-of-type, .mv:first-of-type { border-top: 0; }
.qlabel { font-weight: 700; }
.btn.wide { display: block; width: 100%; text-align: center; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.fchip {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: 13px; cursor: pointer;
}
.fchip.is-on { background: var(--accent); color: #1a1406; border-color: transparent; font-weight: 700; }
.datebox { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.datebox input {
  flex: 1 1 200px; min-width: 0; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; direction: rtl;
}
.datebox .err { flex-basis: 100%; margin: 0; color: var(--sell); }
.daynav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.btn.ghost { visibility: hidden; }
.card.trade { border-right: 3px solid var(--line); }
.card.trade.buy { border-right-color: var(--buy); }
.card.trade.sell { border-right-color: var(--sell); }
.tcode { color: var(--muted); font-size: 13px; }
.tline { margin: 4px 0 8px; }
.trade.buy .side { color: var(--buy); }
.trade.sell .side { color: var(--sell); }
.tgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 6px; }
.tgrid > div { display: flex; flex-direction: column; }
.st { font-size: 12px; white-space: nowrap; }
.st-approved { color: var(--buy); }
.st-rejected, .st-cancelled { color: var(--sell); }
.st-waiting_admin, .st-price_changed { color: var(--warn); }
.st-expired { color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }

/* ---------- phase 3: trade ---------- */
button.price.slot { font: inherit; color: inherit; border-top: 0; border-bottom: 0; border-left: 0; text-align: right; cursor: pointer; }
button.price.slot:active { background: var(--line); }
.stepper { display: flex; align-items: center; gap: 8px; margin: 10px 0 6px; }
.step { width: 52px; height: 52px; padding: 0; font-size: 24px; flex: none; }
.qty-input {
  flex: 1; min-width: 0; height: 52px; text-align: center; font-size: 22px; font-weight: 700;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-family: inherit;
}
.qty-input:focus, .datebox input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.err { color: var(--sell); margin: 6px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.actions .btn { flex: 1 1 140px; text-align: center; padding: 12px 14px; }
.btn:disabled { opacity: .6; }
.kv.total { font-weight: 700; font-size: 16px; }
.status-box { display: flex; flex-direction: column; gap: 4px; }
.status-box.waiting { flex-direction: row; align-items: center; gap: 14px; border-color: rgba(224,164,58,.4); }
.status-box.waiting .spinner { flex: none; }
.status-box p { margin: 0; }
.status-box.st-approved { border-color: rgba(47,191,113,.45); }
.status-box.st-rejected, .status-box.st-cancelled { border-color: rgba(229,83,75,.45); }
.status-box.st-price_changed { border-color: rgba(224,164,58,.45); }
@keyframes flash { 0% { background: rgba(212,175,90,.35); } 100% { background: transparent; } }
.flash { animation: flash 1.2s ease-out; }
.banner.flash { animation: none; }

/* ---------- toman ---------- */
.amt { display: inline-flex; align-items: baseline; gap: 4px; direction: rtl; }
.unit { font-size: 11px; color: var(--muted); font-weight: 400; }
.price .amt { justify-content: flex-start; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); display: inline-block; }
.live-dot.on { background: var(--buy); box-shadow: 0 0 0 3px rgba(47,191,113,.18); }

/* ---------- 🛠 admin ---------- */
.top-right { display: flex; align-items: center; gap: 6px; }
.mode-chip { cursor: pointer; color: var(--accent); }
.tabbar.admin { grid-template-columns: repeat(3, 1fr); }
.tab { position: relative; }
.badge {
  position: absolute; top: 0; left: calc(50% - 22px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--sell); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(80px + var(--safe-bottom)); z-index: 30;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); text-align: center; animation: rise .2s ease-out;
}
.toast.bad { border-color: rgba(229,83,75,.6); color: #ffb4ae; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.dash { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dtile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; display: flex; flex-direction: column; gap: 2px;
}
.dtile[data-agoto] { cursor: pointer; }
.dcount { font-size: 26px; font-weight: 700; line-height: 1.2; }
.dlabel { font-size: 12px; color: var(--muted); }
.ddetail { font-size: 11px; color: var(--muted); margin-top: 4px; }
.dtile.tone-alert { border-color: rgba(229,83,75,.55); }
.dtile.tone-alert .dcount { color: var(--sell); }
.dtile.tone-warn { border-color: rgba(224,164,58,.5); }
.dtile.tone-warn .dcount { color: var(--warn); }
.dtile.tone-ok .dcount { color: var(--muted); }
.left-chip { font-size: 13px; color: var(--warn); }
.left-chip.urgent { color: var(--sell); font-weight: 700; }
.effect { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; margin: 6px 0; line-height: 1.9; }
.btn-ok { background: var(--buy); color: #04170c; border-color: transparent; font-weight: 700; }
.btn-reject { color: #ffb4ae; border-color: rgba(229,83,75,.5); }
.rejbox { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.rejbox .reason {
  width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; margin-top: 4px;
}
.pre { white-space: pre-line; }
.halt-all, .halt-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.btn.halt { font-size: 12px; }
.btn.halt.is-closed { border-color: rgba(229,83,75,.6); color: #ffb4ae; background: rgba(229,83,75,.08); }
.small-btn { padding: 6px 10px; font-size: 12px; }
.card.rate.is-off { opacity: .6; }
.rateform { display: flex; flex-direction: column; gap: 10px; }
.fld { display: flex; flex-direction: column; gap: 4px; padding-right: 10px; border-right: 3px solid var(--line); }
.fld.buy { border-right-color: var(--buy); }
.fld.sell { border-right-color: var(--sell); }
.fld input {
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 18px; font-weight: 700; text-align: left;
}
.fld .hint { min-height: 1.2em; }

/* ---------- 🌐 web version / wide screens ---------- */
.ghost-btn { margin-top: 14px; background: transparent; }
#logout-btn { cursor: pointer; }
a.btn { text-decoration: none; color: var(--text); }
a.btn.btn-primary { color: #1a1406; }
@media (min-width: 640px) {
  #app { max-width: 560px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); min-height: 100vh; }
  .tabbar, .toast { max-width: 560px; margin: 0 auto; }
  .tabbar { left: 0; right: 0; }
  .toast { left: 16px; right: 16px; }
}

/* ---------- 🧾📒 requests ---------- */
.banner.info { background: rgba(212,175,90,.07); border: 1px solid rgba(212,175,90,.28); color: var(--text); }
.card.req.is-open { border-color: rgba(224,164,58,.45); }
.req-title { font-weight: 700; margin-bottom: 4px; }
.st-text { font-size: 13px; }
.tone-ok { color: var(--buy); }
.tone-bad { color: var(--sell); }
.tone-warn { color: var(--warn); }
.tone-muted { color: var(--muted); }
.details { margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: rgba(229,83,75,.07); color: #ffb4ae; font-size: 13px; }
.card.req .btn.wide { margin-top: 10px; }

/* ---------- 📤 receipt upload ---------- */
.top-actions { margin: 0 0 10px; }
button.card.pick { display: block; width: 100%; text-align: right; font: inherit; color: inherit; cursor: pointer; }
.files { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.file {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px;
}
.file.bad { border-color: rgba(229,83,75,.5); color: #ffb4ae; }
.fic { font-size: 20px; }
.fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xbtn { background: none; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px 6px; }
.spinner.sm { width: 18px; height: 18px; border-width: 2px; }
label.picker { cursor: pointer; text-align: center; border-style: dashed; padding: 14px; }
label.picker.disabled { opacity: .5; pointer-events: none; }
.dtile.other { opacity: .55; }
.dother { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

/* ---------- 🔑 login / sign-up / 👤 حساب من (B1) ---------- */
.auth { max-width: 420px; margin: 0 auto; }
.auth-head { text-align: center; margin: 8px 0 16px; }
.auth-mark { font-size: 34px; color: var(--accent); line-height: 1; }
.auth-head h1 { margin: 6px 0 2px; font-size: 22px; letter-spacing: .5px; }
.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.seg button { border: 0; background: transparent; padding: 9px 0; border-radius: 9px; cursor: pointer; color: var(--muted); }
.seg button.is-on { background: var(--surface-2); color: var(--text); font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); }
.authform { display: flex; flex-direction: column; gap: 10px; }
.authform h2 { margin: 0; font-size: 18px; }
.afld { display: flex; flex-direction: column; gap: 4px; }
.ainput { position: relative; display: block; }
.ainput input {
  width: 100%; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px;  /* 16px: no iOS zoom */
}
.ainput input[dir="ltr"] { text-align: left; }
.ainput input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.ainput .eye {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  background: none; border: 0; cursor: pointer; opacity: .7; padding: 4px;
}
.ainput input[type="password"], .ainput input[name="password"], .ainput input[name="password2"], .ainput input[name="current"] { padding-right: 40px; }
.authform .hint { margin: -4px 0 0; }
.authform .err { margin: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
details.rules { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
details.rules summary { cursor: pointer; font-size: 14px; }
.rules-text { max-height: 240px; overflow: auto; margin-top: 8px; color: var(--muted); }
.big-ic { font-size: 40px; line-height: 1.2; }
.card.center h2 { margin: 6px 0; }
.auth-alt { margin-top: 18px; text-align: center; display: flex; flex-direction: column; gap: 8px; }
.auth-alt .btn { color: var(--text); }
#account-btn { cursor: pointer; }
.btn.confirm { border-color: rgba(229,83,75,.6); color: #ffb4ae; }
.state .spinner { margin-top: 4px; }

/* ---------- 📲 install / home screen ---------- */
.topbar { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
.card.install { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-color: rgba(212,175,90,.35); }
.install-ic { font-size: 26px; }
.install-t { flex: 1; display: flex; flex-direction: column; line-height: 1.6; }
.card.install .btn { flex: 0 0 auto; }
#install-slot:empty { display: none; }
.auth #install-slot { margin-top: 12px; }

/* =====================================================================
 * ✨ Polish layer — same layout and colours, more depth and life.
 * (Only refines what is above: removing this block restores the old look.)
 * ===================================================================== */
:root {
  --gold-1: #f3d48a;
  --gold-2: #d4af5a;
  --gold-3: #a8822f;
  --glass: rgba(23,26,33,.78);
  --shadow: 0 8px 24px rgba(0,0,0,.28);
}
body {
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(212,175,90,.10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
.topbar { background: rgba(15,17,21,.82); backdrop-filter: blur(14px) saturate(140%); }
.brand-mark { filter: drop-shadow(0 0 6px rgba(212,175,90,.45)); }
.brand-name {
  background: linear-gradient(90deg, var(--gold-1), #fff 45%, var(--gold-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* cards: a soft top light + shadow instead of flat panels */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,0) 40%), var(--surface);
  border-color: rgba(255,255,255,.06);
  box-shadow: var(--shadow);
}
.view > .card:first-child, .hero {
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(212,175,90,.18), transparent 55%),
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,0)), var(--surface);
  border-color: rgba(212,175,90,.28);
}
.hello { font-size: 21px; }

/* home tiles: icon in a glowing gold chip, gentle press */
.grid { gap: 12px; }
.tile {
  background: linear-gradient(160deg, rgba(255,255,255,.045), rgba(255,255,255,0) 55%), var(--surface);
  border-color: rgba(255,255,255,.06);
  box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .2s ease, background .2s ease;
  padding: 16px 14px;
}
.tile .ic {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 10px;
  background: radial-gradient(circle at 30% 25%, rgba(243,212,138,.28), rgba(212,175,90,.08));
  border: 1px solid rgba(212,175,90,.25);
}
.tile:hover { border-color: rgba(212,175,90,.35); }
.tile:active { transform: scale(.97); }

/* buttons */
.btn { transition: transform .1s ease, filter .2s ease; }
.btn:active { transform: scale(.98); }
.btn-primary {
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2) 55%, var(--gold-3));
  box-shadow: 0 6px 18px rgba(212,175,90,.25), inset 0 1px 0 rgba(255,255,255,.35);
}
.ghost-btn { border-color: rgba(212,175,90,.22); }
.fchip { transition: background .2s ease; }
.fchip.is-on {
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  box-shadow: 0 4px 12px rgba(212,175,90,.22);
}

/* group titles with a fading rule */
h2.group { display: flex; align-items: center; gap: 10px; color: var(--gold-2); }
h2.group::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(212,175,90,.35), transparent); }
[dir="rtl"] h2.group::after { background: linear-gradient(270deg, rgba(212,175,90,.35), transparent); }

/* prices: tinted green / red panels, bigger numbers */
.price { padding: 10px 12px; border-radius: 12px; transition: background .35s ease, box-shadow .35s ease; }
.price.buy { background: linear-gradient(180deg, rgba(47,191,113,.12), rgba(47,191,113,.04)); }
.price.sell { background: linear-gradient(180deg, rgba(229,83,75,.12), rgba(229,83,75,.04)); }
.price .num { font-size: 17px; font-weight: 800; letter-spacing: .2px; }
.price .delta { font-size: 11.5px; font-weight: 700; direction: ltr; text-align: right; }
.price .delta.up { color: var(--buy); }
.price .delta.down { color: var(--sell); }
.price .delta.same { color: var(--muted); font-weight: 400; }
.price.flash { animation: flash 1.6s ease-out 1; }
@keyframes flash {
  0% { box-shadow: 0 0 0 3px rgba(243,212,138,.65); background: rgba(243,212,138,.18); }
  100% { box-shadow: 0 0 0 0 rgba(243,212,138,0); }
}
button.price, .price.tap { cursor: pointer; }

/* balance colours with a soft pill behind */
.net.pos, .net.neg { padding: 2px 10px; border-radius: 999px; }
.net.pos { background: rgba(47,191,113,.10); }
.net.neg { background: rgba(229,83,75,.10); }

/* live dot: a calm pulse when connected */
.live-dot.on { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(47,191,113,.5); } 50% { box-shadow: 0 0 0 5px rgba(47,191,113,0); } }

/* tab bar: frosted glass, active tab in a gold pill */
.tabbar { background: var(--glass); backdrop-filter: blur(16px) saturate(150%); border-top-color: rgba(255,255,255,.06); }
.tab { border-radius: 12px; margin: 0 1px; transition: background .2s ease, color .2s ease; white-space: nowrap; letter-spacing: -.2px; }
.tab.is-active { background: rgba(212,175,90,.12); font-weight: 700; }
.tab.is-active .ic { transform: translateY(-1px); filter: drop-shadow(0 2px 6px rgba(212,175,90,.45)); }

/* B2 pieces (announcement, market status) */
.ann {
  border-color: rgba(212,175,90,.45) !important;
  background:
    linear-gradient(135deg, rgba(212,175,90,.16), rgba(212,175,90,.03) 60%), var(--surface) !important;
}
.ann .ann-title { display: flex; align-items: center; gap: 6px; font-weight: 800; color: var(--gold-1); }
.ann p { margin: 6px 0 10px; font-size: 14px; line-height: 1.9; }
.ann .call {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid rgba(212,175,90,.45); color: var(--gold-1); text-decoration: none; font-size: 13px;
  background: rgba(212,175,90,.06);
}
.chip.market-open { color: var(--buy); border-color: rgba(47,191,113,.4); background: rgba(47,191,113,.08); }
.chip.market-closed { color: var(--sell); border-color: rgba(229,83,75,.4); background: rgba(229,83,75,.08); }

@media (prefers-reduced-motion: reduce) {
  .price.flash, .live-dot.on { animation: none !important; }
}

/* B2: notices, call buttons, inbox badge, switch */
.ann .pre { white-space: pre-line; }
.ann .calls { margin: 0; }
.ann .call .num { opacity: .8; }
.ann.important {
  border-color: rgba(229,83,75,.55) !important;
  background: linear-gradient(135deg, rgba(229,83,75,.16), rgba(229,83,75,.03) 60%), var(--surface) !important;
}
.ann.important .ann-title { color: #ff9c95; }
.count-badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-right: 6px;
  border-radius: 999px; background: var(--sell); color: #fff; font-size: 12px; font-weight: 800; vertical-align: 1px;
}
.linklike { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 4px 0; }
.switch {
  position: relative; flex: none; width: 50px; height: 30px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-2); cursor: pointer; transition: background .2s ease;
}
.switch span {
  position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #cfd5df; transition: right .2s ease, background .2s ease;
}
.switch.on { background: linear-gradient(180deg, var(--gold-1), var(--gold-2)); border-color: transparent; }
.switch.on span { right: 24px; background: #fff; }

/* rates: tappable prices + live wording */
button.price { font: inherit; color: inherit; border-top: 0; border-bottom: 0; border-left: 0; text-align: right; cursor: pointer; width: 100%; }
button.price:active { transform: scale(.98); }
.live-word { color: var(--buy); font-size: 12px; }
.price .delta .num { font-size: inherit; font-weight: inherit; text-align: inherit; letter-spacing: 0; }
#pdf-state a { color: var(--accent); }

/* 🛠 admin: receipts (A2) */
.tabbar.admin { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 1fr; }
.rcard { display: flex; flex-direction: column; gap: 6px; }
.rfile { display: flex; gap: 12px; align-items: flex-start; padding-top: 10px; border-top: 1px solid var(--line); }
.rthumb {
  flex: none; width: 96px; height: 120px; border-radius: 12px; overflow: hidden; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line); cursor: zoom-in;
}
.rthumb img { width: 100%; height: 100%; object-fit: cover; }
.pdf-ic { font-size: 14px; font-weight: 700; }
.rinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rinfo .actions { margin-top: 6px; }
.viewer { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.92); display: grid; place-items: center; padding: 16px; }
.viewer img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.viewer iframe { width: 100%; height: 90vh; border: 0; background: #fff; border-radius: 8px; }
.viewer-x { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); left: 12px; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.3); background: rgba(0,0,0,.5); color: #fff; font-size: 18px; cursor: pointer; }

/* 🏠 «مانده‌ی من» breathing room */
#home-balance:not(:empty) { margin-top: 14px; }
#home-balance .card { margin-bottom: 4px; }
#home-balance + .ghost-btn { margin-top: 10px; }

/* ⏳ در انتظار */
.pending-line { margin-top: 10px; padding: 8px 12px; border-radius: 12px; font-size: 13px;
  background: color-mix(in srgb, var(--accent, #d4a64a) 14%, transparent); color: var(--text, inherit); }

/* 🏦 صندوق */
.kv-btn { width: 100%; background: none; border: 0; color: inherit; font: inherit; padding: 8px 0; cursor: pointer; text-align: inherit; }
.kv-btn.is-active { color: var(--accent); }
.kv.total { border-top: 1px dashed var(--line, rgba(255,255,255,.12)); margin-top: 6px; padding-top: 8px; font-weight: 700; }
.num.neg, .neg .num { color: var(--danger, #e5534b); }
.num.pos { color: var(--ok, #3fb950); }
.warn-card { border-color: var(--danger, #e5534b); }
.move { padding: 8px 0; border-bottom: 1px solid var(--line, rgba(255,255,255,.08)); }
.move:last-child { border-bottom: 0; }

/* ✍️ treasury / 🔁 transfers forms */
.actions.wrap { flex-wrap: wrap; gap: 6px; }
.tform { margin-top: 10px; }
.inp { width: 100%; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2, var(--surface)); color: var(--text); font: inherit; }
.inp.small { width: 9em; padding: 6px 8px; }
#x-range { display: flex; gap: 6px; margin: 6px 0; }
#x-range[hidden] { display: none; }
details summary { cursor: pointer; margin: 6px 0; }

/* 👥 admin: customer search results */
.list-item { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: start; cursor: pointer; font: inherit; color: inherit; }
/* 👥 / ⚖️ admin forms: same look as .ainput fields */
#c-find input, #st-form input[name="amount"], #st-form input[name="note"], #st-form select {
  width: 100%; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px;
}
#st-form input[name="amount"] { text-align: left; }
#st-form .fchip input { margin: 0 0 0 4px; }
#st-form .fchip:has(input:checked) { background: var(--accent); color: #1a1406; border-color: transparent; font-weight: 700; }
/* 📐 equal-width choices (they were as wide as their own text — uneven rows) */
#st-form .filters, #c-res > .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#st-form .fchip, #c-res > .filters .fchip { display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 44px; padding: 8px 10px; border-radius: 14px; line-height: 1.35; }
#st-form .fchip input { position: absolute; opacity: 0; pointer-events: none; }  /* the whole chip is the choice */
#st-form .fchip { position: relative; }
#st-form p.small { margin: 12px 0 6px; }
/* compact customer rows */
.list-item { padding: 12px 14px; margin-bottom: 8px; gap: 4px; }
.list-item b { font-size: 15px; }
/* 📅 today's rows · 🔁 transfer form */
.act-row .act-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.act-row .act-who { color: var(--muted); font-size: 13px; }
.act-row.is-void { opacity: .6; }
.act-row .actions { margin-top: 8px; }
#v-form input, #tf-form input[name="q"], #tf-form input[name="amount"] {
  width: 100%; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px;
}
#tf-form input[name="amount"] { text-align: left; }
#tf-form .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#tf-form .fchip { position: relative; display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 44px; padding: 8px 10px; border-radius: 14px; }
#tf-form .fchip input { position: absolute; opacity: 0; pointer-events: none; }
#tf-form .fchip:has(input:checked) { background: var(--accent); color: #1a1406; border-color: transparent; font-weight: 700; }
#tf-form p.small, #v-form p.small { margin: 12px 0 6px; }
#tf-res .list-item { margin: 6px 0 0; }
/* 👤 admin account */
#acc-new input, #totp-ok input, #ask-code input {
  width: 100%; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px; text-align: left; margin-top: 8px;
}
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 17px; letter-spacing: .5px; word-break: break-all; margin: 8px 0; }
ol.codes { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 17px; line-height: 1.9; margin: 8px 0 0; padding-left: 28px; }
.card p + p { margin-top: 6px; }
/* 📋 who owes / who is owed */
.rep-group { padding: 0; overflow: hidden; }
.rep-head { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 14px 16px; background: none; border: 0; text-align: start; cursor: pointer; }
.rep-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 10px 16px;
  background: none; border: 0; border-top: 1px solid var(--line); text-align: start; cursor: pointer; }
.rep-row .rep-amt { text-align: end; max-width: 60%; }
.rep-row .rep-amt b { white-space: nowrap; }
/* 🆕 pending registration */
.card.decide { border-color: rgba(212,175,90,.45); }
#dec-form input { width: 100%; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px; margin-top: 8px; }
#dec-form .filters { margin-top: 8px; }
