/* لوحة لمى — طبقة التصميم الثانية: إدارة + منسقة */

/* ----- demo switch in banner ----- */
.demo-banner{justify-content:center;gap:8px}
.demo-switch{
  flex:none;text-decoration:none;color:#fff;background:var(--violet-d);
  border-radius:999px;padding:3px 10px;font-size:11px;font-weight:800;
  white-space:nowrap;line-height:1.4
}
.demo-switch:hover{filter:brightness(1.1)}
body.role-coord .demo-switch{background:var(--gold);color:var(--violet-d)}
@media (max-width:430px){
  .demo-banner span{display:none}
}

/* role visibility */
body.role-coord .admin-only{display:none!important}
body.role-admin .coord-only{display:none!important}
body.is-chats .stats-bar{display:none}

/* ----- admin stats bar (fixed in the column, doesn't scroll) ----- */
.stats-bar{
  flex:none;display:none;gap:8px;padding:8px 12px;
  background:rgba(251,247,239,.94);backdrop-filter:blur(12px);
  border-bottom:1px solid var(--line);overflow-x:auto;scrollbar-width:none;
  -webkit-overflow-scrolling:touch
}
body.role-admin .stats-bar{display:flex}
.stats-bar::-webkit-scrollbar{display:none}
.st{
  flex:none;min-width:108px;background:var(--card);border:1px solid var(--line);
  border-radius:14px;padding:8px 10px 9px;text-align:start;box-shadow:var(--shadow-s)
}
.st .lbl{display:block;font-size:11px;font-weight:800;color:var(--ink2);line-height:1.3}
.st .num{display:block;font-family:"El Messiri",sans-serif;font-size:22px;font-weight:700;
  color:var(--violet-d);line-height:1.15;margin-top:2px}
