@font-face { font-family: Vazirmatn; src: url(/assets/vazirmatn-arabic-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url(/assets/vazirmatn-arabic-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
:root { --green: #0B3D34; --gold: #C8A96B; --bg: #f6f5f1; --line: #e3e0d6; --text: #1d2422; --muted: #66706c;
        --ok: #1f7a4d; --warn: #a76a00; --bad: #b3261e; --info: #2556a8; }
* { box-sizing: border-box; }
body { margin: 0; font-family: Vazirmatn, Tahoma, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--green); }
select, input, button { font: inherit; }
select, input { padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); }
button { padding: .4rem .9rem; border-radius: 6px; border: 1px solid var(--green); background: var(--green); color: #fff; cursor: pointer; }
button.link { background: none; border: 0; color: inherit; text-decoration: underline; padding: 0; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
main { padding: 1.2rem; max-width: 1400px; margin: 0 auto; }

h1 { font-size: 1.25rem; margin: 0 0 1rem; }
h2 { font-size: 1.05rem; margin: 1.4rem 0 .6rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem; }
.card .k { color: var(--muted); font-size: .85rem; }
.card .v { font-size: 1.35rem; font-weight: 700; margin-top: .25rem; }
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th, td { padding: .45rem .6rem; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
th { background: #efede6; font-weight: 700; position: sticky; top: 0; }
td.n, th.n { text-align: left; direction: ltr; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:hover td { background: #fbfaf6; }
.muted { color: var(--muted); }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; border: 1px solid currentColor; white-space: nowrap; }
.s-SETTLED, .s-CLEARED, .s-ok { color: var(--ok); }
.s-SETTLED_PENDING_CHEQUES, .s-IN_COLLECTION, .s-RECEIVED, .s-ISSUED { color: var(--info); }
.s-PARTIAL, .s-ENDORSED { color: var(--warn); }
.s-OPEN, .s-BOUNCED, .s-RETURNED, .s-bad { color: var(--bad); }
.filters { display: flex; gap: .6rem; margin-bottom: .8rem; flex-wrap: wrap; align-items: center; }
.chain { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin: .4rem 0 1rem; }
.chain .step { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .35rem .6rem; }
.chain .arrow { color: var(--gold); font-weight: 700; }
.login { max-width: 360px; margin: 10vh auto; background: #fff; padding: 1.5rem; border-radius: 12px; border: 1px solid var(--line); display: grid; gap: .8rem; }
.err { color: var(--bad); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } }
/* entry screens */
body.sandbox main::before { content: 'محیط تمرین — اسناد این‌جا فقط برای آزمودن است و هر شب با دفاتر روز از نو ساخته می‌شود.'; display: block; background: #fff4d6; border: 1px solid var(--gold); border-radius: 8px; padding: .5rem .8rem; margin-bottom: 1rem; }
.form { display: grid; gap: .8rem; }
.form .row { display: flex; gap: .8rem; flex-wrap: wrap; align-items: end; }
.form label { display: grid; gap: .25rem; color: var(--muted); font-size: .85rem; }
.form label.wide { flex: 1; min-width: 240px; }
.form label input, .form label select { color: var(--text); font-size: 14px; }
.grid td { padding: .25rem .35rem; }
.grid input, .grid select { width: 100%; min-width: 4rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin: .4rem 0; }
button.secondary, a.btn { background: #fff; color: var(--green); border: 1px solid var(--green); padding: .4rem .9rem; border-radius: 6px; text-decoration: none; }
button.danger { background: var(--bad); border-color: var(--bad); }
.note { background: #fff4d6; border: 1px solid var(--gold); border-radius: 8px; padding: .5rem .8rem; }
.note.bad { background: #fde8e6; border-color: var(--bad); }
a.tile { text-decoration: none; color: inherit; }
a.tile:hover, a.tile:focus-visible { border-color: var(--gold); }
a.tile .v { font-size: 1.05rem; color: var(--green); }
.actionbar { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .8rem; margin-bottom: 1rem; }
.card.mini { padding: .35rem .7rem; } .card.mini .v { font-size: 1rem; }
.prices { flex: 1; display: flex; gap: 1rem; flex-wrap: wrap; font-size: .85rem; }
details.settle { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; }
details.settle summary { cursor: pointer; margin-bottom: .5rem; }
ul.small { font-size: .78rem; margin: .4rem 0 0; padding-inline-start: 1rem; }
table.statement td.n { width: 14rem; }
table.statement tr.sub td:first-child { padding-inline-start: 1.6rem; color: var(--muted); }
table.statement tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
table.statement tr.grand td { font-weight: 700; background: #efede6; font-size: 1.05rem; }
tr.free td { background: #f3f8f1; }
.form textarea { width: 100%; font: inherit; padding: .5rem; border: 1px solid var(--line); border-radius: 6px; direction: ltr; text-align: left; }
kbd { font-size: .7rem; border: 1px solid currentColor; border-radius: 4px; padding: 0 .25rem; margin-inline-start: .3rem; opacity: .8; }
.small { font-size: .8rem; }
/* print view */
.paper { background: #fff; max-width: 210mm; margin: 0 auto; padding: 12mm; border: 1px solid var(--line); }
.paper header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--green); padding-bottom: .5rem; margin-bottom: .8rem; }
.paper header h1 { margin: 0; }
.paper .who { margin-bottom: .8rem; }
.paper table { margin-bottom: .8rem; border-radius: 0; }
.paper table.totals { width: 50%; margin-inline-start: auto; }
.paper tr.grand td { font-weight: 700; background: #efede6; }
.paper footer { display: flex; justify-content: space-around; margin-top: 2.5rem; color: var(--muted); }
@media print { .paper { border: 0; padding: 0; max-width: none; } }
details { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .8rem; margin: .4rem 0; } details summary { cursor: pointer; }
pre.example { direction: ltr; text-align: left; background: #fff; border: 1px dashed var(--line); padding: .5rem; border-radius: 6px; }

/* ---- the CRM's frame: dark-green menu on the right, white bar on top (colours from the CRM theme tokens) ---------------------- */
:root { --sidebar: #0B3D34; --sidebar-dark: #07362F; --on-dark: #F2F7F4; --on-dark-muted: #BFD6CF; --logo-teal: #A0D6D6; --side-w: 268px; }
.shell { display: flex; min-height: 100dvh; }
.side { width: var(--side-w); flex-shrink: 0; height: 100dvh; position: sticky; top: 0; background: var(--sidebar); color: var(--on-dark); display: flex; flex-direction: column; }
.side-brand { padding: 1.1rem 1.2rem .9rem; border-bottom: 1px solid rgba(255,255,255,.12); }
.side-brand img { display: block; width: 190px; height: 62px; object-fit: contain; object-position: right center; }
.tenant-name { font-weight: 700; font-size: .92rem; margin-top: .35rem; }
.side-sub { font-size: .7rem; color: var(--on-dark-muted); }
.side-ctx { padding: .7rem 1rem; display: grid; gap: .45rem; border-bottom: 1px solid rgba(255,255,255,.12); }
.side-ctx label { display: grid; gap: .2rem; font-size: .72rem; color: var(--on-dark-muted); }
.side-ctx select { width: 100%; background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.2); }
.side-ctx select option { color: var(--text); }
.side-nav { flex: 1; overflow-y: auto; padding: .7rem .7rem 1rem; display: flex; flex-direction: column; gap: .15rem; }
.side-nav a { color: var(--on-dark-muted); text-decoration: none; padding: .55rem .8rem; border-radius: 6px; border-right: 3px solid transparent; font-size: .89rem; }
.side-nav a:hover { background: rgba(255,255,255,.09); color: #fff; }
.side-nav a[aria-current="page"] { background: rgba(255,255,255,.12); color: #fff; font-weight: 700; border-right-color: var(--logo-teal); }
.side-nav a:focus-visible { outline: 2px solid var(--logo-teal); outline-offset: -2px; }
.side-group { color: var(--on-dark); font-weight: 700; font-size: .78rem; padding: .8rem .8rem .25rem; opacity: .8; }
.side-foot { display: flex; align-items: center; gap: .7rem; padding: .75rem 1rem; border-top: 1px solid rgba(255,255,255,.13); }
.side-foot img { width: 44px; height: 44px; object-fit: contain; border-radius: 6px; background: #fff; }
.mainwrap { flex: 1; min-width: 0; }
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 1rem; min-height: 72px; padding: .5rem 1.2rem; background: #fff; border-bottom: 1px solid var(--line); }
.bar-logo { width: 150px; height: 54px; background: var(--sidebar-dark); border-radius: 6px; padding: .3rem .5rem; flex-shrink: 0; }
.bar-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.bar-title { flex: 1; display: flex; flex-direction: column; }
.bar-book { font-size: .78rem; color: var(--muted); }
body.sandbox .bar-book { color: #8a5a00; font-weight: 700; }
.bar-user { color: var(--muted); font-size: .88rem; }
.bar button.link { color: var(--green); }
.menu-btn { display: none; background: none; border: 1px solid var(--line); color: var(--green); font-size: 1.2rem; padding: .2rem .6rem; }
@media (max-width: 900px) {
  .menu-btn { display: inline-block; }
  .side { position: fixed; right: 0; top: 0; bottom: 0; z-index: 20; transform: translateX(100%); transition: transform .16s; box-shadow: 0 12px 30px rgba(0,0,0,.2); }
  body.menu-open .side { transform: none; }
  .bar-logo { width: 110px; height: 44px; }
  .bar-user { display: none; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
/* sign-in: the CRM's login look */
body.signin .side, body.signin .bar { display: none; }
body.signin { background: linear-gradient(130deg, var(--sidebar) 0 34%, var(--bg) 34% 100%); }
.login-head { background: var(--sidebar-dark); color: #fff; margin: -1.5rem -1.5rem .5rem; padding: 1.2rem 1.5rem; border-radius: 12px 12px 0 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.login-head .tenant-logo { max-width: 170px; height: 72px; object-fit: contain; object-position: right center; }
.farakar-sign { display: flex; flex-direction: column; align-items: center; font-size: .62rem; font-weight: 700; text-align: center; }
.farakar-sign img { width: 52px; height: 52px; border-radius: 6px; background: #fff; object-fit: contain; }
.login { max-width: 420px; }
@media print { .side, .bar, .noprint, .actions, .actionbar, body.sandbox main::before { display: none !important; } body { background: #fff; } main { padding: 0; } }
body.printing .side, body.printing .bar, body.printing main::before { display: none; }
main:focus, main:focus-visible { outline: none; }
.login label { display: grid; gap: .3rem; color: var(--muted); font-size: .88rem; }
.login input { width: 100%; padding: .55rem .7rem; }
.login button { padding: .6rem; }
ol.setup li { margin: .5rem 0; } ol.setup li.s-ok b { color: var(--ok, #15803d); } ol.setup li.s-bad b { color: inherit; }
section.draft { margin: 1rem 0; } tr.sum td { border-top: 2px solid #ddd; }

/* ==== Design v2 (owner 2026-11-05): same brand as the CRM — dark green, logo teal, Vazirmatn — grouped menu with icons, calmer cards,
   readable tables. Tokens first; every rule below uses them. ======================================================================== */
:root { --bg: #f4f6f5; --surface: #fff; --line: #dfe5e2; --text: #17201d; --muted: #5d6965; --accent: #12907F; --accent-soft: #e6f4f2;
        --ok: #1b7a4b; --warn: #9a5b00; --bad: #b3261e; --info: #1f5fa8; --radius: 12px; --shadow: 0 1px 2px rgba(16,40,34,.06), 0 2px 8px rgba(16,40,34,.05);
        --bar-h: 64px; }
body { font-size: 14.5px; line-height: 1.6; }
main { padding: 1.4rem 1.6rem 3rem; }
h1 { font-size: 1.35rem; font-weight: 700; margin: 0 0 1.1rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
h2 { font-size: 1.05rem; margin: 1.8rem 0 .7rem; padding-inline-start: .6rem; border-inline-start: 3px solid var(--accent); }
.ico { width: 18px; height: 18px; flex-shrink: 0; }
/* menu: the list scrolls between brand and footer (it no longer runs under the footer) */
.side-nav { min-height: 0; gap: .1rem; padding: .6rem .6rem 1rem; }
.side-nav a { display: flex; align-items: center; gap: .65rem; min-height: 40px; padding: .4rem .75rem; border-right: 0; border-radius: 8px; }
.side-nav a .ico { opacity: .85; }
.side-nav a[aria-current="page"] { background: rgba(160,214,214,.16); box-shadow: inset -3px 0 0 var(--logo-teal); }
.side-nav a[aria-current="page"] .ico { color: var(--logo-teal); opacity: 1; }
.side-section { margin-top: .35rem; }
.side-group { all: unset; box-sizing: border-box; display: flex; width: 100%; align-items: center; justify-content: space-between; cursor: pointer;
              color: var(--on-dark-muted); font-size: .74rem; font-weight: 700; letter-spacing: .02em; padding: .55rem .75rem .3rem; border-radius: 6px; }
.side-group:hover { color: #fff; }
.side-group:focus-visible { outline: 2px solid var(--logo-teal); outline-offset: -2px; }
.side-group .chev { width: 18px; height: 18px; flex: none; }
/* owner 2026-11-05: groups open with ⊕ and close with ⊖ (as in the CRM), not a chevron */
.side-group[aria-expanded="true"] .chev .pl, .side-group[aria-expanded="false"] .chev .mi { display: none; }
.side-group[aria-expanded="false"] + .side-items { display: none; }
.side-foot { flex-shrink: 0; }
.bar { min-height: var(--bar-h); box-shadow: 0 1px 0 var(--line); }
/* cards and KPI tiles */
.cards { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem; }
.card { border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; border-color: var(--line); }
.card .k { font-size: .84rem; display: flex; align-items: center; gap: .4rem; }
.card .v { font-size: 1.45rem; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.card .v small { font-size: .78rem; color: var(--muted); font-weight: 400; margin-inline-start: .35rem; }
a.tile { transition: border-color .15s, box-shadow .15s, transform .15s; }
a.tile:hover, a.tile:focus-visible { border-color: var(--accent); box-shadow: 0 4px 14px rgba(18,144,127,.14); }
.kpi-icon { width: 32px; height: 32px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.kpi-icon.bad { background: #fdebe9; color: var(--bad); } .kpi-icon.warn { background: #fff3dd; color: var(--warn); }
.kpi-head { display: flex; align-items: center; gap: .55rem; color: var(--muted); font-size: .84rem; }
.mini { width: 100%; margin-top: .6rem; border: 0; box-shadow: none; font-size: .8rem; }
.mini td { padding: .3rem .2rem; border-bottom: 1px dashed var(--line); background: transparent !important; }
.mini tr:last-child td { border-bottom: 0; }
.mini .who { max-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* tables: zebra rows, sticky header under the top bar, numbers aligned */
table { border-radius: var(--radius); box-shadow: var(--shadow); border-color: var(--line); }
th { background: #eef2f0; color: #33413c; font-size: .83rem; top: 0; z-index: 1; }
main > table th, main > section > table th { top: var(--bar-h); }   /* only tables on the page itself stick under the top bar */
tbody tr:nth-child(even) td { background: #fafbfa; }
tr:hover td { background: var(--accent-soft) !important; }
tfoot th, tfoot td { background: #eef2f0; font-weight: 700; position: static; }
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .8rem; box-shadow: var(--shadow); }
.filters a { padding: .25rem .6rem; border-radius: 999px; text-decoration: none; border: 1px solid var(--line); }
button { min-height: 36px; border-radius: 8px; }
.badge { font-weight: 600; background: #fff; }
/* reports hub */
.report-group h2 { margin-top: 1.4rem; }
.report-card { display: flex; gap: .8rem; align-items: flex-start; }
.report-card .v { font-size: 1.05rem; color: var(--sidebar); }
.recon { margin-top: .8rem; } .recon td.n { font-weight: 600; }
tr.mismatch td { background: #fff4f2 !important; } tr.mismatch td:last-child { color: var(--bad); font-weight: 700; }
@media (max-width: 900px) { main { padding: 1rem .8rem 2.5rem; } :root { --bar-h: 60px; } .cards { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .cards { grid-template-columns: 1fr; } table { display: block; overflow-x: auto; } th { position: static; } }
@media (prefers-reduced-motion: reduce) { a.tile { transition: none; } }
/* setup checklist */
.progress { height: 8px; border-radius: 999px; background: #e3e9e6; overflow: hidden; margin: .2rem 0 1rem; max-width: 520px; }
.progress span { display: block; height: 100%; background: var(--accent); }
ol.setup { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
ol.setup li.step-item { display: flex; align-items: center; gap: .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; box-shadow: var(--shadow); margin: 0; }
.step-no { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; flex-shrink: 0; }
li.step-item.done .step-no { background: #e3f3ea; color: var(--ok); }
.step-body { flex: 1; min-width: 0; }
li.step-item a.btn { padding: .3rem .8rem; font-size: .85rem; }
@media (max-width: 520px) { ol.setup li.step-item { flex-wrap: wrap; } }
.card .cnt { color: var(--muted); font-size: .8rem; margin-top: .1rem; }
table { overflow: clip; }   /* rounded corners without making each table a scroll box (that pushed sticky headers over the first row) */
