@font-face { font-family: 'Sora'; src: url('/fonts/sora.woff') format('woff'); font-weight: 600 800; font-display: swap; }
@font-face { font-family: 'Source Sans 3'; src: url('/fonts/sourcesans3.woff') format('woff'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('/fonts/vazirmatn.woff') format('woff'); font-weight: 400 800; font-display: swap; }
:root { --navy: #0c1f45; --navy-2: #163266; --blue: #2f6fd0; --blue-soft: #eaf1fc; --orange: #e8782e; --orange-ink: #a8470b; --orange-soft: #fff1e6;
  --grad: linear-gradient(135deg, #f39a45 0%, #d95f17 100%); --ink: #0c1f45; --text: #2a3550; --muted: #5b6782; --line: #e1e7f0; --soft: #f4f7fb; --ok: #157f4b;
  --font-d: 'Sora', 'Segoe UI', system-ui, sans-serif; --font-b: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif; }
:lang(fa), :lang(ar), :lang(ckb), :lang(ps), :lang(ur) { --font-d: 'Vazirmatn', Tahoma, sans-serif; --font-b: 'Vazirmatn', Tahoma, sans-serif; }
* { box-sizing: border-box; }
body { margin: 0; font: 400 16.5px/1.55 var(--font-b); color: var(--text); background: var(--soft); }
h1, h2 { font-family: var(--font-d); color: var(--ink); line-height: 1.2; margin: 0 0 10px; }
h1 { font-size: clamp(24px, 3vw, 32px); } h2 { font-size: 19px; }
a { color: var(--blue); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); } .lead { font-size: 17.5px; margin: 0 0 22px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 22px; border-radius: 12px; border: 1.5px solid transparent; font: 800 16px var(--font-b); text-decoration: none; cursor: pointer; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(217, 95, 23, 0.28); }
.btn-ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.btn-sm { min-height: 40px; padding: 7px 14px; font-size: 15px; border-radius: 10px; }
.btn-lg { min-height: 52px; } .btn:disabled { opacity: .6; cursor: wait; }
.link { background: none; border: 0; padding: 0; color: var(--blue); font: 700 15px var(--font-b); cursor: pointer; text-decoration: none; }
.field { display: grid; gap: 6px; font-weight: 700; color: var(--ink); font-size: 15px; }
.field input, .field select, .field textarea, .search, select { width: 100%; min-height: 46px; padding: 10px 13px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font: 400 16px var(--font-b); color: var(--text); }
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus, select:focus, .search:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 111, 208, .15); }
.field.small { max-width: 160px; }
.stack { display: grid; gap: 14px; }
.chk { display: inline-flex; gap: 8px; align-items: center; font-size: 14.5px; color: var(--muted); }
/* login */
.login-bg { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(800px 480px at 90% 0%, rgba(47,111,208,.42), transparent 62%), radial-gradient(600px 360px at 0% 100%, rgba(232,120,46,.2), transparent 60%), linear-gradient(180deg, #0a1b40, var(--navy)); }
.login-card { width: 100%; max-width: 440px; background: #fff; border-radius: 22px; padding: 28px; box-shadow: 0 30px 70px rgba(0,0,0,.35); }
.login-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-top img { height: 52px; width: auto; }
.login-top select { width: auto; max-width: 170px; min-height: 40px; font-size: 14.5px; }
.code-input { font-size: 24px !important; letter-spacing: .3em; text-align: center; }
/* app shell */
.top { background: #fff; box-shadow: 0 1px 0 var(--line), 0 8px 24px rgba(12,31,69,.05); position: sticky; top: 0; z-index: 20; }
.top-row { display: flex; align-items: center; gap: 14px; min-height: 68px; }
.logo img { height: 46px; width: auto; display: block; }
.app-name { font: 700 17px var(--font-d); color: var(--ink); }
.top-actions { margin-inline-start: auto; display: flex; gap: 10px; align-items: center; }
.top-actions select { width: auto; max-width: 160px; min-height: 40px; font-size: 14.5px; }
.layout { display: grid; grid-template-columns: 230px 1fr; gap: 28px; padding-top: 28px; padding-bottom: 60px; }
.side { display: grid; gap: 4px; align-content: start; position: sticky; top: 96px; }
.side a, .tabbar a { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; color: var(--ink); text-decoration: none; font-weight: 700; }
.side a:hover { background: #fff; } .side a.on { background: var(--navy); color: #fff; }
.tabbar { display: none; }
.main { min-width: 0; }
.panel { background: #fff; border: 1px solid #e3e9f3; border-radius: 18px; padding: 20px 22px; margin-bottom: 20px; box-shadow: 0 1px 2px rgba(12,31,69,.04), 0 8px 24px rgba(12,31,69,.05); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid #e3e9f3; border-radius: 16px; padding: 16px 18px; text-decoration: none; color: var(--muted); display: grid; gap: 2px; }
.stat b { font: 800 30px var(--font-d); color: var(--ink); } .stat.hot b { color: var(--orange-ink); }
.svc { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; color: inherit; text-decoration: none; }
.svc:last-child { border-bottom: 0; }
.svc-main { flex: 1 1 220px; display: grid; } .svc-main strong { color: var(--ink); }
.svc-when { color: var(--muted); font-size: 15px; display: flex; gap: 8px; align-items: center; }
.svc-end { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.svc-end a { font-weight: 700; text-decoration: none; }
.link-row:hover strong { color: var(--blue); }
.pill { display: inline-block; font-size: 13px; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: #eef1f6; color: var(--muted); white-space: nowrap; }
.st-active, .inv-paid, .ord-done, .tk-closed { background: #e3f6ec; color: var(--ok); }
.st-pending, .st-transferring, .ord-new, .ord-processing, .tk-open, .inv-open { background: var(--blue-soft); color: var(--blue); }
.warn, .tk-waiting { background: var(--orange-soft); color: var(--orange-ink); }
.bad, .st-expired { background: #fde8e8; color: #b42318; }
.empty { background: #fff; border: 1px dashed #cdd7e6; border-radius: 18px; padding: 36px; text-align: center; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.tbl th { font-size: 13.5px; color: var(--muted); font-weight: 700; }
.num { text-align: end !important; white-space: nowrap; } .end { text-align: end; }
.kv td { padding: 4px 14px 4px 0; } .kv.wide td:first-child { width: 190px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.opts { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; }
.opt span { display: grid; } .opt input { margin-top: 5px; width: 18px; height: 18px; }
.opt:has(input:checked) { border-color: var(--orange); background: var(--orange-soft); }
.thread { display: grid; gap: 12px; margin: 16px 0 20px; }
.msg { background: #fff; border: 1px solid #e3e9f3; border-radius: 16px; padding: 14px 16px; max-width: 760px; }
.msg.staff { background: var(--blue-soft); border-color: #cfe0f8; margin-inline-start: auto; }
.msg-meta { font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 700; }
.tabs { display: flex; gap: 6px; margin: 4px 0 18px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 10px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 700; }
.tabs a.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.search { max-width: 340px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; } .span2 { grid-column: span 2; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: end; margin: 16px 0; padding-top: 16px; border-top: 1px solid var(--line); }
/* invoice */
.invoice { background: #fff; border-radius: 18px; padding: 34px; border: 1px solid #e3e9f3; }
.inv-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 26px; } .inv-head img { height: 70px; width: auto; }
.inv-from { font-size: 14px; color: var(--muted); text-align: end; }
.inv-meta { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 24px; flex-wrap: wrap; }
.totals { margin-inline-start: auto; margin-top: 14px; } .totals .grand td { font-weight: 800; color: var(--ink); font-size: 18px; border-top: 2px solid var(--ink); padding-top: 8px; }
.paid { color: var(--ok); font-weight: 800; }
.pay { background: var(--orange-soft); border-radius: 16px; padding: 16px 20px; margin-top: 18px; } .pay p { margin: 4px 0; }
.toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 99; font-weight: 700; box-shadow: 0 12px 30px rgba(0,0,0,.25); max-width: 90vw; }
.toast.bad { background: #b42318; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding-top: 18px; padding-bottom: 96px; } .side { display: none; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); z-index: 30; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .tabbar a { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11.5px; font-weight: 700; color: var(--muted); flex: 1; text-align: center; border-radius: 10px; min-width: 0; }
  .tabbar a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .tabbar a.on { color: var(--navy); background: var(--blue-soft); }
  .stats { grid-template-columns: 1fr 1fr; } .grid2, .grid4 { grid-template-columns: 1fr; } .span2 { grid-column: auto; }
  .app-name { display: none; } .top-actions select { max-width: 120px; }
  .invoice { padding: 20px; } .inv-head { flex-direction: column; } .inv-from { text-align: start; }
  .tbl.lines th:nth-child(2), .tbl.lines td:nth-child(2), .tbl.lines th:nth-child(3), .tbl.lines td:nth-child(3) { display: none; }
}
@media print {
  .top, .side, .tabbar, .no-print, .pay { display: none !important; } body { background: #fff; } .layout { display: block; padding: 0; } .invoice { border: 0; padding: 0; }
}
