@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&display=swap');
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

:root {
  --primary:#E8541A; --primary-h:#C9430F; --primary-bg:#FFF4F0; --primary-b:#FDC0A7;
  --success:#059669; --success-bg:#ecfdf5; --success-b:#bbf7d0;
  --warning:#d97706; --warning-bg:#fffbeb; --warning-b:#fde68a;
  --danger:#dc2626;  --danger-bg:#fef2f2;  --danger-b:#fecaca;
  --purple:#7c3aed;  --purple-bg:#f5f3ff;  --purple-b:#ddd6fe;
  --cyan:#E8541A;    --cyan-bg:#ecfeff;    --cyan-b:#a5f3fc;
  --teal:#0d9488;    --teal-bg:#f0fdfa;
  --text:#0f172a;    --text-m:#475569;     --text-l:#94a3b8;
  --bg:#fafafa;      --card:#ffffff;       --border:#e8ddd8;
  --sidebar-w:240px; --topbar-h:56px;
  --radius:10px;     --shadow:0 1px 4px rgba(0,0,0,.07),0 4px 12px rgba(0,0,0,.06);
}

html,body{font-family:'Cairo',sans-serif;font-size:14px;color:var(--text);background:var(--bg);min-height:100vh;direction:rtl}

/* ── SIDEBAR ── */
.sidebar{position:fixed;top:0;right:0;height:100vh;width:var(--sidebar-w);background:#1a0e09;display:flex;flex-direction:column;z-index:200;overflow-y:auto;overflow-x:hidden;transition:transform .25s}
.sb-logo{display:flex;align-items:center;gap:10px;padding:14px 14px 12px;border-bottom:1px solid rgba(255,255,255,.1);background:rgba(232,84,26,.12)}
.sb-logo-img{height:40px;max-width:190px;width:auto;object-fit:contain;flex-shrink:0;filter:brightness(0) invert(1)}
.sb-title{font-size:14px;font-weight:800;color:#fff;line-height:1.2}
.sb-sub{font-size:11px;color:#94a3b8}
.tb-logo-img{height:22px;width:auto;object-fit:contain;vertical-align:middle;margin-left:6px}
.sb-close{display:none;margin-right:auto;background:none;border:none;color:#94a3b8;font-size:18px;cursor:pointer;padding:2px 6px}
.sb-nav{padding:12px 8px;flex:1}
.sb-group-label{font-size:10.5px;font-weight:700;color:#64748b;text-transform:uppercase;letter-spacing:.06em;padding:6px 8px 4px}
.sb-item{display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:8px;color:#94a3b8;font-size:13px;font-weight:600;cursor:pointer;transition:all .15s;text-decoration:none;position:relative}
.sb-item:hover{background:rgba(255,255,255,.06);color:#e2e8f0}
.sb-item.active{background:#E8541A;color:#fff}
.sb-badge{margin-right:auto;background:rgba(255,255,255,.15);color:#e2e8f0;font-size:11px;font-weight:700;padding:1px 7px;border-radius:20px;min-width:22px;text-align:center}
.sb-badge-v{background:#0d9488}
.sb-actions-label{font-size:10.5px;font-weight:700;color:#64748b;text-transform:uppercase;letter-spacing:.06em;padding:6px 16px 4px}
.sb-quick{padding:0 8px 10px;display:flex;flex-direction:column;gap:5px}
.sq-btn{background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.08);color:#94a3b8;border-radius:7px;padding:8px 12px;font-family:inherit;font-size:12.5px;font-weight:600;cursor:pointer;text-align:right;transition:all .15s}
.sq-btn:hover{background:rgba(255,255,255,.1);color:#e2e8f0;border-color:rgba(255,255,255,.15)}
.sq-btn.danger{color:#fecaca;border-color:rgba(248,113,113,.28)}
.sq-btn.danger:hover{background:rgba(220,38,38,.14);color:#fff;border-color:rgba(248,113,113,.55)}
.sb-footer{padding:14px 16px;font-size:11px;color:#475569;border-top:1px solid rgba(255,255,255,.06);line-height:1.7}
.sb-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:199}
.sb-overlay.show{display:block}

/* ── TOPBAR ── */
.topbar{position:fixed;top:0;right:var(--sidebar-w);left:0;height:var(--topbar-h);background:#fff;border-bottom:1.5px solid var(--border);display:flex;align-items:center;gap:12px;padding:0 20px;z-index:100;box-shadow:0 1px 3px rgba(0,0,0,.04)}
.menu-toggle{display:none;flex-direction:column;gap:5px;background:none;border:none;cursor:pointer;padding:4px}
.menu-toggle span{display:block;width:20px;height:2.5px;background:var(--text-m);border-radius:2px}
.tb-left{display:flex;align-items:center;gap:8px}
.tb-appname{font-size:15px;font-weight:800;color:var(--text)}
.tb-center{flex:1;display:flex;justify-content:center;max-width:480px;margin:0 auto}
.tb-right{display:flex;align-items:center;gap:8px;margin-left:0;margin-right:auto}
.tb-date{font-size:12.5px;color:var(--text-m);font-weight:600;white-space:nowrap}

/* ── GLOBAL SEARCH ── */
.global-search-wrap{position:relative;width:100%;max-width:420px}
.gs-icon{position:absolute;right:10px;top:50%;transform:translateY(-50%);width:15px;height:15px;color:var(--text-l);pointer-events:none}
.global-search{width:100%;padding:7px 34px 7px 12px;border:1.5px solid var(--border);border-radius:8px;font-family:'Cairo',sans-serif;font-size:13.5px;font-weight:500;color:var(--text);background:var(--bg);outline:none;transition:all .15s}
.global-search:focus{border-color:var(--primary);background:#fff;box-shadow:0 0 0 3px rgba(232,84,26,.1)}
.global-results{position:absolute;top:calc(100% + 6px);right:0;left:0;background:#fff;border:1.5px solid var(--border);border-radius:10px;box-shadow:var(--shadow);z-index:300;display:none;max-height:360px;overflow-y:auto}
.global-results.open{display:block}
.gr-item{display:flex;align-items:flex-start;gap:10px;padding:10px 14px;cursor:pointer;transition:background .1s;border-bottom:1px solid var(--border)}
.gr-item:last-child{border-bottom:none}
.gr-item:hover{background:#f8fafc}
.gr-name{font-size:13.5px;font-weight:700;color:var(--text)}
.gr-sub{font-size:12px;color:var(--text-m);margin-top:2px}
.hlmark{background:#fef08a;color:#854d0e;border-radius:2px;padding:0 1px}

/* ── MAIN ── */
.main{margin-right:var(--sidebar-w);margin-top:var(--topbar-h);padding:22px;min-height:calc(100vh - var(--topbar-h))}

/* ── PAGE ── */
.page{animation:fadeIn .18s ease}
.page.hidden{display:none}
@keyframes fadeIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.page-header{display:flex;align-items:flex-start;justify-content:space-between;margin-bottom:20px;gap:12px;flex-wrap:wrap}
.page-title{font-size:22px;font-weight:900;color:var(--text);line-height:1.2}
.page-sub{font-size:13px;color:var(--text-m);font-weight:600;margin-top:2px}
.page-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}

/* ── STATS GRID ── */
.stats-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(168px,1fr));gap:14px;margin-bottom:22px}
.stat-card{background:#fff;border-radius:var(--radius);padding:16px 18px;border:1.5px solid var(--border);display:flex;align-items:center;gap:14px;box-shadow:var(--shadow)}
.stat-icon{width:44px;height:44px;border-radius:10px;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.stat-val{font-size:26px;font-weight:900;color:var(--text);line-height:1}
.stat-lbl{font-size:12px;font-weight:600;color:var(--text-m);margin-top:3px}
.stat-sub{font-size:11px;color:var(--text-l);margin-top:2px}

/* ── DASH GRID ── */
.dash-grid{display:grid;grid-template-columns:2fr 1fr;gap:16px}
.dash-card{background:#fff;border-radius:var(--radius);border:1.5px solid var(--border);padding:18px;box-shadow:var(--shadow)}
.dash-card.wide{grid-column:1/-1}
.card-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px}
.card-header h3{font-size:14.5px;font-weight:800;color:var(--text)}

/* ── QUICK ACTIONS ── */
.quick-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.quick-btn{display:flex;flex-direction:column;align-items:center;gap:6px;padding:14px 8px;border:1.5px solid var(--border);border-radius:10px;background:#f8fafc;color:var(--text-m);font-family:'Cairo',sans-serif;font-size:12px;font-weight:700;cursor:pointer;transition:all .15s}
.quick-btn:hover{background:var(--primary-bg);border-color:var(--primary-b);color:var(--primary)}

/* ── FILTER PANEL ── */
.filter-panel{background:#fff;border-radius:var(--radius);border:1.5px solid var(--border);padding:14px 16px;margin-bottom:14px;box-shadow:var(--shadow)}
.filter-row{display:flex;gap:10px;flex-wrap:wrap;align-items:flex-end;margin-bottom:8px}
.filter-row:last-child{margin-bottom:0}
.filter-group{display:flex;flex-direction:column;gap:4px;min-width:140px;flex:1}
.filter-group.fg-wide{flex:2.5;min-width:200px}
.filter-group label{font-size:11.5px;font-weight:700;color:var(--text-m)}
.filter-actions-group{flex:0 0 auto;min-width:auto}
.fi{padding:7px 10px;border:1.5px solid var(--border);border-radius:8px;font-family:'Cairo',sans-serif;font-size:13px;font-weight:500;color:var(--text);background:#fff;outline:none;width:100%;transition:border-color .15s}
.fi:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(232,84,26,.08)}
select.fi{cursor:pointer}
textarea.fi{resize:vertical}

/* ── FILTER CHIPS ── */
.filter-chips{display:flex;gap:6px;flex-wrap:wrap;margin-top:4px}
.fchip{display:inline-flex;align-items:center;gap:5px;padding:3px 10px;border-radius:20px;background:var(--primary-bg);border:1px solid var(--primary-b);color:var(--primary);font-size:12px;font-weight:700}
.fchip button{background:none;border:none;color:var(--primary);cursor:pointer;font-size:14px;line-height:1;padding:0 1px}

/* ── STATUS CHIPS ── */
.status-chips{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:14px}
.chip{padding:5px 14px;border-radius:20px;border:1.5px solid var(--border);background:#fff;color:var(--text-m);font-family:'Cairo',sans-serif;font-size:12.5px;font-weight:700;cursor:pointer;transition:all .15s;white-space:nowrap}
.chip:hover{border-color:var(--primary);color:var(--primary)}
.chip.active{background:var(--primary);border-color:var(--primary);color:#fff}
.chip-offers.active{background:#0d9488;border-color:#0d9488;color:#fff}

/* ── TABLE ── */
.table-wrap{background:#fff;border-radius:var(--radius);border:1.5px solid var(--border);overflow-x:auto;overflow-y:visible;box-shadow:var(--shadow)}
.tbl{width:100%;border-collapse:collapse;font-size:13.5px}
.tbl thead tr{background:#f8fafc}
.tbl th{padding:11px 12px;text-align:right;font-weight:800;color:var(--text-m);font-size:12.5px;border-bottom:2px solid var(--border);white-space:nowrap}
.tbl td{padding:10px 12px;border-bottom:1px solid var(--border);vertical-align:middle;color:var(--text);font-weight:600}
.tbl td:last-child,.tbl th:last-child{position:sticky;left:0;background:#fff;z-index:2;box-shadow:-2px 0 6px rgba(0,0,0,.06)}
.tbl thead tr th:last-child{background:#f8fafc}
.tbl tbody tr:last-child td{border-bottom:none}
.tbl tbody tr:hover{background:#f8fafc}
.tbl tbody tr.row-contracted{background:rgba(5,150,105,.04)}
.tbl tbody tr.row-no-contract{background:rgba(220,38,38,.03)}
.tbl tbody tr.row-new td:first-child{border-right:3px solid var(--primary)}
.sortable{cursor:pointer;user-select:none}
.sortable:hover{background:#f1f5f9}
.sort-icon{font-size:11px;color:var(--text-l);margin-right:3px}
.sort-asc .sort-icon::after{content:'↑'}
.sort-desc .sort-icon::after{content:'↓'}

/* ── TABLE EMPTY ── */
.tbl-empty{padding:48px 24px;text-align:center;display:flex;flex-direction:column;align-items:center;gap:8px}
.tbl-empty p{font-size:15px;font-weight:700;color:var(--text-m)}
.tbl-empty span{font-size:12.5px;color:var(--text-l)}
.tbl-empty.hidden{display:none}

/* ── TABLE FOOTER ── */
.tbl-footer{padding:10px 16px;background:#f8fafc;border-top:1.5px solid var(--border);display:flex;align-items:center;gap:14px;flex-wrap:wrap;min-height:38px}
.tf-stat{display:flex;align-items:center;gap:5px;font-size:12.5px;font-weight:700;color:var(--text-m)}
.tf-dot{width:8px;height:8px;border-radius:50%;display:inline-block}

/* ── BADGES ── */
.badge{display:inline-flex;align-items:center;gap:4px;padding:3px 10px;border-radius:20px;font-size:12px;font-weight:700;white-space:nowrap}
.b-g{background:var(--success-bg);color:var(--success);border:1px solid var(--success-b)}
.b-y{background:var(--warning-bg);color:var(--warning);border:1px solid var(--warning-b)}
.b-r{background:var(--danger-bg);color:var(--danger);border:1px solid var(--danger-b)}
.b-v{background:var(--purple-bg);color:var(--purple);border:1px solid var(--purple-b)}
.b-b{background:var(--primary-bg);color:var(--primary);border:1px solid var(--primary-b)}
.b-c{background:var(--cyan-bg);color:var(--cyan);border:1px solid var(--cyan-b)}
.b-t{background:var(--teal-bg);color:var(--teal);border:1px solid #99f6e4}
.b-s{background:#f8fafc;color:var(--text-m);border:1px solid var(--border)}
.b-off{background:#fef9c3;color:#854d0e;border:1px solid #fde68a}

/* ── SECTION BADGE ── */
.sec-badge{font-size:11px;font-weight:700;padding:2px 8px;border-radius:20px}
.sec-regular{background:#f1f5f9;color:#64748b}
.sec-outlet{background:var(--purple-bg);color:var(--purple)}

/* ── ACTION BTNS ── */
.act-btns{display:flex;gap:5px;align-items:center;white-space:nowrap;flex-wrap:nowrap}
.act-btn{background:none;border:1.5px solid var(--border);border-radius:7px;padding:4px 8px;cursor:pointer;font-size:12px;color:var(--text-m);transition:all .15s;font-family:'Cairo',sans-serif;font-weight:600}
.act-btn:hover{background:var(--primary-bg);border-color:var(--primary-b);color:var(--primary)}
.act-btn.danger:hover{background:var(--danger-bg);border-color:var(--danger-b);color:var(--danger)}
.ico{width:16px;height:16px;display:block;flex:0 0 16px}
.icon-btn{width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;padding:0}

/* ── BUTTONS ── */
.btn{display:inline-flex;align-items:center;gap:6px;padding:8px 16px;border-radius:8px;font-family:'Cairo',sans-serif;font-size:13.5px;font-weight:700;cursor:pointer;border:1.5px solid transparent;transition:all .15s;white-space:nowrap;text-decoration:none}
.btn-primary{background:var(--primary);color:#fff;border-color:var(--primary)}
.btn-primary:hover{background:var(--primary-h)}
.btn-outline{background:#fff;color:var(--text);border-color:var(--border)}
.btn-outline:hover{border-color:var(--primary);color:var(--primary);background:var(--primary-bg)}
.btn-ghost{background:none;color:var(--text-m);border-color:transparent}
.btn-ghost:hover{background:#f1f5f9}
.btn-danger{background:var(--danger);color:#fff;border-color:var(--danger)}
.btn-danger:hover{background:#b91c1c}
.btn-danger-outline{background:#fff;color:var(--danger);border-color:var(--danger-b)}
.btn-danger-outline:hover{background:var(--danger-bg)}
.btn-sm{padding:5px 12px;font-size:12.5px}

/* ── CONFIRM ── */
.confirm-box{background:#fff;border-radius:16px;padding:28px 32px;max-width:380px;width:100%;text-align:center;box-shadow:0 20px 60px rgba(0,0,0,.2)}
.confirm-icon{font-size:38px;margin-bottom:12px}
.confirm-box p{font-size:15px;font-weight:700;color:var(--text);margin-bottom:18px;line-height:1.5}
.confirm-btns{display:flex;gap:10px;justify-content:center}

/* ── MODALS ── */
.modal-bg{position:fixed;inset:0;background:rgba(15,23,42,.55);backdrop-filter:blur(3px);z-index:1000;display:flex;align-items:center;justify-content:center;padding:18px;opacity:0;pointer-events:none;transition:opacity .2s}
.modal-bg.open{opacity:1;pointer-events:all}
.modal{background:#fff;border-radius:14px;width:100%;max-height:90vh;overflow-y:auto;box-shadow:0 25px 80px rgba(0,0,0,.2)}
.modal-header{display:flex;align-items:center;justify-content:space-between;padding:18px 22px;border-bottom:1.5px solid var(--border);position:sticky;top:0;background:#fff;z-index:10}
.modal-header h2{font-size:17px;font-weight:800;color:var(--text)}
.modal-close{background:none;border:none;font-size:18px;color:var(--text-l);cursor:pointer;padding:2px 6px;border-radius:6px;line-height:1}
.modal-close:hover{background:#f1f5f9;color:var(--text)}
.modal-body{padding:20px 22px}
.modal-footer{display:flex;gap:8px;justify-content:flex-end;padding-top:16px;border-top:1px solid var(--border);margin-top:16px}

/* ── FORM ── */
.form-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:14px}
.form-group{display:flex;flex-direction:column;gap:5px}
.form-group label{font-size:12.5px;font-weight:700;color:var(--text-m)}
.req{color:var(--danger)}
.pass-wrap{position:relative}
.pass-toggle{position:absolute;left:8px;top:50%;transform:translateY(-50%);background:none;border:none;cursor:pointer;font-size:16px;line-height:1}

/* ── TOAST ── */
#toast{position:fixed;bottom:22px;left:50%;transform:translateX(-50%);background:#0f172a;color:#fff;padding:10px 22px;border-radius:8px;font-size:13.5px;font-weight:600;z-index:9999;opacity:0;pointer-events:none;transition:opacity .25s;font-family:'Cairo',sans-serif;white-space:nowrap}
#toast.show{opacity:1}

/* ── IMPORT ── */
.imp-zone{border:2px dashed var(--border);border-radius:12px;padding:36px 24px;text-align:center;display:flex;flex-direction:column;align-items:center;gap:10px;background:#f8fafc;transition:border-color .15s}
.imp-zone.drag-over{border-color:var(--primary);background:var(--primary-bg)}
.imp-zone p{font-size:14px;font-weight:600;color:var(--text-m)}
.map-hint{background:#FFF4F0;border:1px solid var(--primary-b);border-radius:8px;padding:10px 14px;font-size:12.5px;font-weight:600;color:var(--primary);margin-bottom:12px}
.col-map-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.col-map-row{display:flex;flex-direction:column;gap:4px}
.col-map-row label{font-size:12px;font-weight:700;color:var(--text-m)}
.imp-summary{background:#ecfdf5;border:1.5px solid var(--success-b);border-radius:10px;padding:18px;text-align:center}
.imp-summary h3{font-size:22px;font-weight:900;color:var(--success);margin-bottom:6px}
.imp-summary p{font-size:13.5px;color:var(--text-m);font-weight:600}

/* ── VIEW MODAL DETAILS ── */
.view-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.view-item{background:#f8fafc;border-radius:8px;padding:10px 14px}
.view-item .vi-label{font-size:11.5px;font-weight:700;color:var(--text-l);margin-bottom:3px}
.view-item .vi-val{font-size:14px;font-weight:700;color:var(--text)}

/* ── REPORTS ── */
.rep-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-bottom:20px}
.rep-card{background:#fff;border-radius:var(--radius);border:1.5px solid var(--border);padding:18px;box-shadow:var(--shadow)}
.rep-card h4{font-size:14px;font-weight:800;margin-bottom:12px;color:var(--text)}
.rep-row{display:flex;align-items:center;justify-content:space-between;padding:7px 0;border-bottom:1px solid var(--border)}
.rep-row:last-child{border-bottom:none}
.rep-name{font-size:13px;font-weight:700;color:var(--text)}
.rep-num{font-size:14px;font-weight:900;color:var(--primary)}
.rep-bar-wrap{flex:1;height:6px;background:#e2e8f0;border-radius:3px;margin:0 10px}
.rep-bar{height:6px;border-radius:3px;background:var(--primary);transition:width .5s}

/* ── REPS PAGE ── */
.reps-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:14px;margin-top:4px}
.rep-card-item{background:#fff;border-radius:var(--radius);border:1.5px solid var(--border);padding:18px;box-shadow:var(--shadow);display:flex;flex-direction:column;gap:8px}
.rep-card-header{display:flex;align-items:center;gap:12px}
.rep-avatar{width:44px;height:44px;border-radius:50%;background:linear-gradient(135deg,var(--primary),var(--purple));display:flex;align-items:center;justify-content:center;color:#fff;font-size:18px;font-weight:900;flex-shrink:0}
.rep-card-name{font-size:15px;font-weight:800;color:var(--text)}
.rep-card-region{font-size:12px;color:var(--text-m);font-weight:600}
.rep-card-info{display:flex;flex-direction:column;gap:4px}
.rep-info-row{display:flex;align-items:center;gap:6px;font-size:12.5px;color:var(--text-m);font-weight:600}
.rep-card-actions{display:flex;gap:6px;margin-top:4px}
.rep-stats{font-size:12px;font-weight:700;color:var(--primary);background:var(--primary-bg);padding:3px 10px;border-radius:20px;border:1px solid var(--primary-b)}

/* ── BULK BAR ── */
.bulk-bar{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);background:#0f172a;color:#fff;padding:10px 20px;border-radius:10px;display:none;align-items:center;gap:12px;z-index:500;box-shadow:0 8px 32px rgba(0,0,0,.3);font-size:13.5px;font-weight:700}
.bulk-bar.show{display:flex}

/* ── RESPONSIVE ── */
@media(max-width:900px){
  .sidebar{transform:translateX(100%)}
  .sidebar.open{transform:translateX(0)}
  .topbar{right:0}
  .main{margin-right:0}
  .menu-toggle{display:flex}
  .sb-close{display:block}
  .dash-grid{grid-template-columns:1fr}
  .dash-card.wide{grid-column:1}
  .form-grid{grid-template-columns:1fr}
  .view-grid{grid-template-columns:1fr}
  .col-map-grid{grid-template-columns:1fr}
  .tb-center{display:none}
  .rep-grid{grid-template-columns:1fr 1fr}
}
@media(max-width:600px){
  .stats-grid{grid-template-columns:1fr 1fr}
  .rep-grid{grid-template-columns:1fr}
  .filter-row{flex-direction:column}
  .filter-group{min-width:100%}
}
@media print{
  .sidebar,.topbar,.page-actions,.act-btns,.bulk-bar,.filter-panel,.status-chips{display:none!important}
  .main{margin:0;padding:0}
  .tbl th,.tbl td{font-size:11pt}
}

/* ── REGION PILL ── */
.region-pill{background:#f1f5f9;color:#475569;font-size:12px;font-weight:700;padding:2px 8px;border-radius:20px;white-space:nowrap}

/* ── COPY BTN ── */
.copy-btn{background:none;border:none;cursor:pointer;font-size:14px;padding:1px 4px;opacity:.6;transition:opacity .15s;vertical-align:middle}
.copy-btn:hover{opacity:1}

/* ── DROPDOWNS ── */
.drop-wrap{position:relative;display:inline-block}
.drop-menu{position:absolute;top:calc(100% + 4px);left:0;background:#fff;border:1.5px solid var(--border);border-radius:10px;min-width:210px;box-shadow:0 8px 24px rgba(0,0,0,.12);z-index:400;display:none;padding:4px 0}
.drop-menu.open{display:block}
.drop-item{display:flex;align-items:center;gap:8px;padding:9px 14px;width:100%;background:none;border:none;font-family:'Cairo',sans-serif;font-size:13px;font-weight:600;color:var(--text);cursor:pointer;text-align:right;transition:background .1s}
.drop-item span{flex:1;min-width:0;text-align:right}
.drop-item:hover{background:#f8fafc}
.drop-item.danger,.drop-item[style*="color:var(--r)"]{color:var(--danger)!important}
.drop-item.danger:hover{background:var(--danger-bg)}
.drop-sep{height:1px;background:var(--border);margin:4px 0}

/* ── TAG NEW ── */
.tag-new{background:#E8541A;color:#fff;font-size:10px;font-weight:800;padding:1px 6px;border-radius:20px;vertical-align:middle}

/* ── ROW STATES ── */
.row-sel{background:#FFF4F0!important}
.row-contracted{background:rgba(5,150,105,.04)}
.row-no-contract{background:rgba(220,38,38,.03)}

/* ── SORT ── */
.sort-asc .sort-icon::after{content:'↑';color:#E8541A}
.sort-desc .sort-icon::after{content:'↓';color:#E8541A}

/* ── REPS GRID ── */
.reps-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:14px}
.rep-card-item{background:#fff;border-radius:var(--radius);border:1.5px solid var(--border);padding:18px;box-shadow:var(--shadow);display:flex;flex-direction:column;gap:10px}
.rep-card-header{display:flex;align-items:center;gap:12px}
.rep-avatar{width:44px;height:44px;border-radius:50%;background:linear-gradient(135deg,#E8541A,#7c3aed);display:flex;align-items:center;justify-content:center;color:#fff;font-size:16px;font-weight:900;flex-shrink:0}
.rep-card-name{font-size:15px;font-weight:800;color:var(--text)}
.rep-card-region{font-size:12px;color:var(--text-m);font-weight:600}
.rep-stats{margin-right:auto;font-size:12px;font-weight:700;color:#0d9488;background:#f0fdfa;padding:3px 10px;border-radius:20px;border:1px solid #99f6e4;white-space:nowrap}
.rep-card-info{display:flex;flex-direction:column;gap:4px}
.rep-info-row{font-size:12.5px;color:var(--text-m);font-weight:600}
.rep-card-actions{display:flex;gap:6px;flex-wrap:wrap}

/* ── ACTION LOG MODAL ── */
.action-add-box{background:#f8fafc;border:1.5px solid var(--border);border-radius:10px;padding:14px 16px;margin-bottom:14px}
.action-add-title{font-size:13.5px;font-weight:800;color:var(--text);margin-bottom:10px}
.action-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;align-items:end}
.action-form-grid button{grid-column:1/-1}
.tl-offer-ref{font-size:12.5px;font-weight:700;color:var(--primary);background:var(--primary-bg);border:1px solid var(--primary-b);border-radius:20px;display:inline-block;padding:2px 12px;margin-top:3px}
.action-related-box{display:flex;gap:10px;flex-wrap:wrap;padding:8px 0}
.action-related-box span{background:#FFF4F0;border:1px solid #FDC0A7;color:#E8541A;font-size:12.5px;font-weight:700;padding:4px 12px;border-radius:20px}
.action-timeline-label{font-size:13px;font-weight:800;color:var(--text-m);margin-bottom:10px;padding-bottom:6px;border-bottom:1.5px solid var(--border)}

/* ── TIMELINE ── */
.timeline{display:flex;flex-direction:column;gap:0;position:relative}
.timeline::before{content:'';position:absolute;right:11px;top:0;bottom:0;width:2px;background:var(--border);z-index:0}
.timeline-item{display:flex;align-items:flex-start;gap:14px;padding:10px 0;position:relative}
.tl-dot{width:22px;height:22px;border-radius:50%;flex-shrink:0;border:3px solid #fff;box-shadow:0 0 0 2px var(--border);z-index:1;margin-top:2px}
.tl-body{flex:1;min-width:0}
.tl-header{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:4px}
.tl-type{font-size:12.5px;font-weight:800;padding:3px 10px;border-radius:20px;white-space:nowrap}
.tl-date{font-size:12px;color:var(--text-l);font-weight:600;margin-right:auto}
.tl-by{font-size:12.5px;color:var(--text-m);font-weight:600}
.tl-notes{font-size:13px;color:var(--text);font-weight:600;margin-top:3px;background:#f8fafc;border-radius:6px;padding:5px 10px;border-right:3px solid #e2e8f0}
.tl-source{font-size:11.5px;color:var(--text-l);font-weight:600;margin-top:2px}
.tl-del{background:none;border:none;cursor:pointer;color:var(--text-l);font-size:14px;padding:2px 6px;border-radius:5px;flex-shrink:0;transition:all .15s;align-self:flex-start}
.tl-del:hover{background:var(--danger-bg);color:var(--danger)}

/* ── MINI ACTION ITEMS (DASH) ── */
.action-item-mini{display:flex;align-items:flex-start;gap:10px;padding:9px 0;border-bottom:1px solid var(--border);cursor:pointer;transition:background .1s;border-radius:6px;padding-inline:6px}
.action-item-mini:hover{background:#f8fafc}
.action-item-mini:last-child{border-bottom:none}
.action-dot{width:10px;height:10px;border-radius:50%;flex-shrink:0;margin-top:4px}
.action-mini-body{flex:1;min-width:0}
.action-mini-title{font-size:13px;font-weight:700;color:var(--text);display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.action-type-badge{font-size:11.5px;font-weight:700;padding:1px 7px;border-radius:20px}
.action-mini-sub{font-size:12px;color:var(--text-l);font-weight:600;margin-top:2px}

/* ── REPORTS ── */
.rep-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-bottom:16px}
.rep-card{background:#fff;border-radius:var(--radius);border:1.5px solid var(--border);padding:18px;box-shadow:var(--shadow)}
.rep-card h4{font-size:14px;font-weight:800;color:var(--text);margin-bottom:12px}
.rep-row{display:flex;align-items:center;gap:8px;padding:7px 0;border-bottom:1px solid #f1f5f9}
.rep-row:last-child{border-bottom:none}
.rep-name{font-size:13px;font-weight:700;color:var(--text);flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rep-num{font-size:14px;font-weight:900;color:var(--primary);min-width:28px;text-align:left}
.rep-bar-wrap{flex:0 0 70px;height:6px;background:#e2e8f0;border-radius:3px}
.rep-bar{height:6px;border-radius:3px;background:var(--primary)}

/* ── IMPORT ── */
.imp-zone{border:2px dashed var(--border);border-radius:12px;padding:36px 24px;text-align:center;display:flex;flex-direction:column;align-items:center;gap:10px;background:#f8fafc;transition:border-color .15s;cursor:pointer}
.imp-zone.drag-over{border-color:var(--primary);background:var(--primary-bg)}
.imp-zone p{font-size:14px;font-weight:600;color:var(--text-m)}
.map-hint{background:#FFF4F0;border:1px solid var(--primary-b);border-radius:8px;padding:10px 14px;font-size:12.5px;font-weight:600;color:var(--primary);margin-bottom:12px}
.col-map-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;max-height:300px;overflow-y:auto}
.col-map-row{display:flex;flex-direction:column;gap:4px}
.col-map-row label{font-size:12px;font-weight:700;color:var(--text-m)}
.imp-summary{background:#ecfdf5;border:1.5px solid #bbf7d0;border-radius:10px;padding:24px;text-align:center}
.imp-summary h3{font-size:22px;font-weight:900;color:#059669;margin-bottom:8px}
.imp-summary p{font-size:14px;color:var(--text-m);font-weight:600}

/* ── VIEW MODAL ── */
.view-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.view-item{background:#f8fafc;border-radius:8px;padding:10px 14px}
.vi-label{font-size:11.5px;font-weight:700;color:var(--text-l);margin-bottom:3px}
.vi-val{font-size:14px;font-weight:700;color:var(--text)}

/* ── HIDDEN UTILITY ── */
.hidden{display:none!important}

/* ── RESPONSIVE EXTRAS ── */
@media(max-width:900px){
  .rep-grid{grid-template-columns:1fr 1fr}
  .action-form-grid{grid-template-columns:1fr}
  .col-map-grid{grid-template-columns:1fr}
  .view-grid{grid-template-columns:1fr}
}
@media(max-width:600px){
  .rep-grid{grid-template-columns:1fr}
  .reps-grid{grid-template-columns:1fr}
}

/* ═══════════════════════════════════════════════════════════
   v8 ADDITIONS — VIP, WhatsApp, Alerts, Calendar, Targets
   ═══════════════════════════════════════════════════════════ */

/* VIP Badge */
.vip-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 20px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #78350f;
  border: 1px solid #fcd34d;
  letter-spacing: .3px;
  margin-top: 2px;
}

/* WhatsApp Button */
.wa-btn {
  background: #dcfce7 !important;
  color: #16a34a !important;
  border-color: #bbf7d0 !important;
}
.wa-btn:hover { background: #bbf7d0 !important; }

/* ── ALERTS ─────────────────────────────────────────────── */
.alerts-summary {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
}
.alert-sum-card {
  flex: 1;
  border: 2px solid;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}
.alert-sum-num { font-size: 28px; font-weight: 900; }
.alert-sum-lbl { font-size: 12.5px; font-weight: 700; color: #64748b; margin-top: 2px; }

.alerts-list { display: flex; flex-direction: column; gap: 10px; }

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border-right: 4px solid;
  transition: transform .15s;
}
.alert-item:hover { transform: translateX(-2px); }
.alert-icon { font-size: 22px; flex-shrink: 0; margin-top: 2px; }
.alert-body { flex: 1; min-width: 0; }
.alert-name {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.alert-days {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.alert-meta { font-size: 12.5px; color: #64748b; margin-top: 3px; font-weight: 500; }
.alert-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* Dash alerts banner */
.dash-alerts-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: background .15s;
}
.dash-alerts-banner:hover { background: #fee2e2; }
.dash-alerts-banner .ab-icon { font-size: 22px; }
.dash-alerts-banner .ab-text { flex: 1; }
.dash-alerts-banner .ab-title { font-size: 13.5px; font-weight: 800; color: #dc2626; }
.dash-alerts-banner .ab-sub { font-size: 12px; color: #64748b; margin-top: 1px; }

/* Dash daily summary */
.daily-sum-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}
.daily-sum-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.daily-sum-info { flex: 1; min-width: 0; }
.daily-sum-name { font-size: 13px; font-weight: 700; color: #0f172a; }
.daily-sum-stats { font-size: 12px; color: #64748b; margin-top: 1px; }
.daily-sum-count {
  font-size: 22px; font-weight: 900; color: #E8541A; min-width: 32px; text-align: left;
}

/* ── CALENDAR ───────────────────────────────────────────── */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cal-month-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}
.cal-stats-row {
  margin-bottom: 10px;
  font-size: 13px;
  color: #64748b;
  font-weight: 600;
  display: flex;
  gap: 16px;
}
.cal-stat { display: flex; align-items: center; gap: 5px; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  background: #f1f5f9;
  border-radius: 12px;
  overflow: hidden;
  padding: 3px;
}
.cal-hdr {
  padding: 8px 4px;
  text-align: center;
  font-size: 11.5px;
  font-weight: 800;
  color: #64748b;
  background: #f8fafc;
  border-radius: 6px;
}
.cal-day {
  background: #fff;
  border-radius: 8px;
  padding: 6px;
  min-height: 64px;
  cursor: pointer;
  transition: background .15s, transform .1s;
  position: relative;
}
.cal-day:hover { background: #FFF4F0; transform: scale(1.02); }
.cal-empty { background: #f8fafc; cursor: default; }
.cal-empty:hover { background: #f8fafc; transform: none; }
.cal-today { background: #FFF4F0; border: 2px solid #E8541A; }
.cal-day-num {
  font-size: 12.5px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 3px;
}
.cal-today-num { color: #E8541A; }
.cal-dots { display: flex; gap: 2px; flex-wrap: wrap; margin-bottom: 2px; }
.cal-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.cal-count {
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  background: #E8541A;
  border-radius: 10px;
  padding: 0 5px;
  display: inline-block;
}
.cal-more { font-size: 10px; color: #94a3b8; font-weight: 700; }

.cal-detail-box {
  margin-top: 16px;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
}
.cal-detail-title {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f1f5f9;
}
.cal-detail-list { display: flex; flex-direction: column; gap: 8px; }
.cal-detail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #f8fafc;
  border-radius: 8px;
}

/* ── TARGETS / LEADERBOARD ──────────────────────────────── */
.targets-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.targets-header h3 { font-size: 18px; font-weight: 800; color: #0f172a; }

.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 900px;
}
.lb-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 18px;
  transition: box-shadow .15s;
}
.lb-item:hover { box-shadow: 0 4px 20px rgba(0,0,0,.08); }
.lb-top { border-left: 4px solid #f59e0b; }
.lb-rank { font-size: 22px; min-width: 34px; text-align: center; }
.lb-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.lb-info { flex: 1; min-width: 0; }
.lb-name {
  font-size: 14.5px;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.lb-region {
  font-size: 11.5px;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  padding: 1px 8px;
  border-radius: 20px;
}
.lb-bars { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.lb-bar-row { display: flex; align-items: center; gap: 8px; }
.lb-bar-label { font-size: 11.5px; font-weight: 700; color: #64748b; min-width: 60px; }
.lb-bar-track {
  flex: 1;
  height: 7px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}
.lb-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .6s ease;
}
.lb-bar-val { font-size: 12px; font-weight: 800; color: #0f172a; min-width: 44px; text-align: left; }
.lb-score {
  font-size: 26px;
  font-weight: 900;
  color: #E8541A;
  min-width: 42px;
  text-align: center;
}

/* ── Sidebar Badge Variants ─────────────────────────────── */
.sb-badge-teal { background: #0d9488; }
.sb-badge-danger { background: #dc2626; }

/* ── Chart.js wrapper ───────────────────────────────────── */
.rep-card canvas { max-height: 200px; }

/* Offers page */
.offers-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:14px}
.offer-card{background:#fff;border:1.5px solid var(--border);border-radius:8px;padding:16px;box-shadow:var(--shadow);display:flex;flex-direction:column;gap:12px}
.offer-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.offer-title{font-size:15px;font-weight:900;color:var(--text);line-height:1.35}
.offer-meta{font-size:12px;font-weight:600;color:var(--text-m);margin-top:2px}
.offer-detail{background:#f8fafc;border:1px solid var(--border);border-radius:8px;padding:10px 12px;min-height:54px;font-size:13px;font-weight:700;color:var(--text);line-height:1.7}
.offer-tags,.offer-actions{display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.report-detail-grid{display:grid;grid-template-columns:1fr;gap:14px;margin-bottom:16px}
.detailed-report-card{overflow:hidden}
.report-mini-table{box-shadow:none;border-radius:8px;overflow:auto}
.report-mini-table .tbl{min-width:760px}
.report-mini-table .tbl th,.report-mini-table .tbl td{text-align:center}
.report-mini-table .tbl th:first-child,.report-mini-table .tbl td:first-child{text-align:right}
.perm-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:8px}
.perm-check{display:flex;align-items:center;gap:8px;background:#f8fafc;border:1px solid var(--border);border-radius:8px;padding:9px 10px;font-weight:800;color:var(--text-m)}
.user-perm-list{display:flex;gap:6px;flex-wrap:wrap}

/* ── btn-success ────────────────────────────────────────── */
.btn-success {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}
.btn-success:hover { background: #15803d; }

/* ── Visit link badge in contracts table ─────────────────── */
.visit-link-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 20px;
  background: #ecfeff;
  color: #E8541A;
  border: 1px solid #a5f3fc;
  cursor: pointer;
  margin-top: 2px;
  transition: background .15s;
}
.visit-link-badge:hover {
  background: #cffafe;
}

/* ══════════════════════════════════════════════════════════
   MERCHANT CODE + DUPLICATE ALERT + BRANCHES + AI ASSISTANT
   ══════════════════════════════════════════════════════════ */

/* ── Merchant code pill ──────────────────────────────────── */
.merch-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 22px;
  padding: 0 7px;
  border-radius: 20px;
  background: var(--primary);
  color: #fff;
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: .5px;
  line-height: 1;
}
.merch-code.branch { background: #7c3aed; }

/* ── Duplicate alert banner ─────────────────────────────── */
.dup-alert {
  display: none;
  align-items: flex-start;
  gap: 10px;
  background: #fffbeb;
  border: 1.5px solid #fbbf24;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  animation: fadeIn .2s;
}
.dup-alert.show { display: flex; }
.dup-alert-icon { font-size: 22px; flex-shrink: 0; }
.dup-alert-body { flex: 1; }
.dup-alert-title { font-size: 13.5px; font-weight: 900; color: #92400e; margin-bottom: 4px; }
.dup-alert-info  { font-size: 12px;   font-weight: 700; color: #78350f; line-height: 1.7; }
.dup-alert-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.dup-alert-btn {
  font-size: 12px; font-weight: 800; padding: 4px 12px; border-radius: 20px;
  border: 1.5px solid currentColor; cursor: pointer; background: transparent;
  transition: background .15s;
}
.dup-alert-btn.primary { color: var(--primary); }
.dup-alert-btn.primary:hover { background: #fff4f0; }
.dup-alert-btn.ghost { color: #64748b; }
.dup-alert-btn.ghost:hover { background: #f1f5f9; }

/* ── AI suggestion strip inside form ───────────────────── */
.ai-suggest-strip {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 7px 12px;
  margin-bottom: 10px;
}
.ai-suggest-strip.show { display: flex; }
.ai-suggest-strip .ai-chip {
  background: #dbeafe;
  border: 1px solid #93c5fd;
  border-radius: 20px;
  padding: 2px 10px;
  cursor: pointer;
  transition: background .15s;
}
.ai-suggest-strip .ai-chip:hover { background: #bfdbfe; }

/* ── Branch badge ───────────────────────────────────────── */
.branch-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 900;
  padding: 1px 7px;
  border-radius: 20px;
  background: #f3e8ff;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
  margin-top: 2px;
}

/* ── Branches section in view modal ─────────────────────── */
.branches-section {
  margin-top: 18px;
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.branches-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.branches-section-title {
  font-size: 13.5px;
  font-weight: 900;
  color: var(--text);
}
.branch-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
}
.branch-item:last-child { margin-bottom: 0; }
.branch-item-code { color: #7c3aed; font-weight: 900; font-size: 12px; }
.branch-item-name { flex: 1; color: var(--text); }
.branch-item-status { font-size: 11.5px; }

/* ── AI Floating Assistant ─────────────────────────────── */
.ai-fab {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 18px #6366f140;
  z-index: 4000;
  transition: transform .2s, box-shadow .2s;
}
.ai-fab:hover { transform: scale(1.1); box-shadow: 0 6px 24px #6366f155; }
.ai-fab .ai-fab-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid #8b5cf680;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { transform: scale(1); opacity: .6; }
  50%      { transform: scale(1.15); opacity: 0; }
}

.ai-panel {
  position: fixed;
  bottom: 86px;
  left: 24px;
  width: 320px;
  background: #fff;
  border: 1.5px solid #e0e7ff;
  border-radius: 16px;
  box-shadow: 0 8px 32px #6366f120;
  z-index: 4000;
  overflow: hidden;
  transform-origin: bottom left;
  transform: scale(.92) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), opacity .18s;
}
.ai-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.ai-panel-head {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 900;
}
.ai-panel-body { padding: 14px 16px; }
.ai-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-m);
}
.ai-stat-row:last-child { border-bottom: none; }
.ai-stat-val {
  font-size: 15px;
  font-weight: 900;
  color: var(--text);
}
.ai-stat-val.ok    { color: #16a34a; }
.ai-stat-val.warn  { color: #d97706; }
.ai-stat-val.err   { color: #dc2626; }
.ai-insight {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: #1d4ed8;
  margin-top: 10px;
  line-height: 1.6;
}
.ai-panel-footer {
  border-top: 1px solid #f1f5f9;
  padding: 8px 16px;
  font-size: 11.5px;
  color: #94a3b8;
  text-align: center;
  font-weight: 700;
}

/* ── AI Action Detection Strip ───────────────────────────── */
.ai-action-strip {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  color: #374151;
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 8px;
  padding: 7px 12px;
  margin-bottom: 8px;
  animation: fadeIn .18s;
}
.ai-action-strip.visible { display: flex; }
.ai-action-strip .ai-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 20px;
  padding: 2px 9px;
  font-size: 11.5px;
  font-weight: 900;
  color: #15803d;
}
.ai-action-strip .ai-tag.offer {
  background: #fff7ed;
  border-color: #fdba74;
  color: #c2410c;
}
.ai-action-strip .ai-tag.warn {
  background: #fef9c3;
  border-color: #fde047;
  color: #854d0e;
}
/* Offer-ref field glow when relevant */
#action-offer-ref.offer-active {
  border-color: #f97316;
  box-shadow: 0 0 0 3px #fed7aa60;
  background: #fff7ed;
}

/* ── Login Page ──────────────────────────────────────────── */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 70% 30%, #E8541A 0%, #9c2d0a 40%, #1a0e09 80%);
  font-family: 'Cairo', sans-serif;
  direction: rtl;
}
.login-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(460px, 95vw);
}
.login-logo-wrap {
  background: #E8541A;
  width: 100%;
  border-radius: 18px 18px 0 0;
  padding: 34px 32px 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 3px solid rgba(0,0,0,.12);
}
.login-logo {
  height: 80px;
  width: auto;
  max-width: 300px;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.25));
}
.login-box {
  width: 100%;
  background: #fff;
  border-radius: 0 0 18px 18px;
  padding: 32px 32px 28px;
  box-shadow: 0 32px 80px rgba(0,0,0,.5);
}
.login-title {
  font-size: 20px;
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 4px;
  text-align: center;
}
.login-sub {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 26px;
  text-align: center;
}
.login-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 6px;
}
.login-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #0f172a;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  margin-bottom: 16px;
}
.login-input:focus {
  border-color: #E8541A;
  box-shadow: 0 0 0 3px rgba(232,84,26,.12);
}
.login-btn {
  width: 100%;
  padding: 13px;
  background: #E8541A;
  color: #fff;
  border: none;
  border-radius: 9px;
  font-family: 'Cairo', sans-serif;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s;
  margin-top: 6px;
}
.login-btn:hover { background: #C9430F; }
.login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 700;
  margin-bottom: 18px;
  font-size: 13.5px;
  display: none;
}
