@font-face { font-family: "Vazirmatn"; src: url("/Vazirmatn.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
.tbl-tools { display: flex; gap: .35rem; justify-content: flex-end; padding: .5rem .8rem; border-bottom: 1px solid var(--line, #e4e9e5); }
.err-cell { color: var(--bad, #c8312b); font-size: .8rem; display: inline-block; max-width: 320px; white-space: normal; line-height: 1.5; }
.btn-row.row-acts { flex-wrap: nowrap; }

:root {
  --bg: #f3f6fb; --surface: #ffffff; --surface-2: #f8fafd; --line: #e3e9f2; --line-strong: #cfd8e6;
  --text: #17233c; --muted: #66758f; --dim: #9aa6bb;
  --primary: #1c5fd4; --primary-600: #174fb0; --primary-50: #eaf1fd; --primary-ink: #fff;
  --side: #0e2347; --side-2: #14305e; --side-text: #c6d3ea; --side-active: #ffffff;
  --ok: #138a4b; --ok-bg: #e5f6ed; --bad: #c8312b; --bad-bg: #fdeceb; --warn: #a76100; --warn-bg: #fff3dc; --info: #1c5fd4; --info-bg: #eaf1fd;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,34,66,.06), 0 4px 16px rgba(16,34,66,.05);
  --font: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #0b1424; --surface: #121e33; --surface-2: #162540; --line: #22324f; --line-strong: #2f4366;
  --text: #e6ecf7; --muted: #9db0cf; --dim: #6f82a3;
  --primary: #5b9bff; --primary-600: #78acff; --primary-50: #17294a; --primary-ink: #07162f;
  --side: #08111f; --side-2: #0e1b31; --side-text: #9db0cf;
  --ok: #4cd08a; --ok-bg: #11301f; --bad: #ff7b74; --bad-bg: #3a1716; --warn: #ffbf5e; --warn-bg: #36270c; --info: #7fb0ff; --info-bg: #17294a;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.7; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.4; }
h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.ic { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -.25em; }
.num { font-variant-numeric: tabular-nums; unicode-bidi: plaintext; }
.dim { color: var(--dim); } .muted { color: var(--muted); }
.inline { display: inline; margin: 0; }
.only-mobile { display: none; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: linear-gradient(180deg, var(--side), var(--side-2)); color: var(--side-text); z-index: 40; }
.brand { display: flex; gap: .75rem; align-items: center; padding: 1.1rem 1.1rem 1rem; color: #fff; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 40px; height: 40px; border-radius: 11px; background: var(--primary); display: grid; place-items: center; color: #fff; font-size: 1.15rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text b { font-size: 1rem; } .brand-text small { color: var(--side-text); font-size: .74rem; }
.nav { flex: 1; overflow-y: auto; padding: .6rem .7rem; }
.nav-group { font-size: .72rem; letter-spacing: .02em; color: #7f93b8; padding: .9rem .7rem .3rem; }
.nav-link { display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: 9px; color: var(--side-text); font-size: .92rem; }
.nav-link:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.nav-link.active { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(28,95,212,.35); }
.nav-link.sub { padding-right: 2.2rem; font-size: .84rem; opacity: .9; }
.sidebar-foot { padding: .6rem .7rem 1rem; border-top: 1px solid rgba(255,255,255,.07); }
.scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .6rem; height: 62px; padding: 0 1.4rem; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-title { font-weight: 700; font-size: 1.05rem; }
.top-spacer { flex: 1; }
.top-date { color: var(--muted); font-size: .85rem; }
.icon-btn { border: 0; background: transparent; color: var(--muted); width: 38px; height: 38px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; font-size: 1.05rem; }
.icon-btn:hover { background: var(--primary-50); color: var(--primary); }
.userbox { display: flex; align-items: center; gap: .5rem; padding: 0 .4rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; }
.user-name { font-size: .88rem; font-weight: 600; }
.content { padding: 1.4rem; flex: 1; width: 100%; max-width: 1500px; margin: 0 auto; }
.foot { text-align: center; color: var(--dim); font-size: .78rem; padding: 1rem; }

/* ---------- components ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: .6rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); }
.card-h h2, .card-h h3 { margin: 0; flex: 1; }
.card-b { padding: 1.1rem; }
.page-head { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.3rem; margin: 0; flex: 1; }
.page-head p { margin: 0; color: var(--muted); width: 100%; order: 3; }
.grid { display: grid; gap: 1rem; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 1rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .5rem 1rem; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; white-space: nowrap; transition: .15s; }
.btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-600); color: var(--primary-ink); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.danger:hover { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: .25rem .6rem; font-size: .8rem; border-radius: 7px; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .08rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.info { background: var(--info-bg); color: var(--info); }
.badge.mute { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

.alert { display: flex; gap: .7rem; padding: .75rem 1rem; border-radius: 10px; border: 1px solid; margin-bottom: 1rem; align-items: flex-start; }
.alert.ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.alert.bad { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert.info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.alert ul { margin: .2rem 0 0; padding-inline-start: 1.1rem; }

/* stat tiles */
.stat { position: relative; padding: 1rem 1.1rem; display: flex; gap: .9rem; align-items: center; overflow: hidden; }
.stat .ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; background: var(--primary-50); color: var(--primary); flex: none; }
.stat.ok .ico { background: var(--ok-bg); color: var(--ok); } .stat.bad .ico { background: var(--bad-bg); color: var(--bad); } .stat.warn .ico { background: var(--warn-bg); color: var(--warn); }
.stat .v { font-size: 1.7rem; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; }
.stat .l { color: var(--muted); font-size: .84rem; }
.stat .s { color: var(--dim); font-size: .76rem; }
a.stat { color: inherit; } a.stat:hover { text-decoration: none; border-color: var(--primary); transform: translateY(-1px); }
.stat { transition: .15s; }

/* tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.t th { text-align: right; font-weight: 600; color: var(--muted); background: var(--surface-2); padding: .65rem .8rem; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
table.t td { padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tbody tr:hover { background: var(--surface-2); }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t td.act, table.t th.act { width: 1%; white-space: nowrap; text-align: left; }
table.t td.n, table.t th.n { text-align: left; }
table.t tr.row-err td { background: color-mix(in srgb, var(--bad-bg) 55%, transparent); }
table.t tr.row-warn td { background: color-mix(in srgb, var(--warn-bg) 55%, transparent); }
.empty { text-align: center; color: var(--muted); padding: 2.4rem 1rem; }
.empty .ic { width: 2.6rem; height: 2.6rem; color: var(--dim); display: block; margin: 0 auto .5rem; }
.pager { display: flex; align-items: center; gap: .3rem; justify-content: center; padding: .9rem; flex-wrap: wrap; }
.pager a, .pager span { min-width: 34px; height: 34px; display: grid; place-items: center; padding: 0 .5rem; border-radius: 8px; border: 1px solid var(--line); color: var(--text); font-size: .85rem; }
.pager a:hover { border-color: var(--primary); text-decoration: none; }
.pager .cur { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.pager .dis { opacity: .4; }
.table-foot { display: flex; align-items: center; justify-content: space-between; padding: .6rem 1rem; color: var(--muted); font-size: .84rem; border-top: 1px solid var(--line); gap: 1rem; flex-wrap: wrap; }

/* forms */
label.f { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .25rem; font-weight: 600; }
.in, select.in, textarea.in { width: 100%; padding: .5rem .75rem; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; font-size: .92rem; transition: border-color .15s, box-shadow .15s; }
.in:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.in[readonly] { background: var(--surface-2); }
textarea.in { min-height: 90px; resize: vertical; }
.field { margin-bottom: .9rem; }
.field-validation-error, .err-text { color: var(--bad); font-size: .8rem; display: block; margin-top: .2rem; }
.hint { color: var(--dim); font-size: .78rem; margin-top: .2rem; }
.fgrid { display: grid; gap: .9rem 1rem; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.fgrid .field { margin: 0; }
.filters { padding: 1rem; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.filters .btn-row { margin-top: .9rem; }
.check { display: flex; gap: .5rem; align-items: center; cursor: pointer; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { padding: .25rem .8rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: .84rem; }
.chip:hover { text-decoration: none; border-color: var(--primary); }
.chip.on { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }

.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 2rem 1rem; text-align: center; background: var(--surface-2); transition: .15s; cursor: pointer; }
.dropzone.drag, .dropzone:hover { border-color: var(--primary); background: var(--primary-50); }
.dropzone .ic { width: 2.6rem; height: 2.6rem; color: var(--primary); }
.dropzone input { display: none; }
.dropzone .fname { font-weight: 700; margin-top: .4rem; }

/* kv list */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem 1.2rem; }
.kv dt { color: var(--muted); font-size: .78rem; } .kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.kv > div { min-width: 0; }

/* charts */
.chart { width: 100%; height: 220px; display: block; }
.chart .gl { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .b-ok { fill: var(--ok); } .chart .b-bad { fill: var(--bad); } .chart .b-oth { fill: var(--warn); }
.chart rect.bar { transition: opacity .15s; } .chart g.col:hover rect.bar { opacity: .75; }
.legend { display: flex; gap: 1rem; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: .35rem; }
.donut-wrap { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; justify-content: center; }
.donut { width: 150px; height: 150px; }
.donut .c { font-size: 22px; font-weight: 800; fill: var(--text); } .donut .cs { font-size: 10px; fill: var(--muted); }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }

/* invoice editor */
.sum { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: flex-end; padding: .9rem 1.1rem; background: var(--surface-2); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.sum div { text-align: left; } .sum small { display: block; color: var(--muted); font-size: .76rem; } .sum b { font-size: 1.05rem; }
.in.sm { padding: .3rem .5rem; font-size: .85rem; min-width: 70px; }
.in.num-in { text-align: left; direction: ltr; }

/* modal */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(760px, 94vw); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(8,16,32,.55); backdrop-filter: blur(2px); }
dialog .m-h { display: flex; align-items: center; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); gap: .6rem; }
dialog .m-h h3 { margin: 0; flex: 1; } dialog .m-b { padding: 1.1rem; max-height: 70vh; overflow: auto; }

/* date picker */
.dp { position: absolute; z-index: 60; width: 272px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 12px 40px rgba(10,20,40,.28); padding: .7rem; user-select: none; }
.dp-h { display: flex; align-items: center; gap: .3rem; margin-bottom: .5rem; }
.dp-h b { flex: 1; text-align: center; } .dp-h button { border: 0; background: transparent; color: var(--text); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font: inherit; }
.dp-h button:hover { background: var(--primary-50); color: var(--primary); }
.dp-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.dp-g span.w { font-size: .72rem; color: var(--muted); padding: .2rem 0; }
.dp-g button { border: 0; background: transparent; color: var(--text); height: 33px; border-radius: 8px; cursor: pointer; font: inherit; font-size: .85rem; }
.dp-g button:hover { background: var(--primary-50); } .dp-g button.sel { background: var(--primary); color: var(--primary-ink); } .dp-g button.today { outline: 1px solid var(--primary); }
.dp-g button.fri { color: var(--bad); }
.dp-f { display: flex; justify-content: space-between; margin-top: .5rem; }

/* toasts */
.toasts { position: fixed; inset-inline-start: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 100; }
.toast { background: var(--text); color: var(--bg); padding: .65rem 1rem; border-radius: 10px; box-shadow: var(--shadow); animation: up .2s; max-width: 340px; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* login */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); }
.login-hero { background: radial-gradient(900px 500px at 80% 10%, #2f6fe0 0%, transparent 60%), linear-gradient(160deg, #0e2347, #0a1a36); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: center; gap: 1.2rem; }
.login-hero h1 { font-size: 2rem; margin: 0; } .login-hero p { color: #b9c9e6; max-width: 34ch; margin: 0; }
.login-hero ul { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .7rem; color: #d9e4f7; }
.login-hero li { display: flex; gap: .6rem; align-items: center; }
.login-hero .brand-mark { width: 56px; height: 56px; font-size: 1.6rem; }
.login-box { display: grid; place-items: center; padding: 2rem; }
.login-card { width: min(400px, 100%); }
.captcha { display: flex; gap: .6rem; align-items: center; }
.captcha .q { flex: none; padding: .45rem .9rem; background: var(--primary-50); color: var(--primary); border-radius: 9px; font-weight: 800; letter-spacing: .05em; direction: ltr; }

@media (max-width: 1100px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-main { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .app { display: block; }
  .only-mobile { display: grid; } .only-desktop { display: none !important; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px; transform: translateX(110%); transition: transform .22s; }
  .sidebar.open { transform: none; } .scrim.open { display: block; position: fixed; inset: 0; background: rgba(8,16,32,.5); z-index: 35; }
  .content { padding: 1rem; } .cols-2, .cols-3 { grid-template-columns: 1fr; } .topbar { padding: 0 .8rem; }
  .login-page { grid-template-columns: 1fr; } .login-hero { display: none; }
}
@media print {
  .sidebar, .topbar, .foot, .no-print, .toasts { display: none !important; }
  .app { display: block; } body { background: #fff; color: #000; } .card { box-shadow: none; border-color: #bbb; } .content { padding: 0; }
}

/* ===== Moodian-style theme (green, light sidebar card, dashed stat boxes) ===== */
:root {
  --bg: #f4f6f4; --primary: #1f9d55; --primary-600: #187d44; --primary-50: #e3f1e8;
  --side: #ffffff; --side-2: #ffffff; --side-text: #2b3a33; --side-active: #fff;
  --line: #e4e9e5; --line-strong: #cdd6cf; --surface-2: #f6faf7; --muted: #66756c;
}
:root[data-theme="dark"] {
  --bg: #0d1511; --surface: #141f19; --surface-2: #19271f; --line: #25382d; --line-strong: #32493b;
  --primary: #3fbf79; --primary-600: #5ad08e; --primary-50: #17301f; --primary-ink: #06180d;
  --side: #141f19; --side-2: #141f19; --side-text: #c4d3c9;
}
.app { grid-template-columns: 290px 1fr; gap: 0; }
.sidebar { background: transparent; height: auto; top: 0; padding: 1rem 0 1rem 1rem; color: var(--side-text); }
.sidebar > .brand, .sidebar > .nav, .sidebar > .sidebar-foot { background: var(--surface); border: 1px solid var(--line); }
.sidebar > .brand { border-radius: var(--radius) var(--radius) 0 0; color: var(--text); border-bottom: 1px solid var(--line); }
.sidebar > .nav { border-top: 0; border-bottom: 0; max-height: calc(100vh - 190px); }
.sidebar > .sidebar-foot { border-radius: 0 0 var(--radius) var(--radius); border-top: 1px solid var(--line); }
.brand-mark { background: var(--primary); }
.brand-text small { color: var(--muted); }
.nav-group { color: var(--dim); }
.nav-link { color: var(--side-text); }
.nav-link:hover { background: var(--primary-50); color: var(--primary-600); }
.nav-link.active { background: var(--primary); color: #fff; box-shadow: none; }
.nav-link .ic { color: var(--muted); } .nav-link.active .ic { color: #fff; }
.topbar { height: 74px; background: linear-gradient(90deg, #e8f2ea, #f3f8f4 50%, #e8f2ea); border-bottom: 1px solid var(--line); backdrop-filter: none; }
:root[data-theme="dark"] .topbar { background: linear-gradient(90deg, #12241a, #16281d 50%, #12241a); }
.top-title { position: absolute; inset-inline: 0; text-align: center; pointer-events: none; font-size: 1.1rem; color: var(--text); }
.top-date { color: var(--primary-600); font-weight: 700; }
.stat { background: var(--primary-50); border: 1.5px dashed color-mix(in srgb, var(--primary) 55%, transparent); box-shadow: none; }
.stat.bad { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.stat.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.stat .ico { background: var(--surface); }
table.t th { background: var(--primary-50); color: var(--text); }
table.t td a:not(.btn) { color: var(--primary-600); font-weight: 600; }
.btn.dark { background: #1f2623; color: #fff; border-color: #1f2623; }
.sec { margin-bottom: 1.6rem; position: relative; }
.sec > .sec-t { position: absolute; top: -17px; inset-inline-start: 0; background: var(--primary); color: #fff; font-weight: 700; font-size: .85rem; padding: .35rem 2.2rem; border-radius: 8px 8px 0 0; z-index: 1; }
.sec > .card { border-color: var(--primary); border-radius: 0 8px 8px 8px; margin-top: 0; box-shadow: none; }
.sec .kv { grid-template-columns: repeat(2, minmax(0,1fr)); }
.sec .kv > div { display: flex; gap: .5rem; align-items: baseline; }
.sec .kv dt::after { content: ":"; } .sec .kv dt { color: var(--muted); } .sec .kv dd { font-weight: 600; }
.badge.ok { background: #1f9d55; color: #fff; } .badge.bad { background: #d03a34; color: #fff; } .badge.warn { background: #ffe8c2; color: #9a5a00; }
@media (max-width: 860px) { .sidebar { padding: 0; background: var(--surface); } .sidebar > .brand, .sidebar > .nav, .sidebar > .sidebar-foot { border: 0; border-radius: 0; max-height: none; } .top-title { position: static; text-align: start; } .sec .kv { grid-template-columns: 1fr; } }

.login-hero { background: radial-gradient(900px 500px at 80% 10%, #2fb36a 0%, transparent 60%), linear-gradient(160deg, #146b3a, #0d4a28); } .login-hero p, .login-hero li { color: #e3f4e9; }

@media (max-width:1100px){.cols-main{grid-template-columns:minmax(0,1fr)}} @media (max-width:860px){.cols-2,.cols-3{grid-template-columns:minmax(0,1fr)}} .grid>*{min-width:0}

@media (max-width:1250px){.top-title{position:static;text-align:start}}

/* ===== manual invoice editor ===== */
.step { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: .8rem; font-weight: 700; flex: none; }
.fgrid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.seg { display: flex; flex-wrap: wrap; gap: .35rem; background: var(--surface-2); border: 1px solid var(--line); padding: .25rem; border-radius: 10px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--text); font: inherit; font-size: .85rem; padding: .4rem .6rem; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--primary); color: #fff; font-weight: 700; }
table.lines td { padding: .4rem .5rem; vertical-align: top; } table.lines .rn { color: var(--dim); text-align: center; padding-top: .9rem; }
.stuffcell { display: grid; gap: .3rem; } .stuffcell input:first-child { font-size: .82rem; }
table.lines td.n b { display: inline-block; padding-top: .45rem; }
table.lines td.act { white-space: nowrap; padding-top: .55rem; }
.ac { position: absolute; z-index: 70; width: 380px; max-height: 280px; overflow: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 12px 36px rgba(0,0,0,.25); }
.ac button { display: flex; justify-content: space-between; gap: .8rem; width: 100%; border: 0; background: transparent; color: var(--text); font: inherit; font-size: .85rem; padding: .5rem .8rem; cursor: pointer; text-align: right; border-bottom: 1px solid var(--line); }
.ac button:hover { background: var(--primary-50); } .ac bdi { color: var(--muted); font-size: .78rem; }
.savebar { position: sticky; bottom: 0; z-index: 20; display: flex; gap: 1.6rem; align-items: center; flex-wrap: wrap; margin: 1rem -1.4rem -1.4rem; padding: .8rem 1.4rem; background: var(--surface); border-top: 1px solid var(--line-strong); box-shadow: 0 -6px 20px rgba(0,0,0,.06); }
.savebar .tot small { display: block; color: var(--muted); font-size: .74rem; } .savebar .tot b { font-size: 1rem; } .savebar .tot.main b { font-size: 1.25rem; color: var(--primary-600); }
@media (max-width: 860px) { .fgrid.two { grid-template-columns: 1fr; } .savebar { margin-inline: -1rem; } }

[hidden]{display:none !important}

.stuff-cta{padding:1rem;font-size:1.05rem;font-weight:600;background:var(--surface);border:1.5px dashed var(--primary);color:var(--primary-600)} .stuff-cta:hover{background:var(--primary-50)}

.dl-list{display:grid;gap:.35rem}.dl-list a{display:flex;gap:.5rem;align-items:center;padding:.45rem .6rem;border-radius:8px;color:var(--text)}.dl-list a:hover{background:var(--primary-50);text-decoration:none;color:var(--primary-600)}.dl-list .ic{color:var(--primary)}
table.t tr.row-skip td{color:var(--muted);background:var(--surface-2)}

html { font-size: 14px; }
body { font-weight: 350; letter-spacing: 0; }
b, strong, th, .badge, .nav-link.active, label.f, .user-name { font-weight: 500; }
h1, h2, h3, .page-head h1, .top-title, .brand-text b { font-weight: 600; }
.stat .v { font-weight: 600; font-size: 1.55rem; }
.stat .l { font-weight: 400; }
.btn { font-weight: 400; }
table.t th { font-weight: 500; color: var(--muted); }
table.t td { font-weight: 350; }
.sec > .sec-t { font-weight: 500; }
table.t a.sort { color: inherit; text-decoration: none; white-space: nowrap; }
table.t a.sort:hover { color: var(--primary-600); }
.buyer-name { margin-top: .3rem; color: var(--primary-600); font-size: .85rem; font-weight: 500; }
.btn.pick { white-space: nowrap; }

/* ===== collapsible sidebar on desktop (menu button; state kept in localStorage by theme.js/app.js) ===== */
@media (min-width: 861px) { .side-off .app { grid-template-columns: minmax(0, 1fr); } .side-off .sidebar { display: none; } }

/* ===== long lists: the table scrolls inside the viewport, header and action column stay put ===== */
.scroll-box { max-height: calc(100vh - 170px); overflow: auto; scrollbar-width: auto; scrollbar-color: var(--line-strong) transparent; }
.scroll-box table.t th { z-index: 2; }
.scroll-box table.t th.act, .scroll-box table.t td.act { position: sticky; inset-inline-end: 0; z-index: 1; text-align: left; background: var(--surface); box-shadow: inset -2px 0 0 var(--line-strong), 8px 0 10px -8px rgba(0,0,0,.18); }
.scroll-box table.t th.act { z-index: 3; background: var(--primary-50); }
.scroll-box table.t tbody tr:hover td.act { background: var(--surface-2); }
.scroll-box table.t tr.row-err td.act { background: color-mix(in srgb, var(--bad-bg) 55%, var(--surface)); }
/* status column frozen at the start (right in RTL), mirroring the actions column at the end */
.scroll-box table.t th.st, .scroll-box table.t td.st { position: sticky; inset-inline-start: 0; z-index: 1; background: var(--surface); box-shadow: inset 2px 0 0 var(--line-strong), -8px 0 10px -8px rgba(0,0,0,.18); }
.scroll-box table.t th.st { z-index: 3; background: var(--primary-50); }
.scroll-box table.t tbody tr:hover td.st { background: var(--surface-2); }
.scroll-box table.t tr.row-err td.st { background: color-mix(in srgb, var(--bad-bg) 55%, var(--surface)); }
.scroll-box .row-acts { gap: .25rem; flex-wrap: nowrap; }
.scroll-box table.t td { white-space: nowrap; }
.scroll-box .row-acts .btn.sm { padding: .3rem .45rem; }
.scroll-box .row-acts .lbl { display: none; }
.hscroll { overflow-x: auto; overflow-y: hidden; height: 14px; border-bottom: 1px solid var(--line); scrollbar-width: auto; scrollbar-color: var(--primary) var(--surface-2); background: var(--surface-2); }
.hscroll > div { height: 1px; }
.hscroll::-webkit-scrollbar, .scroll-box::-webkit-scrollbar { height: 12px; width: 12px; }
.hscroll::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 6px; }
.scroll-box::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; }
.tag98 { display: inline-block; font-weight: 800; letter-spacing: .02em; color: var(--primary-600); }
.login-hero .tag98 { color: #fff; background: rgba(255,255,255,.18); padding: 0 .45rem; border-radius: 6px; }
/* compact filter bar; the full filter form opens on demand */
.flt-bar { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.flt-bar .chip { padding: .15rem .7rem; font-size: .8rem; }
.filters:has(.flt-bar) { padding: .6rem 1rem; }
.flt-panel { margin-top: .8rem; padding-top: .8rem; border-top: 1px dashed var(--line-strong); }
.flt-panel[hidden] { display: none; }
/* forgot-password guide */
.guide { display: grid; gap: .6rem; }
.guide details.card { padding: 0; }
.guide summary { cursor: pointer; padding: .85rem 1rem; font-weight: 600; display: flex; align-items: center; gap: .55rem; list-style: none; }
.guide summary::-webkit-details-marker { display: none; }
.guide summary::after { content: "▾"; margin-inline-start: auto; color: var(--muted); transition: transform .15s; }
.guide details[open] summary::after { transform: rotate(180deg); }
.guide details[open] summary { border-bottom: 1px solid var(--line); color: var(--primary-600); }
.guide ol { list-style: persian; margin: 0; padding: .9rem 2.4rem 1rem 1rem; display: grid; gap: .55rem; line-height: 1.9; }
.copy-chip { display: inline-block; font-family: Consolas, "Courier New", monospace; font-weight: 600; font-size: .85rem; background: var(--primary-50); color: var(--primary-600); border: 1px dashed color-mix(in srgb, var(--primary) 50%, transparent); border-radius: 6px; padding: 0 .45rem; cursor: copy; user-select: all; }
.login-forgot { display: block; text-align: center; margin-top: .7rem; font-size: .85rem; }
/* tax-system error: compact button in grids, full text in a dialog */
.btn.err-btn { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: var(--surface); white-space: nowrap; }
.btn.err-btn:hover { background: var(--bad-bg); }
/* a cancelled invoice's row in the sent list: faint red hatching (the frozen cells too, which have their own background) */
table.t tr.row-cancel td { background-image: repeating-linear-gradient(-45deg, rgba(211,47,47,.09) 0 6px, transparent 6px 14px); }
.scroll-box table.t tr.row-cancel td.st, .scroll-box table.t tr.row-cancel td.act { background-color: color-mix(in srgb, var(--bad-bg) 35%, var(--surface)); }
/* a cancelled invoice's details: red halo over the content and a faint diagonal stamp */
.content:has(> .cancelled-page) { background: radial-gradient(ellipse at center, rgba(211,47,47,.09) 0%, rgba(211,47,47,.03) 65%, rgba(211,47,47,.08) 100%);
    box-shadow: inset 0 0 80px rgba(211,47,47,.28); border-radius: 14px; }
.cancelled-page { position: fixed; inset: 0; z-index: 0; pointer-events: none; display: grid; place-items: center; overflow: hidden; }
.cancelled-page span { transform: rotate(-22deg); padding: .1em .5em; border: 8px double rgba(211,47,47,.22); border-radius: 18px;
    color: rgba(211,47,47,.16); font-size: clamp(4rem, 12vw, 9rem); font-weight: 800; white-space: nowrap; }
button.badge.st-err { border: 0; font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; }
button.badge.st-err:hover { text-decoration: underline; }
button.badge.st-err .ic { width: .9em; height: .9em; }
dialog.err-dlg { width: min(620px, 94vw); }
dialog.err-dlg ol { margin: 0; padding-inline-start: 1.3rem; display: grid; gap: .7rem; line-height: 1.9; list-style: persian; }
dialog.err-dlg li { color: var(--bad); white-space: pre-wrap; overflow-wrap: anywhere; }
dialog .m-f { display: flex; justify-content: flex-end; gap: .5rem; padding: .8rem 1.1rem; border-top: 1px solid var(--line); }
.ac .ac-h { position: sticky; top: 0; padding: .35rem .8rem; font-size: .74rem; font-weight: 700; color: var(--primary-600); background: var(--primary-50); border-bottom: 1px solid var(--line); }
/* manual invoice form: number fields keep LTR digit order but line up on the right like the rest of the form */
.content:has(#invData) .in[dir="ltr"], .content:has(#invData) .in.num-in, .content:has(#invData) .in.jdate { text-align: right; }
.content:has(#invData) .in[dir="ltr"]::placeholder { text-align: right; }
/* admin monitor: online indicator */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); margin-inline-end: .35rem; vertical-align: middle; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
