:root{
  --ground:#F2F4F3; --card:#FFFFFF; --line:#DDE3E0; --line2:#C9D2CE; --ink:#14211D; --ink2:#3F4B47; --muted:#56635E;
  --accent:#0E6A55; --accent-d:#0A4F3F; --tint:#E3F1EC;
  --amber-bg:#FBEFD9; --amber:#8A4B05; --amber-line:#F0D3A1;
  --red-bg:#FBE6E3; --red:#A8261B; --red-line:#F1BDB6;
  --green-bg:#E2F2E8; --green:#17663F; --green-line:#B9DEC7;
  --gray-bg:#E8ECEA; --gray:#3F4B47;
  --r:14px; --nav:64px;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;background:var(--ground);color:var(--ink);font-family:'IBM Plex Sans Arabic','Segoe UI',Tahoma,sans-serif;font-size:15px;line-height:1.6}
body{min-height:100vh}
button,input,select,textarea{font:inherit;color:inherit}
a{color:var(--accent);text-decoration:none}
#app{max-width:560px;margin:0 auto;min-height:100vh;display:flex;flex-direction:column;padding-bottom:calc(var(--nav) + env(safe-area-inset-bottom) + 8px)}
.top{padding:calc(14px + env(safe-area-inset-top)) 16px 10px;display:flex;align-items:center;gap:6px}
.top h1{font-size:20px;margin:0;font-weight:700}
.top .sub{font-size:13px;color:var(--muted)}
.top .grow{flex:1;min-width:0}
.iconbtn{width:44px;height:44px;border:0;background:transparent;border-radius:12px;display:inline-flex;align-items:center;justify-content:center;color:var(--ink);cursor:pointer}
.avatar{width:44px;height:44px;border-radius:22px;background:var(--tint);color:var(--accent);display:flex;align-items:center;justify-content:center;font-weight:600}
.page{padding:0 16px 16px;display:flex;flex-direction:column;gap:12px}
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--r);padding:14px 16px}
.card.link{display:block;color:var(--ink)}
.row{display:flex;justify-content:space-between;align-items:center;gap:10px}
.col{display:flex;flex-direction:column;gap:2px;min-width:0}
.title{font-size:15px;font-weight:600}
.small{font-size:12.5px;color:var(--muted)}
.amount{font-size:17px;font-weight:700;white-space:nowrap}
.big{font-size:32px;font-weight:700;text-align:center}
.section{font-size:14px;font-weight:600;color:var(--muted);margin:6px 2px -2px}
.pill{display:inline-block;font-size:12px;font-weight:600;padding:3px 10px;border-radius:8px;white-space:nowrap}
.pill.gray{background:var(--gray-bg);color:var(--gray)}.pill.amber{background:var(--amber-bg);color:var(--amber)}
.pill.red{background:var(--red-bg);color:var(--red)}.pill.green{background:var(--green-bg);color:var(--green)}
.steps{display:flex;gap:4px;margin:10px 0}.steps i{flex:1;height:5px;border-radius:3px;background:var(--line)}
.steps i.on{background:var(--accent)}.steps.done i.on{background:var(--green)}.steps i.warn{background:#E7A23A}
.alert{border-radius:var(--r);padding:12px 14px;display:flex;gap:10px;align-items:flex-start;border:1px solid}
.alert.amber{background:var(--amber-bg);border-color:var(--amber-line);color:var(--amber)}
.alert.red{background:var(--red-bg);border-color:var(--red-line);color:var(--red)}
.alert.green{background:var(--green-bg);border-color:var(--green-line);color:var(--green)}
.alert .t{font-weight:600}.alert .d{font-size:13px;opacity:.95}
.grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}
.stat{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:10px 12px}
.stat b{display:block;font-size:22px;line-height:1.3}.stat span{font-size:12px;color:var(--muted)}
.btn{min-height:48px;border:0;border-radius:12px;background:var(--accent);color:#fff;font-weight:600;font-size:15px;display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:0 16px;cursor:pointer;width:100%}
.btn:active{background:var(--accent-d)}.btn[disabled]{opacity:.55}
.btn.sec{background:#fff;color:var(--ink);border:1px solid var(--line2);font-weight:500}
.btn.danger{background:#fff;color:var(--red);border:1px solid var(--red-line)}
.btn.small{min-height:40px;font-size:13.5px;width:auto}
.btns{display:flex;gap:8px}.btns>*{flex:1}
.fab{position:fixed;inset-inline:0;bottom:calc(var(--nav) + env(safe-area-inset-bottom) + 10px);max-width:560px;margin:0 auto;padding:0 16px;pointer-events:none}
.fab .btn{pointer-events:auto;box-shadow:0 6px 18px rgba(14,106,85,.25)}
.has-fab{padding-bottom:70px}
label.f{display:flex;flex-direction:column;gap:6px;font-size:14px;font-weight:600}
input.i,select.i,textarea.i{height:48px;border:1px solid var(--line2);border-radius:12px;padding:0 14px;background:#fff;font-size:15px;width:100%}
textarea.i{height:auto;min-height:72px;padding:10px 14px}
input.i:focus,select.i:focus,textarea.i:focus{outline:2px solid var(--accent);outline-offset:-1px;border-color:var(--accent)}
input.amt{font-size:22px;font-weight:700}
.hint{font-size:12.5px;color:var(--muted);font-weight:400}
.drop{min-height:72px;border:1.5px dashed #9FB1AA;border-radius:12px;background:#fff;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;font-size:13px;color:var(--ink2);cursor:pointer;padding:8px;text-align:center}
.drop.has{border-style:solid;border-color:var(--accent);background:var(--tint);color:var(--accent)}
.kv{display:flex;justify-content:space-between;gap:12px;font-size:13.5px;padding:7px 0;border-bottom:1px solid var(--line)}
.kv:last-child{border-bottom:0}.kv span:first-child{color:var(--muted)}.kv span:last-child{font-weight:500;text-align:left}
.ltr{direction:ltr;unicode-bidi:isolate}
.tl{display:flex;flex-direction:column}
.tl .s{display:flex;gap:12px}.tl .s .dot{display:flex;flex-direction:column;align-items:center}
.tl .s .dot i{width:24px;height:24px;border-radius:12px;border:2px solid var(--line2);display:flex;align-items:center;justify-content:center;box-sizing:border-box}
.tl .s.done .dot i{background:var(--accent);border-color:var(--accent);color:#fff}
.tl .s.warn .dot i{background:var(--amber-bg);border-color:#E7A23A}
.tl .s .dot b{width:2px;flex:1;min-height:14px;background:var(--line)}
.tl .s.done .dot b{background:var(--accent)}
.tl .s:last-child .dot b{display:none}
.tl .s .c{padding-bottom:12px}
.msg{background:#fff;border-radius:12px 12px 12px 4px;padding:10px 12px;font-size:13.5px;white-space:pre-line}
.listrow{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 0;border-bottom:1px solid var(--line);min-height:44px}
.listrow:last-child{border-bottom:0}
.bar{height:8px;border-radius:4px;background:var(--gray-bg);overflow:hidden}.bar i{display:block;height:100%;border-radius:4px}
.bars{display:flex;gap:10px;align-items:flex-end;height:140px;padding-top:10px}
.bars .m{flex:1;display:flex;flex-direction:column;align-items:center;gap:6px;min-width:0}
.bars .p{display:flex;gap:3px;align-items:flex-end;height:110px}.bars .p i{width:14px;border-radius:4px 4px 0 0}
.legend{display:flex;gap:12px;font-size:12px;color:var(--muted)}.legend i{display:inline-block;width:10px;height:10px;border-radius:3px;margin-inline-end:4px;vertical-align:-1px}
nav.tabs{position:fixed;bottom:0;inset-inline:0;background:#fff;border-top:1px solid var(--line);padding-bottom:env(safe-area-inset-bottom);z-index:5}
nav.tabs .in{max-width:560px;margin:0 auto;display:flex;height:var(--nav)}
nav.tabs a{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font-size:11.5px;color:var(--muted);position:relative}
nav.tabs a.on{color:var(--accent);font-weight:600}
nav.tabs .badge{position:absolute;top:6px;inset-inline-start:calc(50% + 6px);background:var(--red);color:#fff;font-size:10.5px;min-width:18px;height:18px;border-radius:9px;display:flex;align-items:center;justify-content:center;padding:0 4px}
.toast{position:fixed;top:calc(12px + env(safe-area-inset-top));inset-inline:12px;max-width:520px;margin:0 auto;background:var(--ink);color:#fff;border-radius:12px;padding:12px 14px;font-size:14px;z-index:20;transition:opacity .3s}
.toast.err{background:var(--red)}
.busy{position:fixed;inset:0;background:rgba(20,33,29,.45);display:flex;align-items:center;justify-content:center;z-index:30}
.busy div{background:#fff;border-radius:14px;padding:18px 22px;display:flex;gap:12px;align-items:center;font-weight:500}
.spin{width:22px;height:22px;border:3px solid var(--tint);border-top-color:var(--accent);border-radius:50%;animation:sp 0.8s linear infinite}
@keyframes sp{to{transform:rotate(360deg)}}
.empty{text-align:center;color:var(--muted);padding:28px 12px;font-size:14px}
.seg{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;background:#fff;border:1px solid var(--line);border-radius:12px;padding:5px}
.seg button{min-height:40px;border:0;border-radius:9px;background:transparent;font-weight:500;cursor:pointer}
.seg button.on{background:var(--accent);color:#fff}
.switch{width:48px;height:28px;border-radius:14px;background:var(--line2);border:0;padding:3px;display:flex;cursor:pointer;flex-shrink:0}
.switch i{width:22px;height:22px;border-radius:11px;background:#fff;display:block}
.switch.on{background:var(--accent);justify-content:flex-end}
.login{min-height:100vh;display:flex;flex-direction:column;justify-content:center;padding:24px 20px;gap:14px;max-width:420px;margin:0 auto}
.logo{width:64px;height:64px;border-radius:18px;background:var(--accent);display:flex;align-items:center;justify-content:center;margin-bottom:6px}
code{font-family:inherit;background:var(--gray-bg);padding:0 4px;border-radius:4px}
@media (prefers-reduced-motion:reduce){.spin{animation:none}}
.card.link.row{display:flex}
.listrow code{display:block;white-space:pre-line;background:var(--tint);padding:8px 10px;border-radius:8px;margin-top:6px;font-size:13px}
#job{display:flex;flex-direction:column;gap:10px}
.dropzone{display:none;min-height:84px;border:2px dashed #9FB1AA;border-radius:14px;background:#fff;color:var(--ink2);flex-direction:column;align-items:center;justify-content:center;gap:6px;font-size:14px;text-align:center;padding:10px;cursor:pointer}
@media (hover:hover) and (pointer:fine){.dropzone{display:flex}}
.dropzone[data-drop=import]{display:flex}
[data-drop].over,.dropzone.over{border-color:var(--accent);background:var(--tint);color:var(--accent)}
body.dragging #app [data-drop]{outline:2px dashed var(--accent);outline-offset:3px}

details.confirm{padding:12px 14px}
details.confirm summary{cursor:pointer;font-size:14px;color:var(--muted);list-style:none;min-height:24px}
details.confirm summary::-webkit-details-marker{display:none}
details.confirm summary b{color:var(--accent)}
.toast{white-space:pre-line}
.linkbtn{border:0;background:none;padding:4px 0;font:inherit;color:var(--ink);display:inline-flex;align-items:center;gap:6px;cursor:pointer;min-height:32px}
.linkbtn svg{width:14px;height:14px;color:var(--accent)}

.vpick{position:relative}
.vlist{position:absolute;inset-inline:0;top:calc(100% + 4px);z-index:30;background:var(--card,#fff);border:1px solid var(--line);border-radius:12px;
  box-shadow:0 8px 24px rgba(0,0,0,.12);max-height:300px;overflow:auto;padding:4px}
.vopt{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;min-height:44px;padding:8px 10px;border:0;background:none;
  font:inherit;color:var(--ink);text-align:start;border-radius:8px;cursor:pointer}
.vopt:hover,.vopt:focus,.vopt.hl{background:var(--ground)}
.vopt .small{color:var(--muted)}
.vopt.new{flex-direction:row;align-items:center;color:var(--accent);font-weight:600}
.vopt.new svg{width:16px;height:16px}
