  :root{
    --blue:#0066CC; --teal:#00A693; --orange:#F7941D;
    --navy:#15294d; --navy2:#1d3a66;
    --bg:#0e1117; --panel:#1a1a2e; --panel2:#1e1e2e; --panel3:#252535;
    --border:#3a3a4a; --text:#e8e8ee; --muted:#9a9aac;
    --green:#2ecc71; --red:#e74c3c;
    --hover:rgba(255,255,255,.03); --branch:#cfe; --head-text:#fff;
    --shadow:0 4px 20px rgba(0,0,0,.35); --shadow-sm:0 2px 10px rgba(0,0,0,.25);
    --alt-a-bg:#12122a; --alt-a-bd:#2a2a3a;
    --alt-b-bg:#0d1f3c; --alt-b-bd:#1e3a5f; --alt-hover:#1a1a35;
    /* Surfaces used by inline styles throughout the app */
    --surf-1:#12122a;   /* inset: bare inputs, key/value tiles */
    --surf-2:#0f152b;   /* raised: bridge bars, popovers, dropdowns */
    --surf-bd:#2a2f45; --surf-bd2:#2a4a7a; --surf-bd3:#35558a;
    --tag-bg:#0d1f3c; --tag-bd:#1e3a5f; --tag-fg:#60a5fa;
    --label:#8a93a6;    /* small caps field labels */
    --accent-head:#8ab4f8; --loc-fg:#9fd; --chip-fg:#d8fff8; --chip-fg-b:#fff;
    --orange-text:#F7941D; --teal-text:#00A693; --divider:rgba(255,255,255,.06);
  }
  /* Light ("morning") theme - dark stays the default when nothing is saved */
  body.light{
    --bg:#eef1f7; --panel:#ffffff; --panel2:#f5f7fb; --panel3:#e7ebf3;
    --border:#d5dbe6; --text:#16202f; --muted:#5c6880;
    --hover:rgba(16,32,64,.04); --branch:#0a6d5f; --head-text:#16202f;
    --shadow:0 2px 14px rgba(20,35,70,.10); --shadow-sm:0 1px 6px rgba(20,35,70,.08);
    --alt-a-bg:#f5f7fb; --alt-a-bd:#d5dbe6;
    --alt-b-bg:#eaf2fd; --alt-b-bd:#c2d8f2; --alt-hover:#e3ecf9;
    --surf-1:#f1f4f9; --surf-2:#ffffff;
    --surf-bd:#d5dbe6; --surf-bd2:#b9cbe6; --surf-bd3:#c2d8f2;
    --tag-bg:#e4eefb; --tag-bd:#bcd5f2; --tag-fg:#1a5cb0;
    --label:#6b7689;
    --accent-head:#1d5fb0; --loc-fg:#0a6d5f; --chip-fg:#0a5c52; --chip-fg-b:#06413a;
    --orange-text:#8a4f00; --teal-text:#00776a; --divider:rgba(16,32,64,.08);
  }
  *{box-sizing:border-box; margin:0; padding:0;}
  body{font-family:'Inter',-apple-system,Segoe UI,Roboto,sans-serif;
    background:var(--bg); color:var(--text); line-height:1.5; min-height:100vh;}

  /* ===== HEADER ===== */
  .site-header{
    background:linear-gradient(120deg,var(--navy),var(--navy2));
    display:flex; align-items:center; justify-content:space-between;
    padding:10px 22px; gap:14px; box-shadow:0 2px 16px rgba(0,0,0,.4);
    position:sticky; top:0; z-index:500; flex-wrap:wrap;
  }
  .site-header img{height:54px; width:auto; border-radius:8px;}
  .site-header .brand-mid{flex:1; text-align:center; min-width:140px;}
  .site-header .brand-mid .t1{color:#fff; font-size:clamp(18px,3vw,28px); font-weight:800; letter-spacing:.4px; line-height:1.1;}
  .site-header .brand-mid .t-opc{color:var(--teal-text); font-size:13px; font-weight:800; letter-spacing:5px; margin:3px 0 2px; text-transform:uppercase;}
  .site-header .brand-mid .t2{color:#9fc3ee; font-size:11px; letter-spacing:1px; text-transform:uppercase;}
  .site-header .gear{background:rgba(255,255,255,.12); border:1px solid rgba(255,255,255,.25); color:#fff;
    border-radius:10px; padding:9px 16px; cursor:pointer; font-size:14px; font-weight:600; font-family:inherit; transition:all .2s; white-space:nowrap;}
  .site-header .gear:hover{background:rgba(255,255,255,.22);}
  .header-right{display:flex; align-items:center; gap:14px;}
  .header-left{display:flex; align-items:center; gap:14px;}
  @media(max-width:600px){
    .site-header img{height:40px;}
    .header-left{flex-wrap:wrap;}
    .header-right img{display:none;}
  }

  .wrap{max-width:1200px; margin:0 auto; padding:18px 18px 60px; transition:max-width .3s;}
  .wrap.wide{max-width:100%;}

  /* ===== TABS ===== */
  .tabs{display:flex; gap:6px; flex-wrap:wrap;}
  .tab{background:var(--panel2); border:none; color:var(--muted); cursor:pointer;
    padding:11px 20px; font-size:14px; font-weight:600; border-radius:8px 8px 0 0;
    font-family:inherit; transition:all .2s;}
  .tab:hover{color:var(--text);}
  .tab.active{background:linear-gradient(135deg,var(--blue),var(--teal)); color:#fff;}
  .subtab{background:var(--panel2); border:none; color:var(--muted); cursor:pointer;
    padding:8px 16px; font-size:13px; font-weight:600; border-radius:8px 8px 0 0; font-family:inherit; transition:all .2s;}
  .subtab:hover{color:var(--text);}
  .subtab.active{background:linear-gradient(135deg,var(--blue),var(--teal)); color:#fff;}
  .subpanel{padding-top:14px;}
  .panelbox{background:var(--panel); border:1px solid var(--border);
    border-radius:14px; padding:22px; box-shadow:var(--shadow-sm);}

  .subhead{font-size:18px; font-weight:600; color:var(--text); margin-bottom:14px;}
  label{display:block; font-size:13px; color:var(--muted); margin:10px 0 5px; font-weight:600;}
  input[type=text], input[type=number], input[type=password], textarea, select{
    width:100%; background:var(--panel2); color:var(--text); border:1px solid var(--border);
    border-radius:8px; padding:11px 13px; font-size:15px; font-family:inherit;}
  textarea{min-height:90px; resize:vertical;}
  input:focus, textarea:focus, select:focus{outline:none; border-color:var(--teal);}

  .btn{background:linear-gradient(135deg,var(--blue),var(--teal)); color:#fff;
    font-weight:700; border:none; border-radius:8px; padding:12px 24px; font-size:15px;
    cursor:pointer; font-family:inherit; transition:all .25s; letter-spacing:.3px; width:100%; margin-top:14px;}
  .btn:hover{opacity:.9; transform:translateY(-2px); box-shadow:0 6px 18px rgba(0,102,204,.35);}
  .btn.sm{width:auto; padding:7px 14px; font-size:13px; margin:0;}
  .btn.gray{background:var(--panel3); color:var(--text);}
  .btn.red{background:linear-gradient(135deg,#b71c1c,#e65100);}
  .btn.outline{background:transparent; border:1px solid var(--teal); color:var(--teal-text);}

  .radio-row{display:flex; gap:18px; margin:10px 0; flex-wrap:wrap;}
  .radio-row label{display:flex; align-items:center; gap:6px; margin:0; cursor:pointer; color:var(--text);}
  .radio-row input{width:auto;}

  .card{background:var(--panel); border-left:5px solid var(--teal);
    padding:18px 20px; border-radius:14px; margin:16px 0;}
  .card h3{color:var(--teal-text); font-size:18px; margin-bottom:6px;}
  .card p{color:var(--muted); font-size:13px;}

  .alert{padding:11px 15px; border-radius:8px; margin:12px 0; font-size:14px;}
  .alert.warn{background:#3a2e00; border:1px solid var(--orange); color:#ffd98a;}
  .alert.err{background:#3a0000; border:1px solid #b71c1c; color:#ff9a9a;}
  .alert.ok{background:#003a1e; border:1px solid var(--teal); color:#8affc8;}

  .tbl-wrap{overflow-x:auto; border-radius:10px; margin-top:14px; max-height:520px; border:1px solid var(--border);}
  table{width:100%; border-collapse:collapse; font-size:14px;}
  th{background:var(--panel3); color:var(--head-text); padding:10px 12px; text-align:left;
    position:sticky; top:0; font-weight:600; white-space:nowrap; border:1px solid var(--border); user-select:none;}
  th.sortable{cursor:pointer;}
  th.sortable:hover{filter:brightness(1.15);}
  th .arrow{font-size:11px; opacity:.6; margin-left:4px;}
  td{padding:9px 12px; border:1px solid var(--border); white-space:nowrap;}
  tr:hover td{background:var(--hover);}
  .dist-badge{padding:3px 10px; border-radius:20px; font-weight:700; color:#fff; font-size:13px;}
  td.branch-cell{font-weight:600; color:var(--branch); cursor:pointer; user-select:none;}
  #ovm-table tr.row-selected td{background:rgba(0,224,192,.16) !important;}
  #ovm-table tr.row-selected td.branch-cell{color:var(--text);}
  #ovm-table .select-col{width:42px;text-align:center;}
  #ovm-table .ovm-row-check,#ovm-table #ovm-select-all{width:17px;height:17px;cursor:pointer;accent-color:var(--teal);}
  .ovm-stock-summary{display:flex;gap:10px;flex-wrap:wrap;margin:0 0 12px;}
  .ovm-stock-chip{padding:9px 13px;border:1px solid rgba(0,224,192,.35);border-radius:9px;background:rgba(0,224,192,.08);color:var(--chip-fg);font-size:13px;}
  .ovm-stock-chip b{color:var(--chip-fg-b);font-size:15px;}
  #order-out tr.row-selected td{background:rgba(0,224,192,.16) !important;}
  #order-out tr.row-selected td.branch-cell{color:var(--text);}
  #order-out .select-col{width:42px;text-align:center;}
  #order-out .order-row-check,#order-out .order-select-all-grp{width:17px;height:17px;cursor:pointer;accent-color:var(--teal);}
  .ovm-hint{color:var(--muted); font-size:12px; margin:6px 0 0;}
  .an-users-row{display:flex;gap:12px;flex-wrap:wrap;margin-top:14px;}
  .an-mini{flex:1;min-width:150px;background:var(--panel2);border:1px solid var(--border);border-radius:12px;padding:12px 14px;}
  .an-mini .v{font-size:22px;font-weight:800;color:var(--teal-text);line-height:1.15;}
  .an-mini .k{font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:.5px;margin-top:3px;}
  .an-mini .sub{font-size:11px;color:var(--muted);margin-top:4px;}
  .an-delta{font-size:12px;font-weight:700;margin-top:4px;}
  .an-delta.up{color:var(--green);} .an-delta.down{color:var(--red);}

  .checkbox-row{display:flex; align-items:center; gap:8px; margin-top:14px;}
  .checkbox-row input{width:auto;}
  .checkbox-row label{margin:0;}

  #map_ovm, #map_full, #map_order, #map_near{height:480px; border-radius:12px; margin-top:18px; border:1px solid var(--border);}
  .legend-pills{display:flex; gap:6px; flex-wrap:wrap; margin-top:10px;}
  .pill{padding:4px 12px; border-radius:12px; font-size:12px; font-weight:600; color:#fff;}
  .controls-3{display:grid; grid-template-columns:1fr 1.5fr 1.5fr; gap:14px;}
  @media(max-width:760px){.controls-3{grid-template-columns:1fr;}}
  .group-head{padding:10px 16px; border-radius:8px; margin:16px 0 4px; font-weight:700; font-size:15px;}
  .group-head.collapsible{cursor:pointer; user-select:none; display:flex; align-items:center; gap:9px;}
  .group-head.collapsible:hover{filter:brightness(1.18);}
  .group-head .gh-chev{display:inline-block; font-size:12px; transition:transform .18s ease; flex:0 0 auto;}
  .group-head.open .gh-chev{transform:rotate(90deg);}
  .grp-body{display:none;}
  .grp-body.open{display:block;}
  .plan-take{display:flex; flex-wrap:wrap; gap:6px;}
  .plan-chip{background:rgba(0,224,192,.12); border:1px solid rgba(0,224,192,.35); color:var(--chip-fg); border-radius:7px; padding:3px 9px; font-size:12px; white-space:nowrap;}
  .plan-chip b{color:var(--chip-fg-b);}
  .plan-note{color:var(--muted); font-size:12px; margin:8px 2px 0;}
  .plan-card{border:1px solid var(--border); border-radius:12px; padding:12px; margin:10px 0; background:var(--panel2);}
  .plan-card-head{display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:2px;}
  .plan-rank{font-size:15px; font-weight:800; color:var(--teal-text); min-width:20px;}
  .plan-name{font-weight:700; font-size:14px; color:var(--text);}
  .plan-badges{display:flex; gap:6px; flex-wrap:wrap; margin-left:auto;}
  .plan-badge{font-size:11px; color:var(--muted); border:1px solid var(--border); border-radius:20px; padding:2px 9px; white-space:nowrap;}
  .plan-desc{color:var(--muted); font-size:11.5px; margin:0 0 8px;}
  .muted-note{font-size:11px; color:#555; text-align:center; line-height:1.8; margin-top:24px;}
  .signature{text-align:center; margin:14px 0 26px; padding-top:12px;}
  .signature .sig-line{display:inline-block; width:50px; height:1px; background:linear-gradient(90deg,transparent,#7a5c1e,transparent); margin-bottom:8px;}
  .signature .sig-name{font-family:'Segoe UI',system-ui,sans-serif; font-size:12px; font-weight:600; letter-spacing:3px; background:linear-gradient(90deg,#6b531c,#9a7b2e,#6b531c); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; color:#8a6d28; display:block;}
  .signature .sig-by{display:block; font-size:8px; letter-spacing:3px; text-transform:uppercase; color:#5a4d30; margin-bottom:4px;}
  .leaflet-popup-content{font-family:inherit; font-size:13px;}
  .file-drop{border:2px dashed var(--border); border-radius:10px; padding:18px; text-align:center;
    color:var(--muted); cursor:pointer; transition:all .2s;}
  .file-drop:hover{border-color:var(--teal); color:var(--text);}
  .hidden{display:none;}
  .mat-grid{display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:12px 0;}
  @media(max-width:600px){.mat-grid{grid-template-columns:1fr;}}
  .mat-item{background:var(--panel2); border:1px solid var(--border); border-radius:8px; padding:8px 12px;}
  .mat-item label{margin:0 0 4px; font-size:12px; color:var(--muted);}
  .mat-item input{padding:7px 10px; font-size:14px;}

  /* stats */
  .stats{display:flex; gap:10px; justify-content:center; flex-wrap:wrap; margin:14px 0 18px;}
  .stat{background:var(--panel2); border:1px solid var(--border); border-radius:10px; padding:8px 18px; text-align:center; min-width:90px;}
  .stat .n{font-size:22px; font-weight:700; color:var(--teal-text);}
  .stat .l{font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.5px;}

  /* dashboard */
  .dash-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:10px; margin-top:6px;}
  .dash-card{background:var(--panel2); border:1px solid var(--border); border-radius:12px; padding:13px; text-align:center; transition:all .2s; cursor:pointer;}
  .dash-card:hover{border-color:var(--teal); transform:translateY(-3px);}
  .dash-card .ic{font-size:22px;}
  .dash-card .num{font-size:23px; font-weight:800; color:var(--teal-text); margin:4px 0 1px;}
  .dash-card .lbl{color:var(--muted); font-size:12px;}
  /* ===== ANIMATIONS ===== */
  @keyframes fadeSlide{from{opacity:0;transform:translateY(8px);}to{opacity:1;transform:translateY(0);}}
  @keyframes counterPop{0%{transform:scale(1);}50%{transform:scale(1.18);}100%{transform:scale(1);}}
  .dash-card{transition:all .25s cubic-bezier(.4,0,.2,1) !important;}
  .dash-card:hover{border-color:var(--teal) !important;transform:translateY(-4px) !important;box-shadow:0 8px 24px rgba(0,166,147,.25),0 2px 8px rgba(0,0,0,.3) !important;}
  .dash-card .num.popped{animation:counterPop .35s ease-out;}
  .nbr-dd-item{opacity:0;transform:translateX(-10px);transition:opacity .22s ease,transform .22s ease,background .15s;}
  .nbr-dd-item.shown{opacity:1;transform:translateX(0);}
  .nbr-dd-item:hover,.nbr-dd-item.active{background:linear-gradient(135deg,rgba(0,102,204,.3),rgba(0,166,147,.3));}
  .tab,.subtab{transition:all .2s cubic-bezier(.4,0,.2,1);}
  .tab.active,.subtab.active{box-shadow:0 3px 12px rgba(0,102,204,.35);}
  .dash-welcome{background:linear-gradient(120deg,var(--navy),var(--navy2)); border-radius:14px; padding:24px; margin-bottom:18px; display:flex; align-items:center; gap:20px;}
  .dash-welcome-text h2{color:#fff; font-size:22px;}
  .dash-welcome-text p{color:#9fc3ee; font-size:14px; margin-top:4px;}
  .dash-welcome-logo{flex-shrink:0; width:90px; height:73px; object-fit:contain; filter:drop-shadow(0 2px 8px rgba(0,0,0,.4));}

  /* info cards */
  .info-card{background:var(--panel2); border-left:5px solid var(--teal); padding:14px 18px; border-radius:12px; margin:9px 0; color:var(--text); font-size:14px;}
  .info-card.orange{border-left-color:var(--orange-text);}
  .info-card.clickable{cursor:pointer; transition:all .15s;}
  .info-card.clickable:hover{background:var(--panel3);}
  /* compact branch cards — responsive grid */
  .card-grid{display:grid; gap:8px; grid-template-columns:repeat(auto-fill,minmax(260px,1fr));}
  .mini-card{background:var(--panel2); border-left:4px solid var(--teal); border-radius:10px;
             padding:9px 12px; color:var(--text); font-size:13px; transition:background .15s;}
  .mini-card:hover{background:var(--panel3);}
  .mini-card-head{display:flex; align-items:center; gap:8px; flex-wrap:wrap;}
  .mini-code{font-size:16px; font-weight:800; color:var(--orange-text); letter-spacing:.3px;}
  .mini-city{color:#777; font-size:12px;}
  .mini-row{display:flex; align-items:center; gap:7px; margin-top:4px; line-height:1.35;}
  .mini-lbl{font-size:12px; opacity:.85; flex-shrink:0;}
  .mini-val{font-size:13px; color:var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
  @media (max-width:520px){ .card-grid{grid-template-columns:1fr;} }
  .alt-item:hover{border-color:var(--teal)!important; background:var(--alt-hover)!important; transform:translateX(-3px);}
  .detail-card{background:var(--panel2); border-left:5px solid var(--blue); padding:18px 22px; border-radius:12px; margin-top:14px;}
  .badge-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(85px,1fr)); gap:8px; margin-top:12px;}
  .cov-badge{padding:9px; border-radius:10px; text-align:center; font-size:12px; font-weight:600; border:1px solid;}
  /* Item Search — مفتاح وضع البحث (segmented) */
  .is-seg-row{display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:2px 0 12px;}
  .is-seg-lbl{color:var(--label); font-size:11px; font-weight:600; letter-spacing:.6px; text-transform:uppercase;}
  .is-seg{display:inline-flex; gap:3px; padding:3px; max-width:100%; background:var(--surf-1); border:1px solid var(--border); border-radius:999px;}
  .is-seg-btn{background:transparent; border:none; color:var(--muted); font-family:inherit; font-size:13px; font-weight:600;
    padding:7px 16px; border-radius:999px; cursor:pointer; white-space:nowrap; transition:background .18s, color .18s, box-shadow .18s;}
  .is-seg-btn:hover{color:var(--text);}
  .is-seg-btn:focus-visible{outline:2px solid var(--teal); outline-offset:2px;}
  .is-seg-btn.active{background:var(--panel3); color:var(--teal-text); box-shadow:inset 0 0 0 1px var(--teal);}
  body.light .is-seg-btn.active{background:#fff; box-shadow:inset 0 0 0 1px var(--teal), 0 1px 3px rgba(16,32,64,.12);}
  @media(max-width:520px){.is-seg-btn{padding:7px 11px; font-size:12.5px;}}
  /* Item Search — صورة الصنف + لينك الموقع */
  .is-web-img{flex:0 0 96px; width:96px; height:96px; border-radius:10px; background:var(--surf-1); border:1px solid var(--border);
    display:flex; align-items:center; justify-content:center; overflow:hidden;}
  .is-web-img.has{background:#fff;}
  .is-web-img.none{display:none;}
  .is-web-img img{width:100%; height:100%; object-fit:contain; display:block; cursor:zoom-in;}
  .is-web-price{display:flex; gap:8px; flex-wrap:wrap; margin-top:10px;}
  .is-web-price:empty{display:none;}
  .is-wp{display:inline-flex; align-items:baseline; gap:7px; flex-wrap:wrap; font-size:12.5px; font-weight:600; padding:5px 11px; border-radius:8px; border:1px solid; cursor:default;}
  .is-wp b{font-size:14px; font-weight:800;}
  .is-wp s{font-weight:500; opacity:.75;}
  .is-wp.offer{background:rgba(46,204,113,.12); border-color:rgba(46,204,113,.5); color:#2ecc71;}
  .is-wp.diff{background:rgba(247,148,29,.12); border-color:rgba(247,148,29,.5); color:var(--orange-text);}
  body.light .is-wp.offer{background:rgba(21,122,63,.08); border-color:rgba(21,122,63,.4); color:#157a3f;}
  .is-web-links{display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-top:10px;}
/* in-page messages (toasts + confirm dialog) */
#ui-toasts{position:fixed; top:16px; left:50%; transform:translateX(-50%); z-index:6000; display:flex; flex-direction:column; gap:8px; align-items:center; pointer-events:none; width:min(92vw,520px);}
.ui-toast{pointer-events:auto; background:var(--surf-2,#1b2240); color:var(--text,#e8ecf8); border:1px solid var(--surf-bd2,#2f3a63); border-left:4px solid var(--teal,#00A693); border-radius:10px; padding:10px 14px; font-size:13.5px; box-shadow:0 10px 28px rgba(0,0,0,.35); cursor:pointer; white-space:pre-wrap; word-break:break-word; user-select:text; animation:uiIn .2s ease-out;}
.ui-toast.bad{border-left-color:#e74c3c;}
.ui-toast.out{opacity:0; transform:translateY(-6px); transition:all .25s;}
@keyframes uiIn{from{opacity:0; transform:translateY(-6px);}to{opacity:1; transform:none;}}
.ui-confirm{position:fixed; inset:0; z-index:6001; background:rgba(0,0,0,.55); display:flex; align-items:center; justify-content:center; padding:16px;}
.ui-confirm-box{background:var(--surf-2,#1b2240); color:var(--text,#e8ecf8); border:1px solid var(--surf-bd2,#2f3a63); border-radius:14px; padding:18px 18px 14px; width:min(92vw,420px); box-shadow:0 18px 48px rgba(0,0,0,.45);}
.ui-confirm-msg{font-size:14.5px; line-height:1.6; margin-bottom:14px; white-space:pre-wrap;}
.ui-confirm-btns{display:flex; gap:8px; justify-content:flex-end;}
.ui-confirm-btns .btn{max-width:none; width:auto; margin:0; padding:7px 18px;}
/* نص العرض الأحمر اللي فوق اسم المنتج على موقع المتحدة (offer_label) */
.web-offer{display:inline-flex; align-items:center; gap:6px; direction:rtl; background:#a51d24; color:#fff; font-weight:800; font-size:13px; padding:4px 12px; border-radius:8px; border:1px solid #d33a41; box-shadow:0 2px 8px rgba(165,29,36,.35);}
.web-offer.sm{font-size:11px; padding:2px 8px; border-radius:6px; font-weight:700;}
  .is-web-links:empty{display:none;}
  .is-web-links a.btn{text-decoration:none; display:inline-block;}
  #is-zoom{position:fixed; inset:0; z-index:5000; background:rgba(0,0,0,.82); display:flex; align-items:center; justify-content:center; cursor:zoom-out; padding:20px;}
  #is-zoom img{max-width:min(92vw,640px); max-height:92vh; border-radius:14px; background:#fff;}
  @media(max-width:520px){.is-web-img{flex-basis:72px; width:72px; height:72px;}}

  /* One vs Many — هيكل جدول الفروع وهو بيحمّل */
  .ovm-skel{margin-top:14px; padding:16px; border-radius:14px; background:var(--surf-2); border:1px solid var(--surf-bd2);}
  .ovm-skel-head{display:flex; align-items:center; gap:10px; font-size:13px; font-weight:700; color:var(--teal-text,#2dd4bf); margin-bottom:14px;}
  .ovm-skel-dots{display:inline-flex; gap:4px;}
  .ovm-skel-dots i{width:6px; height:6px; border-radius:50%; background:currentColor; animation:ovmDot 1s infinite ease-in-out;}
  .ovm-skel-dots i:nth-child(2){animation-delay:.15s;} .ovm-skel-dots i:nth-child(3){animation-delay:.3s;}
  @keyframes ovmDot{0%,80%,100%{opacity:.25; transform:translateY(0);}40%{opacity:1; transform:translateY(-4px);}}
  .ovm-skel-row{display:grid; grid-template-columns:28px 50px 1.2fr 1fr 1.4fr .8fr; gap:14px; align-items:center; padding:11px 4px; border-top:1px solid var(--surf-bd2);
    opacity:0; animation:ovmRowIn .35s ease forwards;}
  .ovm-skel-row span{height:12px; border-radius:6px; position:relative; overflow:hidden; background:var(--surf-1);}
  .ovm-skel-row span::after{content:""; position:absolute; inset:0; transform:translateX(-100%);
    background:linear-gradient(90deg,transparent,rgba(45,212,191,.18),transparent); animation:ovmShimmer 1.3s infinite;}
  .ovm-skel-row span.pill{height:20px; width:56px; border-radius:10px;}
  .ovm-skel-row span.box{width:14px; height:14px; border-radius:4px;}
  @keyframes ovmShimmer{100%{transform:translateX(100%);}}
  @keyframes ovmRowIn{from{opacity:0; transform:translateY(6px);}to{opacity:1; transform:none;}}
  .ovm-skel-bar{height:3px; border-radius:3px; background:var(--surf-1); overflow:hidden; margin-bottom:6px;}
  .ovm-skel-bar::after{content:""; display:block; height:100%; width:35%; border-radius:3px; background:linear-gradient(90deg,var(--teal,#00a693),var(--blue,#2563eb)); animation:ovmBar 1.4s infinite ease-in-out;}
  @keyframes ovmBar{0%{transform:translateX(-100%);}100%{transform:translateX(300%);}}
  @media (prefers-reduced-motion:reduce){.ovm-skel *,.ovm-skel *::after{animation:none !important; opacity:1 !important;}}

  /* dropdown search */
  .dd-wrap{position:relative;}
  .dd-list{position:absolute; left:0; right:0; top:100%; background:var(--panel3); border:1px solid var(--border);
    border-radius:0 0 10px 10px; max-height:340px; overflow-y:auto; z-index:50; box-shadow:0 8px 24px rgba(0,0,0,.5);}
  .dd-item{padding:10px 14px; cursor:pointer; border-bottom:1px solid var(--border); font-size:14px;}
  .dd-item:hover, .dd-item.active{background:linear-gradient(135deg,rgba(0,102,204,.3),rgba(0,166,147,.3));}
  .dd-item .code{color:#888; font-size:12px; margin-left:8px;}

  /* expander */
  .expander{background:var(--panel2); border:1px solid var(--border); border-radius:10px; margin:8px 0; overflow:hidden;}
  .expander-head{padding:14px 18px; cursor:pointer; display:flex; align-items:center; gap:10px; font-weight:600; user-select:none;}
  .expander-head:hover{background:var(--panel3);}
  .expander-body{padding:0 18px; max-height:0; overflow:hidden; transition:max-height .3s;}
  .expander.open .expander-body{max-height:none; padding:8px 18px 14px;}
  .expander .chev{transition:transform .25s;}
  .expander.open .chev{transform:rotate(90deg);}
  .exp-item{padding:7px 0; border-bottom:1px solid var(--panel3); color:var(--text); font-size:14px;}

  /* warehouse */
  .day-card{background:var(--panel2); border:2px solid var(--teal); border-radius:12px; padding:14px; text-align:center; min-width:110px;}
  .day-card.today{border-color:var(--green);}
  .wh-days{display:flex; gap:10px; flex-wrap:wrap; margin-top:16px;}

  /* SETTINGS PAGE (full screen) */
  #settings-page{position:fixed; inset:0; background:var(--bg); z-index:2000; overflow-y:auto; display:none;}
  #settings-page.show{display:block;}
  .settings-bar{background:linear-gradient(120deg,var(--navy),var(--navy2)); padding:14px 22px; display:flex; align-items:center; justify-content:space-between; position:sticky; top:0; z-index:10;}
  .settings-bar h2{color:#fff; font-size:20px;}
  .settings-bar .close-x{background:rgba(255,255,255,.15); border:none; color:#fff; font-size:20px; cursor:pointer; border-radius:8px; padding:6px 14px;}
  .settings-inner{max-width:1000px; margin:0 auto; padding:24px 18px 60px;}
  .form-grid{display:grid; grid-template-columns:1fr 1fr; gap:12px;}
  @media(max-width:600px){.form-grid{grid-template-columns:1fr;}}
  .row-actions{display:flex; gap:6px;}
  .loader{text-align:center; color:var(--muted); padding:30px;}
  .spin{display:inline-block; width:22px; height:22px; border:3px solid var(--border); border-top-color:var(--teal); border-radius:50%; animation:sp .8s linear infinite;}
  @keyframes sp{to{transform:rotate(360deg);}}

  /* mobile */
  @media(max-width:600px){
    .wrap{padding:12px 10px 50px;}
    .panelbox{padding:14px;}
    .tab{padding:9px 13px; font-size:13px;}
    .stat{min-width:72px; padding:6px 12px;}
    .stat .n{font-size:18px;}
    .dist-badge{font-size:12px; padding:2px 8px;}
    th, td{padding:7px 8px; font-size:13px;}
  }
  /* warehouse improved */
  .wh-hero{background:linear-gradient(120deg,#15294d,#1d3a66); border-radius:16px; padding:22px 26px; margin:16px 0; display:flex; align-items:center; gap:18px; flex-wrap:wrap;}
  .wh-hero .wh-icon{font-size:42px;}
  .wh-hero .wh-name{color:#fff; font-size:26px; font-weight:800;}
  .wh-hero .wh-sub{color:#9fc3ee; font-size:14px; margin-top:2px;}
  .wh-hero .wh-badge{margin-left:auto; background:rgba(255,255,255,.15); padding:8px 16px; border-radius:12px; color:#fff; font-weight:700;}
  .wh-timeline{display:flex; gap:0; flex-wrap:wrap; margin-top:18px; align-items:stretch;}
  .trip-card{flex:1; min-width:200px; background:var(--panel2); border:1px solid var(--border); border-radius:16px; padding:0; margin:8px; overflow:hidden; transition:all .2s;}
  .trip-card:hover{transform:translateY(-3px); box-shadow:0 8px 24px rgba(0,0,0,.35);}
  .trip-card.today{border:2px solid var(--green); box-shadow:0 0 18px rgba(46,204,113,.25);}
  .trip-card .trip-top{padding:8px; text-align:center; font-size:12px; font-weight:700; color:#fff;}
  .trip-card .trip-body{padding:18px; display:flex; align-items:center; justify-content:space-around;}
  .trip-leg{text-align:center;}
  .trip-leg .lbl{color:#888; font-size:11px; text-transform:uppercase; letter-spacing:.5px;}
  .trip-leg .day{font-size:18px; font-weight:700; margin-top:4px;}
  .trip-arrow{font-size:24px; color:var(--teal-text);}
  .wh-bigcards{display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; margin:14px 0;}

  /* pickup guide */
  .pickup-result{background:var(--panel2); border-radius:14px; padding:20px; margin-top:14px; border-left:5px solid var(--teal);}
  .pickup-result.warn{border-left-color:var(--orange-text);}
  .pickup-result.danger{border-left-color:var(--red);}
  .pickup-result h3{color:var(--text); font-size:20px; margin-bottom:6px;}
  .pickup-tag{display:inline-block; padding:3px 12px; border-radius:12px; font-size:12px; font-weight:700; margin-bottom:10px;}
  .ask-chip{display:inline-block; background:var(--panel3); border:1px solid var(--teal); color:var(--branch); padding:6px 14px; border-radius:20px; margin:4px 4px 0 0; font-size:13px;}
  .zone-card{background:var(--panel2); border:1px solid var(--border); border-radius:12px; padding:14px 18px; margin:8px 0;}
  .zone-card .zone-region{color:var(--teal-text); font-size:12px; font-weight:700; text-transform:uppercase;}
  .wa-btn{display:inline-flex; align-items:center; gap:5px; background:#25D366; color:#fff; padding:4px 12px; border-radius:8px; font-size:12px; font-weight:700; text-decoration:none; margin:2px 4px 2px 0; user-select:text;}
  .wa-btn:hover{opacity:.88;}
  .map-btn{display:inline-flex; align-items:center; gap:5px; background:#4285F4; color:#fff; padding:4px 12px; border-radius:8px; font-size:12px; font-weight:700; text-decoration:none; margin:2px 4px 2px 0;}
  .map-btn:hover{opacity:.88;}
  .type-badge{display:inline-block; padding:2px 10px; border-radius:10px; font-size:11px; font-weight:700; margin-left:6px;}
  .type-online{background:#2563eb33; color:#7eb0ff; border:1px solid #2563eb;}
  .type-offline{background:#55555533; color:#aaa; border:1px solid #666;}

  /* ── Global Search ── */
  .gs-bar{width:100%;box-sizing:border-box;background:rgba(0,0,0,.28);padding:8px 20px;border-top:1px solid rgba(255,255,255,.08);}
  .gs-inner{max-width:720px;margin:0 auto;position:relative;}
  #gs-input{width:100%;padding:9px 16px 9px 38px;border-radius:22px;border:1px solid rgba(255,255,255,.18);background:rgba(255,255,255,.09);color:#fff;font-size:14px;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .2s,background .2s;}
  #gs-input:focus{background:rgba(255,255,255,.15);border-color:var(--teal);}
  #gs-input::placeholder{color:rgba(255,255,255,.45);}
  .gs-icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);font-size:15px;pointer-events:none;}
  #gs-drop{display:none;position:absolute;top:calc(100% + 6px);left:0;right:0;background:var(--panel2);border:1px solid var(--border);border-radius:14px;z-index:900;max-height:400px;overflow-y:auto;box-shadow:0 10px 40px rgba(0,0,0,.6);}
  .gs-sec-head{padding:8px 14px 4px;font-size:11px;color:var(--muted);font-weight:700;letter-spacing:1px;text-transform:uppercase;}
  .gs-row{padding:9px 14px;cursor:pointer;display:flex;align-items:baseline;gap:8px;font-size:13px;border-bottom:1px solid var(--divider);}
  .gs-row:last-child{border-bottom:none;}
  .gs-row:hover{background:var(--hover);}
  .gs-name{color:var(--text);flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
  .gs-sub{color:var(--muted);font-size:11.5px;white-space:nowrap;}
  .gs-empty{padding:14px;color:var(--muted);text-align:center;font-size:13px;}

  .bc-pin-btn{background:none;border:none;cursor:pointer;font-size:14px;margin-left:6px;opacity:.6;vertical-align:middle;padding:0;line-height:1;transition:opacity .15s;}
  .bc-pin-btn:hover{opacity:1;}
  /* ── Branch Detail Card ── */
  #bc-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.6);z-index:1100;backdrop-filter:blur(4px);align-items:center;justify-content:center;padding:16px;box-sizing:border-box;}
  #bc-overlay.open{display:flex;}
  #bc-modal{background:var(--panel2);border:1px solid var(--border);border-radius:20px;width:100%;max-width:540px;max-height:90vh;overflow-y:auto;box-shadow:0 20px 60px rgba(0,0,0,.7);animation:bc-in .18s ease;}
  @keyframes bc-in{from{opacity:0;transform:scale(.94)}to{opacity:1;transform:scale(1)}}
  #bc-modal .bc-header{background:linear-gradient(135deg,var(--blue),var(--teal));padding:20px 22px 16px;border-radius:20px 20px 0 0;position:relative;}
  #bc-modal .bc-close{position:absolute;top:14px;right:16px;background:rgba(0,0,0,.25);border:none;color:#fff;width:30px;height:30px;border-radius:50%;cursor:pointer;font-size:16px;display:flex;align-items:center;justify-content:center;}
  #bc-modal .bc-name{color:#fff;font-size:20px;font-weight:800;margin-bottom:4px;}
  #bc-modal .bc-city{color:rgba(255,255,255,.75);font-size:13px;}
  #bc-modal .bc-status{display:inline-block;padding:3px 10px;border-radius:20px;font-size:12px;font-weight:700;margin-top:6px;}
  #bc-modal .bc-status.online{background:rgba(0,200,100,.25);color:#00e678;}
  #bc-modal .bc-status.offline{background:rgba(150,150,150,.2);color:#aaa;}
  #bc-modal .bc-body{padding:18px 22px 24px;}
  #bc-modal .bc-row{display:flex;align-items:flex-start;gap:10px;padding:8px 0;border-bottom:1px solid var(--border);font-size:13.5px;}
  #bc-modal .bc-row:last-child{border-bottom:none;}
  #bc-modal .bc-row .ic{font-size:17px;flex-shrink:0;width:24px;text-align:center;margin-top:1px;}
  #bc-modal .bc-row .val{color:var(--text);flex:1;min-width:0;overflow-wrap:anywhere;line-height:1.45;}
  #bc-modal .bc-row .lbl{color:var(--muted);font-size:11.5px;min-width:70px;}
  #bc-modal .bc-actions{display:flex;gap:8px;margin-top:14px;flex-wrap:wrap;}
  #bc-modal .bc-btn{flex:1;min-width:110px;padding:9px 14px;border-radius:10px;border:1px solid rgba(255,255,255,.2);background:rgba(255,255,255,.07);color:#fff;font-size:13px;font-family:inherit;cursor:pointer;font-weight:600;text-align:center;text-decoration:none;display:flex;align-items:center;justify-content:center;gap:6px;transition:background .2s;}
  #bc-modal .bc-btn:hover{background:var(--hover);}
  #bc-modal .bc-btn.primary{background:linear-gradient(135deg,var(--blue),var(--teal));border-color:transparent;}
  #bc-modal .bc-contacts{margin-top:10px;}
  #bc-modal .bc-contacts h4{font-size:12px;color:var(--muted);font-weight:700;letter-spacing:.8px;text-transform:uppercase;margin:0 0 6px;}
  #bc-modal .bc-contact-row{font-size:13px;color:var(--text);padding:5px 0;
    display:flex;align-items:center;gap:7px;flex-wrap:wrap;}
  #bc-modal .bc-cic{flex-shrink:0;}
  #bc-modal .bc-cname{font-weight:600;min-width:0;overflow-wrap:anywhere;}
  /* ===== SIDEBAR LAYOUT ===== */
  .layout{display:flex; align-items:stretch; gap:0; background:var(--bg);
    min-height:calc(100vh - 96px);}
  .layout > .wrap{flex:1 1 auto; min-width:0;}
  /* The column stretches to the full layout height so there is never a gap
     under it; the inner block is what sticks while the page scrolls. */
  .sidebar{flex:0 0 236px; width:236px; box-sizing:border-box;
    background:var(--panel); border-right:1px solid var(--border);
    position:relative; z-index:400;}
  .sidebar-inner{position:sticky; top:0; padding:16px 12px 24px;
    /* no overflow here: any non-visible value makes the browser compute
       overflow-x as auto too, which would clip the search dropdown */}
  .sidebar .gs-bar{background:transparent; border-top:none; padding:0 0 14px;}
  .sidebar .gs-inner{max-width:100%;}
  .sidebar #gs-drop{width:340px; left:0; right:auto;}
  .sidebar .tabs{flex-direction:column; flex-wrap:nowrap; gap:4px;}
  .sidebar .tab{width:100%; text-align:left; border-radius:10px; padding:11px 14px;
    background:transparent; border:1px solid transparent;}
  .sidebar .tab:hover{background:var(--panel2); border-color:var(--border);}
  .sidebar .tab.active{background:linear-gradient(135deg,var(--blue),var(--teal));
    border-color:transparent; box-shadow:var(--shadow-sm);}
  .layout > .wrap{padding:18px 20px 40px;}
  @media(max-width:900px){
    .layout{flex-direction:column; align-items:stretch;}
    .sidebar-inner{position:static; padding:0;}
    .sidebar{width:100%; flex:none;
      border-right:none; border-bottom:1px solid var(--border); padding:12px 14px;}
    .sidebar .tabs{flex-direction:row; flex-wrap:wrap;}
    .sidebar .tab{width:auto; border-radius:8px 8px 0 0;}
    .sidebar #gs-drop{width:auto; right:0;}
    /* .wrap's `margin:0 auto` acts as auto cross-axis margins in a column
       flex container, shrinking it to content width - override it */
    .layout > .wrap{margin:0; max-width:none; width:100%;}
  }
  /* ── Light theme repairs ── */
  /* The search field is white-on-white without this. */
  body.light #gs-input{background:var(--panel2); border-color:var(--border); color:var(--text);}
  body.light #gs-input::placeholder{color:var(--muted);}
  body.light #gs-input:focus{background:#fff; border-color:var(--teal);}
  body.light .sidebar .tab{color:var(--muted);}
  body.light .sidebar .tab.active{color:#fff;}
  body.light .subhead{color:var(--text);}

  /* Headings written with an inline light colour sit on page/panel surfaces
     that turn light, so they have to flip with them. Scoped to headings and
     .detail-card so text inside a card that keeps its own dark background is
     never touched. */
  body.light h2[style^="color:#fff"], body.light h3[style^="color:#fff"],
  body.light h4[style^="color:#fff"], body.light h3[style^="color:#e0e0e0"],
  body.light h3[style^="color:#d0d0d0"], body.light h4[style^="color:#e0e0e0"],
  body.light .detail-card [style^="color:#fff"],
  body.light .detail-card [style^="color:#ddd"],
  body.light .detail-card [style^="color:#ccc"]{color:var(--text) !important;}
  body.light .detail-card [style^="color:#aaa"],
  body.light .info-card [style^="color:#aaa"]{color:var(--muted) !important;}
  /* <option> is painted by the OS list, not the <select> box, so it needs
     its own colours or the list renders unreadable in light mode. */
  select option{background:var(--panel2); color:var(--text);}

  /* Alerts carry their own dark fills; light needs its own tints. */
  body.light .alert.warn{background:#fff4d6; color:#7a5600; border-color:#dda200;}
  body.light .alert.err{background:#fde8e8; color:#8f1d1d; border-color:#dc5b5b;}
  body.light .alert.ok{background:#e2f7ee; color:#0a5c42; border-color:var(--teal);}
  body.light .type-offline{background:#e7ebf3; color:#5c6880; border-color:#c2c9d6;}
  body.light .type-online{background:#e4eefb; color:#1a5cb0; border-color:#9dc2ee;}
  body.light .file-drop{color:var(--muted);}
  body.light .dash-welcome-text p{color:#c9dcf5;}
  /* Contact numbers are plain text with a copy affordance - not tel: links,
     which browsers repaint with their own link/visited colours. */
  #bc-modal .bc-phone{direction:ltr; unicode-bidi:embed; font-variant-numeric:tabular-nums;
    user-select:text; -webkit-user-select:text; cursor:text; color:var(--text);}
  #bc-modal .bc-copy{background:transparent; border:none; cursor:pointer; font-size:13px;
    line-height:1; padding:3px 5px; margin-inline-start:4px; border-radius:6px;
    opacity:.55; transition:opacity .15s, background .15s; font-family:inherit;}
  #bc-modal .bc-copy:hover{opacity:1; background:var(--hover);}
  #bc-modal .bc-copy:focus-visible{outline:2px solid var(--teal); outline-offset:1px; opacity:1;}
  /* ===== REPLACEMENT ORDER ===== */
  .ro-help{color:var(--muted); font-size:13px; margin:-6px 0 14px; max-width:860px;}
  .ro-grid{display:grid; grid-template-columns:1fr 1fr; gap:14px;}
  @media(max-width:820px){.ro-grid{grid-template-columns:1fr;}}
  .ro-grid label{margin-top:0; color:var(--text); font-size:14px;}
  .ro-grid label span{color:var(--muted); font-weight:500; font-size:12.5px;}
  .ro-grid label b, .ro-step b{display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; border-radius:50%;
    background:linear-gradient(135deg,var(--blue),var(--teal)); color:#fff; font-size:12px; font-weight:800; margin-inline-end:6px;}
  .ro-grid textarea{min-height:92px; max-height:220px; font-size:12.5px; font-family:ui-monospace,Consolas,monospace; white-space:pre; overflow:auto;}
  .ro-bar{display:flex; align-items:center; justify-content:space-between; gap:12px 20px; flex-wrap:wrap; margin:18px 0 4px;}
  .ro-order-info{display:flex; align-items:center; gap:8px; flex-wrap:wrap; font-size:13px; color:var(--muted);}
  .ro-order-info strong{color:var(--text); font-size:15px;}
  .ro-chip{display:inline-flex; align-items:center; gap:6px; padding:3px 10px; border-radius:999px; font-size:12px; font-weight:600;
    background:var(--tag-bg); border:1px solid var(--tag-bd); color:var(--tag-fg);}
  .ro-step{font-size:14px; font-weight:600; color:var(--text); margin:16px 0 0;}
  .ro-tbl td, .ro-tbl th{white-space:normal; vertical-align:middle;}
  .ro-tbl th{text-align:start;}
  .ro-tbl th.ro-n, .ro-tbl td.ro-n{text-align:end; white-space:nowrap; font-variant-numeric:tabular-nums;}
  .ro-tbl th{position:static;}
  .ro-name{font-weight:600; color:var(--text); min-width:150px;}
  .ro-sku{font-size:12px; color:var(--muted); margin-top:2px;}
  .ro-badges{display:flex; gap:6px; flex-wrap:wrap; margin-top:7px;}
  .ro-badges:empty{display:none;}
  .ro-badges .is-wp{font-size:11.5px; padding:3px 9px;}
  .ro-badges .is-wp b{font-size:12.5px;}
  .ro-lbl{display:inline-flex; flex-direction:column; align-items:flex-start; gap:4px; padding:4px 6px 5px; border-radius:8px; border:1px solid var(--surf-bd2);
    background:var(--surf-1); font-size:11.5px; font-weight:600; color:var(--text); cursor:zoom-in; font-family:inherit; max-width:100%; text-align:start;}
  .ro-lbl img{width:240px; max-width:100%; height:auto; max-height:60px; border-radius:5px; display:block; object-fit:contain; object-position:right center;}
  .ro-lbl span{padding-inline-start:4px;}
  .ro-lbl.unknown{border-color:var(--orange); color:var(--orange-text);}
  .ro-qty{display:inline-flex; align-items:center; gap:4px;}
  .ro-qty input{width:58px; text-align:center; padding:7px 4px; font-size:15px; font-weight:700;}
  .ro-qty button{width:30px; height:34px; border-radius:8px; border:1px solid var(--border); background:var(--panel3); color:var(--text);
    font-size:17px; font-weight:700; cursor:pointer; font-family:inherit; line-height:1;}
  .ro-qty button:hover{border-color:var(--teal);}
  .ro-qty .ro-none{width:auto; padding:0 9px; font-size:12px; font-weight:600; color:var(--muted); white-space:nowrap;}
  tr.ro-out td{background:rgba(231,76,60,.07);}
  tr.ro-out .ro-name{text-decoration:line-through; text-decoration-color:var(--red);}
  tr.ro-part td{background:rgba(247,148,29,.07);}
  .ro-off{color:var(--red); font-weight:700;}
  .ro-zero{color:var(--muted);}
  .ro-cards{display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin-top:16px;}
  @media(max-width:820px){.ro-cards{grid-template-columns:repeat(2,1fr);}}
  .ro-card{background:var(--panel2); border:1px solid var(--border); border-radius:12px; padding:12px 14px;}
  .ro-card .l{font-size:12.5px; color:var(--label); font-weight:600;}
  .ro-card .n{font-size:22px; font-weight:800; color:var(--text); font-variant-numeric:tabular-nums; margin-top:3px;}
  .ro-card .s{font-size:12px; color:var(--muted); margin-top:2px;}
  .ro-card.main{border-color:var(--teal); background:linear-gradient(135deg,rgba(0,102,204,.14),rgba(0,166,147,.14));}
  .ro-card.main .n{color:var(--teal-text);}
  .ro-two{display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:10px;}
  @media(max-width:620px){.ro-two{grid-template-columns:1fr;}}
  .ro-opt{background:var(--panel2); border:1px solid var(--border); border-radius:12px; padding:12px 14px;}
  .ro-opt h4{font-size:13.5px; color:var(--text); margin-bottom:6px;}
  .ro-opt .row{display:flex; justify-content:space-between; gap:10px; font-size:13.5px; color:var(--muted); padding:2px 0;}
  .ro-opt .row b{color:var(--text); font-variant-numeric:tabular-nums;}
  .ro-opt.match{border-color:var(--teal);}
  .ro-why{margin:8px 0 0 0; padding:0; list-style:none; font-size:13px;}
  .ro-why li{padding:5px 0; border-top:1px solid var(--divider); display:flex; gap:10px; justify-content:space-between; flex-wrap:wrap;}
  .ro-why li span:last-child{font-variant-numeric:tabular-nums; font-weight:700; white-space:nowrap;}
  .ro-why small{display:block; opacity:.85; font-weight:500;}
  .ro-actions{display:flex; gap:8px; flex-wrap:wrap; margin-top:16px;}
  .ro-labels{margin-top:22px; border-top:1px solid var(--divider); padding-top:14px;}
  .ro-labels summary{cursor:pointer; font-weight:600; font-size:14px; color:var(--muted);}
  .ro-labels summary:hover{color:var(--text);}
  .ro-lrow{display:grid; grid-template-columns:minmax(150px,240px) minmax(200px,260px) 1fr auto; gap:8px 10px; align-items:start; padding:12px 0; border-top:1px solid var(--divider);}
  .ro-lrow img{max-width:100%; max-height:52px; border-radius:6px; cursor:zoom-in; display:block;}
  .ro-lrow input, .ro-lrow select{padding:8px 10px; font-size:13px;}
  .ro-lrow .id{font-size:11.5px; color:var(--muted); margin-top:3px; line-height:1.6;}
  .ro-lf{display:flex; gap:8px; flex-wrap:wrap; align-items:flex-end;}
  .ro-lf label{margin:0; display:flex; flex-direction:column; gap:3px; font-size:11.5px; color:var(--muted); font-weight:600;}
  .ro-lf input[type=number]{width:96px;}
  .ro-lf .f-note{flex:1 1 180px;}
  .ro-lf .f-note input{width:100%;}
  .ro-lrow[data-kind=""] .ro-lf label, .ro-lrow[data-kind="none"] .ro-lf label:not(.f-note){display:none;}
  .ro-lrow[data-kind="qty"] .f-free, .ro-lrow[data-kind="qty"] .f-amt{display:none;}
  .ro-lrow[data-kind="set"] .f-amt{display:none;}
  .ro-lrow[data-kind="amt"] .f-free, .ro-lrow[data-kind="amt"] .f-pct{display:none;}
  .ro-lhint{grid-column:2 / 4; font-size:12.5px; color:var(--teal-text); min-height:0; line-height:1.7;}
  .ro-lhint:empty{display:none;}
  .ro-aiout{grid-column:1 / -1;}
  .ro-aiout:empty{display:none;}
  .ro-aiout .alert{margin:4px 0 0;}
  .ro-aierr{font-family:ui-monospace,Consolas,monospace; font-size:11.5px; margin-top:6px; opacity:.85; word-break:break-word; text-align:left;}
  @media(max-width:900px){.ro-lrow{grid-template-columns:1fr;} .ro-lhint{grid-column:1;}}
  .ro-pw{display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin:6px 0 4px;}
  .ro-pw input{max-width:220px; padding:8px 10px; font-size:13px;}
  #tab-replacement{font-family:'Segoe UI',Tahoma,'Noto Sans Arabic','Inter',sans-serif;}
  #tab-replacement .is-seg-lbl{letter-spacing:0; font-size:12.5px;}
  .ro-explain{background:var(--panel2); border:1px solid var(--border); border-inline-start:5px solid var(--teal); border-radius:12px; padding:12px 16px; margin:14px 0 4px;}
  .ro-explain h4{font-size:14px; color:var(--text); margin-bottom:6px;}
  .ro-explain ul{margin:0; padding:0; list-style:none;}
  .ro-explain li{font-size:13.5px; color:var(--text); line-height:1.75; padding:4px 0; border-top:1px solid var(--divider);}
  .ro-explain li:first-child{border-top:none;}
  .ro-explain li.muted{color:var(--muted);}
  .ro-explain .tag{display:inline-block; font-size:11.5px; font-weight:700; padding:1px 8px; border-radius:999px; margin-inline-end:6px; border:1px solid;}
  .ro-explain .tag.c{color:var(--tag-fg); background:var(--tag-bg); border-color:var(--tag-bd);}
  .ro-explain .tag.p{color:#2ecc71; background:rgba(46,204,113,.12); border-color:rgba(46,204,113,.5);}
  .ro-explain .tag.l{color:var(--orange-text); background:rgba(247,148,29,.12); border-color:rgba(247,148,29,.5);}
  body.light .ro-explain .tag.p{color:#157a3f; background:rgba(21,122,63,.08); border-color:rgba(21,122,63,.4);}
  .ro-say{font-size:13.5px; color:var(--text); background:var(--surf-1); border:1px solid var(--surf-bd); border-radius:10px; padding:10px 14px; margin-top:10px; line-height:1.8;}
  .ro-pct{color:var(--muted); font-size:12px;}
  .ro-care ul, .ro-soft{margin:6px 0 0; padding:0; list-style:none;}
  .ro-care li{padding:6px 0; border-top:1px solid rgba(247,148,29,.3); line-height:1.8;}
  .ro-soft li{line-height:1.8;}
  .ro-code{margin-top:12px; border-radius:12px; padding:14px 16px; border:2px solid var(--orange); background:rgba(247,148,29,.10);}
  .ro-code.ok{border-color:var(--teal); background:rgba(0,166,147,.10);}
  .ro-code .l{font-size:13.5px; font-weight:700; color:var(--text);}
  .ro-code .n{font-size:26px; font-weight:800; color:var(--orange-text); margin:2px 0 4px; font-variant-numeric:tabular-nums;}
  .ro-code.ok .n{color:var(--teal-text); font-size:20px;}
  .ro-code .s{font-size:12.5px; color:var(--muted); line-height:1.8;}
  .ro-code .ro-why{color:var(--text);}
  tr.ro-more td{background:rgba(46,204,113,.07);}
  .ro-add{color:#2ecc71; font-weight:700;}
  body.light .ro-add{color:#157a3f;}
  .ro-hint{color:var(--muted); font-weight:500; font-size:12.5px;}
  .ro-st{display:inline-block; font-size:11px; font-weight:700; padding:1px 8px; border-radius:999px; border:1px solid; margin-inline-start:4px;}
  .ro-st.ok{color:var(--teal-text); border-color:var(--teal);}
  .ro-st.wait{color:var(--orange-text); border-color:var(--orange);}
  .ro-st.none{color:var(--muted); border-color:var(--border);}
  .ro-lbtns{display:flex; gap:6px; flex-wrap:wrap;}
  .ro-ah{font-size:14px; color:var(--text); margin:14px 0 2px;}
  #sec-promo-labels{font-family:'Segoe UI',Tahoma,'Noto Sans Arabic','Inter',sans-serif;}
  .ro-addbar{margin-top:12px; background:var(--panel2); border:1px dashed var(--surf-bd2); border-radius:12px; padding:10px 14px 12px;}
  .ro-addbar label{margin:0 0 6px; color:var(--text); font-size:13.5px;}
  .ro-addrow{display:flex; gap:8px; flex-wrap:wrap; align-items:center;}
  .ro-addrow #ro-add-code{flex:1 1 220px; max-width:360px; padding:8px 11px; font-size:14px;}
  .ro-addrow #ro-add-qty{width:74px; padding:8px 6px; font-size:14px; text-align:center;}
  .ro-addmsg{font-size:13px; color:var(--text); margin-top:7px; line-height:1.7;}
  .ro-addmsg:empty{display:none;}
  .ro-addlist{display:flex; flex-direction:column; gap:5px; margin-top:6px;}
  .ro-addlist:empty{display:none;}
  .ro-pick{display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; text-align:start; background:var(--surf-1); border:1px solid var(--surf-bd); border-radius:8px;
    padding:7px 11px; font-family:inherit; font-size:13px; color:var(--text); cursor:pointer;}
  .ro-pick:hover{border-color:var(--teal);}
  .ro-pick span{color:var(--muted); font-size:12px;}
  .ro-xprice{width:92px !important; padding:7px 6px !important; font-size:14px !important; text-align:center; font-weight:700;}
  .ro-tbl td, .ro-tbl th{padding:8px 9px;}
  .ro-tbl .ro-qty input{width:48px;}
  .ro-tbl .ro-qty .ro-none{padding:0 7px; font-size:11.5px;}
  .ro-xprice{width:78px !important;}
  .ro-chip.old{color:var(--orange-text); border-color:var(--orange); background:rgba(247,148,29,.12);}
  .ro-daynote{font-size:13px; margin:4px 0 2px; opacity:.95; line-height:1.8;}

/* Multi-Item Order — item cards */
.ord-card{position:relative;display:flex;flex-direction:column;gap:8px;padding:10px 12px;border:1px solid var(--surf-bd2);border-radius:12px;background:var(--surf-1);min-width:0;height:100%;box-sizing:border-box;transition:border-color .15s;}
.ord-card:hover{border-color:var(--teal,#00a693);}
.ord-top{display:flex;gap:10px;align-items:center;min-width:0;}
.ord-img{flex:0 0 48px;width:48px;height:48px;border-radius:9px;background:#fff;display:flex;align-items:center;justify-content:center;overflow:hidden;}
.ord-img img{width:100%;height:100%;object-fit:contain;cursor:zoom-in;}
.ord-noimg{font-size:20px;opacity:.45;}
.ord-names{flex:1;min-width:0;}
.ord-name{font-weight:700;font-size:13px;line-height:1.3;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.ord-ar{font-size:11.5px;line-height:1.4;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px;}
.ord-x{flex:0 0 22px;width:22px;height:22px;align-self:flex-start;border:0;border-radius:6px;background:transparent;color:var(--muted);cursor:pointer;font-size:16px;line-height:1;padding:0;}
.ord-x:hover{background:rgba(248,113,113,.15);color:#f87171;}
.ord-mid{display:flex;align-items:baseline;justify-content:space-between;gap:8px;padding-top:8px;border-top:1px solid var(--surf-bd2);}
.ord-code{font-family:monospace;font-size:12px;color:var(--tag-fg);}
.ord-prices{display:flex;align-items:baseline;gap:6px;white-space:nowrap;}
.ord-price{font-size:13px;font-weight:800;color:#2ecc71;}
.ord-was{font-size:11px;color:var(--muted);}
.ord-pct{font-size:10.5px;font-weight:700;color:#fbbf24;background:rgba(251,191,36,.12);border:1px solid rgba(251,191,36,.35);padding:0 6px;border-radius:20px;}
.ord-foot{display:flex;align-items:center;gap:8px;margin-top:auto;min-height:22px;}
.ord-tags{flex:1;min-width:0;display:flex;gap:6px;align-items:center;overflow:hidden;}
.ord-tag{flex:0 0 auto;font-size:10.5px;font-weight:700;padding:2px 8px;border-radius:20px;white-space:nowrap;line-height:1.5;}
.ord-tag.rx{background:#3a1620;border:1px solid #7f1d2e;color:#f87171;}
.ord-tag.otc{background:#142a1c;border:1px solid #1e4d2b;color:#4ade80;}
.ord-tag.lbl{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;background:#a51d24;border:1px solid #d33a41;color:#fff;border-radius:6px;}
.ord-web{flex:0 0 auto;margin-left:auto;font-size:13px;text-decoration:none;opacity:.75;}
.ord-web:hover{opacity:1;}
