@font-face{font-family:Vazirmatn;src:url(../fonts/Vazirmatn-Regular.woff2) format("woff2");font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:Vazirmatn;src:url(../fonts/Vazirmatn-Bold.woff2) format("woff2");font-weight:700;font-style:normal;font-display:swap}
:root{--navy:#0d2b4a;--blue:#2459d3;--bg:#f5f7fa;--ink:#17202a;--muted:#64748b;--line:#e5e7eb;--debit:#d62828;--credit:#18864b;--warn:#b45309;--zero:#64748b}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{margin:0;background:var(--bg);font-family:Vazirmatn,Tahoma,Arial,sans-serif;color:var(--ink);overflow-x:hidden;-webkit-tap-highlight-color:transparent}
button,input,select,textarea{font-family:inherit;color:inherit}
button{cursor:pointer}
button:disabled{opacity:.55;cursor:default}
:focus-visible{outline:3px solid #7aa2ff;outline-offset:2px}
[hidden]{display:none!important}
.skip{position:absolute;right:-999px;top:0;background:#fff;padding:8px;z-index:100}
.skip:focus{right:8px}
.app{max-width:560px;margin:auto;min-height:100vh;min-height:100dvh}

/* ---------- header ---------- */
header{min-height:64px;background:var(--navy);color:#fff;display:flex;align-items:center;gap:6px;padding:0 8px;padding-top:env(safe-area-inset-top);position:sticky;top:0;z-index:5}
header h1{font-size:18px;margin:0;flex:1;min-width:0;text-align:center;white-space:pre-line;line-height:1.35;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.icon{border:0;background:transparent;color:#fff;font-size:26px;min-width:44px;min-height:44px;border-radius:10px;line-height:1}
.icon:active{background:#ffffff18}
.searchBtn{border:0;background:#ffffff18;color:#fff;border-radius:10px;padding:0 10px;min-height:44px;min-width:44px;font-size:13px;flex:none}
.syncChip{flex:none;display:flex;align-items:center;gap:5px;border:1px solid #ffffff30;background:#ffffff10;color:#fff;border-radius:999px;padding:0 9px;min-height:44px;max-width:112px;font-size:11px;line-height:1.3;text-align:right}
.syncChip span{overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.syncChip i,.syncStatus i{width:8px;height:8px;border-radius:50%;background:#4ade80;flex:none}
.syncChip.off i,.syncStatus.off i{background:#94a3b8}
.syncChip.warn i,.syncStatus.warn i{background:#fbbf24}
.syncChip.err i,.syncStatus.err i{background:#f87171}
.syncChip.busy i,.syncStatus.busy i{background:#60a5fa;animation:pulse 1s infinite alternate}
@keyframes pulse{from{opacity:1}to{opacity:.25}}
.offlineBanner{background:#475569;color:#fff;font-size:12px;text-align:center;padding:7px 12px;line-height:1.6;position:sticky;top:64px;z-index:4}

main{padding:14px 12px 24px;outline:none}
body.hasBottom main{padding-bottom:calc(92px + env(safe-area-inset-bottom))}
.splash{text-align:center;color:var(--muted);padding:60px 0}
.pad{padding:0 4px}

/* ---------- cards & customers ---------- */
.card{background:#fff;border:1px solid var(--line);border-radius:14px;margin-bottom:11px;box-shadow:0 2px 8px #00000008;overflow:hidden}
.customer{width:100%;border:0;background:#fff;padding:16px 14px;text-align:right;font-size:16px;border-radius:14px;display:flex;justify-content:space-between;align-items:center;gap:8px;min-height:64px}
.customer:active{background:#f8fafc}
.customer .info{min-width:0;flex:1}
.customer .info b{overflow-wrap:anywhere}
.customer small{display:block;color:#666;font-size:11.5px;margin-top:6px;line-height:1.8;overflow-wrap:anywhere}
.customer .arrow{font-size:25px;color:#777}
.balanceBox{text-align:left;min-width:96px;font-size:12px;line-height:1.7;display:flex;flex-direction:column;align-items:flex-end}
.balanceBox b{display:block;font-size:13px;white-space:nowrap}
.balanceBox.debit{color:var(--debit)}
.balanceBox.credit{color:var(--credit)}
.balanceBox.zero{color:var(--zero)}
.pendingDot{display:inline-block;width:7px;height:7px;border-radius:50%;background:#f59e0b;vertical-align:middle;margin-inline-start:4px}
.topSearch{display:flex;gap:8px;margin:-14px -12px 12px;padding:10px 12px;position:sticky;top:64px;z-index:3;background:var(--bg,#f5f7fa)}
.topSearch input{margin:0;height:46px;flex:1;min-width:0}
.topSearch .clearSearch{height:46px;min-width:46px;border:1px solid #d5dae1;border-radius:10px;background:#fff;color:#475569;padding:0 12px;font-size:16px}
.topSearch .clearSearch[hidden]{display:none}
.bottom-btn{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:min(560px,100%);padding:9px 12px calc(9px + env(safe-area-inset-bottom));background:var(--bg);border-top:1px solid #ddd;z-index:4}
.primary{width:100%;height:50px;border:0;border-radius:12px;background:var(--blue);color:#fff;font-size:16px;font-weight:700}
.primary:active{filter:brightness(.92)}
.empty{text-align:center;color:#777;padding:32px 10px;font-size:13px;line-height:1.9}

/* ---------- ledger ---------- */
.infoCard{padding:12px 14px;display:flex;gap:10px;align-items:flex-start;justify-content:space-between}
.infoText{min-width:0;flex:1}
.infoText b{overflow-wrap:anywhere}
.infoText .sub{font-size:12px;color:#666;margin-top:5px;overflow-wrap:anywhere}
.infoText a{color:var(--blue);text-decoration:none}
.infoActions{display:flex;gap:6px;flex:none}
.smallBtn{min-height:44px;min-width:52px;border:1px solid #d5dae1;background:#fff;border-radius:10px;padding:0 10px;font-size:13px}
.smallBtn.dangerSoft{color:var(--debit);border-color:#f3c4c4}
.table{width:100%;overflow:hidden}
.ledger-grid{width:100%;display:grid;grid-template-columns:20% 39% 20.5% 20.5%;direction:rtl}
button.ledger-grid{border:0;background:#fff;padding:0;text-align:inherit;font-size:inherit}
button.ledger-grid:active{background:#f1f5fb}
.cell{padding:9px 4px;text-align:center;font-size:11.5px;min-height:48px;display:flex;align-items:center;justify-content:center;border-bottom:1px solid #eee;line-height:1.5;overflow-wrap:anywhere;min-width:0}
.cell.desc{text-align:right;justify-content:flex-start;padding-right:7px}
.head .cell{background:#eef2f7;font-weight:700;color:#334155;min-height:42px;font-size:11px}
.debitText{color:var(--debit)!important;font-weight:700}
.creditText{color:var(--credit)!important;font-weight:700}
.zeroText{color:var(--zero)}
.warnText{color:var(--warn)}
.dangerText{color:var(--debit)!important}
.unitNote{font-size:11px;color:var(--muted);padding:7px 10px;text-align:left}
.summary{padding:13px 14px}
.sumline{display:flex;justify-content:space-between;gap:10px;padding:6px 0;font-size:13px}
.sumline b{text-align:left}
.sumline.debitLine b{color:var(--debit)}
.sumline.creditLine b{color:var(--credit)}
.balance{font-weight:700;border-top:1px solid #eee;margin-top:6px;padding-top:11px;font-size:14px}
.balance.debitLine,.balance.debitLine b{color:var(--debit)}
.balance.creditLine,.balance.creditLine b{color:var(--credit)}
.balance.zero,.balance.zero b{color:var(--zero)}

/* ---------- reports ---------- */
.tabs{display:flex;gap:6px;margin-bottom:11px;overflow-x:auto;scrollbar-width:none}
.tab{flex:1;min-height:44px;border:1px solid #d5dae1;background:#fff;border-radius:10px;font-size:12.5px;padding:0 8px;white-space:nowrap}
.tab.active{background:var(--blue);color:#fff;border-color:var(--blue)}
.controls{padding:12px}
.controls select{margin-bottom:8px}
.rangeRow{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.rangeRow .datePickerBtn{margin-bottom:6px;font-size:14px}
.chips{display:flex;flex-wrap:wrap;gap:6px;margin:4px 0 10px}
.chipBtn{min-height:44px;border:1px solid #d5dae1;background:#f8fafc;border-radius:999px;padding:0 12px;font-size:12px}
.grid5{display:grid;grid-template-columns:18% 30% 17% 17% 18%}
.grid5 .cell{font-size:11px;padding:8px 3px}
.grid5.opening .cell{background:#fafbfc;color:var(--muted)}
.grid4p{display:grid;grid-template-columns:34% 22% 22% 22%;width:100%;border:0;background:#fff;padding:0;text-align:inherit;font-size:inherit}
.grid4p .cell small{color:var(--muted);margin-inline-start:3px}
.repHead{display:flex;justify-content:space-between;padding:12px 14px;background:#f8fafc;border-bottom:1px solid #eee;font-size:14px}
.repRow{display:flex;justify-content:space-between;gap:10px;width:100%;min-height:48px;align-items:center;padding:0 14px;border:0;border-bottom:1px solid #f1f1f1;background:#fff;font-size:13.5px;text-align:right}
.repRow span{min-width:0;overflow-wrap:anywhere}

/* ---------- settings ---------- */
.section{padding:14px}
.section h3{margin:0 0 10px;font-size:15px}
.kv{display:flex;justify-content:space-between;gap:10px;padding:7px 0;font-size:13px;border-bottom:1px dashed #eef0f3}
.kv span{color:var(--muted)}
.kv b{text-align:left;overflow-wrap:anywhere;min-width:0}
.hint{font-size:12px;color:var(--muted);line-height:1.8;margin:8px 0}
.btnRow{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
.btnRow>*{flex:1 1 140px}
.secondary{min-height:46px;border:1px solid #d5dae1;background:#fff;border-radius:10px;padding:0 12px;font-size:14px}
.secondary.full{width:100%;margin-top:10px}
.segmented{display:flex;background:#eef0f3;border-radius:12px;padding:4px;gap:4px;margin-bottom:6px}
.segmented button{flex:1;min-height:44px;border:0;background:transparent;border-radius:9px;font-size:14px}
.segmented button.on{background:#fff;color:var(--blue);font-weight:700;box-shadow:0 1px 3px #0002}
.member{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:8px 0;border-bottom:1px solid #f1f1f1}
.member small{display:block;color:var(--muted);font-size:11.5px;text-align:right}
.roleTag{font-size:12px;background:#e7eefc;color:var(--blue);border-radius:999px;padding:4px 10px;white-space:nowrap}
.joinRow{display:flex;gap:8px}
.joinRow input{margin:0;flex:1;min-width:0;text-transform:uppercase;letter-spacing:2px;text-align:center}
.joinRow button{min-width:88px;height:48px;border:0;border-radius:10px}
.inviteCode{font-size:30px;font-weight:700;letter-spacing:6px;text-align:center;background:#f1f5fb;border-radius:12px;padding:16px;margin:10px 0 14px;user-select:all}

/* ---------- forms & sheets ---------- */
.modal{position:fixed;inset:0;background:#0008;display:flex;align-items:flex-end;z-index:10}
.sheet{background:#fff;width:100%;max-width:560px;margin:auto auto 0;border-radius:20px 20px 0 0;padding:10px 18px calc(18px + env(safe-area-inset-bottom));max-height:94vh;max-height:94dvh;overflow:auto;outline:none;animation:up .18s ease-out}
@keyframes up{from{transform:translateY(30px);opacity:.6}to{transform:none;opacity:1}}
.sheetGrip{width:42px;height:5px;border-radius:3px;background:#d5dae1;margin:0 auto 10px}
.sheet h2{font-size:18px;margin:0 0 15px}
input,select,textarea{width:100%;height:48px;border:1px solid #d5dae1;border-radius:10px;padding:8px 11px;font-size:16px;margin-bottom:10px;text-align:right;background:#fff}
input[dir=ltr]{text-align:right}
input:focus,select:focus,textarea:focus{border-color:var(--blue);outline:2px solid #2459d322}
.fieldLabel{display:block;font-size:12.5px;color:#555;margin:2px 0 5px}
.amountRow{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.date-title{font-size:13px;color:#555;margin:2px 0 7px}
.datePickerBtn{width:100%;height:50px;border:1px solid #d5dae1;border-radius:10px;background:#fff;font-size:15px;text-align:right;padding:0 12px;margin-bottom:10px;display:flex;justify-content:space-between;align-items:center}
.calIcon{color:var(--muted)}
.formError{background:#fdecec;color:#a61b1b;border-radius:10px;padding:9px 12px;font-size:13px;margin-bottom:10px;line-height:1.7}
.actions{display:flex;gap:9px;margin-top:4px}
.actions button{flex:1;min-height:47px;border-radius:10px;border:0;font-size:15px}
.cancel{background:#eef0f3}.save{background:var(--blue);color:#fff}
.danger{background:var(--debit);color:#fff}
.dangerOutline{width:100%;min-height:46px;margin-top:10px;border:1px solid #f3c4c4;background:#fff;color:var(--debit);border-radius:10px;font-size:14px}
.hidden{display:none}
.note{font-size:11.5px;color:#777;text-align:center;line-height:1.8}
.copyArea{height:220px;font-size:13px;line-height:1.8;white-space:pre-wrap}
.menuUser{background:#f8fafc;border-radius:12px;padding:10px 12px;margin-bottom:8px}
.menuUser small{display:block;color:var(--muted);font-size:12px;margin-top:3px}
.menuList{display:flex;flex-direction:column;margin-bottom:10px}
.menuItem{display:flex;align-items:center;gap:12px;min-height:52px;border:0;border-bottom:1px solid #f1f1f1;background:#fff;text-align:right;font-size:15px;padding:0 6px}
.menuItem span{width:24px;text-align:center;color:var(--blue);font-size:18px}

/* ---------- multi-line entries (v1.1) ---------- */
.sideToggle{margin-bottom:12px}
.sideToggle .sideBtn{font-weight:700;color:#475569}
.sideToggle .sideBtn.debit.on{background:#fdecec;color:var(--debit);box-shadow:inset 0 0 0 1px #f3c4c4}
.sideToggle .sideBtn.credit.on{background:#e7f6ee;color:var(--credit);box-shadow:inset 0 0 0 1px #b7e2c9}
.linesHead{display:flex;justify-content:space-between;align-items:baseline;gap:8px}
.lineCount{font-size:11.5px;color:var(--muted)}
.lineRow{display:grid;grid-template-columns:24px minmax(0,1fr);grid-template-areas:"no desc" ". amt";gap:6px;align-items:center;padding:7px;border:1px solid var(--line);border-radius:12px;background:#f8fafc;margin-bottom:8px}
.lineRow input{margin:0;height:44px}
.lineNo{grid-area:no;width:24px;height:24px;border-radius:50%;background:#e2e8f0;color:#475569;font-size:12px;display:flex;align-items:center;justify-content:center;font-weight:700}
.lineDesc{grid-area:desc}
.lineAmountWrap{grid-area:amt;display:flex;gap:6px;min-width:0}
.lineAmount{flex:1;min-width:0}
.removeLine{flex:none;width:44px;height:44px;border:1px solid #f3c4c4;background:#fff;color:var(--debit);border-radius:10px;font-size:15px;line-height:1}
.removeLine:active{background:#fdecec}
.lines.single .lineRow{grid-template-columns:minmax(0,1fr);grid-template-areas:"desc" "amt";background:transparent;border:0;padding:0}
.lines.single .lineNo,.lines.single .removeLine{display:none}
@media (min-width:480px){
  .lineRow{grid-template-columns:24px minmax(0,1fr) 210px;grid-template-areas:"no desc amt"}
  .lines.single .lineRow{grid-template-columns:minmax(0,1fr) 190px;grid-template-areas:"desc amt"}
}
input.invalid{border-color:var(--debit);outline:2px solid #d6282822}
.addLine{width:100%;min-height:46px;border:1.5px dashed #9db5ec;background:#f4f7fe;color:var(--blue);border-radius:10px;font-size:14px;font-weight:700;margin:2px 0 10px}
.addLine:active{background:#e7eefc}
.lineTotal,.detailTotal{display:flex;justify-content:space-between;align-items:center;gap:10px;background:#f8fafc;border:1px solid var(--line);border-radius:10px;padding:10px 12px;margin-bottom:10px;font-size:14px}
.lineTotal b,.detailTotal b{font-size:15px;white-space:nowrap}
.debitLine.lineTotal b,.debitLine.detailTotal b{color:var(--debit)}
.creditLine.lineTotal b,.creditLine.detailTotal b{color:var(--credit)}
.dtext{min-width:0}
.moreLines{color:var(--muted);font-size:10.5px;font-weight:400;white-space:nowrap}
.detailMeta{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:10px}
.detailMeta>div{background:#f8fafc;border-radius:10px;padding:8px 12px;display:flex;flex-direction:column;gap:3px}
.detailMeta span{font-size:11.5px;color:var(--muted)}
.detailMeta b{font-size:15px}
.sidePill{align-self:flex-start;border-radius:999px;padding:1px 12px;font-size:14px}
.sidePill.debit{background:#fdecec;color:var(--debit)}
.sidePill.credit{background:#e7f6ee;color:var(--credit)}
.pendingHint{display:flex;align-items:center;gap:6px;margin-top:0}
.pendingHint .pendingDot{margin:0}
.detailItems{border:1px solid var(--line);border-radius:12px;overflow:hidden;margin-bottom:10px}
.dRow{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;padding:10px 12px;border-bottom:1px solid #eef0f3;font-size:14px;line-height:1.7}
.dRow:last-child{border-bottom:0}
.dRow.head{background:#eef2f7;font-weight:700;font-size:12px;color:#334155;padding:8px 12px}
.dDesc{flex:1;min-width:0;text-align:right;overflow-wrap:anywhere}
.dAmt{flex:none;text-align:left;white-space:nowrap;font-weight:700}
.dNo{font-style:normal;color:var(--muted);font-size:12px;margin-inline-end:8px}
.actions .dangerOutline{width:auto;margin-top:0;border:1px solid #f3c4c4}
.itemLines{list-style:none;margin:0;padding:0}
.itemLines li{display:flex;justify-content:space-between;gap:8px;line-height:1.7}
.itemLines .iDesc{min-width:0;overflow-wrap:anywhere}
.itemLines .iAmt{white-space:nowrap;color:#334155}
.gridItems{padding:2px 8px 8px;padding-inline-start:calc(18% + 4px);border-bottom:1px solid #eee;font-size:11px;color:#475569;margin-top:-1px}
.gridItems li::before{content:"•";color:#94a3b8;margin-inline-end:4px}
.gridItems li{justify-content:flex-start}
.gridItems .iDesc{flex:1}
.vsItems{margin:2px 0;font-size:12px}
.vsItems li{border-bottom:1px dashed #eef0f3}
.printTable tr.itemRow td{background:#fff!important;border-top:0;border-bottom:1px dashed #e2e8f0;padding-top:2px;padding-bottom:2px;font-size:.92em;color:#475569}
.printTable tr.itemRow td.c-desc{padding-inline-start:18px}
.pItem::before{content:"— ";color:#94a3b8}
.pItemAmt{color:#475569}

/* ---------- dialogs ---------- */
.dialogWrap{position:fixed;inset:0;background:#0009;display:flex;align-items:center;justify-content:center;z-index:30;padding:16px}
.dialog{background:#fff;border-radius:16px;padding:18px;width:min(420px,100%);box-shadow:0 10px 35px #0005;outline:none;max-height:90vh;overflow:auto}
.dialog h3{margin:0 0 8px;font-size:17px}
.dialog p{font-size:14px;line-height:1.9;margin:0 0 16px;color:#333}
.choiceList{display:flex;flex-direction:column;gap:8px;margin-bottom:12px}
.choice{min-height:52px;border:1px solid #d5dae1;background:#fff;border-radius:12px;text-align:right;padding:8px 12px}
.choice small{display:block;color:var(--muted);font-size:12px;margin-top:2px;font-weight:400}

/* ---------- calendar ---------- */
.calendarModal{position:fixed;inset:0;background:#0008;display:flex;align-items:center;justify-content:center;z-index:20;padding:12px}
.calendar{width:min(500px,100%);background:#fff;border-radius:18px;padding:14px;box-shadow:0 10px 35px #0005;outline:none}
.calHead{display:flex;align-items:center;gap:7px;margin-bottom:10px}
.calHead button{width:44px;height:44px;flex:none;border:0;border-radius:9px;background:#eef2f7;font-size:22px}
.calHead select{margin:0;height:44px;font-size:14px;min-width:0}
.calTitle{font-weight:700;text-align:center;font-size:13.5px;margin-bottom:6px}
.week,.days{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px;direction:rtl}
.week div{text-align:center;color:var(--muted);font-size:10px;padding:5px 0;overflow:hidden;white-space:nowrap}
.day{height:44px;border:0;border-radius:9px;background:var(--bg);font-size:14px;min-width:0}
.day.emptyDay{background:transparent}
.day.today{border:1px solid var(--blue)}
.day.selected{background:var(--blue);color:#fff}
.calActions{display:flex;gap:8px;margin-top:12px}
.calActions button{flex:1;min-height:44px;border:0;border-radius:10px;font-size:13.5px}
.calCancel{background:#eef0f3}.calToday{background:#e7eefc;color:var(--blue)}.calOk{background:var(--blue);color:#fff}

/* ---------- toast ---------- */
.toast{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(84px + env(safe-area-inset-bottom));width:max-content;max-width:calc(100% - 32px);background:#1f2937;color:#fff;border-radius:12px;padding:10px 14px;font-size:13.5px;z-index:50;display:flex;align-items:center;gap:12px;box-shadow:0 6px 20px #0004;line-height:1.7}
.toast.error{background:#991b1b}
.toastAction{border:0;background:#ffffff22;color:#fff;border-radius:8px;min-height:40px;padding:0 12px;font-weight:700;white-space:nowrap}

/* ---------- sync sheet ---------- */
.syncStatus{display:flex;align-items:center;gap:8px;background:#f8fafc;border-radius:12px;padding:12px;margin-bottom:8px}
.subhead{font-size:14px;margin:16px 0 8px}
.conflict{border:1px solid #fde68a;background:#fffbeb;border-radius:12px;padding:12px;margin-bottom:10px}
.conflictTitle{font-weight:700;font-size:14px}
.vs{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:8px 0 10px}
.vs.one{grid-template-columns:1fr}
.vs>div{background:#fff;border:1px solid var(--line);border-radius:10px;padding:8px;font-size:12.5px;line-height:1.8;overflow-wrap:anywhere}
.vs small{display:block;color:var(--muted);font-size:11px;margin-bottom:2px}
.conflict .actions button{font-size:13px}

/* ---------- auth ---------- */
body.noHeader .offlineBanner{top:0}
.authWrap{padding-top:28px}
.authBrand{text-align:center;margin-bottom:18px}
.authBrand img{border-radius:18px;box-shadow:0 6px 20px #0d2b4a33}
.authBrand h1{margin:10px 0 2px;font-size:24px;color:var(--navy)}
.authBrand p{margin:0;color:var(--muted);font-size:13px}
.authCard{padding:16px}
.authCard .segmented{margin-bottom:14px}
.authCard .primary{margin-top:6px}
.pwRow{display:flex;gap:8px}
.pwRow input{flex:1;min-width:0}
.pwToggle{height:48px;min-width:64px;border:1px solid #d5dae1;background:#fff;border-radius:10px;font-size:13px}

/* ---------- print view ---------- */
.printView{position:fixed;inset:0;background:#e9edf2;z-index:40;overflow:auto;padding:12px}
.printBar{display:flex;gap:8px;max-width:794px;margin:0 auto 6px;position:sticky;top:0}
.printBar button{flex:1;min-height:48px;border:0;border-radius:10px;font-size:15px}
.printHint{max-width:794px;margin:0 auto 10px;text-align:center;font-size:12px;color:#475569}
.printDoc{overflow-x:auto;background:#fff;max-width:794px;margin:0 auto;padding:22px 18px;border-radius:6px;box-shadow:0 2px 10px #0002;font-size:12.5px;color:#111}
.printHead{display:flex;justify-content:space-between;align-items:flex-start;gap:10px;border-bottom:2px solid var(--navy);padding-bottom:10px;margin-bottom:10px}
.printHead h1{font-size:18px;margin:0;color:var(--navy)}
.printSub{color:#475569;font-size:12px;margin-top:4px}
.printDate{font-size:11.5px;color:#475569;white-space:nowrap}
.printMeta{display:flex;flex-wrap:wrap;gap:4px 18px;margin:0 0 10px;font-size:12px}
.printMeta div{display:flex;gap:4px}
.printMeta dt{color:#64748b}.printMeta dd{margin:0}
.printTable{width:100%;border-collapse:collapse}
.printTable th,.printTable td{border:1px solid #cbd5e1;padding:6px 5px;text-align:center;overflow-wrap:anywhere;vertical-align:middle}
.printTable th{background:#eef2f7;font-weight:700}
.printTable .c-desc{text-align:right}
.printTable .c-date,.printTable .c-num{white-space:nowrap}
@media screen and (max-width:480px){.printDoc{padding:14px 10px;font-size:11px}.printTable th,.printTable td{padding:5px 3px}}
.printTable tbody tr:nth-child(even) td{background:#fafbfc}
.printFoot{margin-top:12px;margin-inline-start:auto;width:min(320px,100%)}
.printFooter{margin-top:18px;text-align:center;color:#94a3b8;font-size:11px}

@media print{
  @page{size:A4;margin:12mm}
  body{background:#fff}
  body>*:not(.printView){display:none!important}
  .printView{position:static;background:#fff;padding:0;overflow:visible}
  .noPrint{display:none!important}
  .printDoc{box-shadow:none;max-width:none;padding:0;border-radius:0}
  .printTable thead{display:table-header-group}
  .printTable tr{break-inside:avoid}
  *{-webkit-print-color-adjust:exact;print-color-adjust:exact}
}
@media (max-width:370px){
  header h1{font-size:16px}
  .syncChip{max-width:92px;padding:0 7px}
  .balanceBox{min-width:84px}
  .ledger-grid .cell{font-size:11px;padding-left:2px;padding-right:2px}
  .ledger-grid .cell.desc{padding-right:5px}
}
@media (prefers-reduced-motion:reduce){*{animation:none!important}}
body.has-layer .toast{bottom:auto;top:calc(16px + env(safe-area-inset-top))}
.grid5:has(+ .gridItems) .cell{border-bottom-color:transparent}
.printTable:has(.itemRow) tbody tr:nth-child(even) td{background:#fff}
/* v1.2.0 — ledger sort sheet */
.sortHint{margin:-6px 0 12px;font-size:13px}
.sortList{display:flex;flex-direction:column;gap:8px;margin-bottom:14px}
.sortOpt{display:flex;align-items:center;gap:12px;min-height:54px;border:1px solid #d5dae1;background:#fff;border-radius:12px;text-align:right;padding:8px 14px;font-size:15px;color:inherit}
.sortOpt .radioMark{flex:none;width:20px;height:20px;border-radius:50%;border:2px solid #b6bec9;background:#fff;box-sizing:border-box}
.sortOpt.on{border-color:var(--blue);background:#eef3fd;color:var(--blue);font-weight:700}
.sortOpt.on .radioMark{border-color:var(--blue);border-width:6px}
/* v1.3.0 — ارسال صورتحساب به مشتری (SMS) */
.smsNotice{background:#fff7e6;color:#8a4b00;border:1px solid #f5d9a8;border-radius:10px;padding:10px 12px;font-size:14px;font-weight:700;margin-bottom:12px;line-height:1.7}
.smsSaveOpt{display:flex;align-items:center;gap:10px;min-height:44px;margin:-4px 0 8px;font-size:13.5px;color:var(--ink);cursor:pointer}
.smsSaveOpt input{flex:none;width:22px;height:22px;margin:0;padding:0;accent-color:var(--blue)}
.smsMode{margin-bottom:12px}
.smsMode button{font-size:13px;line-height:1.4;padding:4px 6px}
.smsBody{height:190px;font-size:14px;line-height:1.85;white-space:pre-wrap;resize:vertical;margin-bottom:4px}
.smsCounter{font-size:12.5px;color:var(--muted);text-align:left;margin-bottom:8px}
.smsCounter.long{color:var(--warn)}
.smsDesktopHint{background:#f1f5fb;color:#334155;border-radius:10px;padding:8px 12px;margin:0 0 10px}
.smsViewerNote{margin-top:-2px}
.actions .secondary{flex:1;min-height:47px;border:1px solid #d5dae1;background:#fff;color:var(--ink)}

/* ---------- v1.4.0 login footer ---------- */
main.screen-login{padding-bottom:0}
.authWrap{display:flex;flex-direction:column;min-height:calc(100vh - 14px);min-height:calc(100dvh - 14px)}
.authFooter{margin-top:auto;padding:22px 0 calc(12px + env(safe-area-inset-bottom));text-align:center;font-size:11px;color:#94a3b8;letter-spacing:0}

/* ---------- v1.4.0 subscription / read-only ---------- */
.subBanner{display:flex;align-items:center;justify-content:center;gap:10px;background:#fff4e5;color:#7c2d12;border-bottom:1px solid #fcd9b6;font-size:13px;padding:4px 12px;position:sticky;top:64px;z-index:4;line-height:1.6}
.subBanner span{font-weight:700}
.subBanner button{min-height:44px;border:0;background:transparent;color:var(--blue);font-weight:700;font-size:13.5px;padding:0 10px;text-decoration:underline;text-underline-offset:4px}
body.noHeader .subBanner{top:0}
.offlineBanner:not([hidden])+.subBanner{top:96px}
.backupNote{padding:12px 14px;margin-bottom:26px;background:#fff8ec;border-color:#fcd9b6}
.backupNote p{margin:0 0 8px;font-size:13.5px;line-height:1.8;color:#7c2d12}
.backupNote .actions .secondary{border:1px solid #d5dae1;background:#fff;font-size:14px}
.payResult{border-width:2px}
.payResult.ok{border-color:#9bd8b4;background:#f1fbf5}
.payResult.bad{border-color:#f3c4c4;background:#fff6f6}
.payResult h3{margin:0 0 6px}
.payResult.ok h3{color:var(--credit)}
.payResult.bad h3{color:var(--debit)}
.payResult p{margin:4px 0;font-size:14px;line-height:1.8}
.payResult .secondary{margin-top:8px;min-width:96px}
.menuBadge{font-style:normal;font-size:11px;background:#fde8e8;color:var(--debit);border-radius:999px;padding:2px 8px;margin-inline-start:auto}
a.menuItem{color:inherit;text-decoration:none}
.subHead{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px}
.subBiz{min-width:0}
.subBiz small{display:block;color:var(--muted);font-size:11.5px}
.subBiz b{font-size:16px;overflow-wrap:anywhere}
.subChip{flex:none;font-size:12px;font-weight:700;border-radius:999px;padding:5px 11px;white-space:nowrap}
.subChip.active{background:#e7f6ee;color:var(--credit)}
.subChip.expired{background:#fdecec;color:var(--debit)}
.subChip.none{background:#eef0f3;color:#475569}
.subPrice{margin:14px 0 4px;text-align:center;font-size:14px;color:#334155}
.subPrice b{font-size:22px;color:var(--navy)}
.subAction{margin-top:12px}
.subAction .primary{margin-top:2px}
.subNotice{background:#f8fafc;border:1px dashed #cbd5e1;border-radius:12px;padding:12px;font-size:13px;line-height:1.8;text-align:center;color:#475569;margin:0}
.subPayHint{text-align:center}

/* ---------- v1.5.0 calculator in money inputs ---------- */
.amountField{position:relative;display:block;min-width:0;margin-bottom:10px}
.amountField>input{margin-bottom:0}
.lineAmountWrap .amountField{flex:1;margin:0}
input.hasCalc{padding-left:48px}
.calcBtn{position:absolute;left:1px;top:50%;transform:translateY(-50%);width:44px;height:44px;padding:0;border:0;border-radius:9px;background:transparent;color:var(--blue);display:flex;align-items:center;justify-content:center}
.calcBtn:active{background:#e7eefc}
.calcGlyph{width:22px;height:22px;display:block}
.calcGlyph .cgBody{fill:none;stroke:currentColor;stroke-width:1.7}
.calcGlyph .cgScreen{fill:currentColor;opacity:.3}
.calcGlyph .cgKey{fill:currentColor}
.calcSheet h2{margin-bottom:10px}
.calcDisplay{background:#f1f5fb;border:1px solid #dfe7f3;border-radius:14px;padding:10px 14px;margin-bottom:12px;text-align:right;min-height:100px;display:flex;flex-direction:column;justify-content:flex-end;gap:2px}
.calcExpr{font-size:15px;color:var(--muted);line-height:1.7;overflow-wrap:anywhere;min-height:26px}
.calcResultRow{display:flex;justify-content:flex-end;align-items:center;gap:8px;min-width:0}
.calcResult{font-size:26px;font-weight:700;color:#475569;line-height:1.4;overflow-wrap:anywhere;min-width:0}
.calcResult.final{color:var(--ink)}
.calcResult.bad{color:var(--debit)}
.calcNote{flex:none;font-size:12px;background:#fff4e5;color:var(--warn);border-radius:999px;padding:2px 10px}
.calcError{direction:rtl;font-size:13px;color:#a61b1b;line-height:1.7}
.calcKeys{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin-bottom:12px}
.calcKey{min-height:54px;border:0;border-radius:12px;background:#f1f3f6;color:var(--ink);font-size:21px;font-weight:700;line-height:1}
.calcKey.op{background:#e7eefc;color:var(--blue);font-size:26px}
.calcKey.fn{background:#e2e8f0;color:#334155}
.calcKey.eq{background:var(--blue);color:#fff}
.calcKey:active{filter:brightness(.9)}
@media (max-height:640px){.calcKey{min-height:46px}.calcDisplay{min-height:84px}}
.calcKey.minus{font-family:Roboto,Arial,Helvetica,sans-serif;font-weight:400;font-size:30px}
/* v1.6.0 — «حالت نمایش» (ساده / حرفه‌ای): labels only */
.termAcc{display:inline-block;font-size:11px;font-weight:400;color:var(--muted);white-space:nowrap}
.sideToggle.simple .sideBtn{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;min-height:56px;padding:4px 6px;line-height:1.5;font-size:13.5px}
.sideToggle.simple .sideBtn.debit{color:var(--debit)}
.sideToggle.simple .sideBtn.credit{color:var(--credit)}
.sideToggle.simple .sideBtn .termAcc{font-size:10.5px}
.sideToggle.simple .sideBtn.on .termAcc{color:inherit;opacity:.8}
.sidePill.simple{display:inline-flex;flex-direction:column;align-items:flex-start;border-radius:10px;padding:3px 10px;line-height:1.5}
.detailMeta .sidePill .termMain{font-size:13.5px;color:inherit}
.sidePill.simple .termAcc{color:inherit;opacity:.75;font-size:10.5px}
.sumline>span{min-width:0}
.sumline .termAcc{margin-inline-start:2px}
.balanceBox.simple span{white-space:nowrap}
.termHint{margin:0;padding:2px 10px 9px;font-size:11px;line-height:1.8;color:var(--muted)}
.modeOpt{padding-top:10px;padding-bottom:10px}
.modeText{display:flex;flex-direction:column;gap:2px;min-width:0}
.modeText b{font-size:15px}
.modeText small{font-size:12px;line-height:1.7;color:var(--muted);font-weight:400}
.modeText .nw,.termHint .nw{white-space:nowrap}
/* v1.7.0 — account periods («بستن حساب») */
.prevPeriods{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;min-height:46px;margin:0 0 11px;padding:0 14px;border:1px solid #d5dfef;background:#f4f7fe;color:var(--blue);border-radius:12px;font-size:14px;font-weight:700;text-align:right}
.prevPeriods .arrow{font-size:22px;line-height:1;color:var(--blue)}
.prevPeriods:active{background:#e7eefc}
button.ledger-grid.carryRow{background:#f1f3f6}
button.ledger-grid.carryRow .cell{border-bottom-color:#dfe3e8}
.carryLabel{font-weight:700;color:#475569}
.carryFrom{display:inline-block;font-size:10.5px;color:var(--muted);white-space:nowrap}
.closeBlock{margin:2px 0 11px}
.closeBlock.prominent{background:#fff;border:1px solid #cfe3d8;border-radius:14px;padding:12px 14px;box-shadow:0 2px 8px #00000008}
.closeHint{margin:0 0 10px;font-size:13px;line-height:1.8;color:#1f5f3c}
.closeBtn{width:100%;min-height:50px;border:0;border-radius:12px;background:var(--credit);color:#fff;font-size:15px;font-weight:700}
.closeBtn:active{filter:brightness(.92)}
.closeBlock .secondary.full{margin-top:0;color:#334155;font-size:14px}
.closeNote{margin:8px 2px 0;font-size:12px;line-height:1.8;color:var(--muted);text-align:center}
.closeNote.warnText{color:var(--warn)}
.closeHead{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:-4px 0 8px}
.closeHead b{min-width:0;overflow-wrap:anywhere;font-size:15px}
.periodTag{flex:none;font-size:12px;font-weight:700;background:#e7eefc;color:var(--blue);border-radius:999px;padding:4px 11px;white-space:nowrap}
.closeTotals{background:#f8fafc;border:1px solid var(--line);border-radius:12px;padding:6px 12px;margin:10px 0}
.carryWarn{background:#fff7e6;color:#7c4a03;border:1px solid #f5d9a8;border-radius:10px;padding:9px 12px;font-size:13.5px;line-height:1.8;margin:0 0 6px}
.periodCard{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:10px;row-gap:3px;width:100%;border:0;background:#fff;padding:13px 14px;text-align:right;font-size:13px;border-radius:14px}
.periodCard:active{background:#f8fafc}
.periodCard>span:not(.arrow){grid-column:1}
.periodCard .arrow{grid-column:2;grid-row:1/span 5;align-self:center;font-size:25px;color:#777}
.pcTop{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:2px}
.pcName{font-size:15.5px}
.statusChip{flex:none;font-size:12px;font-weight:700;border-radius:999px;padding:3px 11px;white-space:nowrap}
.statusChip.debit{background:#fdecec;color:var(--debit)}
.statusChip.credit{background:#e7f6ee;color:var(--credit)}
.statusChip.zero{background:#eef0f3;color:#475569}
.pcRange{font-size:12px;color:var(--muted);margin-bottom:3px}
.pcLine{display:flex;justify-content:space-between;gap:8px;font-size:12.5px;line-height:1.7}
.pcLine>span{min-width:0;color:#475569}
.pcLine b{white-space:nowrap}
.pcBal{border-top:1px dashed #e5e7eb;padding-top:4px;margin-top:2px;font-weight:700}
.pcBal.debit b{color:var(--debit)}.pcBal.credit b{color:var(--credit)}.pcBal.zero b{color:var(--zero)}
.lockTag{flex:none;font-size:12px;font-weight:700;background:#eef0f3;color:#475569;border-radius:999px;padding:4px 11px;white-space:nowrap}
.lockNote{background:#f1f3f6;color:#475569;border-radius:10px;padding:8px 12px;font-size:12.5px;line-height:1.8;margin:0 0 11px}
.detailSheet .lockNote{margin-bottom:10px}
.autoNote{display:flex;flex-direction:column;gap:3px;background:#f1f3f6;border-radius:10px;padding:10px 12px;margin-bottom:10px;font-size:13px;line-height:1.8;color:#475569}
.autoNote b{color:var(--ink);font-size:14px}
.printTable tr.carryRow td{background:#f1f3f6!important;color:#475569}
.conflict.locked{border-color:#e5e7eb;background:#f8fafc}
.topSearch input[type=search]::-webkit-search-cancel-button{-webkit-appearance:none;appearance:none;display:none}

/* v1.8.0 reopened (editing) period */
.statusChip.editing,.lockTag.editing{background:#fff4e5;color:#b45309;border-color:#f5c27a}
.editNote{background:#fff4e5;color:#7c4a03;border:1px solid #f5c27a;border-radius:12px;padding:10px 12px;font-size:12.5px;line-height:1.9;margin:0 0 11px}
.segTabs{display:flex;gap:8px;margin-bottom:10px}

/* v1.9.0 support tickets — Telegram-like chat */
.ticketRow{width:100%;border:0;background:#fff;padding:14px;display:flex;align-items:center;gap:10px;text-align:right;border-radius:14px;font:inherit;color:inherit}
.trMain{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px}.trMain b{font-size:15px}.trMain small{color:var(--muted);font-size:12px}
.unreadDot{min-width:24px;height:24px;border-radius:12px;background:var(--blue);color:#fff;font-size:12px;display:flex;align-items:center;justify-content:center;padding:0 7px}
.menuBadge.newMsg{background:#e7eefc;color:var(--blue)}
.chatBox{display:flex;flex-direction:column;height:calc(100dvh - 64px - 28px);background:#e8eef6;border-radius:16px;overflow:hidden}
.chatList{flex:1;overflow-y:auto;padding:12px 10px;display:flex;flex-direction:column;gap:6px}
.chatEmpty{margin:auto;color:var(--muted);font-size:13px}
.chatDay{text-align:center;margin:6px 0}.chatDay span{background:#ffffffb0;color:#475569;font-size:11px;border-radius:999px;padding:3px 10px}
.bubble{max-width:82%;padding:8px 11px 5px;border-radius:16px;font-size:14px;line-height:1.8;box-shadow:0 1px 1px #0000000f;overflow-wrap:anywhere}
.bubble.me{align-self:flex-start;background:#dcf3d6;border-bottom-right-radius:4px}
.bubble.them{align-self:flex-end;background:#fff;border-bottom-left-radius:4px}
.bubble time{display:block;font-size:10.5px;color:#64748b;text-align:left;margin-top:2px}
.bubbleWho{display:block;color:var(--blue);font-weight:700;font-size:12px}
.chatInput{display:flex;gap:8px;align-items:flex-end;padding:8px;background:#fff;border-top:1px solid var(--line);margin:0}
.chatInput textarea{flex:1;min-height:44px;max-height:140px;resize:none;margin:0;border-radius:22px;padding:10px 14px;font:inherit;font-size:14px;border:1px solid #d5dae1;width:auto}
.chatSend{flex:none;width:46px;height:46px;border:0;border-radius:23px;background:var(--blue);color:#fff;font-size:18px;transform:scaleX(-1)}
.chatSend:disabled{opacity:.5}
.chatErr{margin:0;padding:6px 10px;font-size:12px;color:var(--debit);background:#fff}
.ticketHead{display:flex;align-items:center;gap:8px;margin-bottom:10px}.ticketHead b{flex:1;min-width:0;font-size:14px}
.subNotice.okNotice{background:#e7f6ee;color:#14532d;border-color:#b7e3c9}
.segTabs{display:flex;gap:8px;margin-bottom:10px}
.adminPage .chatBox{height:calc(100dvh - 250px)}
