/* path: /public/app.css — پنل پست‌یار (فارسی راست‌به‌چپ پیش‌فرض، انگلیسی چپ‌به‌راست، موبایل اول) */
@font-face { font-family: "Vazirmatn"; src: url("/fonts/Vazirmatn-FD-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("/fonts/Vazirmatn-FD-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #f4f6fb; --card: #ffffff; --text: #0a0f24; --muted: #5b6385; --line: #e2e6f3;
  --brand: #3563f0; --brand-2: #2a50c8; --brand-soft: #e6edff; --brand-text: #2a50c8; --accent: #8fb0ff;
  --ok: #15803d; --ok-soft: #dcfce7; --warn: #b45309; --warn-soft: #fef3c7; --bad: #b91c1c; --bad-soft: #fee2e2;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0a0f24; --card: #121a3a; --text: #f2f4ff; --muted: #a9b1d6; --line: #26305c;
    --brand: #3563f0; --brand-2: #4a74f5; --brand-soft: #1a2a66; --brand-text: #8fb0ff; --ok-soft: #12321f; --warn-soft: #3a2a0e; --bad-soft: #3b1515;
    --ok: #4ade80; --warn: #fbbf24; --bad: #f87171; --shadow: none; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.8 "Vazirmatn", Tahoma, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--brand-text); text-decoration: none; }
h1 { font-size: 20px; margin: 0 0 12px; } h2 { font-size: 16px; margin: 0 0 8px; } h3 { font-size: 15px; margin: 0 0 6px; }
p { margin: 0 0 8px; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* چیدمان */
.layout { min-height: 100vh; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
.top { position: sticky; top: 0; z-index: 5; background: var(--brand); color: #fff; padding: 10px 16px; display: flex; align-items: center; gap: 10px; }
.top .title { font-weight: 700; flex: 1; }
.top a, .top button { color: #fff; }
main { max-width: 760px; margin: 0 auto; padding: 16px; }
nav.tabs { position: fixed; bottom: 0; inset-inline: 0; z-index: 5; background: var(--card); border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
nav.tabs a { flex: 1; text-align: center; color: var(--muted); font-size: 12px; padding: 6px 2px; border-radius: 10px; }
nav.tabs a .ic { display: block; font-size: 20px; line-height: 1.2; }
nav.tabs a.on { color: var(--brand-text); background: var(--brand-soft); font-weight: 700; }
@media (min-width: 900px) {
  .layout { padding: 0 0 0 0; display: grid; grid-template-columns: 220px 1fr; }
  .top { grid-column: 1 / -1; }
  nav.tabs { position: sticky; top: 52px; height: calc(100vh - 52px); flex-direction: column; justify-content: flex-start; border-top: 0; border-inline-start: 1px solid var(--line); padding: 12px; gap: 4px; }
  nav.tabs a { flex: none; text-align: start; font-size: 14px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; }
  nav.tabs a .ic { display: inline; font-size: 18px; }
}

/* کارت‌ها و اجزا */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; border: 1px solid var(--line); }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.stat { text-align: center; } .grid > .card { margin-bottom: 0; } .stat b { display: block; font-size: 26px; color: var(--brand-text); } .stat span { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .row .grow { flex: 1; min-width: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--line); } .list li:last-child { border-bottom: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-block; font-size: 12px; padding: 1px 10px; border-radius: 99px; background: var(--line); color: var(--text); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.bad { background: var(--bad-soft); color: var(--bad); }
.notice { border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; background: var(--brand-soft); }
.notice.warn { background: var(--warn-soft); } .notice.bad { background: var(--bad-soft); }
.todo { display: flex; gap: 12px; align-items: center; } .todo .ic { font-size: 22px; }
pre.caption { white-space: pre-wrap; font: inherit; background: var(--bg); border-radius: 10px; padding: 10px 12px; margin: 6px 0 0; border: 1px solid var(--line); max-height: 360px; overflow: auto; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* فرم */
label { display: block; font-weight: 700; margin: 12px 0 4px; font-size: 14px; }
label .muted { font-weight: 400; }
input[type=text], input[type=number], input[type=url], input:not([type]), textarea, select {
  width: 100%; font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
.ltr { direction: ltr; text-align: left; font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.code-input { font-size: 28px; letter-spacing: 8px; text-align: center; direction: ltr; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-weight: 400; margin: 0; cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch input { width: 44px; height: 24px; appearance: none; background: var(--line); border-radius: 99px; position: relative; cursor: pointer; flex: none; transition: .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked { background: var(--brand); } .switch input:checked::after { inset-inline-start: 23px; }
.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { flex: 1; border: 0; background: transparent; padding: 7px 10px; border-radius: 9px; font: inherit; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--text); font-weight: 700; box-shadow: var(--shadow); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 700; border: 0; border-radius: 11px;
  padding: 10px 18px; cursor: pointer; background: var(--brand); color: #fff; text-decoration: none; }
.btn:hover { background: var(--brand-2); } .btn[disabled] { opacity: .55; cursor: wait; }
.btn.ghost { background: transparent; color: var(--brand-text); border: 1px solid var(--line); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.small { padding: 5px 12px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.linkbtn { background: none; border: 0; font: inherit; color: var(--brand-text); cursor: pointer; padding: 0; }

/* ورود */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 400px; padding: 24px; }
.login .logo { width: 64px; height: 64px; border-radius: 16px; display: block; margin: 0 auto 8px; }
.steps { padding-inline-start: 20px; margin: 8px 0 16px; } .steps li { margin-bottom: 4px; }

#toast { position: fixed; bottom: calc(84px + env(safe-area-inset-bottom)); inset-inline: 16px; margin: 0 auto; max-width: 420px; z-index: 50;
  background: #111827; color: #fff; border-radius: 12px; padding: 10px 14px; opacity: 0; transform: translateY(10px); transition: .25s; pointer-events: none; text-align: center; }
#toast.show { opacity: 1; transform: none; }
#toast.bad { background: #991b1b; }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; } .empty .ic { font-size: 36px; display: block; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 24px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.secret { direction: ltr; font-family: ui-monospace, monospace; word-break: break-all; background: var(--bg); border: 1px dashed var(--line); padding: 8px 10px; border-radius: 10px; user-select: all; }
table { width: 100%; border-collapse: collapse; } td, th { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: start; font-size: 14px; }

/* آیکن‌ها و تصویرها */
svg.i { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; flex: none; }
nav.tabs a .ic svg.i { width: 22px; height: 22px; display: block; margin: 0 auto 2px; }
@media (min-width: 900px) { nav.tabs a .ic svg.i { width: 20px; height: 20px; margin: 0; } }
.todo .ic { color: var(--brand-text); display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--brand-soft); flex: none; }
.todo .ic svg.i { width: 20px; height: 20px; }
.todo .i-warning { color: var(--warn); } .todo .i-subscription { color: var(--warn); }
.ic-title { display: flex; align-items: center; gap: 8px; } .ic-title svg.i { color: var(--brand-text); }
.hello { display: flex; align-items: center; gap: 8px; } .hello svg.i { color: var(--brand-text); }
.art { display: block; max-width: 100%; height: auto; border-radius: var(--radius); }
.art.hero { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; margin-bottom: 12px; background: #0a0f24; }
.empty .art { width: 220px; margin: 0 auto 10px; aspect-ratio: 4 / 3; object-fit: cover; background: #0a0f24; }
.empty .ic svg.i { width: 40px; height: 40px; }
.login .art.hero { margin: -8px 0 12px; }
.top-logo { width: 26px; height: 26px; border-radius: 7px; box-shadow: 0 0 0 1.5px rgba(255,255,255,.6); }
.top .lang { color: #fff; font-size: 13px; opacity: .9; }
.lang-row { text-align: end; margin: -10px 0 6px; } .lang-row .lang { font-size: 13px; }
/* انگلیسی: فونت سیستم (فونت فارسی عددها را فارسی نشان می‌دهد) */
html[lang="en"] body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 15px; line-height: 1.6; }

/* v4: livelier colors */
:root{--c-blue:#3563f0;--c-coral:#f0643c;--c-violet:#7c4dff;--c-teal:#0d9488;--c-amber:#d97706;--c-pink:#db2777;--c-green:#16a34a}
@media (prefers-color-scheme: dark){:root{--c-blue:#6f95ff;--c-coral:#ff8a6b;--c-violet:#a78bfa;--c-teal:#2dd4bf;--c-amber:#fbbf24;--c-pink:#f472b6;--c-green:#4ade80}}
.top{background:linear-gradient(120deg,#3563f0 0%,#5b4cf5 55%,#7c4dff 100%);z-index:10;box-shadow:0 2px 12px rgba(53,99,240,.25)}
.top-logo{background:#fff;padding:3px;width:30px;height:30px;border-radius:9px;box-shadow:0 2px 6px rgba(0,0,0,.2)}
@media (min-width:900px){nav.tabs{bottom:auto;top:50px;align-self:start;height:calc(100vh - 50px)}}
nav.tabs a{--c:var(--c-blue)}
nav.tabs a:nth-child(2){--c:var(--c-coral)}nav.tabs a:nth-child(3){--c:var(--c-violet)}nav.tabs a:nth-child(4){--c:var(--c-teal)}nav.tabs a:nth-child(5){--c:var(--c-amber)}
nav.tabs a .ic{color:var(--c)}
nav.tabs a.on{color:var(--c);background:color-mix(in srgb,var(--c) 14%,transparent)}
@media (min-width:900px){nav.tabs a .ic{display:grid;place-items:center;width:34px;height:34px;border-radius:10px;background:color-mix(in srgb,var(--c) 14%,transparent)}nav.tabs a.on .ic{background:var(--c);color:#fff}}
.hello svg.i{color:var(--c-amber)}
.notice{border-inline-start:4px solid var(--c-blue)}.notice.warn{border-color:var(--c-amber)}.notice.bad{border-color:#ef4444}
.grid>.stat{position:relative;overflow:hidden;--c:var(--c-blue);background:linear-gradient(160deg,color-mix(in srgb,var(--c) 16%,var(--card)) 0%,var(--card) 70%);border-color:color-mix(in srgb,var(--c) 30%,var(--line))}
.grid>.stat:nth-child(2){--c:var(--c-teal)}.grid>.stat:nth-child(3){--c:var(--c-violet)}.grid>.stat:nth-child(4){--c:var(--c-coral)}
.grid>.stat:before{content:"";position:absolute;inset-inline:0;top:0;height:4px;background:var(--c)}
.stat b{color:var(--c,var(--brand-text))}
.todo .ic{--c:var(--c-blue);color:var(--c);background:color-mix(in srgb,var(--c) 15%,transparent)}
.todo .ic:has(.i-source),.ic-title .i-source{--c:var(--c-teal);color:var(--c-teal)}
.todo .ic:has(.i-destination),.ic-title .i-destination{--c:var(--c-coral);color:var(--c-coral)}
.todo .ic:has(.i-caption){--c:var(--c-violet)}
.todo .ic:has(.i-site){--c:var(--c-teal)}
.todo .ic:has(.i-subscription),.todo .ic:has(.i-warning){--c:var(--c-amber)}
.todo .ic:has(.i-account){--c:var(--c-pink)}
.todo .ic:has(.i-admin){--c:var(--c-violet)}
.ic-title svg.i{width:22px;height:22px}
.card h2{position:relative}
.btn{background:linear-gradient(120deg,#3563f0,#5b4cf5)}.btn:hover{background:linear-gradient(120deg,#2a50c8,#4a3be0)}
.btn.ghost{background:transparent}.btn.danger{background:var(--bad-soft)}
.stat .sic{display:grid;place-items:center;width:38px;height:38px;margin:4px auto 6px;border-radius:12px;color:var(--c);background:color-mix(in srgb,var(--c) 16%,transparent)}.stat .sic svg.i{width:20px;height:20px}
.stat b{font-size:28px;line-height:1.2}
@media (min-width:900px){main{width:100%}}
.list li .badge{flex:none}
/* v5: پشتیبانی */
.todo .ic:has(.i-support){--c:var(--c-green)}
.ticket.unread b{color:var(--brand-text)}
.chat{display:flex;flex-direction:column;gap:10px;margin:6px 0 14px}
.bubble{max-width:85%;padding:10px 14px;border-radius:16px;background:var(--card);border:1px solid var(--line);box-shadow:0 1px 3px rgba(0,0,0,.05)}
.bubble.me{align-self:flex-start;background:linear-gradient(140deg,#3563f0,#5b4cf5);color:#fff;border:0;border-end-start-radius:4px}
.bubble.them{align-self:flex-end;border-end-end-radius:4px;border-inline-start:4px solid var(--c-green)}
.bubble.admin-view.me{align-self:flex-end;border-end-start-radius:16px;border-end-end-radius:4px}
.bubble.admin-view.them{align-self:flex-start}
.bubble .who{font-size:12px;font-weight:700;opacity:.85;margin-bottom:3px}
.bubble .txt{white-space:pre-wrap;word-break:break-word;line-height:1.8}
.bubble .when{font-size:11px;opacity:.7;margin-top:4px}
.bubble.me .who,.bubble.me .when{color:#fff}
.cats .seg button{white-space:nowrap;padding-inline:6px}

/* v6 حسابداری */
.subnav { display: flex; gap: 6px; overflow-x: auto; margin: -4px 0 14px; padding-bottom: 4px; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); color: var(--muted); font-size: 13px; white-space: nowrap; }
.subnav a .ic { display: inline-flex; font-size: 16px; }
.subnav a.on { background: var(--brand-soft); color: var(--brand-text); border-color: transparent; font-weight: 700; }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; } .kv b { white-space: nowrap; } .kv.warn b { color: var(--warn); } .kv.bad b { color: var(--bad); } .kv.big b { font-size: 18px; color: var(--brand-text); }
.grid3 { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid3 label { margin-top: 8px; font-size: 13px; }
@media (max-width: 420px) { .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat .sic { display: inline-flex; font-size: 20px; color: var(--brand-text); }
.stat b { font-size: 18px; } .stat small { display: block; font-size: 12px; direction: ltr; }
.stat small.up { color: var(--ok); } .stat small.down { color: var(--bad); }
.inv-rows { display: grid; gap: 8px; margin-bottom: 8px; }
.inv-row { margin-bottom: 0; padding: 12px; }
.inv-totals { position: relative; }
.var-row { display: grid; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.var-row:last-child { border-bottom: 0; } .var-row > .linkbtn { justify-self: start; font-size: 13px; }
.sticky-actions { position: sticky; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 4; background: var(--bg); padding: 10px 0; border-top: 1px solid var(--line); }
@media (min-width: 900px) { .sticky-actions { bottom: 0; } }
.backlink { display: inline-block; margin-bottom: 8px; }
html[dir=rtl] .backlink::before { content: "→ "; } html[dir=ltr] .backlink::before { content: "← "; }
.danger-text { color: var(--bad); }
