/* Naxo sales board — mobile first, RTL */
:root{
  --bg:#0A0A0B;
  --surface:#141416;
  --surface-2:#1B1C1F;
  --surface-3:#232428;
  --line:#2A2B30;
  --gold:#E3B24B;
  --gold-soft:rgba(227,178,75,.12);
  --text:#F5F2EA;
  --muted:#9C9890;
  --muted-2:#7A7770;
  --red:#F05252;
  --red-soft:rgba(240,82,82,.12);
  --green:#3DD68C;
  --blue:#6AA9FF;
  --violet:#B08BFF;
  --r-card:16px;
  --r-input:12px;
  --top:56px;
  --tab:64px;
  --safe-b:env(safe-area-inset-bottom,0px);
  --safe-t:env(safe-area-inset-top,0px);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%}
body{
  background:var(--bg);color:var(--text);
  font-family:'Cairo',system-ui,-apple-system,'Segoe UI',sans-serif;
  font-size:16px;line-height:1.5;
  height:100dvh;display:flex;flex-direction:column;overflow:hidden;
  -webkit-font-smoothing:antialiased;
}
button{font-family:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}
input,select,textarea{font-family:inherit;font-size:16px;color:var(--text)}
a{color:inherit;text-decoration:none}
.ic{width:24px;height:24px;stroke:currentColor;fill:none;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round;flex:none}

