@font-face {
  font-family: Vazirmatn;
  src: url(Vazirmatn.woff2) format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #161a20;
  --muted: #667085;
  --line: #e3e6eb;
  --soft: #f8f9fb;
  --accent: #0b6e5c;
  --accent-ink: #ffffff;
  --accent-soft: #e5f3ef;
  --ok: #0f7a52;
  --ok-soft: #e4f4ec;
  --warn: #a64b07;
  --warn-soft: #fdf0e2;
  --bad: #b42318;
  --bad-soft: #fdeceb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --card: #1a1e24;
    --ink: #e8eaed;
    --muted: #98a2b3;
    --line: #2b313a;
    --soft: #20252c;
    --accent: #3fb59b;
    --accent-ink: #0b1210;
    --accent-soft: #173029;
    --ok: #4cc38a;
    --ok-soft: #16291f;
    --warn: #f0a050;
    --warn-soft: #2e2214;
    --bad: #f07167;
    --bad-soft: #301b1a;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.7 Vazirmatn, Tahoma, sans-serif;
  font-feature-settings: "ss01";
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.08rem; margin: 1.6rem 0 .7rem; }
.card h2 { margin-top: 0; }
code { font-size: .85em; background: var(--soft); padding: 0 .3em; border-radius: 4px; }

/* سرصفحه */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 1120px; margin: 0 auto; padding: .55rem 16px; display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.15rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: .2rem; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--muted); padding: .3rem .7rem; border-radius: 8px; }
.nav a:hover { background: var(--soft); text-decoration: none; color: var(--ink); }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.me { display: flex; align-items: center; gap: .6rem; margin-inline-start: auto; font-size: .9rem; }
.me form { margin: 0; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 1.2rem 16px 3rem; }
.wrap.narrow { max-width: 560px; }

/* کارت و چیدمان */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card.flush { padding: 0; }
.card.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; align-items: start; }
.split > .card { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: .7rem; }
.stack > * { margin: 0; }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.head-row h1, .head-row h2 { margin-bottom: .4rem; }
section + h2, .split + h2 { margin-top: 1.8rem; }
.split { margin-bottom: 1rem; }

