:root{
  --navy:#072f64;--navy2:#0a4b92;--blue:#0d72f5;--blue2:#2494ff;--green:#12a85a;--green2:#1ac66b;
  --orange:#ff8b16;--purple:#6f42ed;--red:#ef334f;--cyan:#0fb6b5;--ink:#10233f;--muted:#6e7f97;
  --line:#dce6f2;--bg:#eef4fb;--card:#fff;--shadow:0 10px 28px rgba(16,42,76,.08);--radius:16px;
  font-family:"Segoe UI",Tahoma,Arial,sans-serif;
}
*{box-sizing:border-box}html,body{margin:0;min-height:100%;background:var(--bg);color:var(--ink)}body{direction:rtl}
button,input,select,textarea{font:inherit}button{cursor:pointer}a{text-decoration:none;color:inherit}
.hidden{display:none!important}.muted{color:var(--muted)}.small{font-size:12px}.nowrap{white-space:nowrap}.ltr{direction:ltr;text-align:left}
.brand{display:flex;align-items:center;gap:12px;font-weight:900}.brand-mark{width:48px;height:48px;border-radius:50%;background:conic-gradient(from 220deg,#0c68e8,#14c99a,#0c68e8);position:relative;box-shadow:0 8px 20px rgba(13,114,245,.25)}.brand-mark:after{content:"×";position:absolute;inset:0;display:grid;place-items:center;color:#fff;font-size:36px;font-weight:300}.brand-title{font-size:28px;letter-spacing:-1px;color:#fff}.brand-title b{color:#2fa3ff}.brand-sub{font-size:11px;color:#dbeafd;font-weight:600}
.btn{border:0;border-radius:11px;padding:10px 16px;font-weight:800;display:inline-flex;align-items:center;justify-content:center;gap:7px;transition:.18s}.btn:hover{transform:translateY(-1px)}.btn.primary{background:linear-gradient(135deg,var(--blue),#0756be);color:#fff}.btn.success{background:linear-gradient(135deg,var(--green2),var(--green));color:#fff}.btn.danger{background:var(--red);color:#fff}.btn.warn{background:var(--orange);color:#fff}.btn.ghost{background:#f5f8fc;border:1px solid var(--line);color:var(--navy)}.btn.sm{padding:7px 10px;font-size:12px}.btn.block{width:100%}
.input,.select,.textarea{width:100%;border:1px solid #cfdceb;border-radius:11px;background:#fff;padding:11px 12px;outline:none;color:var(--ink)}.input:focus,.select:focus,.textarea:focus{border-color:#7bb6ff;box-shadow:0 0 0 3px rgba(13,114,245,.08)}.label{font-size:13px;font-weight:800;margin-bottom:6px;display:block}.field{margin-bottom:12px}.grid2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.grid3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.grid4{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.card{background:var(--card);border:1px solid #e1eaf5;border-radius:var(--radius);box-shadow:var(--shadow)}.card.pad{padding:18px}.card-title{font-size:18px;font-weight:900;margin:0 0 14px}.section-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}.section-head h3{margin:0;font-size:18px}.chip{display:inline-flex;align-items:center;gap:5px;border-radius:999px;padding:5px 9px;font-size:12px;font-weight:800;background:#eaf3ff;color:#075ec9}.chip.green{background:#e5f8ed;color:#0c8f48}.chip.red{background:#ffe7eb;color:#c9213d}.chip.orange{background:#fff1df;color:#c66a00}.chip.gray{background:#edf1f6;color:#657188}.chip.purple{background:#eee8ff;color:#6c3ee5}
.kpis{display:grid;grid-template-columns:repeat(6,minmax(150px,1fr));gap:12px}.kpi{min-height:112px;padding:17px;border-radius:15px;color:#fff;position:relative;overflow:hidden;box-shadow:0 10px 20px rgba(0,0,0,.10)}.kpi:after{content:"";position:absolute;width:110px;height:110px;border-radius:50%;background:rgba(255,255,255,.1);left:-34px;bottom:-58px}.kpi.blue{background:linear-gradient(135deg,#0d72f5,#1d96ff)}.kpi.green{background:linear-gradient(135deg,#16ad61,#0a944c)}.kpi.orange{background:linear-gradient(135deg,#ff981d,#f26b0b)}.kpi.purple{background:linear-gradient(135deg,#7647ef,#512bd5)}.kpi.red{background:linear-gradient(135deg,#f04d62,#df2341)}.kpi.cyan{background:linear-gradient(135deg,#0fb7b5,#0a869f)}.kpi .v{font-size:25px;font-weight:900;margin:8px 0}.kpi .t{font-size:13px;font-weight:800}.kpi .s{font-size:11px;opacity:.9}
.shell{display:grid;grid-template-columns:235px 1fr;min-height:100vh}.sidebar{background:linear-gradient(180deg,#063871,#052a58);color:#fff;padding:16px 12px;position:sticky;top:0;height:100vh;overflow:auto}.sidebar .brand{margin-bottom:20px}.nav{display:flex;flex-direction:column;gap:5px}.nav-btn{width:100%;border:0;background:transparent;color:#eaf3ff;padding:12px;border-radius:11px;display:flex;align-items:center;gap:10px;text-align:right;font-weight:800}.nav-btn:hover,.nav-btn.active{background:linear-gradient(90deg,#0d72f5,#0a59c8);color:#fff}.nav-btn i{width:20px}.main{min-width:0}.topbar{height:76px;background:linear-gradient(90deg,#06366f,#0b4d91);color:#fff;display:flex;align-items:center;justify-content:space-between;padding:0 20px;position:sticky;top:0;z-index:30}.topbar .search{max-width:520px;flex:1;margin:0 25px;position:relative}.topbar .search input{width:100%;background:rgba(255,255,255,.07);border:1px solid rgba(255,255,255,.18);color:#fff;border-radius:12px;padding:12px 40px 12px 12px}.topbar .search input::placeholder{color:#d4e3f7}.topbar .profile{display:flex;align-items:center;gap:10px}.avatar{width:42px;height:42px;border-radius:50%;background:linear-gradient(135deg,#cfe3ff,#fff);display:grid;place-items:center;color:#0a4c92;font-weight:900;border:2px solid #fff}.content{padding:16px 18px 40px}.view{display:none}.view.active{display:block}
.two-col{display:grid;grid-template-columns:1.5fr .85fr;gap:14px}.three-col{display:grid;grid-template-columns:1.2fr 1.7fr .9fr;gap:14px}.map-wrap{height:390px;border-radius:14px;overflow:hidden;background:linear-gradient(135deg,#e7eef7,#cfe5f8);position:relative}.map{height:100%;width:100%}.map-fallback{position:absolute;inset:0;display:grid;place-items:center;text-align:center;padding:20px;color:#42617f;background:linear-gradient(135deg,#e8f2ff,#dceaf8)}
.table-wrap{overflow:auto;border:1px solid var(--line);border-radius:12px}.table{width:100%;border-collapse:collapse;background:#fff;min-width:650px}.table th,.table td{padding:10px 11px;border-bottom:1px solid #e5edf6;text-align:right;font-size:13px}.table th{background:#f2f7fd;color:#294c73;position:sticky;top:0}.table tr:hover td{background:#fbfdff}.amount{font-weight:900}.amount.red{color:#d5223d}.amount.green{color:#0d9d52}
.list{display:flex;flex-direction:column}.list-row{display:flex;align-items:center;gap:10px;padding:11px 4px;border-bottom:1px solid #e7edf5}.list-row:last-child{border-bottom:0}.list-row .grow{flex:1;min-width:0}.list-row b{display:block}.row-actions{display:flex;gap:6px;flex-wrap:wrap}
.tabs{display:flex;gap:7px;flex-wrap:wrap;margin-bottom:12px}.tab{border:1px solid var(--line);background:#fff;border-radius:10px;padding:8px 12px;font-weight:800;color:#4d6682}.tab.active{background:var(--blue);color:#fff;border-color:var(--blue)}
.modal{position:fixed;inset:0;background:rgba(4,20,41,.55);z-index:100;display:flex;align-items:center;justify-content:center;padding:18px}.modal-card{width:min(920px,100%);max-height:92vh;overflow:auto;background:#fff;border-radius:20px;box-shadow:0 24px 70px rgba(0,0,0,.3)}.modal-head{padding:15px 18px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;position:sticky;top:0;background:#fff;z-index:2}.modal-body{padding:18px}.modal-foot{padding:14px 18px;border-top:1px solid var(--line);display:flex;gap:8px;justify-content:flex-start;position:sticky;bottom:0;background:#fff}
.login-page{min-height:100vh;display:grid;grid-template-columns:1.2fr .8fr;background:#e9f4fb}.login-hero{position:relative;background:linear-gradient(120deg,rgba(4,52,100,.88),rgba(14,126,162,.65)),radial-gradient(circle at 30% 25%,#c3efff,#2c77a5 55%,#16456f);padding:50px;color:#fff;display:flex;flex-direction:column;justify-content:center;overflow:hidden}.login-hero:after{content:"✚";position:absolute;left:70px;top:80px;font-size:200px;color:#39e3c9;opacity:.17;filter:drop-shadow(0 0 20px rgba(57,227,201,.3))}.login-hero .brand-title{font-size:42px}.hero-copy{max-width:680px;margin-top:70px}.hero-copy h1{font-size:48px;line-height:1.25;margin:0 0 18px}.hero-copy p{font-size:19px;line-height:1.9;color:#e8f5ff}.feature-row{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-top:35px}.feature{background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.15);border-radius:15px;padding:15px;text-align:center;backdrop-filter:blur(8px)}.feature i{display:block;font-size:25px;margin-bottom:8px}.login-side{display:flex;align-items:center;justify-content:center;padding:30px;background:linear-gradient(135deg,#edf8fb,#dff7f4)}.login-box{width:min(500px,100%);background:rgba(255,255,255,.92);border:1px solid rgba(255,255,255,.8);border-radius:24px;box-shadow:0 25px 60px rgba(11,58,99,.18);padding:34px}.login-logo{display:flex;justify-content:center;margin-bottom:8px}.login-logo .brand-title{color:#07366f}.login-logo .brand-sub{color:#627998}.login-box h2{text-align:center;margin:8px 0 4px;font-size:30px}.login-box .subtitle{text-align:center;color:#6a7d92;margin-bottom:26px}.login-demo{background:#f5f9fe;border:1px dashed #b9cee4;border-radius:12px;padding:11px;font-size:12px;line-height:1.8;color:#47617c}
.mobile-only{display:none}.bottom-nav{display:none}
.toast{position:fixed;left:20px;bottom:20px;z-index:999;background:#102d4f;color:#fff;border-radius:12px;padding:12px 16px;box-shadow:0 12px 30px rgba(0,0,0,.2);max-width:380px}.toast.error{background:#b71f38}.toast.ok{background:#0c8b48}
.report-sheet{background:#fff;padding:24px;width:794px;max-width:100%;margin:auto;color:#172a42}.report-head{display:flex;justify-content:space-between;align-items:flex-start;border-bottom:3px solid #0d72f5;padding-bottom:12px;margin-bottom:16px}.report-brand{font-size:28px;font-weight:900;color:#07366f}.report-brand b{color:#1495e8}.report-summary{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin:14px 0}.report-summary>div{border:1px solid #dfe8f2;border-radius:10px;padding:10px;background:#f8fbff}.report-summary b{display:block;font-size:18px;margin-top:4px}
.product-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.product-card{border:1px solid #dce6f2;border-radius:13px;padding:12px;background:#fff;cursor:pointer}.product-card:hover{border-color:#6eb1ff;box-shadow:0 8px 20px rgba(13,114,245,.08)}.product-icon{height:70px;border-radius:10px;background:linear-gradient(135deg,#edf5ff,#f2fffb);display:grid;place-items:center;font-size:32px;margin-bottom:8px}.phone-stage{max-width:520px;margin:0 auto}.mobile-card{background:#fff;border:1px solid #e1eaf5;border-radius:16px;padding:14px;margin-bottom:12px;box-shadow:var(--shadow)}
@media(max-width:1250px){.kpis{grid-template-columns:repeat(3,1fr)}.three-col{grid-template-columns:1fr 1fr}.three-col>*:last-child{grid-column:1/-1}}
@media(max-width:800px){
 body{background:#f1f5fa}.shell{display:block}.sidebar{display:none}.topbar{height:66px;padding:0 12px}.topbar .search{display:none}.topbar .profile .meta{display:none}.topbar .mobile-only{display:block}.content{padding:10px 10px 84px}.kpis{grid-template-columns:repeat(2,1fr);gap:8px}.kpi{min-height:94px;padding:13px}.kpi .v{font-size:20px}.two-col,.three-col,.grid2,.grid3,.grid4{grid-template-columns:1fr}.map-wrap{height:310px}.bottom-nav{display:grid;position:fixed;bottom:0;left:0;right:0;height:68px;background:#fff;border-top:1px solid #dce5ef;z-index:50;grid-template-columns:repeat(5,1fr);padding-bottom:env(safe-area-inset-bottom)}.bottom-nav button{border:0;background:transparent;color:#6c7f98;font-size:10px;font-weight:800;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px}.bottom-nav button.active{color:var(--blue)}.bottom-nav i{width:21px;height:21px}.mobile-only{display:block}.desktop-only{display:none!important}.card.pad{padding:13px}.card-title,.section-head h3{font-size:16px}.table{min-width:620px}.modal{padding:0;align-items:flex-end}.modal-card{border-radius:18px 18px 0 0;max-height:94vh}.product-grid{grid-template-columns:repeat(2,1fr)}
 .login-page{display:block;background:linear-gradient(180deg,#063a75,#eaf4fb)}.login-hero{display:none}.login-side{min-height:100vh;background:linear-gradient(180deg,#063a75 0,#0b5da7 28%,#edf6fb 28%);padding:90px 16px 30px}.login-box{padding:24px 18px}.login-logo .brand-title{font-size:26px}.report-sheet{width:100%;padding:15px}.report-summary{grid-template-columns:repeat(2,1fr)}
}
@media print{body{background:#fff}.no-print,.sidebar,.topbar,.bottom-nav,.modal-head,.modal-foot{display:none!important}.shell{display:block}.content{padding:0}.report-sheet{box-shadow:none;border:0;width:100%}.card{box-shadow:none}}

/* PharmaAxis V1.2 */
.map-popup-btn{margin-top:8px;border:0;border-radius:8px;background:#0d72f5;color:#fff;padding:7px 10px;font-weight:800;cursor:pointer}
.customer-pick-map{height:300px;margin-top:8px}.gps-fields{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:8px}.route-map-wrap{height:520px}.route-summary{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}.route-summary>div:first-child{display:flex;flex-direction:column;gap:4px}.route-summary span{color:var(--muted);font-size:13px}.report-textarea{min-height:230px;resize:vertical}.report-preview{margin-top:6px;color:#40556e;white-space:pre-line;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.report-meta{display:flex;flex-direction:column;gap:5px;padding-bottom:12px;border-bottom:1px solid var(--line);margin-bottom:14px}.report-meta span{color:var(--muted);font-size:13px}.field-report-body{white-space:pre-wrap;line-height:2;background:#f8fbff;border:1px solid var(--line);border-radius:12px;padding:16px;margin-bottom:12px}
.chat-layout{display:grid;grid-template-columns:340px 1fr;gap:14px;min-height:650px}.chat-threads{height:650px;overflow:auto}.chat-thread{width:100%;border:0;background:#fff;border-bottom:1px solid #e7edf5;padding:12px 5px;display:flex;align-items:center;gap:10px;text-align:right;color:var(--ink)}.chat-thread:hover,.chat-thread.active{background:#eef6ff}.chat-thread small{display:block;color:var(--muted);margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:190px}.chat-unread{background:var(--red);color:#fff;border-radius:999px;min-width:22px;height:22px;display:grid;place-items:center;font-size:11px;font-weight:900}.chat-panel{height:650px;overflow:hidden}.chat-empty{height:100%;display:grid;place-items:center;align-content:center;text-align:center;color:var(--muted);gap:8px}.chat-empty svg{width:48px;height:48px}.chat-empty-mini{text-align:center;color:var(--muted);padding:28px}.chat-head{height:72px;padding:14px 16px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between}.chat-head>div{display:flex;flex-direction:column;gap:3px}.chat-head span{font-size:12px;color:var(--muted)}.chat-messages{height:calc(650px - 150px);overflow:auto;padding:16px;background:linear-gradient(180deg,#f7fbff,#eef4fb)}.chat-msg{max-width:74%;padding:10px 12px;border-radius:14px;margin:7px 0;box-shadow:0 4px 12px rgba(16,42,76,.05);line-height:1.7}.chat-msg.mine{margin-right:auto;background:#0d72f5;color:#fff;border-bottom-left-radius:4px}.chat-msg.other{margin-left:auto;background:#fff;border:1px solid #dfe9f4;border-bottom-right-radius:4px}.chat-msg small{display:block;margin-top:5px;opacity:.75;font-size:10px}.chat-msg audio{width:260px;max-width:100%;margin-top:8px}.chat-attachment{border:1px solid currentColor;background:transparent;color:inherit;border-radius:9px;padding:7px 9px;margin-top:7px;display:inline-flex;gap:6px;align-items:center;font-weight:800}.chat-compose{height:78px;border-top:1px solid var(--line);padding:10px;display:grid;grid-template-columns:auto auto 1fr auto;gap:8px;align-items:center;background:#fff}.chat-compose textarea{height:48px;min-height:48px;resize:none;margin:0}.chat-file-label{height:42px}.recording{background:#ffe7eb!important;color:#c9213d!important;border-color:#f4a4b1!important}.call-overlay{position:fixed;inset:0;z-index:1000;background:rgba(3,16,35,.72);display:grid;place-items:center;padding:20px;backdrop-filter:blur(5px)}.call-card{width:min(360px,100%);background:#fff;border-radius:24px;padding:28px;text-align:center;box-shadow:0 30px 80px rgba(0,0,0,.35)}.call-avatar{width:92px;height:92px;margin:0 auto 14px;border-radius:50%;background:linear-gradient(135deg,#0d72f5,#13bd99);color:#fff;display:grid;place-items:center;font-size:38px;font-weight:900}.call-card h3{font-size:23px;margin:8px 0}.call-card p{color:var(--muted);margin-bottom:20px}.call-card .row-actions{justify-content:center}
@media(max-width:800px){.chat-layout{grid-template-columns:1fr;min-height:0}.chat-threads{height:auto;max-height:280px}.chat-panel{height:calc(100vh - 180px);min-height:520px}.chat-messages{height:calc(100% - 150px)}.chat-compose{grid-template-columns:auto auto 1fr auto}.route-map-wrap{height:55vh}.route-summary{align-items:flex-start;flex-direction:column}.gps-fields{grid-template-columns:1fr 1fr}}

/* Approved PharmaAxis login — reference locked 100/100 */
.approved-login-body{margin:0;min-height:100vh;background:#eaf6fb;overflow-x:hidden}.approved-login-page{min-height:100vh;display:grid;grid-template-columns:58% 42%;direction:ltr;background:#dff4f6}.approved-login-hero{direction:rtl;background-image:url('/assets/login-approved.png');background-repeat:no-repeat;background-size:172% 100%;background-position:left center;min-height:100vh}.approved-login-side{direction:rtl;position:relative;min-height:100vh;display:flex;align-items:center;justify-content:center;padding:36px;background:linear-gradient(135deg,#d9f5fa 0%,#eaf9fb 35%,#9fe7e4 100%)}.approved-login-side:before{content:'✚';position:absolute;right:4%;top:13%;font-size:190px;color:#1be1c8;opacity:.25;filter:blur(.2px)}.approved-language{position:absolute;top:24px;right:34px;color:#fff;font-size:15px;font-weight:700;text-shadow:0 1px 3px rgba(0,0,0,.12)}.approved-login-card{position:relative;z-index:2;width:min(530px,92%);background:rgba(255,255,255,.94);border:1px solid rgba(255,255,255,.9);border-radius:24px;padding:24px 34px 30px;box-shadow:0 24px 60px rgba(10,66,99,.18);backdrop-filter:blur(8px)}.approved-login-logo{display:block;width:min(360px,82%);margin:0 auto 0}.approved-ar-subtitle{text-align:center;color:#28486d;font-size:18px;margin:-1px 0 20px}.approved-field{border:1px solid #cbd9e7;border-radius:12px;padding:10px 13px 11px;margin:12px 0;background:rgba(255,255,255,.82)}.approved-field label{display:flex;justify-content:space-between;align-items:center;font-weight:900;color:#0c2f66;font-size:14px;margin-bottom:7px}.approved-field input{width:100%;border:1px solid #d3dfeb;border-radius:9px;padding:12px 13px;background:#fff;color:#233d5d;outline:none;font-size:15px;text-align:right}.approved-field input:focus{border-color:#4da3ff;box-shadow:0 0 0 3px rgba(13,114,245,.08)}.approved-password-wrap{position:relative}.approved-password-wrap input{padding-left:48px}.approved-password-wrap button{position:absolute;left:7px;top:50%;transform:translateY(-50%);width:36px;height:36px;border:0;background:transparent;color:#41638a;font-size:18px;z-index:2}.approved-login-button{width:100%;border:0;border-radius:11px;padding:14px;margin-top:12px;background:linear-gradient(180deg,#0a8dcc,#0055b5);color:#fff;font-size:20px;font-weight:900;box-shadow:0 7px 18px rgba(0,84,181,.2)}.approved-login-button span{margin-right:8px}.approved-login-error{margin-top:12px;border-radius:10px;padding:10px;background:#ffe6ea;color:#b71f38;font-weight:800;text-align:center}.approved-help{text-align:center;margin-top:18px;color:#67809c;font-size:13px}.approved-help span{display:block;position:relative;margin-bottom:15px}.approved-help span:before,.approved-help span:after{content:'';position:absolute;top:50%;height:1px;background:#cbd9e7;width:42%}.approved-help span:before{right:0}.approved-help span:after{left:0}.approved-help b{display:block;color:#08a889;margin-top:7px}
@media(max-width:900px){.approved-login-page{display:block;background-image:url('/assets/login-approved.png');background-size:cover;background-position:center}.approved-login-hero{display:none}.approved-login-side{min-height:100vh;background:linear-gradient(180deg,rgba(4,50,101,.86),rgba(9,117,151,.56)),url('/assets/login-approved.png') center/cover no-repeat;padding:70px 14px 24px}.approved-language{top:18px;right:18px}.approved-login-card{padding:22px 18px 24px;width:min(480px,100%)}.approved-login-logo{width:78%}.approved-ar-subtitle{font-size:15px}.approved-login-side:before{display:none}}


/* PharmaAxis V1.5 — unified professional chat for Super Admin / Supervisor / Rep */
.chat-layout{height:calc(100vh - 122px);min-height:570px;display:grid;grid-template-columns:330px minmax(0,1fr);gap:12px;overflow:hidden}.chat-threads,.chat-panel{height:100%;min-height:0;overflow:hidden}.chat-threads{padding:0!important}.chat-list-head{height:76px;padding:12px 14px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;background:#fff}.chat-list-head h3{margin:0;font-size:18px}.chat-list-head span{font-size:11px;color:var(--muted)}.chat-thread-list{height:calc(100% - 76px);overflow:auto;padding:5px 8px;background:#fff}.chat-thread{border-radius:12px;border-bottom:0!important;margin:3px 0;padding:10px 8px!important;gap:9px!important}.chat-thread.active{background:#e8f3ff!important;box-shadow:inset -3px 0 #0d72f5}.chat-thread .grow{min-width:0}.chat-thread b{display:block}.chat-thread small{max-width:none!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-thread small strong{color:#0a5ab7;font-size:10px}.chat-thread-meta{margin-right:auto;display:flex;flex-direction:column;align-items:flex-end;gap:5px;flex:none}.chat-thread-meta time{font-size:9px;color:var(--muted);direction:ltr}.chat-thread-meta .chat-unread{font-style:normal}.chat-avatar{overflow:hidden;flex:none}.chat-avatar img{width:100%;height:100%;object-fit:cover}.chat-panel{display:flex;flex-direction:column;background:#fff}.chat-pane-inner{height:100%;min-height:0;display:flex;flex-direction:column}.chat-head{height:72px!important;flex:none;padding:10px 14px!important;background:#fff}.chat-peer{display:flex!important;align-items:center!important;flex-direction:row!important;gap:9px}.chat-peer>div{display:flex;flex-direction:column;gap:2px}.chat-back{display:none;border:0;background:transparent;color:var(--navy);padding:5px}.chat-messages{height:auto!important;flex:1;min-height:0;overflow:auto;padding:18px;background:linear-gradient(180deg,#f7fbff 0%,#edf4fb 100%);scroll-behavior:smooth}.chat-msg{max-width:min(72%,620px)!important;margin:7px 0!important;padding:10px 12px!important;overflow:hidden}.chat-msg.mine{margin-left:auto!important;margin-right:0!important;background:#0d72f5!important;color:#fff!important;border:0!important;border-bottom-left-radius:4px!important}.chat-msg.other{margin-right:auto!important;margin-left:0!important;background:#fff!important;color:var(--ink)!important;border:1px solid #dfe9f4!important;border-bottom-right-radius:4px!important}.chat-text{word-break:break-word}.chat-seen{font-weight:900;letter-spacing:-2px}.chat-file-selected{min-height:0;padding:0 12px;background:#fff;color:var(--muted);font-size:11px}.chat-file-selected:not(:empty){padding:7px 12px;border-top:1px solid #edf2f7;display:flex;justify-content:space-between;align-items:center}.chat-file-selected span{display:flex;align-items:center;gap:7px;min-width:0}.chat-file-selected span b{max-width:320px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-file-selected span small{font-size:9px}.chat-file-selected button{border:0;background:#f3f6fa;color:#7a8796;border-radius:8px;width:28px;height:28px}.chat-compose{height:70px!important;flex:none;display:grid!important;grid-template-columns:auto auto minmax(0,1fr) auto!important;gap:7px!important;padding:9px 11px!important;background:#fff;border-top:1px solid var(--line)}.chat-compose textarea{height:48px!important;min-height:48px!important;border:1px solid #d1deeb!important;border-radius:14px!important;padding:12px!important;resize:none!important;outline:none!important}.chat-compose-btn,.chat-send{width:44px;height:44px;border:0;border-radius:12px;display:grid;place-items:center;align-self:center}.chat-compose-btn{background:#f0f5fb;color:#0a4c92;cursor:pointer}.chat-send{background:#0d72f5;color:#fff}.chat-send.sending{opacity:.55;pointer-events:none}.chat-compose-btn svg,.chat-send svg{width:21px;height:21px}.chat-compose-btn.recording{background:#ffe7eb;color:#c9213d}.voice-note{display:flex;flex-direction:column;gap:7px;min-width:260px;max-width:100%;margin-top:5px}.voice-note>span{display:flex;gap:6px;align-items:center;font-weight:800}.voice-note audio{width:100%;margin:0}.chat-file-card,.chat-image-card{border:0;margin-top:8px;cursor:pointer;color:inherit}.chat-file-card{width:min(360px,100%);display:flex;align-items:center;gap:10px;padding:10px;border-radius:12px;background:rgba(255,255,255,.14);border:1px solid currentColor;text-align:right}.chat-msg.other .chat-file-card{background:#f5f9fd;border-color:#d6e4f2;color:#123b66}.chat-file-card>svg{width:28px;height:28px;flex:none}.chat-file-card>span{display:flex;flex-direction:column;min-width:0;flex:1}.chat-file-card>span small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:250px}.chat-file-card>em{display:grid;place-items:center;flex:none}.chat-file-card.pdf>svg{color:#d6324b}.chat-image-card{padding:0;width:min(360px,100%);border-radius:14px;overflow:hidden;background:rgba(255,255,255,.18);text-align:right}.chat-image-card img{width:100%;max-height:280px;object-fit:cover;display:block;background:#dce7f2;min-height:120px}.chat-image-card>span{display:flex;align-items:center;gap:6px;padding:7px 9px}.chat-image-card>span small{margin-right:auto;max-width:210px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-image-card.media-error img{display:none}.chat-media-error{font-size:11px;opacity:.75}.chat-empty-mini{padding:24px;text-align:center;color:var(--muted)}
@media(max-width:800px){.chat-layout{height:calc(100vh - 150px);min-height:500px;display:block}.chat-threads,.chat-panel{height:100%;width:100%}.chat-panel{display:none}.chat-layout.chat-open .chat-threads{display:none}.chat-layout.chat-open .chat-panel{display:flex}.chat-back{display:grid;place-items:center}.chat-head{height:64px!important}.chat-msg{max-width:88%!important}.voice-note{min-width:210px}.chat-compose{height:66px!important;padding:8px!important}.chat-compose-btn,.chat-send{width:42px;height:42px}.chat-thread-list{height:calc(100% - 76px)}.chat-image-card img{max-height:220px}}


/* V1.6 explicit warehouse permissions */
.permission-toggle-row{display:flex;flex-wrap:wrap;gap:10px 18px;margin-top:12px}
.permission-toggle-row.stacked{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.permission-toggle-row label{display:flex;align-items:center;gap:8px;font-weight:700}
.warehouse-permission-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:10px}
.warehouse-permission-item{display:flex;align-items:center;gap:10px;padding:12px;border:1px solid #dbe7f3;border-radius:12px;background:#f8fbff;cursor:pointer;transition:.18s ease}
.warehouse-permission-item:hover{border-color:#4b98ff;background:#f1f7ff}
.warehouse-permission-item:has(input:checked){border-color:#1677ff;background:#eaf4ff;box-shadow:0 0 0 2px rgba(22,119,255,.08)}
.warehouse-permission-item input{width:18px;height:18px;accent-color:#1677ff;flex:0 0 auto}
.warehouse-permission-item span{display:flex;flex-direction:column;gap:2px}
.warehouse-permission-item small{color:#6d7f92;font-weight:500}
@media(max-width:700px){.warehouse-permission-grid,.permission-toggle-row.stacked{grid-template-columns:1fr}}


/* PharmaAxis V1.7 — maps stay inside their frame; no Leaflet layer may escape above UI */
.map-wrap{overflow:hidden!important;isolation:isolate!important;contain:paint;z-index:0!important}
.map-wrap>.map,.map-wrap>.leaflet-container,.leaflet-container{position:relative!important;z-index:0!important;max-width:100%;max-height:100%}
.map-wrap .leaflet-pane,.map-wrap .leaflet-top,.map-wrap .leaflet-bottom{max-width:100%}
#modalHost{position:relative;z-index:5000}.modal{z-index:5000!important}.modal-card{position:relative;z-index:5001}.modal-backdrop{z-index:4999}
.route-modal .modal-card{width:min(1100px,100%)}
.role-supervisor .map-wrap,.role-superadmin .map-wrap{border:1px solid #dbe6f2;box-shadow:inset 0 0 0 1px rgba(255,255,255,.6)}

/* Dedicated Supervisor phone entry while supervisor.html remains laptop/desktop responsive */
body.supervisor-mobile-mode{max-width:520px;margin:0 auto;min-height:100vh;background:#dfe8f2;box-shadow:0 0 40px rgba(9,38,72,.22)}
body.supervisor-mobile-mode .shell{display:block}
body.supervisor-mobile-mode .sidebar{display:none}
body.supervisor-mobile-mode .topbar{height:66px;padding:0 12px}
body.supervisor-mobile-mode .topbar .search{display:none}
body.supervisor-mobile-mode .topbar .profile .meta{display:none}
body.supervisor-mobile-mode .topbar .mobile-only{display:block}
body.supervisor-mobile-mode .content{padding:10px 10px 84px}
body.supervisor-mobile-mode .kpis{grid-template-columns:repeat(2,1fr);gap:8px}
body.supervisor-mobile-mode .kpi{min-height:94px;padding:13px}
body.supervisor-mobile-mode .kpi .v{font-size:20px}
body.supervisor-mobile-mode .two-col,body.supervisor-mobile-mode .three-col,body.supervisor-mobile-mode .grid2,body.supervisor-mobile-mode .grid3,body.supervisor-mobile-mode .grid4{grid-template-columns:1fr}
body.supervisor-mobile-mode .map-wrap{height:330px!important}
body.supervisor-mobile-mode .bottom-nav{display:grid;position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:min(520px,100%);height:68px;background:#fff;border-top:1px solid #dce5ef;z-index:1200;grid-template-columns:repeat(5,1fr);padding-bottom:env(safe-area-inset-bottom)}
body.supervisor-mobile-mode .bottom-nav button{border:0;background:transparent;color:#6c7f98;font-size:10px;font-weight:800;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px}
body.supervisor-mobile-mode .bottom-nav button.active{color:var(--blue)}
body.supervisor-mobile-mode .mobile-only{display:block}
body.supervisor-mobile-mode .card.pad{padding:13px}
body.supervisor-mobile-mode .table{min-width:620px}
body.supervisor-mobile-mode .modal{padding:0;align-items:flex-end}
body.supervisor-mobile-mode .modal-card{border-radius:18px 18px 0 0;max-height:94vh}
body.supervisor-mobile-mode .chat-layout{height:calc(100vh - 150px);min-height:500px;display:block}
body.supervisor-mobile-mode .chat-threads,body.supervisor-mobile-mode .chat-panel{height:100%;width:100%}


/* PharmaAxis V1.8 — Representative profile */
.rep-profile-head{display:grid;grid-template-columns:auto 1fr auto;gap:16px;align-items:center;padding:4px 0 14px;border-bottom:1px solid #e3ebf4}.rep-profile-avatar{width:82px;height:82px;border-radius:22px;background:linear-gradient(135deg,#ddebff,#f7fbff);border:2px solid #fff;box-shadow:0 8px 24px rgba(7,54,111,.12);display:grid;place-items:center;font-size:30px;font-weight:900;color:#0a4c92;overflow:hidden}.rep-profile-avatar img{width:100%;height:100%;object-fit:cover}.rep-profile-main h2{margin:0 0 4px;font-size:23px;color:#0c315c}.rep-contact-line{display:flex;align-items:center;gap:7px;margin-top:8px;color:#365a7e}.rep-contact-line svg{width:17px}.rep-contact-actions{margin-top:10px}.rep-contact-actions a{text-decoration:none}.rep-status-box{display:flex;flex-direction:column;gap:8px;align-items:flex-start}.rep-kpis{grid-template-columns:repeat(4,1fr)}.rep-name-link{border:0;background:transparent;padding:0;color:#0b4e93;font:inherit;font-weight:900;cursor:pointer;text-align:right}.rep-name-link:hover{text-decoration:underline}.rep-profile-tabs{margin-top:4px}
@media(max-width:800px){.rep-profile-head{grid-template-columns:auto 1fr}.rep-status-box{grid-column:1/-1;flex-direction:row;align-items:center}.rep-profile-avatar{width:64px;height:64px;border-radius:18px}.rep-profile-main h2{font-size:19px}.rep-contact-actions{gap:5px}.rep-contact-actions .btn{padding:9px 10px;font-size:12px}.rep-kpis{grid-template-columns:repeat(2,1fr)}.rep-profile-tabs{display:grid;grid-template-columns:repeat(2,1fr)}.rep-profile-tabs .tab{width:100%}}

/* PharmaAxis V1.9 — account menu / notifications / image cropper */
.rx-top-actions{display:flex;align-items:center;gap:9px;position:relative}.rx-icon-button{position:relative;width:44px;height:44px;border:1px solid rgba(255,255,255,.22);border-radius:12px;background:rgba(255,255,255,.10);color:#fff;display:grid;place-items:center}.rx-icon-button:hover{background:rgba(255,255,255,.16)}.rx-icon-button svg{width:21px;height:21px}.rx-notif-badge{position:absolute;top:-5px;left:-5px;min-width:20px;height:20px;border-radius:99px;background:#ef334e;color:#fff;border:2px solid #06366f;font-size:10px;font-weight:900;display:grid;place-items:center;padding:0 5px}.rx-notif-badge.hidden{display:none}.rx-profile-button{border:0;background:transparent;color:#fff;display:flex;align-items:center;gap:9px;text-align:right;padding:4px 6px;border-radius:12px}.rx-profile-button:hover{background:rgba(255,255,255,.08)}.rx-profile-button>.meta{display:flex;flex-direction:column;line-height:1.25}.rx-profile-button>.meta small{font-size:10px;color:#d7e7f9}.rx-profile-button>svg{width:16px}.rx-profile-avatar{overflow:hidden;flex:none}.rx-profile-avatar img{width:100%;height:100%;object-fit:cover;display:block}.rx-profile-avatar.large{width:70px;height:70px;font-size:24px}.rx-profile-avatar.xlarge{width:96px;height:96px;font-size:32px}.rx-profile-menu{position:absolute;top:58px;left:0;width:280px;background:#fff;border:1px solid #dfe8f3;border-radius:16px;padding:8px;box-shadow:0 18px 45px rgba(4,28,57,.24);z-index:2000;color:var(--ink)}.rx-profile-menu button{width:100%;border:0;background:#fff;border-radius:10px;padding:11px 12px;display:flex;align-items:center;gap:10px;text-align:right;color:#173b63;font-weight:800}.rx-profile-menu button:hover{background:#f1f7ff}.rx-profile-menu button.danger{color:#c8223e;border-top:1px solid #edf2f7;margin-top:5px;padding-top:13px}.rx-profile-menu svg{width:18px}.rx-notification-list{display:grid;gap:8px;max-height:62vh;overflow:auto}.rx-notification{border:1px solid #e0e9f4;background:#fff;border-radius:13px;padding:11px;display:grid;grid-template-columns:auto 1fr auto;gap:10px;align-items:start;text-align:right;color:var(--ink)}.rx-notification.unread{background:#f1f7ff;border-color:#bcd8fb}.rx-notification-icon{width:38px;height:38px;border-radius:11px;background:#eaf3ff;color:#0d72f5;display:grid;place-items:center}.rx-notification span:nth-child(2){display:flex;flex-direction:column;gap:3px}.rx-notification small{color:#4d6680}.rx-notification em{font-style:normal;font-size:10px;color:var(--muted)}.rx-unread-dot{width:9px;height:9px;background:#e62946;border-radius:50%;margin-top:6px}.rx-notif-pulse{animation:rxNotifPulse 1.1s infinite}.rx-nav-flash{animation:rxNavFlash 1.15s infinite!important}@keyframes rxNotifPulse{0%,100%{box-shadow:0 0 0 0 rgba(255,80,100,.0)}50%{box-shadow:0 0 0 7px rgba(255,80,100,.28);background:rgba(255,255,255,.2)}}@keyframes rxNavFlash{0%,100%{box-shadow:inset 0 0 0 0 rgba(255,255,255,0)}50%{box-shadow:inset 0 0 0 2px #fff,0 0 14px rgba(45,160,255,.65)}}
.rx-profile-editor{display:flex;align-items:center;gap:9px;flex-wrap:wrap;margin-bottom:15px}.rx-profile-preview{margin-left:auto}.rx-sep{border:0;border-top:1px solid var(--line);margin:18px 0}.rx-settings-list{display:grid;gap:10px}.rx-settings-list>label,.rx-settings-row{display:flex;justify-content:space-between;align-items:center;gap:12px;border:1px solid var(--line);border-radius:13px;padding:13px;background:#fff}.rx-settings-list>label span,.rx-settings-row span:first-child{display:flex;flex-direction:column;gap:3px}.rx-settings-list small,.rx-settings-row small{color:var(--muted)}.rx-settings-list input[type=checkbox]{width:21px;height:21px}.rx-policy-body{line-height:2;color:#304a66;padding:10px 2px}.rx-policy-body h3{color:#07366f}.rx-policy-body p{background:#f8fbff;border:1px solid #e1eaf5;border-radius:11px;padding:12px 14px}.crop-help{text-align:center;color:#59718c;margin-bottom:12px}.crop-stage{width:300px;height:300px;margin:0 auto;border-radius:18px;overflow:hidden;background:#dce7f3;position:relative;touch-action:none;cursor:grab;box-shadow:inset 0 0 0 1px #c5d4e5}.crop-stage:active{cursor:grabbing}.crop-stage>img{position:absolute;top:0;left:0;max-width:none!important;user-select:none;pointer-events:none;transform-origin:top left}.crop-guide{position:absolute;inset:22px;border:3px solid rgba(255,255,255,.95);border-radius:50%;box-shadow:0 0 0 999px rgba(6,31,60,.28),0 0 0 1px rgba(4,40,80,.2);pointer-events:none}.crop-controls{display:flex;align-items:center;gap:12px;justify-content:center;margin-top:14px}.crop-controls label{display:flex;align-items:center;gap:8px;font-weight:800}.crop-controls input[type=range]{width:min(260px,45vw)}
@media(max-width:800px){.rx-profile-button>.meta,.rx-profile-button>svg{display:none}.rx-profile-button{padding:0}.rx-icon-button{width:42px;height:42px}.rx-top-actions{margin-right:auto}.rx-profile-menu{left:0;right:auto;top:54px;width:min(290px,calc(100vw - 24px))}.rx-profile-editor{justify-content:center}.rx-profile-preview{width:100%;display:flex;justify-content:center;margin:0}.crop-stage{width:min(300px,82vw);height:min(300px,82vw)}.crop-controls{flex-direction:column}.crop-controls input[type=range]{width:min(280px,75vw)}}
.image-crop-overlay{position:fixed;inset:0;background:rgba(4,20,41,.72);z-index:9000;display:flex;align-items:center;justify-content:center;padding:16px}.image-crop-card{width:min(520px,100%);max-height:96vh;overflow:auto;background:#fff;border-radius:20px;box-shadow:0 28px 80px rgba(0,0,0,.38)}

/* PharmaAxis V2.0 FINAL — approved internal/external icon + role-specific device UI */
.brand-mark{background:#062f62!important;overflow:hidden;border-radius:14px!important;box-shadow:0 8px 20px rgba(13,114,245,.24)!important}
.brand-mark:after{display:none!important}
.brand-mark img{width:100%;height:100%;object-fit:cover;display:block}
.rx-mobile-brand{align-items:center;gap:8px;font-weight:900}
.rx-mobile-brand img{width:40px;height:40px;border-radius:11px;object-fit:cover;box-shadow:0 5px 12px rgba(0,0,0,.16)}
.desktop-only-gate{min-height:100vh;display:grid;place-items:center;align-content:center;text-align:center;padding:28px;background:linear-gradient(160deg,#062f64,#0a579a);color:#fff;gap:14px}
.desktop-only-gate img{width:112px;height:112px;border-radius:26px;box-shadow:0 18px 44px rgba(0,0,0,.28)}
.desktop-only-gate h1{margin:0;font-size:28px}.desktop-only-gate p{margin:0 0 8px;color:#d9e9fa;max-width:430px;line-height:1.8}

/* Representative is a phone-only product UI, even when previewed from a laptop. */
body.rep-mobile-only-mode{max-width:520px;margin:0 auto;min-height:100vh;background:#dfe8f2;box-shadow:0 0 45px rgba(9,38,72,.25)}
body.rep-mobile-only-mode .shell{display:block}
body.rep-mobile-only-mode .sidebar{display:none!important}
body.rep-mobile-only-mode .topbar{height:66px;padding:0 10px;position:sticky;top:0}
body.rep-mobile-only-mode .topbar .search{display:none!important}
body.rep-mobile-only-mode .topbar .mobile-only{display:flex!important}
body.rep-mobile-only-mode .rx-top-actions{margin-right:auto;gap:6px}
body.rep-mobile-only-mode .rx-profile-button>.meta,body.rep-mobile-only-mode .rx-profile-button>svg{display:none}
body.rep-mobile-only-mode .content{padding:10px 10px 86px}
body.rep-mobile-only-mode .kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
body.rep-mobile-only-mode .kpi{min-height:94px;padding:12px}
body.rep-mobile-only-mode .kpi .v{font-size:20px}
body.rep-mobile-only-mode .two-col,body.rep-mobile-only-mode .three-col,body.rep-mobile-only-mode .grid2,body.rep-mobile-only-mode .grid3,body.rep-mobile-only-mode .grid4{grid-template-columns:1fr}
body.rep-mobile-only-mode .bottom-nav{display:grid!important;position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:min(520px,100%);height:70px;background:#fff;border-top:1px solid #dce5ef;z-index:1500;grid-template-columns:repeat(5,1fr);padding-bottom:env(safe-area-inset-bottom)}
body.rep-mobile-only-mode .bottom-nav button{border:0;background:transparent;color:#6c7f98;font-size:10px;font-weight:800;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px}
body.rep-mobile-only-mode .bottom-nav button.active{color:var(--blue)}
body.rep-mobile-only-mode .card.pad{padding:12px}
body.rep-mobile-only-mode .table{min-width:620px}
body.rep-mobile-only-mode .modal{padding:0;align-items:flex-end}
body.rep-mobile-only-mode .modal-card{border-radius:18px 18px 0 0;max-height:94vh;width:100%}
body.rep-mobile-only-mode .rep-kpis{grid-template-columns:repeat(2,1fr)!important}
body.rep-mobile-only-mode .rep-quick-grid{grid-template-columns:repeat(2,1fr)!important}
body.rep-mobile-only-mode .rep-home-cols,body.rep-mobile-only-mode .rep-map-grid{grid-template-columns:1fr!important}
body.rep-mobile-only-mode .sale-product-grid{grid-template-columns:repeat(2,1fr)!important}
body.rep-mobile-only-mode .rep-main-map{height:58vh!important;min-height:380px!important}
body.rep-mobile-only-mode .chat-layout{height:calc(100vh - 150px);min-height:500px;display:block}
body.rep-mobile-only-mode .chat-threads,body.rep-mobile-only-mode .chat-panel{height:100%;width:100%}
body.rep-mobile-only-mode .chat-panel{display:none}
body.rep-mobile-only-mode .chat-layout.chat-open .chat-threads{display:none}
body.rep-mobile-only-mode .chat-layout.chat-open .chat-panel{display:flex}
body.rep-mobile-only-mode .chat-back{display:grid;place-items:center}

/* Supervisor has two approved layouts: desktop and dedicated phone. */
body.supervisor-desktop-mode .bottom-nav{display:none!important}
body.supervisor-desktop-mode .sidebar{display:block}
body.supervisor-mobile-mode .rx-mobile-brand{display:flex!important}
body.supervisor-mobile-mode .rx-top-actions{margin-right:auto;gap:6px}
body.supervisor-mobile-mode .rx-profile-button>.meta,body.supervisor-mobile-mode .rx-profile-button>svg{display:none}

/* Super Admin is desktop/laptop only; never convert it into the generic phone layout. */
@media(max-width:800px) and (pointer:fine){
  body.superadmin-desktop-mode .shell{display:grid;grid-template-columns:235px 1fr}
  body.superadmin-desktop-mode .sidebar{display:block}
  body.superadmin-desktop-mode .topbar{height:76px;padding:0 20px}
  body.superadmin-desktop-mode .topbar .search{display:block}
  body.superadmin-desktop-mode .topbar .mobile-only{display:none!important}
  body.superadmin-desktop-mode .content{padding:16px 18px 40px}
  body.superadmin-desktop-mode .bottom-nav{display:none!important}
}