/* ---------- top bar ---------- */
.topbar{
  height:calc(var(--top) + var(--safe-t));padding:var(--safe-t) 16px 0;
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  background:rgba(10,10,11,.92);backdrop-filter:blur(14px);
  border-bottom:1px solid var(--line);position:sticky;top:0;z-index:50;flex:none;
}
.brand{display:flex;align-items:center;gap:10px;min-width:0}
.mark{
  width:34px;height:34px;border-radius:50%;flex:none;
  display:grid;place-items:center;font-weight:800;font-size:16px;color:#12100B;
  background:linear-gradient(150deg,#F2CB74,#D9A33A);
  box-shadow:0 0 0 1px rgba(227,178,75,.35),0 4px 14px rgba(227,178,75,.18);
}
.brand-txt{display:flex;flex-direction:column;line-height:1.15;min-width:0}
.brand-txt strong{font-size:16px;font-weight:700;letter-spacing:.2px}
.brand-txt span{font-size:12px;color:var(--muted)}
.top-actions{display:flex;align-items:center;gap:8px}
.icon-btn{
  width:44px;height:44px;border-radius:14px;display:grid;place-items:center;
  color:var(--text);background:var(--surface);border:1px solid var(--line);
  transition:background .15s,transform .08s;
}
.icon-btn:active{transform:scale(.94);background:var(--surface-2)}
.icon-btn.solid{background:var(--gold);color:#12100B;border-color:transparent;font-weight:700}
.icon-btn.ghost{background:transparent;border-color:transparent;color:var(--muted)}

/* ---------- layout ---------- */
main{flex:1;display:flex;min-height:0;position:relative}
.view{flex:1;display:flex;flex-direction:column;min-height:0;min-width:0}
.view[hidden]{display:none}

/* ---------- board ---------- */
.stage-tabs{
  display:flex;gap:8px;padding:12px 16px 10px;overflow-x:auto;flex:none;
  scrollbar-width:none;-ms-overflow-style:none;
}
.stage-tabs::-webkit-scrollbar{display:none}
.stage-chip{
  flex:none;height:36px;padding:0 14px;border-radius:999px;
  display:flex;align-items:center;gap:8px;
  background:var(--surface);border:1px solid var(--line);
  font-size:14px;font-weight:600;color:var(--muted);white-space:nowrap;
}
.stage-chip .dot{width:8px;height:8px;border-radius:50%;flex:none}
.stage-chip .n{font-size:12px;color:var(--muted-2);font-weight:700}
.stage-chip.on{background:var(--surface-3);color:var(--text);border-color:#3A3B41}

.board{
  flex:1;display:flex;gap:16px;padding:0 0 12px;scroll-padding-inline:16px;
  overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;
  scrollbar-width:none;
}
.board::-webkit-scrollbar{display:none}
.col{
  flex:0 0 calc(100vw - 32px);display:flex;flex-direction:column;min-height:0;
  scroll-snap-align:start;border-radius:var(--r-card);
  transition:background .15s,box-shadow .15s;
}
.board > .col:first-child{margin-inline-start:16px}
.board > .col:last-child{margin-inline-end:16px}
.col.drop-active{background:rgba(227,178,75,.07);box-shadow:inset 0 0 0 1.5px rgba(227,178,75,.55)}
.col-head{display:flex;align-items:center;gap:8px;padding:2px 4px 10px;flex:none}
.col-head .dot{width:9px;height:9px;border-radius:50%;flex:none}
.col-head h3{margin:0;font-size:14px;font-weight:700;letter-spacing:.2px}
.col-head .count{font-size:12px;color:var(--muted-2);font-weight:700;background:var(--surface-2);border-radius:999px;padding:1px 8px}
.col-head .sum{margin-inline-start:auto;font-size:12px;color:var(--gold);font-weight:700;white-space:nowrap}
.col-body{
  flex:1;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;
  display:flex;flex-direction:column;gap:10px;padding:2px 2px 24px;
  scrollbar-width:none;
}
.col-body::-webkit-scrollbar{display:none}
.col-empty{
  border:1.5px dashed #2F3036;border-radius:var(--r-card);padding:22px 14px;
  text-align:center;color:var(--muted-2);font-size:14px;
}

/* ---------- card ---------- */
.card{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r-card);
  padding:12px 12px 10px;display:flex;flex-direction:column;gap:8px;
  position:relative;touch-action:pan-y;
}
.card:active{background:var(--surface-2)}
.card.due{border-color:rgba(240,82,82,.55);box-shadow:inset 3px 0 0 var(--red)}
.card.isnew::after{
  content:'جديد';position:absolute;inset-inline-start:10px;top:-9px;
  background:var(--gold);color:#12100B;font-size:12px;font-weight:800;
  padding:1px 8px;border-radius:999px;
}
.card-top{display:flex;align-items:flex-start;gap:8px}
.card-name{font-size:16px;font-weight:700;line-height:1.3;flex:1;min-width:0;word-break:break-word}
.grip{
  width:44px;height:40px;margin:-8px -8px -8px 0;display:grid;place-items:center;
  color:var(--muted-2);touch-action:none;cursor:grab;flex:none;
}
.grip .ic{width:20px;height:20px;stroke-width:2.4}
.card-meta{font-size:12px;color:var(--muted);display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.card-meta .sep{width:3px;height:3px;border-radius:50%;background:#4A4B52}
.card-price{
  font-size:14px;font-weight:800;color:var(--gold);background:var(--gold-soft);
  border-radius:999px;padding:2px 10px;white-space:nowrap;
}
.card-tags{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.tag{
  font-size:12px;font-weight:700;border-radius:999px;padding:2px 8px;
  display:inline-flex;align-items:center;gap:4px;
}
.tag.red{background:var(--red-soft);color:#FF8A8A}
.tag.green{background:rgba(61,214,140,.12);color:var(--green)}
.tag.mut{background:var(--surface-2);color:var(--muted)}
.card-foot{display:flex;align-items:center;gap:8px;margin-top:2px}
.card-foot .when{font-size:12px;color:var(--muted-2);display:flex;align-items:center;gap:4px}
.card-foot .when .ic{width:14px;height:14px}
.card-foot .acts{margin-inline-start:auto;display:flex;gap:6px}
.mini-btn{
  width:40px;height:40px;border-radius:12px;display:grid;place-items:center;
  background:var(--surface-2);border:1px solid var(--line);color:var(--muted);
}
.mini-btn:active{background:var(--surface-3);color:var(--text)}
.mini-btn .ic{width:20px;height:20px}
.mini-btn.wa{color:#5BE49B}

.card.dragging{
  position:fixed;z-index:900;pointer-events:none;margin:0;
  box-shadow:0 18px 40px rgba(0,0,0,.6),0 0 0 1.5px var(--gold);
  transform:rotate(1.2deg) scale(1.03);opacity:.97;
}

/* ---------- leads view ---------- */
.leads-top{padding:12px 16px 8px;display:flex;flex-direction:column;gap:10px;flex:none}
.searchbox{
  display:flex;align-items:center;gap:10px;height:48px;padding:0 14px;
  background:var(--surface);border:1px solid var(--line);border-radius:14px;color:var(--muted);
}
.searchbox input{flex:1;background:none;border:0;outline:none;color:var(--text);font-size:16px;min-width:0}
.searchbox input::placeholder{color:var(--muted-2)}
.filter-row{display:flex;gap:8px;overflow-x:auto;scrollbar-width:none}
.filter-row::-webkit-scrollbar{display:none}
.leads-list{flex:1;overflow-y:auto;padding:4px 16px 24px;display:flex;flex-direction:column;gap:10px}
.lead-row{
  display:flex;align-items:center;gap:12px;padding:14px;border-radius:var(--r-card);
  background:var(--surface);border:1px solid var(--line);text-align:start;width:100%;
}
.lead-row.due{border-color:rgba(240,82,82,.45)}
.lead-row .who{flex:1;min-width:0}
.lead-row .who b{display:block;font-size:16px;font-weight:700;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.lead-row .who span{font-size:12px;color:var(--muted)}
.lead-row .right{display:flex;flex-direction:column;align-items:flex-end;gap:4px}
.stage-pill{font-size:12px;font-weight:700;border-radius:999px;padding:3px 9px;white-space:nowrap}
.list-title{font-size:12px;color:var(--muted-2);font-weight:700;padding:10px 4px 0}

/* ---------- money ---------- */
#view-money{overflow-y:auto;padding:16px 16px 24px;display:block}
.money-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.money-card{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r-card);
  padding:14px;display:flex;flex-direction:column;gap:4px;
}
.money-card .k{font-size:12px;color:var(--muted);font-weight:600}
.money-card .v{font-size:24px;font-weight:800;line-height:1.2;letter-spacing:-.5px}
.money-card .v small{font-size:12px;font-weight:600;color:var(--muted);margin-inline-start:4px}
.money-card.gold{background:linear-gradient(160deg,rgba(227,178,75,.14),rgba(227,178,75,.04));border-color:rgba(227,178,75,.35)}
.money-card.gold .v{color:var(--gold)}
.sec-title{font-size:16px;font-weight:700;margin:22px 0 10px}
.bar{height:8px;border-radius:999px;background:var(--surface-3);overflow:hidden;margin-top:8px}
.bar i{display:block;height:100%;background:linear-gradient(90deg,#D9A33A,#F2CB74);border-radius:999px}
.backup{display:flex;gap:10px;margin:20px 0 4px}
.backup .btn{flex:1}
.follow-head{padding:0 16px;flex:none}
.follow-sub{font-size:14px;color:var(--muted);margin:0 0 10px}
.follow-card{
  background:var(--surface);border:1px solid rgba(240,82,82,.45);border-radius:var(--r-card);
  padding:14px;display:flex;flex-direction:column;gap:10px;
}
.follow-card .f-top{display:flex;align-items:center;gap:8px}
.follow-card .f-top b{font-size:16px;font-weight:700;flex:1;min-width:0}
.follow-card .f-meta{font-size:12px;color:var(--muted)}
.follow-card .f-acts{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.follow-card .f-acts .btn{min-height:44px;font-size:14px}
.follow-card .f-acts .btn.wide{grid-column:1/-1}
.empty{
  border:1.5px dashed #2F3036;border-radius:var(--r-card);padding:26px 16px;
  text-align:center;color:var(--muted-2);font-size:14px;
}

/* ---------- tabbar ---------- */
.tabbar{
  flex:none;height:calc(var(--tab) + var(--safe-b));padding-bottom:var(--safe-b);
  display:flex;background:rgba(10,10,11,.94);backdrop-filter:blur(14px);
  border-top:1px solid var(--line);z-index:60;
}
.tab{
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  color:var(--muted-2);font-size:12px;font-weight:700;position:relative;
}
.tab .ic{width:24px;height:24px}
.tab.active{color:var(--gold)}
.badge{
  position:absolute;top:8px;inset-inline-end:calc(50% - 26px);min-width:18px;height:18px;border-radius:999px;
  background:var(--red);color:#fff;font-size:12px;font-weight:800;font-style:normal;
  display:flex;align-items:center;justify-content:center;padding:0 5px;
}
.badge[hidden]{display:none}
.tab.active::before{content:'';position:absolute;top:0;width:26px;height:2.5px;border-radius:0 0 3px 3px;background:var(--gold)}

/* ---------- sheet ---------- */
.overlay{
  position:fixed;inset:0;background:rgba(0,0,0,.62);z-index:200;
  display:flex;align-items:flex-end;animation:fade .18s ease-out;
}
.overlay[hidden]{display:none}
@keyframes fade{from{opacity:0}to{opacity:1}}
.sheet{
  width:100%;max-height:93dvh;background:#101012;border-radius:24px 24px 0 0;
  border-top:1px solid #2E2F35;display:flex;flex-direction:column;
  animation:up .24s cubic-bezier(.2,.8,.2,1);
  box-shadow:0 -20px 60px rgba(0,0,0,.6);
}
@keyframes up{from{transform:translateY(28px);opacity:.6}to{transform:none;opacity:1}}
.sheet-head{display:flex;align-items:center;justify-content:space-between;padding:8px 12px 0;flex:none}
.sheet-grab{width:44px;height:4px;border-radius:999px;background:#3A3B41;margin:0 auto}
.sheet-body{overflow-y:auto;padding:4px 16px calc(24px + var(--safe-b));-webkit-overflow-scrolling:touch}
.sheet-title{font-size:20px;font-weight:800;margin:6px 0 14px}

/* detail */
.d-head{display:flex;align-items:flex-start;gap:12px;margin-bottom:6px}
.d-head h2{font-size:20px;font-weight:800;margin:0;line-height:1.3;flex:1}
.d-sub{font-size:12px;color:var(--muted);margin:0 0 16px}
.d-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:16px}
.btn{
  min-height:48px;border-radius:14px;display:flex;align-items:center;justify-content:center;gap:8px;
  font-size:16px;font-weight:700;background:var(--surface-2);border:1px solid var(--line);color:var(--text);
  transition:transform .08s,background .15s;padding:0 14px;
}
.btn:active{transform:scale(.98);background:var(--surface-3)}
.btn .ic{width:20px;height:20px}
.btn.primary{background:var(--gold);color:#12100B;border-color:transparent}
.btn.primary:active{background:#D9A33A}
.btn.wa{background:rgba(37,211,102,.14);border-color:rgba(37,211,102,.4);color:#5BE49B}
.btn.danger{color:#FF8A8A;border-color:rgba(240,82,82,.35);background:var(--red-soft)}
.btn.block{width:100%;margin-top:6px}
.btn.small{min-height:44px;font-size:14px}
.d-block{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-card);padding:14px;margin-bottom:12px}
.d-label{font-size:12px;color:var(--muted);font-weight:700;margin:0 0 8px}
.kv{display:flex;align-items:center;gap:10px;padding:9px 0;border-bottom:1px solid #212226;font-size:14px}
.kv:last-child{border-bottom:0}
.kv .ic{width:20px;height:20px;color:var(--muted)}
.kv .v{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;direction:ltr;text-align:start}
.kv .v.ar{direction:rtl;text-align:start}
.kv .k{color:var(--muted);font-size:12px;flex:none}
.stage-pick{display:grid;grid-template-columns:1fr 1fr 1fr;gap:8px}
.stage-opt{
  min-height:44px;border-radius:12px;border:1px solid var(--line);background:var(--surface-2);
  font-size:14px;font-weight:700;color:var(--muted);display:flex;align-items:center;justify-content:center;gap:6px;
}
.stage-opt .dot{width:7px;height:7px;border-radius:50%}
.stage-opt.on{color:var(--text);border-color:#4A4B52;background:var(--surface-3)}
.form{display:flex;flex-direction:column;gap:12px}
.form label{display:flex;flex-direction:column;gap:6px;font-size:12px;color:var(--muted);font-weight:700}
.form input,.form select,.form textarea{
  height:48px;background:var(--surface);border:1px solid var(--line);border-radius:var(--r-input);
  padding:0 12px;outline:none;font-size:16px;color:var(--text);
}
.form textarea{height:auto;min-height:88px;padding:12px;line-height:1.5;resize:vertical}
.form input:focus,.form select:focus,.form textarea:focus{border-color:rgba(227,178,75,.6)}
.form .two{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.d-block textarea{
  width:100%;min-height:92px;background:var(--surface-2);border:1px solid var(--line);
  border-radius:12px;padding:12px;font-size:16px;color:var(--text);line-height:1.55;
  font-family:inherit;outline:none;resize:vertical;
}
.d-block textarea:focus{border-color:rgba(227,178,75,.6)}
.log{display:flex;flex-direction:column;gap:10px}
.log-item{display:flex;gap:10px;font-size:14px}
.log-item .dot{width:7px;height:7px;border-radius:50%;background:var(--gold);margin-top:8px;flex:none}
.log-item .t{flex:1;min-width:0}
.log-item .d{font-size:12px;color:var(--muted-2);display:block}

/* toast */
.toast{
  position:fixed;bottom:calc(var(--tab) + var(--safe-b) + 16px);left:50%;transform:translateX(-50%);
  background:#F5F2EA;color:#12100B;font-size:14px;font-weight:700;
  padding:10px 18px;border-radius:999px;z-index:400;box-shadow:0 10px 30px rgba(0,0,0,.5);
  animation:fade .15s ease-out;max-width:calc(100vw - 32px);text-align:center;
}
.toast[hidden]{display:none}

#view-money[hidden]{display:none}
#view-leads[hidden]{display:none}
#view-board[hidden]{display:none}

@media (min-width:760px){
  .board{gap:16px;padding:0 24px 16px}
  .col{flex:0 0 320px}
  .board > .col:first-child{margin-inline-start:24px}
  .board > .col:last-child{margin-inline-end:24px}
  .stage-tabs{padding:14px 24px 10px}
  .leads-top{padding:16px 24px 8px;max-width:720px}
  .leads-list{padding:4px 24px 24px;max-width:720px}
  #view-money{max-width:720px;padding:20px 24px 32px}
  .money-grid{grid-template-columns:repeat(4,1fr)}
  .overlay{align-items:center;justify-content:center}
  .sheet{max-width:520px;border-radius:24px;border:1px solid #2E2F35;max-height:88dvh}
  .sheet-head{padding-top:12px}
  .tabbar{
    position:fixed;bottom:18px;left:50%;transform:translateX(-50%);
    height:56px;width:auto;border:1px solid var(--line);border-radius:999px;
    background:rgba(18,18,20,.96);padding:0 6px;box-shadow:0 14px 40px rgba(0,0,0,.5);
  }
  .tab{flex-direction:row;gap:8px;padding:0 22px;font-size:14px;min-width:0}
  .badge{
  position:absolute;top:8px;inset-inline-end:calc(50% - 26px);min-width:18px;height:18px;border-radius:999px;
  background:var(--red);color:#fff;font-size:12px;font-weight:800;font-style:normal;
  display:flex;align-items:center;justify-content:center;padding:0 5px;
}
.badge[hidden]{display:none}
.tab.active::before{display:none}
  .tab.active{background:var(--gold-soft);border-radius:999px}
  .d-actions{grid-template-columns:1fr 1fr}
}

@media (min-width:760px){
  main{padding-bottom:84px}
  .col-body{padding-bottom:24px}
}
