/* Clinova Easy — الألوان: أخضر غامق + ذهبي */
:root{
  --ink:#13201C; --muted:#55645F; --soft:#3D4B46; --line:#DCE4E0; --line2:#EEF2F0;
  --bg:#F3F6F4; --card:#fff; --brand:#0B6B4F; --brand-d:#08513C; --side:#0B3B2E; --side2:#1F5646;
  --gold:#F5B841; --mint:#E1F3EA; --mint-t:#0B5A41; --red:#9B1C14; --red-bg:#FDE8E7;
  --r:12px;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{font-family:'IBM Plex Sans Arabic',Tahoma,sans-serif;background:var(--bg);color:var(--ink);font-size:15px}
button,input,select,textarea{font-family:inherit;font-size:15px;color:inherit}
button{cursor:pointer}
a{color:var(--brand)}
h1,h2,h3{margin:0}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}

/* الهيكل */
.shell{display:flex;height:100vh;height:100dvh;overflow:hidden}
.side{flex:0 0 150px;background:var(--side);color:#fff;display:flex;flex-direction:column;gap:12px;padding:16px 14px;overflow-y:auto}
.brand{display:flex;align-items:center;gap:10px;padding:2px 2px 6px}
.logo{width:40px;height:40px;border-radius:12px;background:var(--gold);color:var(--side);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:20px;flex:none}
.brand b{display:block;font-size:16px}.brand small{color:var(--gold);font-weight:600;font-size:13px}
/* الأزرار المربعة الكبيرة */
.tiles{display:flex;flex-direction:column;gap:12px}
.tile{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;height:clamp(84px,calc((100vh - 250px) / var(--n,5) - 12px),136px);flex:none;border-radius:20px;color:#fff;text-decoration:none;font-size:16px;font-weight:700;text-align:center;line-height:1.2;padding:8px;box-shadow:inset 0 -5px 0 rgba(0,0,0,.18);transition:transform .12s,filter .12s}
.tile:hover{filter:brightness(1.1)}
.tile:active{transform:scale(.97)}
.tile.on{outline:4px solid var(--gold);outline-offset:3px}
.t-appointments{background:#8A4466}
.t-patients{background:#35587A}
.t-today{background:#1F7A66}
.t-finance{background:#A8731F}
.t-settings,.t-account{background:#5E5247}
.t-admin{background:#1F7A66}
.t-notes{background:#6B7A2E}
.tile .badge{position:absolute;top:8px;left:8px;margin:0;min-width:26px;height:26px;border-radius:13px;font-size:14px;box-shadow:0 0 0 3px var(--side)}
.me{margin-top:auto;display:flex;flex-direction:column;align-items:center;gap:4px;padding-top:10px;border-top:1px solid var(--side2);text-align:center}
.me .av{width:38px;height:38px;border-radius:50%;background:var(--side2);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:18px;flex:none}
.me b{font-size:14px;display:block}
.me small{display:block;color:#B9D3C9;font-size:12px}
.mebtns{display:flex;gap:6px;justify-content:center;flex-wrap:wrap}
.me button{display:flex;align-items:center;gap:6px;background:none;border:1px solid var(--side2);color:#CFE3DA;padding:0 12px;min-height:40px;border-radius:10px;font-size:13px}
.me button:hover{background:var(--side2);color:#fff}
/* زر الإضافة الكبير */
.fab{position:fixed;left:28px;bottom:28px;width:84px;height:84px;border-radius:50%;border:0;background:var(--brand);color:#fff;display:flex;align-items:center;justify-content:center;box-shadow:0 10px 28px rgba(11,59,46,.35),inset 0 -5px 0 rgba(0,0,0,.18);z-index:30;transition:transform .12s}
.fab:hover{background:var(--brand-d);transform:scale(1.05)}
.fab:active{transform:scale(.96)}
.fab span{position:absolute;bottom:100%;margin-bottom:8px;background:var(--ink);color:#fff;font-size:13px;font-weight:600;padding:4px 10px;border-radius:8px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s}
.fab:hover span,.fab:focus-visible span{opacity:1}
.main{flex:1;min-width:0;overflow-y:auto;padding:24px 28px 120px}
.bottom{display:none}

/* عناصر عامة */
.head{display:flex;flex-wrap:wrap;align-items:center;gap:12px;margin-bottom:18px}
.head .title{margin-left:auto}
.head h1{font-size:26px}
.sub{font-size:14px;color:var(--muted)}
.btn{height:46px;padding:0 18px;border-radius:var(--r);border:1px solid var(--line);background:#fff;font-weight:600;display:inline-flex;align-items:center;justify-content:center;gap:8px;text-decoration:none;color:var(--ink);white-space:nowrap}
.btn:hover{border-color:#B9C9C2}
.btn.pri{background:var(--brand);border-color:var(--brand);color:#fff}
.btn.pri:hover{background:var(--brand-d)}
.btn.gold{background:var(--gold);border-color:var(--gold);color:var(--side);font-weight:700}
.btn.danger{color:var(--red);border-color:#F3D0CC}
.btn.sm{height:40px;padding:0 12px;font-size:14px}
.btn.icon{width:46px;padding:0}
.btn:disabled{opacity:.5;cursor:default}
.card{background:var(--card);border:1px solid var(--line);border-radius:18px;padding:16px 20px}
.card h2{font-size:17px;margin-bottom:10px}
.search{display:flex;align-items:center;gap:8px;background:#fff;border:1px solid var(--line);border-radius:var(--r);padding:0 12px;height:46px;min-width:240px}
.search input{border:0;outline:0;flex:1;min-width:0;background:transparent}
.chips{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.chip{height:42px;padding:0 16px;border-radius:21px;border:1px solid var(--line);background:#fff;font-weight:600;font-size:14px}
.chip.on{background:var(--brand);border-color:var(--brand);color:#fff}
.pill{display:inline-block;font-size:12px;font-weight:600;padding:3px 10px;border-radius:20px;white-space:nowrap}
.pill.green{background:var(--mint);color:var(--mint-t)}
.pill.red{background:var(--red-bg);color:var(--red)}
.pill.grey{background:#EEF1F0;color:var(--soft)}
.empty{color:#6B7A75;text-align:center;padding:24px 0;font-size:14px}
.row{display:flex;flex-wrap:wrap;gap:16px;align-items:flex-start}
.grow{flex:999 1 420px;min-width:0}
.aside{flex:1 1 300px;display:flex;flex-direction:column;gap:16px;min-width:0}
.kv{display:flex;justify-content:space-between;gap:8px;font-size:15px;padding:4px 0}
table{width:100%;border-collapse:collapse;font-size:14px}
th{font-weight:500;color:var(--muted);text-align:right;padding:10px 8px;border-bottom:1px solid #E4EBE7}
td{padding:11px 8px;border-bottom:1px solid var(--line2);text-align:right}
.tablewrap{overflow-x:auto}
.money{font-variant-numeric:tabular-nums;white-space:nowrap}
.neg{color:var(--red)}

/* الحقول */
.form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.form .full{grid-column:1/-1}
.field{display:flex;flex-direction:column;gap:6px}
.field label{font-size:14px;font-weight:600}
.field input,.field select,.field textarea{height:46px;border:1px solid var(--line);border-radius:var(--r);padding:0 12px;background:#fff;outline:0;width:100%}
.field textarea{height:auto;min-height:80px;padding:10px 12px;resize:vertical}
.field input:focus,.field select:focus,.field textarea:focus{border-color:var(--brand);box-shadow:0 0 0 3px rgba(11,107,79,.15)}
.seg{display:flex;gap:6px;flex-wrap:wrap}
.seg label{flex:1;min-width:90px;position:relative}
.seg input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
.seg span{display:flex;align-items:center;justify-content:center;height:44px;border:1px solid var(--line);border-radius:var(--r);font-weight:600;font-size:14px;cursor:pointer;background:#fff}
.seg input:checked+span{background:var(--brand);border-color:var(--brand);color:#fff}
.seg input:focus-visible+span{outline:2px solid var(--brand);outline-offset:2px}

/* المواعيد */
.week{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(132px,100%),1fr));gap:10px}
.day{background:#fff;border:1px solid var(--line);border-radius:16px;overflow:hidden;display:flex;flex-direction:column;min-height:180px}
.day.today{border:2px solid var(--brand)}
.day .dh{display:flex;align-items:baseline;justify-content:space-between;padding:10px 14px;background:#F7FAF8;border-bottom:1px solid #E4EBE7}
.day.today .dh{background:var(--brand);color:#fff}
.day .dh b{font-size:22px}
.day .list{display:flex;flex-direction:column;gap:8px;padding:8px;flex:1}
.day .add{border:1px dashed #C6D3CD;background:none;border-radius:10px;min-height:40px;color:var(--muted);font-size:14px}
.day .add:hover{border-color:var(--brand);color:var(--brand)}
.appt{text-align:right;display:flex;flex-direction:column;align-items:flex-start;gap:3px;padding:10px 12px;border-radius:12px;border:0;border-top:4px solid}
.appt b{font-size:15px}
.appt span{font-size:13px;color:var(--soft)}
.appt small{font-size:12px;color:var(--muted)}
.st-booked{background:#EAF0FB;border-color:#3B5BDB}.st-booked .s{color:#1E3A8A}
.st-waiting{background:#FFF4DB;border-color:#E59A1A}.st-waiting .s{color:#8A4B05}
.st-inside{background:#E1F3EA;border-color:#0B6B4F}.st-inside .s{color:#0B5A41}
.st-done{background:#EEF1F0;border-color:#8C9A95}.st-done .s{color:#3D4B46}
.st-noshow{background:#FDE8E7;border-color:#D93A2B}.st-noshow .s{color:#9B1C14}
.appt .s{font-size:12px;font-weight:600}
.lg-booked{background:#3B5BDB}.lg-waiting{background:#E59A1A}.lg-inside{background:#0B6B4F}.lg-done{background:#8C9A95}.lg-noshow{background:#D93A2B}
.legend{display:flex;flex-wrap:wrap;gap:14px;font-size:13px;color:var(--soft);margin-right:auto}
.legend i{display:inline-block;width:10px;height:10px;border-radius:3px;margin-left:6px;vertical-align:middle}
.status-btns{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:8px}
.status-btns button{min-height:48px;border-radius:var(--r);border:0;border-top:4px solid;font-weight:600}
.status-btns button.on{outline:3px solid var(--ink);outline-offset:1px}

/* المرضى */
.plist .p{display:flex;align-items:center;gap:14px;padding:12px 4px;border-bottom:1px solid var(--line2);text-decoration:none;color:inherit}
.plist .p:hover{background:#F7FAF8}
.pav{width:46px;height:46px;border-radius:14px;background:var(--mint);color:var(--mint-t);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:20px;flex:none}
.pinfo{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.pinfo b{font-size:16px}
.pinfo span{font-size:13px;color:var(--muted)}
.phead{display:flex;flex-wrap:wrap;align-items:center;gap:18px;margin-bottom:16px}
.phead .pav{width:72px;height:72px;border-radius:20px;font-size:30px}
.tabs{display:flex;gap:4px;border-bottom:1px solid #E4EBE7;margin:-8px 0 8px;overflow-x:auto}
.tabs button{height:48px;padding:0 14px;border:0;background:none;color:var(--muted);border-bottom:3px solid transparent;margin-bottom:-1px;white-space:nowrap}
.tabs button.on{color:var(--mint-t);font-weight:700;border-bottom-color:var(--brand)}
.visit{display:flex;gap:14px;padding:14px 0;border-bottom:1px solid var(--line2);align-items:flex-start}
.vdate{flex:0 0 64px;display:flex;flex-direction:column;align-items:center;background:var(--bg);border-radius:12px;padding:6px 0}
.vdate b{font-size:20px}.vdate small{font-size:12px;color:var(--muted)}
.vbody{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px}
.vbody .t{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.vbody .t b{font-size:16px}
.tag{font-size:12px;background:#EAF0FB;color:#1E3A8A;padding:2px 8px;border-radius:8px}
.vbody p{margin:0;font-size:14px;color:var(--soft);white-space:pre-line}
.vbody small{font-size:12px;color:var(--muted)}
.vend{display:flex;flex-direction:column;align-items:flex-end;gap:4px}
.del{background:none;border:0;color:#9AA7A2;padding:6px;border-radius:8px;font-size:13px}
.del:hover{color:var(--red);background:var(--red-bg)}
.account{background:var(--side);color:#fff;border-radius:18px;padding:18px 20px;display:flex;flex-direction:column;gap:10px}
.account h2{font-size:16px;font-weight:600;color:#CFE3DA}
.account .rest{display:flex;justify-content:space-between;align-items:baseline;border-top:1px solid var(--side2);padding-top:10px}
.account .rest b{font-size:24px;color:var(--gold)}
.quick{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.quick button{min-height:56px;border-radius:12px;border:1px solid #CFE3DA;background:#F5FAF7;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;padding:6px}
.quick button b{font-size:14px}.quick button small{font-size:12px;color:var(--mint-t)}
.quick button:hover{border-color:var(--brand)}

/* الإحصائيات */
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(210px,100%),1fr));gap:12px;margin-bottom:16px}
.stat{background:#fff;border:1px solid var(--line);border-radius:16px;padding:16px 18px;display:flex;flex-direction:column;gap:4px}
.stat span{font-size:14px;color:var(--muted)}
.stat b{font-size:24px}
.stat small{font-size:13px;color:var(--muted)}
.stat.dark{background:var(--side);border-color:var(--side);color:#fff}
.stat.dark span,.stat.dark small{color:#CFE3DA}.stat.dark b{color:var(--gold)}
.bar{height:8px;background:var(--line2);border-radius:4px;overflow:hidden;margin-top:6px}
.bar i{display:block;height:100%;background:var(--brand);border-radius:4px}

/* النوافذ */
.modal-bg{position:fixed;inset:0;background:rgba(11,32,26,.45);display:flex;align-items:flex-start;justify-content:center;padding:40px 16px;overflow-y:auto;z-index:50}
.modal{background:#fff;border-radius:20px;width:100%;max-width:560px;padding:20px 22px;box-shadow:0 20px 60px rgba(0,0,0,.2)}
.modal.wide{max-width:760px}
.modal .mh{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}
.modal .mh h2{font-size:19px}
.modal .mf{display:flex;flex-wrap:wrap;gap:10px;margin-top:18px}
#toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%) translateY(120px);background:var(--ink);color:#fff;padding:12px 20px;border-radius:12px;font-weight:600;transition:transform .25s;z-index:60;max-width:90vw}
#toast.show{transform:translateX(-50%) translateY(0)}
#toast.err{background:var(--red)}
.ac{position:relative}
.ac-list{position:absolute;top:100%;right:0;left:0;background:#fff;border:1px solid var(--line);border-radius:12px;margin-top:4px;box-shadow:0 10px 30px rgba(0,0,0,.08);z-index:5;max-height:240px;overflow-y:auto}
.ac-list button{display:flex;justify-content:space-between;width:100%;text-align:right;padding:10px 12px;border:0;background:none;min-height:44px}
.ac-list button:hover,.ac-list button:focus{background:var(--bg)}

/* الدخول */
.login{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px;background:var(--side)}
.login form{background:#fff;border-radius:24px;padding:32px 28px;width:100%;max-width:400px;display:flex;flex-direction:column;gap:14px}
.login .brand{color:var(--ink);padding:0 0 8px}
.login .err{color:var(--red);font-size:14px;min-height:20px}

/* الوصفة */
.rx-items .it{display:flex;align-items:center;gap:10px;padding:10px 0;border-bottom:1px solid var(--line2)}
.rx-items .it .f{flex:1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.rx-items input{height:44px;border:1px solid var(--line);border-radius:10px;padding:0 10px;width:100%}
.rx-paper{background:#fff;border-radius:6px;box-shadow:0 8px 30px rgba(11,59,46,.12);display:flex;flex-direction:column;overflow:hidden;aspect-ratio:148/210}
.rx-paper .top{background:var(--side);color:#fff;padding:18px 22px;display:flex;justify-content:space-between;align-items:center}
.rx-paper .top b{font-size:18px;display:block}.rx-paper .top small{color:#CFE3DA;font-size:13px}
.rx-paper .bd{padding:16px 22px;display:flex;flex-direction:column;gap:10px;flex:1}
.rx-paper .who{display:flex;flex-wrap:wrap;justify-content:space-between;gap:8px;font-size:13px;border-bottom:1px solid #E4EBE7;padding-bottom:10px}
.rx-paper .rx{font-size:28px;font-weight:700;color:var(--brand);font-family:Georgia,serif}
.rx-paper .m b{display:block;font-size:14px;direction:ltr;text-align:left}
.rx-paper .m small{font-size:12px;color:var(--soft)}
.rx-paper .sig{margin-top:auto;display:flex;justify-content:flex-end;font-size:12px;color:var(--muted)}
.rx-paper .sig span{border-top:1px solid #8C9A95;padding-top:4px;width:140px;text-align:center}
.rx-paper .ft{background:var(--bg);padding:8px 22px;font-size:11px;color:var(--soft);display:flex;justify-content:space-between;gap:8px}

/* التابلت: مربعات أصغر */
@media (min-width:761px) and (max-width:1100px){
  .side{flex-basis:108px;padding:12px 10px;gap:10px}
  .brand{justify-content:center}
  .brand>div:not(.logo),.me>div:not(.av),.me button span{display:none}
  .tile{font-size:13px;border-radius:16px;gap:6px;height:clamp(76px,calc((100vh - 200px) / var(--n,5) - 10px),100px)}
  .tile svg{width:32px;height:32px}
  .main{padding:20px 18px 120px}
}

/* الموبايل */
@media (max-width:760px){
  .side{display:none}
  .main{padding:16px 14px 100px}
  .head h1{font-size:22px}
  .search{min-width:0;flex:1 1 100%}
  .bottom{display:grid;grid-template-columns:repeat(var(--n,5),minmax(0,1fr));position:fixed;bottom:0;right:0;left:0;height:72px;gap:6px;padding:6px 6px 0;background:#fff;border-top:1px solid var(--line);z-index:40;padding-bottom:env(safe-area-inset-bottom)}
  .bottom a{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;text-decoration:none;color:#fff;font-size:10.5px;text-align:center;line-height:1.15;font-weight:700;border-radius:12px;height:58px;opacity:.85}
  .bottom a.on{opacity:1;outline:3px solid var(--gold);outline-offset:-3px}
  .fab{width:66px;height:66px;left:16px;bottom:88px}
  .fab svg{width:32px;height:32px}
  .form{grid-template-columns:1fr}
  .modal-bg{padding:12px 8px}
  .rx-items .it .f{grid-template-columns:1fr}
}

/* الاستقبال والدفع */
.nav a,.bottom a{position:relative}
.badge{background:#D93A2B;color:#fff;font-size:12px;font-weight:700;min-width:22px;height:22px;border-radius:11px;display:inline-flex;align-items:center;justify-content:center;padding:0 6px;margin-right:auto}
.bottom .badge{position:absolute;top:6px;left:calc(50% - 22px);margin:0}
.paybox{background:#FFF8E6;border:2px solid #F5B841;border-radius:18px;padding:16px 20px;margin-bottom:16px}
.paybox h2{font-size:17px;margin-bottom:10px}
.paybox .empty{padding:10px 0}
.paylist{display:flex;flex-direction:column;gap:10px}
.paycard{background:#fff;border-radius:14px;padding:14px 16px;display:flex;flex-wrap:wrap;align-items:center;gap:14px;box-shadow:0 1px 0 #EEDCAA}
.paycard .pinfo a{text-decoration:none;color:inherit}
.paycard .due{display:flex;flex-direction:column;align-items:center;min-width:140px}
.paycard .due span{font-size:13px;color:var(--muted)}
.paycard .due b{font-size:24px;color:var(--mint-t)}
.payact{display:flex;flex-wrap:wrap;gap:8px}
.trow{display:flex;flex-wrap:wrap;align-items:center;gap:10px 16px;padding:12px 0;border-bottom:1px solid var(--line2)}
.trow .tt{min-width:70px;font-weight:600}
.trow .tp{flex:1;min-width:160px;display:flex;flex-direction:column;gap:2px}
.trow .tp a{text-decoration:none;color:inherit}
@media (max-width:760px){.trow .chips{width:100%;flex-wrap:nowrap}.trow .chip{flex:1;padding:0 4px;font-size:13px;white-space:nowrap}}
.sendbox{background:#fff;border:2px solid var(--brand);border-radius:18px;padding:14px 16px;display:flex;flex-direction:column;gap:10px}
.sendbox.wait{border-color:#F5B841;background:#FFF8E6;flex-direction:row;justify-content:space-between;align-items:center}

/* مخطط الأسنان */
.chart-editor{display:flex;flex-direction:column}
.chart-editor:fullscreen{background:var(--bg);padding:16px;overflow:auto}
.chart-editor:fullscreen .head{display:none}
.ctools{display:flex;flex-wrap:wrap;gap:12px;align-items:center;justify-content:space-between;background:#fff;border:1px solid var(--line);border-radius:16px;padding:10px 12px;margin-bottom:12px}
.sw{width:44px;height:44px;border-radius:50%;border:3px solid #fff;box-shadow:0 0 0 1px var(--line)}
.sw.on{box-shadow:0 0 0 3px var(--ink)}
.sz{width:44px;height:44px;border-radius:12px;border:1px solid var(--line);background:#fff;display:flex;align-items:center;justify-content:center}
.sz i{display:block;border-radius:50%;background:var(--ink)}
.sz.on,.btn.icon.on{background:var(--mint);border-color:var(--brand)}
.chart-wrap{position:relative;width:100%;aspect-ratio:1200/640;border-radius:16px;overflow:hidden;border:1px solid var(--line);background:#F2F8FC;direction:ltr}
.chart-wrap canvas{position:absolute;inset:0;width:100%;height:100%}
#dr{touch-action:none;cursor:crosshair}
.chart-editor:fullscreen .chart-wrap{max-height:calc(100vh - 180px);width:auto;margin:0 auto}
.cfoot{display:flex;flex-wrap:wrap;gap:10px;align-items:flex-end;margin-top:12px}
.charts{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(260px,100%),1fr));gap:12px;padding-bottom:8px}
.chart-card{margin:0;border:1px solid var(--line);border-radius:14px;overflow:hidden;background:#fff}
.chart-card img{display:block;width:100%;aspect-ratio:1200/640;object-fit:cover;background:#F2F8FC}
.chart-card figcaption{padding:10px 12px;display:flex;flex-direction:column;gap:8px}
.chart-card b{display:block;font-size:15px}.chart-card small{font-size:12px;color:var(--muted)}
.chart-card p{margin:4px 0 0;font-size:13px;color:var(--soft)}
.chart-paper{background:#fff;border-radius:8px;box-shadow:0 8px 30px rgba(11,59,46,.12);overflow:hidden;max-width:900px;display:flex;flex-direction:column}
.chart-paper .top{background:var(--side);color:#fff;padding:14px 22px;display:flex;justify-content:space-between;align-items:center}
.chart-paper .top b{font-size:18px;display:block}.chart-paper .top small{color:#CFE3DA;font-size:13px}
.chart-paper .who{display:flex;flex-wrap:wrap;gap:16px;padding:12px 22px;font-size:14px;border-bottom:1px solid #E4EBE7}
.chart-paper img{display:block;width:100%}
.chart-paper .note{margin:0;padding:10px 22px;font-size:14px;color:var(--soft);white-space:pre-line}
.chart-paper .ft{background:var(--bg);padding:8px 22px;font-size:11px;color:var(--soft);display:flex;justify-content:space-between;gap:8px}

/* صورة المريض */
.pav{overflow:hidden}
.pav.has-photo{background:#E8EEEB;padding:0}
.pav img{width:100%;height:100%;object-fit:cover;display:block}
.avbtn{position:relative;border:0;background:none;padding:0;border-radius:20px;cursor:pointer}
.avbtn .cam{position:absolute;bottom:-4px;left:-4px;width:30px;height:30px;border-radius:50%;background:var(--brand);color:#fff;display:flex;align-items:center;justify-content:center;border:2px solid #fff}
.pav.big{width:160px;height:160px;border-radius:28px;font-size:60px}
.fab2{width:60px;height:60px;bottom:126px;left:40px;background:#fff;color:var(--ink);border:2px solid var(--line)}
.fab2:hover{background:var(--mint)}
@media (max-width:760px){.fab2{width:52px;height:52px;left:23px;bottom:166px}}

/* معرض الأشعة */
.gallery{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(170px,100%),1fr));gap:10px;padding-bottom:8px}
.gimg{border:1px solid var(--line);background:#fff;border-radius:14px;overflow:hidden;padding:0;text-align:right;display:flex;flex-direction:column}
.gimg img{width:100%;aspect-ratio:4/3;object-fit:cover;background:#111;display:block}
.gimg span{padding:8px 10px;font-size:13px;display:flex;flex-direction:column;gap:2px}
.gimg small{color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.gimg:hover{border-color:var(--brand)}
.viewer{position:fixed;inset:0;background:#0B0F0E;z-index:70;display:flex;flex-direction:column;color:#fff}
.vtop{display:flex;justify-content:space-between;align-items:center;padding:10px 14px;gap:10px}
.vinfo{font-size:14px;color:#CFD8D5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.vstage{flex:1;overflow:hidden;display:flex;align-items:center;justify-content:center;touch-action:none;cursor:grab;min-height:0}
.vstage img{max-width:100%;max-height:100%;user-select:none;transform-origin:center;will-change:transform}
.vb{min-width:44px;height:44px;border-radius:12px;border:1px solid #2A3532;background:#151C1A;color:#fff;display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:0 12px;font-weight:600;font-size:14px;text-decoration:none}
.vb:hover,.vb.on{background:#24302D;border-color:#3D4B46}
.vb.danger{color:#FF9B91}
.vnav{position:absolute;top:50%;transform:translateY(-50%);width:52px;height:52px;border-radius:50%}
.vprev{right:12px}.vnext{left:12px}
.vtools{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;align-items:center;padding:10px 12px calc(10px + env(safe-area-inset-bottom));background:#101614}
.vsl{display:flex;align-items:center;gap:6px;font-size:13px;color:#CFD8D5}
.vsl input{width:110px;accent-color:var(--gold)}

/* الملاحظات */
.notes{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(250px,100%),1fr));gap:14px}
.nt{border-radius:16px;padding:14px 16px;display:flex;flex-direction:column;gap:8px;min-height:150px;box-shadow:0 2px 0 rgba(0,0,0,.06)}
.nt p{margin:0;font-size:15px;white-space:pre-line;flex:1;line-height:1.6}
.nt.done{opacity:.55}.nt.done p{text-decoration:line-through}
.nt .ntop{display:flex;gap:6px;align-items:center;min-height:4px}
.nt footer{display:flex;justify-content:space-between;align-items:center;gap:6px}
.nt small{color:var(--soft);font-size:12px;white-space:nowrap}
.nt footer{flex-wrap:wrap}
.nb{min-width:40px;height:40px;border-radius:10px;border:0;background:rgba(255,255,255,.6);display:inline-flex;align-items:center;justify-content:center;padding:0 10px;font-size:13px;font-weight:600}
.nb:hover{background:#fff}
.swn{position:relative}.swn input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}.swn span{display:block;width:44px;height:44px;border-radius:12px;border:2px solid var(--line);cursor:pointer}
.swn input:checked+span{border:3px solid var(--ink)}.swn input:focus-visible+span{outline:2px solid var(--brand)}
/* العدد */
.qty{display:flex;gap:6px;align-items:center}.qty input{width:70px;text-align:center}
/* التحديد والواتساب الجماعي */
.prow{display:flex;align-items:center;gap:6px}.prow .p{flex:1;min-width:0}
.pcheck{display:flex;align-items:center;justify-content:center;width:44px;height:44px}.pcheck input{width:22px;height:22px}
.selbar{position:sticky;top:0;z-index:5;display:flex;flex-wrap:wrap;align-items:center;gap:10px;background:#E1F3EA;border:2px solid var(--brand);border-radius:14px;padding:8px 12px;margin-bottom:12px}
.wq{display:flex;flex-direction:column;max-height:46vh;overflow-y:auto;border:1px solid var(--line);border-radius:12px}
.wrow{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:8px 12px;border-bottom:1px solid var(--line2)}
.wrow.sent{background:#F3F6F4;opacity:.7}
.plan-done .vbody b{color:var(--muted)}

/* العلامات الحيوية */
.vchips{display:flex;flex-wrap:wrap;gap:8px}
.vc{display:flex;flex-direction:column;align-items:center;background:#F3F6F4;border-radius:10px;padding:4px 12px;min-width:64px}
.vc small{font-size:11px;color:var(--muted)}.vc b{font-size:15px}
.vc.hi{background:var(--red-bg)}.vc.hi b{color:var(--red)}
.vgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(220px,100%),1fr));gap:10px;margin-bottom:12px}
.vchart{padding:12px 14px}.vchart h3{font-size:14px;margin-bottom:6px}
.spark-lbl{display:flex;justify-content:space-between;font-size:11px;color:var(--muted);direction:ltr}
.labres{display:flex;flex-wrap:wrap;gap:6px 14px;font-size:14px}
/* الباقات */
.pkg{border:1px solid var(--line);border-radius:14px;padding:12px 14px;margin:8px 0;display:flex;flex-direction:column;gap:10px}
.pkg.done{opacity:.65}
.pkh{display:flex;flex-wrap:wrap;justify-content:space-between;gap:8px;align-items:center}
.dots{display:flex;flex-wrap:wrap;gap:6px}.dots i{width:22px;height:22px;border-radius:50%;border:2px solid var(--brand);background:#fff}.dots i.on{background:var(--brand)}
.sess{display:flex;flex-direction:column;gap:2px;font-size:13px;color:var(--soft)}
.pkg .btn.sm{align-self:flex-start}
/* مقارنة قبل وبعد */
.cmp{position:relative;flex:1;min-height:0;margin:0 12px;overflow:hidden;touch-action:none;cursor:ew-resize;background:#000;direction:ltr}
.cmp>img,.cmpb img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;user-select:none}
.cmpb{position:absolute;inset:0}
.cmpl{position:absolute;top:0;bottom:0;width:3px;background:var(--gold);transform:translateX(-1.5px)}
.cmpl span{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:44px;height:44px;border-radius:50%;background:var(--gold);color:var(--side);display:flex;align-items:center;justify-content:center}
.ctag{position:absolute;top:12px;background:rgba(0,0,0,.6);color:#fff;padding:4px 12px;border-radius:8px;font-weight:700}
.cl{left:12px}.cr{right:12px}
.vsl select{height:40px;border-radius:10px;background:#151C1A;color:#fff;border:1px solid #2A3532;max-width:220px}

/* مسح QR */
.scanbox{position:relative;background:#111;border-radius:14px;overflow:hidden;aspect-ratio:4/3;display:flex;align-items:center;justify-content:center}
.scanbox video{width:100%;height:100%;object-fit:cover}
.scanbox .empty{position:absolute;color:#CFD8D5;padding:16px}
.scanframe{position:absolute;width:56%;aspect-ratio:1;border:3px solid var(--gold);border-radius:18px;box-shadow:0 0 0 999px rgba(0,0,0,.35)}

/* بطاقة الهوية: مقاس بطاقة البنك */
.idcard{width:85.6mm;height:54mm;background:#fff;border-radius:3.5mm;overflow:hidden;box-shadow:0 10px 30px rgba(11,59,46,.18);display:flex;flex-direction:column;font-size:9pt;zoom:1.6}
.idtop{background:var(--side);color:#fff;display:flex;align-items:center;gap:2mm;padding:2mm 3mm}
.idtop .logo{width:7mm;height:7mm;border-radius:2mm;font-size:10pt}
.idtop b{display:block;font-size:9pt}.idtop small{color:#CFE3DA;font-size:6.5pt}
.idbody{flex:1;display:flex;align-items:center;gap:2.5mm;padding:2mm 3mm}
.idqr{width:20mm;height:20mm;flex:none}.idqr svg{width:100%;height:100%}
.idinfo{flex:1;display:flex;flex-direction:column;gap:.6mm;font-size:7pt;min-width:0}
.idinfo>b{font-size:9.5pt;line-height:1.2}
.idav{width:14mm;height:14mm;border-radius:3mm;font-size:16pt;flex:none}
.idfoot{background:var(--bg);display:flex;justify-content:space-between;padding:1mm 3mm;font-size:6pt;color:var(--soft)}

/* الكيسشيت للطباعة */
.chk{display:inline-flex;align-items:center;gap:6px;height:40px;padding:0 12px;border:1px solid var(--line);border-radius:20px;background:#fff;font-size:14px}
.doc{background:#fff;max-width:820px;border-radius:10px;box-shadow:0 8px 30px rgba(11,59,46,.1);padding:24px 28px;display:flex;flex-direction:column;gap:18px;font-size:13px}
.dhead{display:flex;align-items:center;gap:12px;border-bottom:3px solid var(--side);padding-bottom:12px}
.dhead b{font-size:18px;display:block}.dhead small{color:var(--muted)}
.dqr{margin-right:auto;width:64px;height:64px}.dqr svg{width:100%;height:100%}
.dpat{display:flex;gap:16px;align-items:flex-start}
.dpat .pav{width:84px;height:84px;font-size:34px;border-radius:16px}
.dpat h1{font-size:20px;margin-bottom:6px}
.dkv{display:flex;flex-wrap:wrap;gap:6px 16px;color:var(--soft)}
.dalert{margin-top:8px;background:#FFF4DB;color:#6B3A04;padding:6px 10px;border-radius:8px}
.dsum{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.dsum div{border:1px solid var(--line);border-radius:10px;padding:8px 12px;display:flex;flex-direction:column}
.dsum span{color:var(--muted);font-size:12px}.dsum b{font-size:16px}
.doc h2{font-size:15px;border-bottom:1px solid var(--line);padding-bottom:6px;margin-bottom:6px}
.doc table{font-size:12px}.doc td,.doc th{padding:6px}
.doc figure{margin:0 0 10px}.doc figure img{width:100%;border:1px solid var(--line);border-radius:6px;display:block}
.doc figcaption{font-size:11px;color:var(--muted);margin-top:3px}
.dimgs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.dimgs img{max-height:320px;object-fit:contain;background:#111}
.drx{margin-bottom:8px}.drx ul{margin:4px 0;padding-left:18px;text-align:left}
.dfoot{display:flex;justify-content:space-between;color:var(--muted);font-size:11px;border-top:1px solid var(--line);padding-top:8px}

/* الطباعة */
@media print{
  body{background:#fff}
  body:not(.print-all) *{visibility:hidden}
  body:not(.print-all) .print-area,body:not(.print-all) .print-area *{visibility:visible}
  body:not(.print-all) .print-area{position:fixed;inset:0;max-width:none;box-shadow:none;border-radius:0;aspect-ratio:auto}
  .print-area{-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .chart-paper img{max-height:72vh;object-fit:contain}
  .fab,#toast{display:none!important}
  body.print-all .side,body.print-all .bottom,body.print-all .head .btn,body.print-all .no-print{display:none!important}
  body.print-all .doc{box-shadow:none;max-width:none;padding:0;border-radius:0}
  .doc section,.doc figure,.doc tr{break-inside:avoid}
  .dimgs figure{break-inside:avoid}
  .idcard.print-area{zoom:1;inset:auto!important;top:12mm!important;right:12mm!important;width:85.6mm!important;height:54mm!important;border:.2mm solid #ccc;border-radius:3.5mm!important}
  body.print-all .shell{height:auto;overflow:visible;display:block}
  body.print-all .main{overflow:visible;padding:0}
}

/* English (left to right) */
html[dir=ltr] .head .title{margin-left:0;margin-right:auto}
html[dir=ltr] .fab{left:auto;right:28px}
html[dir=ltr] .fab2{left:auto;right:40px}
html[dir=ltr] .tile .badge{left:auto;right:8px}
html[dir=ltr] .legend{margin-right:0;margin-left:auto}
html[dir=ltr] .badge{margin-right:0;margin-left:auto}
html[dir=ltr] .avbtn .cam{left:auto;right:-4px}
html[dir=ltr] .vprev{right:auto;left:12px}html[dir=ltr] .vnext{left:auto;right:12px}
html[dir=ltr] .appt,html[dir=ltr] td,html[dir=ltr] th,html[dir=ltr] .gimg,html[dir=ltr] .ac-list button{text-align:left}
html[dir=ltr] .dqr{margin-right:0;margin-left:auto}
html[dir=ltr] .rx-items input[dir=ltr]{text-align:left}
@media (max-width:760px){html[dir=ltr] .fab{right:16px}html[dir=ltr] .fab2{right:23px}}
html[dir=ltr] svg.chev{transform:scaleX(-1)}
html[dir=ltr] .legend i{margin-left:0;margin-right:6px}
html[dir=ltr] .bottom a{font-size:9.5px;letter-spacing:-.2px}
.chk input,.field .chk input{width:20px;height:20px;min-height:0;padding:0;margin:0;flex:none;box-shadow:none}
.chk{white-space:nowrap;cursor:pointer}

/* الكشفية */
.pill.blue{background:#E4EEFB;color:#1E4E8C}
.pill.amber{background:#FFF1D6;color:#8A5300}
.feebox{display:flex;flex-direction:column;gap:12px}
.feebox .who{display:flex;flex-direction:column;gap:2px;font-size:18px}
.feebox .fu{background:#E4EEFB;color:#1E4E8C;padding:10px 12px;border-radius:10px;font-size:14px}
.feebox input.big{font-size:26px;font-weight:700;height:58px;text-align:center}
.feebtns{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.feebtns .btn{height:58px;font-size:16px;justify-content:center}
.feebtns .btn.pri{grid-column:1/-1;height:64px;font-size:18px}
.feebtns.three{grid-template-columns:repeat(3,1fr)}
@media (max-width:600px){.feebtns.three{grid-template-columns:1fr 1fr}.feebtns.three .btn:last-child{grid-column:1/-1}}
.linkbtn{background:none;border:0;color:var(--soft);text-decoration:underline;font:inherit;font-size:14px;cursor:pointer;align-self:center;padding:6px}
.feemode{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:6px}
.feemode label{position:relative;display:block;cursor:pointer}
.feemode input{position:absolute;inset:0;opacity:0;margin:0;cursor:pointer}
.feemode span{display:flex;flex-direction:column;gap:4px;border:2px solid var(--line);border-radius:14px;padding:12px 14px;height:100%}
.feemode small{color:var(--soft);font-size:13px;line-height:1.5}
.feemode input:checked+span{border-color:var(--brand);background:var(--mint)}
.feemode input:focus-visible+span{outline:3px solid var(--brand);outline-offset:2px}
.feenote{background:var(--mint);color:var(--mint-t);padding:10px 12px;border-radius:10px;font-size:14px}
.trow .tp .pill{margin-top:4px;display:inline-block}
@media (max-width:600px){.feemode{grid-template-columns:1fr}}

/* طلب خصم */
.disc{display:flex;gap:8px;align-items:flex-start;padding:8px 12px;border-radius:10px;font-size:14px;line-height:1.5;grid-column:1/-1}
.disc svg{flex:none;margin-top:2px}
.disc.wait{background:#FFF1D6;color:#7A4A00}
.disc.ok{background:var(--mint);color:var(--mint-t)}
.disc.no{background:var(--red-bg);color:var(--red)}
.due s.old{color:var(--soft);font-size:14px;font-weight:500}
.dsum{display:flex;flex-direction:column;gap:4px;font-size:15px}
.dsum b{font-size:18px}
input.big{font-size:24px;font-weight:700;height:56px;text-align:center}
.dcmp{display:flex;align-items:center;justify-content:center;gap:16px;background:var(--line2);border-radius:14px;padding:14px}
.dcmp div{display:flex;flex-direction:column;align-items:center;gap:2px}
.dcmp span{font-size:13px;color:var(--soft)}
.dcmp b{font-size:22px}
.dcmp .new b{color:var(--brand);font-size:28px}
.dcmp .arrow{font-size:24px;color:var(--soft)}
[dir=ltr] .dcmp .arrow{transform:scaleX(-1)}
.discbar{position:fixed;top:14px;left:50%;transform:translateX(-50%);z-index:60;display:flex;align-items:center;gap:10px;
  background:#7A4A00;color:#fff;border:0;border-radius:999px;padding:12px 22px;font:inherit;font-size:16px;font-weight:700;cursor:pointer;
  box-shadow:0 8px 24px rgba(0,0,0,.25);animation:discpulse 1.6s ease-in-out infinite}
@keyframes discpulse{50%{box-shadow:0 8px 24px rgba(0,0,0,.25),0 0 0 6px rgba(245,184,65,.45)}}
@media (prefers-reduced-motion:reduce){.discbar{animation:none}}
@media print{.discbar{display:none}}
.paycard .disc{flex-basis:100%}
.form[hidden]{display:none}

/* الفترة التجريبية */
.mainwrap{flex:1;min-width:0;display:flex;flex-direction:column;min-height:0}
.mainwrap .main{flex:1;min-height:0}
.trialbar{display:flex;align-items:center;gap:10px;padding:8px 28px;background:#FFF4DB;color:#6B3A04;font-size:14px;border-bottom:1px solid #F1DFAF;flex:none}
.trialbar.soon{background:var(--red-bg);color:var(--red);border-color:#F3D0CC}
.trialbar a{margin-inline-start:auto;background:#1FA855;color:#fff;text-decoration:none;font-weight:700;padding:6px 14px;border-radius:999px}
.btn.wa{background:#1FA855;color:#fff;border-color:#1FA855;justify-content:center;height:50px}
@media print{.trialbar{display:none}}
@media (max-width:760px){.trialbar{padding:8px 16px}}