/* نرخ‌ها */
.rate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; }
.rate-grid .card { margin: 0; }
.rate-name { font-size: .9rem; }
.rate-val { font-size: 1.45rem; font-weight: 700; margin: .1rem 0; }
.rate-meta { font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.card.rate.stale { border-color: var(--bad); }
.rate-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.rate-cards .card { margin: 0; }

/* جدول */
.tw { overflow-x: auto; }
.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
.t th, .t td { text-align: start; padding: .55rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.t thead th { font-weight: 600; color: var(--muted); font-size: .82rem; background: var(--soft); white-space: nowrap; }
.t tbody tr:last-child td { border-bottom: 0; }
.t tfoot th { border-top: 2px solid var(--line); border-bottom: 0; }
.t.inner th, .t.inner td { padding: .45rem .3rem; }
.t.inner thead th { background: none; }
.row-off td { opacity: .55; }
.row-on td { background: var(--accent-soft); }
.row-warn td { background: var(--warn-soft); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.strong { font-weight: 700; }
.neg { color: var(--bad); }
.nowrap { white-space: nowrap; }
.detail { max-width: 420px; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.chip { background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 0 .55rem; font-size: .85rem; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

/* برچسب‌ها */
.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: 0 .5rem; border-radius: 999px; background: var(--soft); color: var(--muted); border: 1px solid var(--line); vertical-align: middle; line-height: 1.7; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.kind { font-size: .8rem; font-weight: 600; }
.k-deposit { color: var(--ok); }
.k-withdraw { color: var(--bad); }
.k-convert { color: var(--accent); }
.k-reversal { color: var(--warn); }

/* پیام‌ها */
.flash { border-radius: 10px; padding: .65rem .9rem; margin-bottom: 1rem; border: 1px solid transparent; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.err { background: var(--bad-soft); color: var(--bad); }
.flash a { color: inherit; text-decoration: underline; }
.note.warn { background: var(--warn-soft); color: var(--warn); padding: .6rem .9rem; border-radius: 10px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }

/* فرم */
label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: .45rem; color: var(--ink); font-size: .92rem; }
input, select, button { font: inherit; color: inherit; }
input:not([type=checkbox]), select {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: .5rem .7rem;
  font-size: 1rem;
  color: var(--ink);
  min-height: 42px;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
input[readonly] { background: var(--soft); }
input.short { width: 8rem; min-height: 36px; padding: .3rem .5rem; }
button {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: .45rem .95rem;
  cursor: pointer;
  min-height: 40px;
  white-space: nowrap;
}
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--bad); }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent); }
button:disabled { opacity: .45; cursor: not-allowed; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; align-items: end; margin-bottom: .9rem; }
.grid-form .wide { grid-column: 1 / -1; }
.card.grid-form { margin-bottom: 1rem; }
.with-btn { display: flex; gap: .4rem; }
.with-btn input { flex: 1; }
.echo { font-size: .82rem; color: var(--accent); min-height: 1.3em; font-weight: 600; }
.echo.bad { color: var(--bad); }
.copy-row { display: flex; gap: .4rem; }
.copy-row input { font-size: .82rem; }
form.inline { display: flex; gap: .3rem; align-items: center; margin: 0; }
details > summary { cursor: pointer; color: var(--accent); font-weight: 600; }
details.card > summary { list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: .8rem; }
details.rev > summary { font-weight: 400; font-size: .85rem; }
details.rev form { min-width: 200px; margin-top: .4rem; }
.asset-list details.card { margin-bottom: .6rem; }
.asset-list summary { color: var(--ink); font-weight: 400; }

.search input { min-width: 240px; }

/* عملیات شخص */
.ops { margin-top: 1rem; }
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin: -.2rem 0 1rem; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: .5rem .9rem; color: var(--muted); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.pane { display: none; }
.pane.on { display: block; }
.rate-line { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; }
.rate-line input { width: 11rem; flex: 0 0 auto; font-weight: 700; }
.quote-info { margin: .35rem .2rem .8rem; }
.preview { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; border: 1px dashed var(--accent); background: var(--accent-soft); border-radius: 10px; padding: .7rem .9rem; margin-bottom: .8rem; }
.preview b { display: block; font-size: 1.15rem; }
.preview .arrow { font-size: 1.4rem; color: var(--accent); }
.confirm { background: var(--warn-soft); color: var(--warn); padding: .55rem .8rem; border-radius: 10px; margin-bottom: .8rem; }
.convert > label.wide { margin-bottom: .9rem; }

/* ورود */
.login { max-width: 360px; margin: 10vh auto 0; }
.brand-lg { text-align: center; font-size: 2rem; font-weight: 800; }

/* صفحه مشتری */
body.bare .wrap { padding-top: 1.5rem; }
.pub-head { text-align: center; margin-bottom: 1rem; }
.pub-head .brand { color: var(--muted); font-size: .95rem; }
.pub-head h1 { margin: .1rem 0 0; }
.pub-total { text-align: center; }
.pub-total .big { font-size: 1.9rem; font-weight: 800; }
.bal-list, .hist { list-style: none; margin: 0; padding: 0; }
.bal-list li, .hist li { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.bal-list li:last-child, .hist li:last-child { border-bottom: 0; }
.bal-list .strong { font-size: 1.2rem; }

@media (max-width: 760px) {
  .split { grid-template-columns: 1fr; }
  .split > .card { margin-bottom: 1rem; }
  .rate-cards { grid-template-columns: 1fr; }
  .rate-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rate-val { font-size: 1.2rem; }
  .search, .search input { width: 100%; min-width: 0; }
  .t th, .t td { padding: .5rem .55rem; }
  .rate-line input { width: 100%; flex: 1 1 100%; order: 2; }
  .me { width: 100%; justify-content: space-between; }
  .hide-sm { display: none; }
}
