/* TomanPay agent mini app — brand identity v1.0 (ink carries the brand, mint gives the signal).
   Theme: html[data-theme="light"|"dark"] is always set by theme.js before first paint. */

@font-face { font-family: Vazirmatn; font-weight: 400; font-display: swap; src: url(/admin/static/fonts/vazirmatn-400.woff2) format("woff2"); }
@font-face { font-family: Vazirmatn; font-weight: 500; font-display: swap; src: url(/admin/static/fonts/vazirmatn-500.woff2) format("woff2"); }
@font-face { font-family: Vazirmatn; font-weight: 700; font-display: swap; src: url(/admin/static/fonts/vazirmatn-700.woff2) format("woff2"); }
@font-face { font-family: Vazirmatn; font-weight: 800; font-display: swap; src: url(/admin/static/fonts/vazirmatn-800.woff2) format("woff2"); }
@font-face { font-family: Vazirmatn; font-weight: 900; font-display: swap; src: url(/admin/static/fonts/vazirmatn-900.woff2) format("woff2"); }
@font-face { font-family: Manrope; font-weight: 700; font-display: swap; src: url(/admin/static/fonts/manrope-700.woff2) format("woff2"); }
@font-face { font-family: Manrope; font-weight: 800; font-display: swap; src: url(/admin/static/fonts/manrope-800.woff2) format("woff2"); }

:root {
  --mint: #3DDC97; --mint-700: #0B7D51; --lilac: #A99BFF;
  --ink-900: #111315; --ink-700: #2A2E33; --ink-500: #5F656D; --ink-300: #B4B9BF;
  --error: #C23030; --error-dark: #FF6B6B;
  --font: Vazirmatn, Manrope, system-ui, sans-serif;
  --r-card: 20px; --r-ctl: 14px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  color-scheme: light;
  --bg: #F6F5F2; --surface: #FFFFFF; --surface-2: #EFEEEA;
  --text: #111315; --text-2: #2A2E33; --muted: #5F656D;
  --line: #E7E9EC; --line-strong: #D5D8DC;
  --hero: #111315; --on-hero: #FFFFFF; --on-hero-muted: #B4B9BF;
  --invert-bg: #111315; --invert-fg: #FFFFFF;
  --ok-text: #0B7D51; --ok-bg: #E3F8EE;
  --bad-text: #C23030; --bad-bg: #FDECEC;
  --wait-text: #4A3FA8; --wait-bg: #EFECFF;
  --off-text: #5F656D; --off-bg: #E7E9EC;
  --shadow: 0 1px 0 #D5D8DC, 0 18px 36px -24px rgba(17, 19, 21, .35);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0C0D0F; --surface: #17191C; --surface-2: #202328;
  --text: #EEF0F2; --text-2: #C5CAD0; --muted: #8E959D;
  --line: #2A2E33; --line-strong: #383D43;
  --hero: #1B1E22; --on-hero: #FFFFFF; --on-hero-muted: #9BA2AA;
  --invert-bg: #EEF0F2; --invert-fg: #111315;
  --ok-text: #3DDC97; --ok-bg: rgba(61, 220, 151, .14);
  --bad-text: #FF6B6B; --bad-bg: rgba(255, 107, 107, .14);
  --wait-text: #C9C0FF; --wait-bg: rgba(169, 155, 255, .16);
  --off-text: #9BA2AA; --off-bg: #25292E;
  --shadow: 0 1px 0 #2A2E33, 0 18px 36px -24px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px;
  line-height: 1.7; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ok-text); text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--lilac); outline-offset: 2px; border-radius: 8px; }
.ic { width: 20px; height: 20px; flex: none; }
&
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------------------------------------------------------------- shell */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px 6px;
}
.top .hello { flex: 1; min-width: 0; }
.top .hello b { display: block; font-size: 18px; font-weight: 900; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .hello span { font-size: 12.5px; color: var(--muted); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  flex: none; border: 0; border-radius: 12px; background: var(--surface); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line); cursor: pointer;
}
.icon-btn .ic { width: 19px; height: 19px; }
.view { flex: 1; padding: 8px 16px calc(var(--tabbar-h) + var(--safe-b) + 24px); display: flex; flex-direction: column; gap: 14px; }
.view > h2 { margin: 4px 2px 0; font-size: 20px; font-weight: 900; }

