:root{
  --bg:#F5F6F8;--surface:#fff;--surface-2:#F9FAFB;--border:#E6E8EC;--border-strong:#D5D9E0;
  --ink:#0F1B2D;--primary:#14274A;--accent:#0E8A7E;--accent-strong:#0B6B61;--accent-soft:#E6F4F2;--accent-bright:#2BB3A3;
  --gold:#C9972E;--gold-soft:#F4EEDD;--gold-ink:#7A5A12;
  --text-1:#0F1B2D;--text-2:#4A5568;--text-3:#5B6475;
  --success:#15803D;--success-bg:#E9F7EE;--warning:#92400E;--warning-fill:#D97706;--warning-bg:#FDF3E3;
  --danger:#A8281F;--danger-fill:#C2362B;--danger-bg:#FCECEA;--info:#1D4F8A;--info-bg:#EAF1FA;
  --madar:#2F3D99;--madar-bg:#ECEEFA;--logo:#A93A1C;--logo-bg:#FDEDE8;
  --r-sm:8px;--r-md:10px;--r-lg:14px;
  --sh-1:0 1px 2px rgba(15,27,45,.04),0 1px 1px rgba(15,27,45,.03);
  --sh-pop:0 12px 32px -8px rgba(15,27,45,.25);
  --font:'IBM Plex Sans Arabic',Tahoma,'Segoe UI',sans-serif;
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--text-1);font-family:var(--font);font-size:14px;line-height:1.6}
a{color:var(--accent-strong)}a:hover{color:#075A52}
button,input,select,textarea{font:inherit;color:inherit}
h1,h2,h3{margin:0;font-weight:600;line-height:1.3}
h1{font-size:26px}h2{font-size:17px}h3{font-size:15px}
.num{font-variant-numeric:tabular-nums;font-feature-settings:"tnum"}
.muted{color:var(--text-3)}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
:focus-visible{outline:3px solid rgba(14,138,126,.45);outline-offset:2px}

/* shell */
.shell{min-height:100vh;display:flex;flex-wrap:wrap}
.side{flex:1 1 248px;max-width:100%;background:var(--ink);padding:24px 16px;display:flex;flex-direction:column;gap:24px}
.side .brandmark{display:flex;flex-direction:column;gap:8px;padding:4px 8px 0}
.side .brandmark img{width:140px;height:auto;display:block}
.side .brandmark span{color:rgba(255,255,255,.62);font-size:12px}
.nav{display:flex;flex-direction:column;gap:4px}
.nav a{display:flex;align-items:center;gap:12px;padding:10px 14px;border-radius:var(--r-md);color:rgba(255,255,255,.74);text-decoration:none;font-weight:500;min-height:44px}
.nav a:hover{background:rgba(255,255,255,.06);color:#fff}
.nav a.on{background:rgba(255,255,255,.09);color:#fff;box-shadow:inset -3px 0 0 var(--accent-bright)}
.nav svg{flex:none}
.side .me{margin-top:auto;display:flex;align-items:center;gap:12px;padding:12px 8px;border-top:1px solid rgba(255,255,255,.08)}
.side .me .who{display:flex;flex-direction:column;flex:1;min-width:0}
.side .me .who b{color:#fff;font-weight:500}
.side .me .who span{color:rgba(255,255,255,.62);font-size:12px}
.side .me button{background:none;border:1px solid rgba(255,255,255,.18);color:rgba(255,255,255,.85);border-radius:8px;height:34px;padding:0 10px;cursor:pointer;font-size:12px}
.side .me button:hover{background:rgba(255,255,255,.08)}
.main{flex:999 1 560px;min-width:0;padding:28px 32px 56px;display:flex;flex-direction:column;gap:22px}
.topbar{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:16px}
.topbar .title{display:flex;flex-direction:column;gap:6px;max-width:760px}
.topbar .tools{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
@media (max-width:820px){
  .side{flex-direction:row;flex-wrap:wrap;align-items:center;padding:12px 14px;gap:10px}
  .side .brandmark img{width:96px}.side .brandmark span{display:none}
  .nav{flex-direction:row;flex-wrap:wrap;gap:2px;order:3;width:100%}
  .nav a{padding:8px 10px;min-height:40px;font-size:13px}
  .side .me{margin:0 auto 0 0;border:none;padding:0}
  .side .me .who{display:none}
  .main{padding:18px 14px 40px}
}

/* primitives */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--r-lg);box-shadow:var(--sh-1)}
.pad{padding:20px 22px}
.row{display:flex;align-items:center;gap:12px}
.between{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.stack{display:flex;flex-direction:column;gap:12px}
.grid{display:grid;gap:20px;grid-template-columns:repeat(auto-fit,minmax(min(420px,100%),1fr))}
.grid-3{display:grid;gap:20px;grid-template-columns:repeat(auto-fit,minmax(min(300px,100%),1fr))}
.grid-4{display:grid;gap:16px;grid-template-columns:repeat(auto-fit,minmax(min(220px,100%),1fr))}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:40px;padding:0 16px;border-radius:var(--r-sm);font-weight:500;cursor:pointer;border:1px solid transparent;text-decoration:none;white-space:nowrap;background:none}
.btn:disabled{opacity:.55;cursor:not-allowed}
.btn-p{background:var(--primary);color:#fff}.btn-p:hover:not(:disabled){background:var(--ink);color:#fff}
.btn-s{background:#fff;color:var(--text-1);border-color:var(--border-strong)}.btn-s:hover:not(:disabled){background:var(--surface-2);color:var(--text-1)}
.btn-d{background:#fff;color:var(--danger);border-color:#F1C5C0}.btn-d:hover{background:var(--danger-bg)}
.btn-g{color:var(--text-2)}.btn-g:hover{background:#EEF0F3}
.btn-sm{height:32px;padding:0 12px;font-size:13px}
.icon-btn{width:40px;height:40px;border-radius:var(--r-md);border:1px solid var(--border);background:#fff;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:var(--text-2);position:relative}
.icon-btn .badge{position:absolute;top:4px;left:4px;min-width:17px;height:17px;padding:0 4px;border-radius:999px;background:var(--danger-fill);color:#fff;font-size:10px;font-weight:700;display:flex;align-items:center;justify-content:center;border:2px solid #fff}
.pill{display:inline-flex;align-items:center;gap:6px;height:24px;padding:0 10px;border-radius:999px;font-size:12px;font-weight:500;white-space:nowrap;background:#EEF0F3;color:var(--text-2)}
.dot{width:7px;height:7px;border-radius:50%;display:inline-block;background:currentColor;flex:none}
.tag-madar{background:var(--madar-bg);color:var(--madar)}
.tag-logo{background:var(--logo-bg);color:var(--logo)}
.st-done{background:var(--gold-soft);color:var(--gold-ink)}
.st-ahead{background:var(--success-bg);color:var(--success)}
.st-ontrack{background:var(--accent-soft);color:var(--accent-strong)}
.st-behind{background:var(--warning-bg);color:var(--warning)}
.st-far{background:#FBE9DF;color:#8A3412}
.st-start,.st-none{background:#EEF0F3;color:var(--text-2)}
.seg{display:flex;background:#fff;border:1px solid var(--border);border-radius:var(--r-md);padding:3px;gap:2px}
.seg button{height:34px;padding:0 14px;border:none;border-radius:8px;cursor:pointer;background:transparent;color:var(--text-2);font-weight:500;font-size:13px}
.seg button.on{background:var(--primary);color:#fff}
.chips{display:flex;gap:8px;flex-wrap:wrap}
.chip{height:38px;padding:0 16px;border-radius:999px;cursor:pointer;border:1px solid var(--border-strong);background:#fff;color:var(--text-2);font-weight:500;font-size:13px}
.chip.on{border-color:var(--accent);background:var(--accent-soft);color:var(--accent-strong)}

/* forms */
label.f{font-size:13px;font-weight:500;color:var(--text-2);display:flex;flex-direction:column;gap:6px;min-width:0}
input,select,textarea{height:42px;border:1px solid var(--border-strong);border-radius:var(--r-sm);padding:0 12px;width:100%;background:#fff;font-size:14px}
textarea{height:auto;min-height:84px;padding:10px 12px;resize:vertical}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px rgba(14,138,126,.2)}
input[type=checkbox]{width:18px;height:18px;accent-color:var(--accent)}
.fgrid{display:grid;gap:14px;grid-template-columns:repeat(auto-fit,minmax(min(200px,100%),1fr))}
.req{color:var(--danger-fill)}
.hint{font-size:12px;color:var(--text-3)}
.err{background:var(--danger-bg);color:var(--danger);border-radius:var(--r-sm);padding:10px 12px;font-size:13px}

/* progress */
.bar{position:relative;height:10px;border-radius:999px;background:#EEF0F3}
.bar.thin{height:6px}
.bar>i{position:absolute;inset-block:0;right:0;border-radius:999px;background:var(--accent);width:0;transition:width .6s ease}
.bar>i.f-done{background:var(--gold)}.bar>i.f-ahead{background:#16A34A}.bar>i.f-ontrack{background:var(--accent)}.bar>i.f-behind{background:var(--warning-fill)}.bar>i.f-far{background:#C2410C}.bar>i.f-start,.bar>i.f-none{background:#64748B}.bar>i.f-ink{background:var(--primary)}.bar>i.f-madar{background:#3646A8}.bar>i.f-logo{background:#C2410C}
.bar>b{position:absolute;top:-4px;width:2px;height:18px;background:var(--ink);border-radius:2px}
.bar.thin>b{top:-4px;height:14px}

/* KPI cards */
.kpi{padding:22px 24px;display:flex;flex-direction:column;gap:14px}
.kpi .big{font-size:34px;font-weight:700;line-height:1.1}
.kpi .pace{background:var(--surface-2);border:1px solid #EEF0F3;border-radius:var(--r-md);padding:10px 12px;font-size:13px;color:var(--text-2)}
.kpi.is-done{box-shadow:inset 0 3px 0 var(--gold),var(--sh-1)}

/* lists */
.list>.it{display:flex;align-items:center;gap:12px;padding:12px 0;border-top:1px solid #F0F1F4}
.list>.it:first-child{border-top:none}
.list .grow{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.list .grow b{font-weight:500}
.list .time{width:52px;font-weight:600}
.kind{min-width:62px;text-align:center;font-size:12px;font-weight:500;padding:4px 8px;border-radius:6px}
.k-meeting,.k-visit{background:#F1ECFD;color:#5B2DB8}
.k-call,.k-followup{background:#E8F2FA;color:#0B5E8E}
.k-whatsapp{background:var(--success-bg);color:var(--success)}
.k-quote{background:#EEF0FF;color:#3F37C9}
.late{color:var(--warning)}
.empty{padding:22px 8px;text-align:center;color:var(--text-3);font-size:13px}

/* table */
.tablebox{overflow-x:auto;position:relative}
table.t{width:100%;border-collapse:collapse}
table.t th{text-align:right;font-size:12px;font-weight:500;color:var(--text-3);padding:12px;white-space:nowrap}
table.t td{padding:12px;border-top:1px solid #F0F1F4;vertical-align:middle}
table.t tr.click{cursor:pointer}table.t tr.click:hover td{background:var(--surface-2)}
table.t input{height:36px;max-width:150px}
.avatar{width:34px;height:34px;border-radius:50%;background:#E7EAF0;display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:600;flex:none}

/* kanban */
.kanban{overflow-x:auto;padding-bottom:8px}
.kanban .cols{display:grid;grid-template-columns:repeat(6,minmax(176px,1fr));gap:10px;min-width:1110px}
.col{background:#EEF0F3;border-radius:var(--r-lg);padding:10px;display:flex;flex-direction:column;gap:10px;min-height:560px;transition:background .15s}
.col.over{background:#DDF0EC}
.col .head{background:#fff;border-radius:var(--r-md);padding:10px 12px;display:flex;flex-direction:column;gap:2px}
.col .head .cnt{font-size:12px;font-weight:600;background:#EEF0F3;border-radius:999px;padding:1px 9px}
.dcard{padding:12px;display:flex;flex-direction:column;gap:9px;border-radius:var(--r-md);cursor:grab}
.dcard.dragging{opacity:.5}
.dcard .name{font-weight:600;color:var(--text-1);text-decoration:none}
.dcard .name:hover{text-decoration:underline}
.s0{box-shadow:inset 0 3px 0 #64748B}.s1{box-shadow:inset 0 3px 0 #0284C7}.s2{box-shadow:inset 0 3px 0 #7C3AED}.s3{box-shadow:inset 0 3px 0 #4F46E5}.s4{box-shadow:inset 0 3px 0 #D97706}.s5{box-shadow:inset 0 3px 0 #16A34A}

/* stepper */
.steps{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(128px,100%),1fr));gap:6px}
.steps button{min-height:44px;border-radius:var(--r-md);cursor:pointer;font-size:13px;font-weight:500;border:1px solid var(--border);background:#fff;color:var(--text-3);padding:4px 8px}
.steps button.past{border-color:var(--accent);background:var(--accent-soft);color:var(--accent-strong)}
.steps button.cur{border-color:var(--primary);background:var(--primary);color:#fff}
.steps button:disabled{cursor:default}

/* timeline */
.tl .ev{display:flex;gap:14px}
.tl .rail{display:flex;flex-direction:column;align-items:center}
.tl .rail i{width:12px;height:12px;border-radius:50%;margin-top:5px;border:3px solid #fff;box-shadow:0 0 0 1.5px #64748B;background:#64748B}
.tl .rail span{flex:1;width:2px;background:#EEF0F3;min-height:20px}
.tl .body{flex:1;min-width:0;padding-bottom:16px;display:flex;flex-direction:column;gap:3px}
.tl .ev.t-call i,.tl .ev.t-followup i{background:#0284C7;box-shadow:0 0 0 1.5px #0284C7}
.tl .ev.t-whatsapp i{background:#15803D;box-shadow:0 0 0 1.5px #15803D}
.tl .ev.t-meeting i,.tl .ev.t-visit i{background:#7C3AED;box-shadow:0 0 0 1.5px #7C3AED}
.tl .ev.t-quote i{background:#4F46E5;box-shadow:0 0 0 1.5px #4F46E5}

/* calendar */
.cal{display:grid;grid-template-columns:repeat(7,minmax(130px,1fr));min-width:920px}
.cal .day{padding:14px 12px;min-height:520px;border-inline-start:1px solid #EEF0F3}
.cal .day:first-child{border-inline-start:none}
.cal .day.today{background:#F7FBFA}
.cal .day.off{background:#FAFAFB}
.cal .dh{display:flex;flex-direction:column;padding-bottom:10px;border-bottom:1px solid #EEF0F3;margin-bottom:6px}
.cal .dh b{font-size:20px}
.cal .day.today .dh b{color:var(--accent-strong)}
.cal .ev{display:flex;flex-direction:column;gap:1px;margin-top:8px;padding:9px 11px;border-radius:var(--r-md);text-decoration:none;font-size:12px}
.cal .ev.m{background:#F1ECFD;color:#4C1D95;box-shadow:inset -3px 0 0 #6D28D9}
.cal .ev.c{background:#E8F2FA;color:#0B4A70;box-shadow:inset -3px 0 0 #0369A1}
.cal .ev.done{opacity:.6}
.cal .ev b{font-size:13px}

/* overlays */
.overlay{position:fixed;inset:0;background:rgba(15,27,45,.42);display:flex;align-items:center;justify-content:center;padding:16px;z-index:50}
.modal{background:#fff;border-radius:16px;width:min(620px,100%);max-height:calc(100vh - 32px);overflow-y:auto;padding:26px;display:flex;flex-direction:column;gap:16px;box-shadow:var(--sh-pop)}
.drawer-bg{position:fixed;inset:0;background:rgba(15,27,45,.28);z-index:40}
.drawer{position:fixed;top:0;left:0;bottom:0;width:min(400px,100%);background:#fff;box-shadow:var(--sh-pop);padding:22px;display:flex;flex-direction:column;gap:12px;overflow-y:auto;z-index:41}
.nt{border:1px solid var(--border);border-radius:12px;padding:13px 14px;display:flex;flex-direction:column;gap:6px}
.nt.urgent{box-shadow:inset -3px 0 0 var(--danger-fill)}.nt.important{box-shadow:inset -3px 0 0 var(--warning-fill)}
.nt.achievement{box-shadow:inset -3px 0 0 #16A34A}.nt.cheer{box-shadow:inset -3px 0 0 var(--gold)}.nt.reminder{box-shadow:inset -3px 0 0 #2563A8}
.lv-urgent{background:var(--danger-bg);color:var(--danger)}.lv-important{background:var(--warning-bg);color:var(--warning)}.lv-achievement{background:var(--success-bg);color:var(--success)}.lv-cheer{background:var(--gold-soft);color:var(--gold-ink)}.lv-reminder{background:var(--info-bg);color:var(--info)}
.toasts{position:fixed;bottom:22px;left:22px;display:flex;flex-direction:column;gap:10px;z-index:60;width:min(380px,calc(100% - 44px))}
.toast{background:var(--ink);color:#fff;border-radius:12px;padding:14px 18px;box-shadow:var(--sh-pop);font-size:14px;line-height:1.6;animation:rise .25s ease-out}
.toast.err{background:#5A1712}
.toast.win{box-shadow:inset 0 3px 0 var(--gold),var(--sh-pop)}
@keyframes rise{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}

/* login */
.auth{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;background:var(--ink)}
.auth .box{background:#fff;border-radius:18px;width:min(420px,100%);padding:34px 32px;display:flex;flex-direction:column;gap:18px;box-shadow:var(--sh-pop)}
.auth .box img{width:170px;height:auto;align-self:center}
.loading{min-height:60vh;display:flex;align-items:center;justify-content:center;color:var(--text-3)}

/* layout utilities (attribute-based so templates stay CSP-safe without inline styles) */
[style-wrap]{flex-wrap:wrap}
[style-s]{font-size:12px}
[style-mb]{margin-bottom:10px}
[style-mt]{margin-top:16px}
[style-mt8]{margin-top:8px}
[style-g0]{gap:0}[style-g2]{gap:2px}[style-g4]{gap:4px}[style-g6]{gap:6px}[style-g8]{gap:8px}[style-g20]{gap:20px}[style-g28]{gap:28px}
[style-gap]{gap:4px;text-align:center}
[style-c]{text-align:center}
[style-m]{margin:0;text-align:center}
[style-lead]{margin:-8px 0 0;font-size:16px;color:var(--text-2);text-wrap:pretty}
[style-pbar]{padding:16px 20px;display:flex;flex-direction:column;gap:12px}
[style-label]{font-weight:500;color:var(--text-2)}
[style-ink]{color:var(--text-1)}
[style-acc]{color:var(--accent)}
[style-rank]{width:22px;font-size:15px}
[style-lb]{width:120px}
[style-note]{margin:10px 0 0;font-size:13px;color:var(--accent-strong)}
[style-note2]{font-size:13px;color:var(--text-2);white-space:pre-line}
[style-kv]{font-size:24px;font-weight:700}
[style-kv-g]{font-size:24px;font-weight:700;color:var(--success)}
[style-kv-w]{font-size:24px;font-weight:700;color:#B45309}
[style-r]{text-align:right}
[style-search]{width:min(260px,60vw)}
[style-back]{text-decoration:none;font-size:13px;gap:6px;width:max-content}
[style-top]{align-items:flex-start}
[style-xl]{width:56px;height:56px;border-radius:14px;font-size:19px;background:var(--madar-bg);color:var(--madar)}
[style-v22]{font-size:22px}[style-v26]{font-size:26px}[style-v16]{font-size:16px}
[style-cols]{align-items:flex-start;flex-wrap:wrap;gap:20px}
[style-mainc]{flex:999 1 520px;min-width:0;gap:20px}
[style-sidec]{flex:1 1 300px;min-width:0;gap:20px}
[style-warnbox]{box-shadow:inset 0 3px 0 var(--warning-fill),var(--sh-1);gap:8px}
[style-w500]{font-weight:500}
[style-w140]{width:140px}
[style-w]{width:auto;min-width:160px}
[style-wauto]{width:auto}
[style-fs]{border:1px solid var(--border);border-radius:var(--r-md);padding:12px 14px 14px;margin:0}
[style-legend]{font-size:13px;font-weight:600;padding:0 6px}
[style-end]{display:flex;align-items:flex-end}
[style-pointer]{cursor:pointer}
[style-purple]{color:#6D28D9}[style-blue]{color:#0369A1}
[style-dark]{background:#2A3B57;color:#fff}
.modal[style-w="1"]{width:min(820px,100%)}
[hidden]{display:none!important}
.side .brandmark{text-decoration:none}
.list a,.cal a,table.t a{color:var(--text-1);text-decoration:none}
.list a:hover,table.t a:hover{color:var(--accent-strong);text-decoration:underline}