.st.warn{border-color:#f3c4ca;background:linear-gradient(180deg,#fff,#fdecee)}
.st.warn .num{color:var(--price)}
.st.amber{border-color:#ecd89a;background:linear-gradient(180deg,#fff,#fff8e8)}
.st.amber .num{color:var(--amber)}
.st.gold{border-color:var(--gold-l);background:linear-gradient(180deg,#fffdf8,#fbf3df)}
.st.gold .num{color:var(--gold-d)}
.st .hint{display:block;font-size:10.5px;color:var(--muted);margin-top:1px;font-weight:700}

/* ----- hello / mission line ----- */
.hello p.mission{margin:6px 0 0;font-size:14px;color:var(--ink2);max-width:44rem;line-height:1.7}
.hello h2{font-size:24px}

/* ----- تحتاجك الحين ----- */
.needs-sec{margin:4px 0 18px}
.needs-h{display:flex;align-items:center;gap:8px;margin:0 2px 4px}
.needs-h h2{font-size:22px;color:var(--price)}
.needs-count{
  min-width:26px;height:26px;padding:0 7px;border-radius:13px;background:var(--price);
  color:#fff;font-weight:800;font-size:13px;display:inline-flex;align-items:center;justify-content:center
}
.needs-lead{margin:0 2px 12px;font-size:13px;color:var(--muted)}
.need-card{padding:0;overflow:hidden;border-color:#f3c4ca;background:linear-gradient(180deg,#fff,#fff8f8)}
.need-card .hd{display:flex;align-items:flex-start;gap:10px;padding:12px 14px 8px}
.need-card .hd .who{flex:1;min-width:0}
.need-card .hd .who b{display:block;font-size:15.5px;line-height:1.35}
.need-card .bd{padding:0 14px 14px}
.need-card .why{margin:0 0 8px;font-size:13.5px;color:var(--ink2)}
.receipt-pic{
  display:block;width:100%;max-height:220px;object-fit:cover;object-position:center top;
  border-radius:12px;border:1px solid var(--line);cursor:zoom-in;background:#f4efe6;margin:4px 0 10px
}
.empty-ok{
  text-align:center;padding:36px 18px 32px;border:1.5px dashed var(--gold);
  border-radius:var(--r);background:linear-gradient(180deg,#fffdf8,#fbf3df);margin-top:8px
}
.empty-ok .orb{
  width:72px;height:72px;border-radius:50%;margin:0 auto 12px;display:grid;place-items:center;
  font-size:36px;background:var(--green-s);box-shadow:0 0 0 6px #fff,0 0 0 7px var(--gold-l)
}
.empty-ok h2{font-size:22px;margin:0 0 6px;color:var(--violet-d)}
.empty-ok p{margin:0;color:var(--muted);font-size:14px}

/* ----- حجوزات الشفت ----- */
.books-sec{margin-top:8px}
.book-item .who b{display:block}
.book-item .meta{display:block;font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.book-item .t{width:64px}

/* ----- client pane (desktop 3-col) + sheet ----- */
.client-pane{
  display:none;min-width:0;min-height:0;overflow:auto;
  background:linear-gradient(180deg,#fffdf9,#f7f1ff);padding:16px 14px 20px
}
.client-pane .empty-c{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;
  text-align:center;color:var(--muted);gap:6px;padding:24px}
.cp-av{width:64px;height:64px;border-radius:50%;display:grid;place-items:center;margin:4px auto 8px;
  font-size:20px;font-weight:800;color:#fff;background:linear-gradient(135deg,#7b4fe0,#3b1f5c)}
.cp-av.g{background:linear-gradient(135deg,#e8cd8a,#c4a05a);color:var(--violet-d)}
.cp-av.a{background:linear-gradient(135deg,#f0a1a8,#d0021b)}
.client-pane h3,.cp-sheet h3{text-align:center;font-size:20px;margin:0 0 2px}
.cp-sub{text-align:center;margin:0;color:var(--muted);font-size:13px}
.cp-block{margin-top:16px}
.cp-block h4{font-size:14px;margin:0 0 8px}
.cp-hist{display:flex;flex-direction:column;gap:0}
.cp-hist .row-h{display:flex;gap:8px;align-items:flex-start;padding:8px 0;border-bottom:1px solid var(--line2)}
.cp-hist .row-h:last-child{border-bottom:0}
.cp-hist .row-h b{display:block;font-size:13.5px}
.cp-actions{display:flex;flex-direction:column;gap:8px;margin-top:16px}
.stars.lg{font-size:20px;text-align:center;display:block;margin-top:6px}

/* ----- coordinators ----- */
.coord-add{margin-bottom:14px}
.coord-add .row-add{display:flex;gap:8px;align-items:flex-end}
.coord-add .row-add .fl{flex:1;min-width:0}
.coord-add .row-add .btn{flex:none}
.coord-card .link-box{
  margin-top:10px;background:#fbf7ef;border:1px dashed var(--gold);border-radius:12px;padding:10px 12px
}
.coord-card .link-box code{
  display:block;font-size:12.5px;word-break:break-all;direction:ltr;text-align:start;
  color:var(--violet-d);font-weight:700;font-family:ui-monospace,Menlo,Consolas,monospace
}
.link-acts{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:10px}
.activity{margin-top:6px}
.act-item{display:flex;gap:10px;padding:10px 0;border-bottom:1px solid var(--line2);align-items:flex-start}
.act-item:last-child{border-bottom:0}
.act-item .dot{width:8px;height:8px;border-radius:50%;background:var(--gold);flex:none;margin-top:8px}
.act-item b{display:block;font-size:14px}
.revoked{opacity:.72}
.revoked .link-box{background:#f4eef4;border-color:var(--faint)}

/* ----- chat status chips already use .pill ----- */
.conv-r .pill{height:22px;font-size:11px}

/* ----- revoked gate ----- */
.gate{max-width:420px;margin:40px auto;text-align:center;padding:28px 20px}

/* ----- book form in modal ----- */
#modal-bg.on{align-items:center}

/* toast sits above tabbar; on desktop already centered */

/* ----- desktop ----- */
@media (min-width:880px){
  .stats-bar{padding:8px 18px;gap:10px}
  .st{flex:1;min-width:0}
  .needs-h h2{font-size:24px}
  .offer-grid{grid-template-columns:repeat(2,1fr)}
}
@media (min-width:1120px){
  .stats-bar{padding:8px 22px}
  /* three-column chats */
  .chat-shell,.chat-shell.open{grid-template-columns:minmax(250px,300px) minmax(0,1fr) 300px}
  .chat-shell .chat-list,.chat-shell.open .chat-list{display:flex;border-inline-end:1px solid var(--line);background:rgba(255,253,249,.7)}
  .chat-shell .chat-thread,.chat-shell.open .chat-thread{display:flex}
  .client-pane{display:flex;flex-direction:column;border-inline-start:1px solid var(--line)}
  .only-desk{display:block}
  body.role-coord .app{grid-template-columns:220px 1fr}
  body.role-coord .sidebar{display:flex}
  body.role-coord .tabbar,body.role-coord .brand-m{display:none}
  body.role-coord .views.is-chats{padding:0}
  .receipt-pic{max-height:260px}
}
@media (min-width:1280px){
  .chat-shell,.chat-shell.open{grid-template-columns:minmax(260px,320px) minmax(0,1fr) 320px}
}

/* phone-only helper already: .only-phone hidden on 880+ */
.only-desk{display:none}

/* coordinator top title */
.role-pill{background:var(--gold-s);color:var(--gold-d)}

/* make home books card breathe */
#view-books{min-height:100%}

/* thread bar client button */
.btn.iconish{width:42px;height:42px;min-height:42px;padding:0;border-radius:12px}

/* prevent long names overflowing need cards */
.need-card .hd .who b,.need-card .hd .who .tiny{
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap
}
.need-card .hd .who .tiny{display:block}

/* ensure RTL numbers don't jump */
.st .num,.price,.book-item .t{font-variant-numeric:tabular-nums;unicode-bidi:isolate}

/* sheet for client card on phone */
.cp-sheet{padding-bottom:calc(18px + var(--safe-b))}

@media (max-width:520px){
  .coord-add .row-add{flex-direction:column;align-items:stretch}
  .coord-add .row-add .btn{width:100%}
}
.thread-bar .pill{flex:none}
.thread-bar .who{min-width:0}
@media (max-width:430px){
  .thread-bar .pill{display:none}
}
/* keep stats tiles from shrinking text */
.st .lbl{white-space:nowrap}
/* books pill row wrap */
#view-books .between{flex-wrap:wrap}

/* fixes after visual QA */
body.role-admin.is-chats .stats-bar,
body.is-chats .stats-bar{display:none!important}

#chat-empty[hidden],.chat-empty[hidden]{display:none!important}

.coord-card .link-box code{
  direction:ltr;unicode-bidi:isolate;overflow-wrap:anywhere;word-break:break-word;
  font-family:"Cairo",ui-monospace,Menlo,Consolas,monospace;font-size:13px;line-height:1.6
}

@media (max-width:879px){
  body.role-admin .stats-bar{
    display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;
    overflow:visible;padding:8px 12px
  }
  .st{min-width:0;width:auto}
  .st .lbl{white-space:normal;font-size:10.5px}
  .st .num{font-size:20px}
}
.receipt-pic{max-height:240px}

.conv.on{background:#f6ead0;box-shadow:none;border-inline-start:3px solid var(--gold)}