.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--surface); box-shadow: 0 -1px 0 var(--line);
}
.tabbar button {
  border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 11.5px; font-weight: 700; color: var(--muted); cursor: pointer; padding: 6px 0;
}
.tabbar button .ic { width: 22px; height: 22px; }
.tabbar button.active { color: var(--text); }
.tabbar button.active .pill { background: var(--mint); color: #111315; }
.tabbar .pill { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 30px; border-radius: 999px; transition: background .15s; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border-radius: var(--r-card); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.card.flush { padding: 6px 0; gap: 0; }
.card-title { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; }
.card-title .spacer { flex: 1; }
.card-title .link { font-size: 13px; font-weight: 700; color: var(--ok-text); background: none; border: 0; cursor: pointer; padding: 0; }
.card.flush .card-title { padding: 10px 18px 4px; }

.hero {
  background: var(--hero); color: var(--on-hero); border-radius: 24px; padding: 20px; display: flex;
  flex-direction: column; gap: 6px; position: relative; overflow: hidden;
}
:root[data-theme="dark"] .hero { box-shadow: inset 0 0 0 1px var(--line); }
.hero .label { font-size: 13px; color: var(--on-hero-muted); font-weight: 600; }
.hero .amount { font-size: 34px; font-weight: 900; line-height: 1.3; color: var(--mint); }
.hero .amount small { font-size: 15px; font-weight: 500; color: var(--on-hero-muted); margin-inline-start: 6px; }
.hero .sub { font-size: 12.5px; color: var(--on-hero-muted); }
.hero .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.hero .mark-bg { position: absolute; inset-inline-end: -18px; top: -18px; opacity: .08; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--surface); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.stat .label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 20px; font-weight: 900; line-height: 1.4; }
.stat .unit { font-size: 12px; color: var(--muted); font-weight: 500; margin-inline-start: 4px; }

.banner { border-radius: 16px; padding: 12px 14px; font-size: 13.5px; font-weight: 700; display: flex; gap: 10px; align-items: center; }
.banner.info { background: var(--wait-bg); color: var(--text); }
.banner.bad { background: var(--bad-bg); color: var(--bad-text); }
.banner.ok { background: var(--ok-bg); color: var(--ok-text); }
.banner .grow { flex: 1; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 18px;
  border: 0; border-radius: var(--r-ctl); background: var(--mint); color: #111315; font-weight: 800;
  font-size: 15px; cursor: pointer; white-space: nowrap; transition: filter .15s, transform .05s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .ic { width: 18px; height: 18px; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line-strong); font-weight: 700; }
.hero .btn.ghost { color: var(--on-hero); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .22); }
.btn.dark { background: var(--invert-bg); color: var(--invert-fg); }
.btn.danger { background: var(--bad-bg); color: var(--bad-text); }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 11px; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.row-btns .btn { flex: 1; }

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.input {
  width: 100%; height: 50px; border: 1.5px solid var(--line); border-radius: var(--r-ctl);
  background: var(--surface); color: var(--text); padding: 0 14px; font-size: 16px; transition: border-color .15s;
}
.input:focus { outline: none; border-color: var(--text); }
.input.big { height: 62px; font-size: 26px; font-weight: 900; text-align: center; }
.input.ltr-input { direction: ltr; text-align: left; font-family: Manrope, Vazirmatn, sans-serif; }
.input-wrap { position: relative; }
.input-wrap .suffix { position: absolute; inset-inline-end: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; pointer-events: none; }
.error-text { color: var(--bad-text); font-size: 13px; font-weight: 700; }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 0; border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 700; cursor: pointer;
  background: var(--surface); color: var(--text-2); box-shadow: inset 0 0 0 1.5px var(--line);
}
.chip.active { background: var(--invert-bg); color: var(--invert-fg); box-shadow: none; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 13px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: none; border-radius: 10px; height: 38px; font-size: 13.5px; font-weight: 700; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button .ic { width: 16px; height: 16px; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
:root[data-theme="dark"] .seg button.active { background: #2C3036; }

/* ---------------------------------------------------------------- lists */
.list { display: flex; flex-direction: column; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px; border: 0; background: none; width: 100%;
  text-align: start; cursor: pointer; border-top: 1px solid var(--line);
}
.list .item:first-child { border-top: 0; }
.item .dot { width: 38px; height: 38px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.item .dot .ic { width: 18px; height: 18px; }
.item .dot.ok { background: var(--ok-bg); color: var(--ok-text); }
.item .dot.bad { background: var(--bad-bg); color: var(--bad-text); }
.item .dot.wait { background: var(--wait-bg); color: var(--wait-text); }
.item .dot.off { background: var(--off-bg); color: var(--off-text); }
.item .main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item .main b { font-size: 15px; font-weight: 800; }
.item .main span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .end { text-align: end; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.static-item { cursor: default; }

.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 1px 9px; font-size: 11.5px; font-weight: 800; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-bg); color: var(--ok-text); }
.badge.bad { background: var(--bad-bg); color: var(--bad-text); }
.badge.wait { background: var(--wait-bg); color: var(--wait-text); }
.badge.off { background: var(--off-bg); color: var(--off-text); }

.kv { display: grid; grid-template-columns: auto 1fr; font-size: 14px; }
.kv > div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv > div:nth-child(odd) { color: var(--muted); padding-inline-end: 16px; }
.kv > div:nth-child(even) { font-weight: 700; text-align: end; overflow-wrap: anywhere; }
.kv > div:nth-last-child(-n+2) { border-bottom: 0; }

.empty { padding: 36px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 14px; }
.empty .mark { opacity: .2; }
.more { margin: 6px 18px 12px; }

/* ---------------------------------------------------------------- chart */
.chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.chart .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; border: 0; background: none; padding: 0; cursor: pointer; }
.chart .bar span { display: block; background: var(--lilac); border-radius: 5px 5px 2px 2px; min-height: 3px; }
.chart .bar.today span { background: var(--mint); }
.chart .bar.sel span { background: var(--text); }
.chart-tip { font-size: 12.5px; color: var(--muted); min-height: 20px; }

/* ---------------------------------------------------------------- secret / copy box */
.copybox { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 14px; padding: 10px 12px; }
.copybox code { flex: 1; min-width: 0; direction: ltr; text-align: left; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- sheet (detail) */
.sheet-back { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .45); animation: fade .15s ease-out; }
.sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 31; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 24px 24px 0 0; padding: 10px 18px calc(18px + var(--safe-b));
  display: flex; flex-direction: column; gap: 12px; animation: up .2s ease-out;
}
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); align-self: center; margin-bottom: 4px; }
.sheet h3 { margin: 0; font-size: 18px; font-weight: 900; }
html.locked, html.locked body { overflow: hidden; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ---------------------------------------------------------------- toast, boot, gate */
.toasts { position: fixed; inset-inline: 16px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px); z-index: 40; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--invert-bg); color: var(--invert-fg); border-radius: 14px; padding: 11px 14px; font-weight: 700; font-size: 14px; box-shadow: var(--shadow); animation: up .2s ease-out; }
.toast.bad { background: var(--error); color: #fff; }
.boot { min-height: 100dvh; display: grid; place-items: center; }
.spinner { width: 24px; height: 24px; border: 3px solid var(--line); border-top-color: var(--text); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.gate { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 32px 24px; text-align: center; }
.gate h1 { margin: 0; font-size: 22px; font-weight: 900; }
.gate p { margin: 0; color: var(--muted); max-width: 340px; }
.lockup { display: flex; align-items: center; gap: 10px; }
.lockup .fa { font-weight: 900; font-size: 24px; line-height: 1; }
.lockup .sep { width: 2px; height: 20px; background: var(--line-strong); }
.lockup .en { font-family: Manrope, sans-serif; font-weight: 800; font-size: 16px; letter-spacing: -.02em; direction: ltr; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.loading { padding: 48px 0; text-align: center; }
.row-btns .input { flex: 2 1 160px; width: auto; }
button.banner { border: 0; width: 100%; text-align: start; cursor: pointer; font: inherit; font-weight: 700; }

/* ---------------------------------------------------------------- branding */
.brand-row { display: flex; align-items: center; gap: 12px; }
.brand-row .main { display: flex; flex-direction: column; min-width: 0; }
.brand-logo { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; flex: none; background: var(--surface-2); }
.brand-logo.initial { display: inline-flex; align-items: center; justify-content: center; font-weight: 900; font-size: 22px; background: var(--mint); color: #111315; }
.file-input { height: auto; padding: 10px 12px; font-size: 13px; }
