/* ═══════════════════════════════════════════════════════════
   Nice Nail — نظام الإدارة | style.css (الهوية البصرية)
   ═══════════════════════════════════════════════════════════ */
:root{
  --rose:#C8686B;--rose-light:#DFA0A2;--rose-pale:#FAF0F0;--rose-deep:#A34E51;
  --slate:#8FA0AE;--slate-light:#B8C8D2;--slate-pale:#EEF2F5;
  --cream:#FDFAF8;--white:#fff;
  --dark:#2C2420;--mid:#5C4E4A;--light:#8C7E7A;
  --green:#3FA66A;--green-pale:#E8F5EE;
  --amber:#C9962E;--amber-pale:#FBF3E0;
  --red:#C0504D;--red-pale:#FBECEB;
  --blue:#5B7C99;--blue-pale:#EAF0F5;
  --line:rgba(200,104,107,.12);
  --shadow:0 8px 30px rgba(200,104,107,.10);
  --radius:16px;
}
*{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth}
body{font-family:'Cairo',sans-serif;background:var(--cream);color:var(--dark);direction:rtl;line-height:1.6;-webkit-font-smoothing:antialiased}
a{text-decoration:none;color:inherit}
.serif{font-family:'Playfair Display',serif}

/* ── LOGIN ───────────────────────────────────────────────── */
.login-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;background:linear-gradient(155deg,var(--cream) 45%,#F7EAEA 100%);padding:1.5rem}
.login-card{background:var(--white);border-radius:24px;box-shadow:var(--shadow);padding:2.6rem 2.2rem;width:100%;max-width:380px;text-align:center;border:1px solid var(--line)}
.login-card img{width:96px;margin-bottom:1rem;filter:drop-shadow(0 8px 24px rgba(200,104,107,.2))}
.login-card h1{font-family:'Playfair Display',serif;font-style:italic;color:var(--rose);font-size:1.5rem;margin-bottom:.2rem}
.login-card p{color:var(--light);font-size:.85rem;margin-bottom:1.6rem}
.login-card input{width:100%;padding:13px 15px;border:1.5px solid var(--line);border-radius:12px;font-family:'Cairo';font-size:.95rem;margin-bottom:1rem;text-align:center;outline:none;transition:border-color .2s}
.login-card input:focus{border-color:var(--rose)}
.login-err{background:var(--red-pale);color:var(--red);font-size:.82rem;padding:9px;border-radius:10px;margin-bottom:1rem}

/* ── LAYOUT ──────────────────────────────────────────────── */
.app{display:flex;min-height:100vh}
.sidebar{width:248px;background:var(--white);border-left:1px solid var(--line);position:fixed;top:0;right:0;height:100vh;display:flex;flex-direction:column;z-index:50;transition:transform .25s}
.side-brand{padding:1.4rem 1.5rem 1.1rem;display:flex;align-items:center;gap:11px;border-bottom:1px solid var(--line)}
.side-brand img{width:42px}
.side-brand .bn{font-family:'Playfair Display',serif;font-style:italic;color:var(--rose);font-size:1.15rem;line-height:1}
.side-brand .bs{font-size:.66rem;color:var(--light);margin-top:3px;letter-spacing:.5px}
.side-nav{flex:1;overflow-y:auto;padding:1rem .8rem}
.side-link{display:flex;align-items:center;gap:11px;padding:11px 13px;border-radius:12px;color:var(--mid);font-size:.9rem;font-weight:500;margin-bottom:3px;transition:all .18s;cursor:pointer}
.side-link .ic{font-size:1.15rem;width:22px;text-align:center;flex-shrink:0}
.side-link:hover{background:var(--rose-pale);color:var(--rose-deep)}
.side-link.active{background:var(--rose);color:#fff;box-shadow:0 6px 16px rgba(200,104,107,.28)}
.side-link .badge{margin-inline-start:auto;background:var(--rose-pale);color:var(--rose-deep);font-size:.66rem;font-weight:700;padding:2px 8px;border-radius:20px}
.side-link.active .badge{background:rgba(255,255,255,.25);color:#fff}
.side-foot{padding:1rem .8rem;border-top:1px solid var(--line)}
.side-foot a{display:flex;align-items:center;gap:9px;padding:9px 13px;color:var(--light);font-size:.82rem;border-radius:10px}
.side-foot a:hover{background:var(--slate-pale);color:var(--mid)}

.main{flex:1;margin-right:248px;min-width:0;display:flex;flex-direction:column}
.topbar{background:rgba(253,250,248,.9);backdrop-filter:blur(8px);border-bottom:1px solid var(--line);padding:1rem 1.8rem;display:flex;align-items:center;justify-content:space-between;position:sticky;top:0;z-index:40}
.topbar h2{font-family:'Playfair Display',serif;font-size:1.3rem;color:var(--dark)}
.topbar .sub{font-size:.78rem;color:var(--light);margin-top:2px;font-weight:400;font-family:'Cairo'}
.topbar-right{display:flex;align-items:center;gap:.7rem}
.menu-btn{display:none;background:var(--rose-pale);color:var(--rose-deep);border:none;width:40px;height:40px;border-radius:10px;font-size:1.2rem;cursor:pointer}
.content{padding:1.8rem;max-width:1180px;width:100%;margin:0 auto}

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn{display:inline-flex;align-items:center;gap:7px;border:none;border-radius:11px;padding:10px 18px;font-family:'Cairo';font-size:.88rem;font-weight:700;cursor:pointer;transition:all .18s;background:var(--slate-pale);color:var(--mid)}
.btn:hover{transform:translateY(-1px)}
.btn-primary{background:var(--rose);color:#fff;box-shadow:0 5px 14px rgba(200,104,107,.25)}
.btn-primary:hover{background:var(--rose-deep);box-shadow:0 8px 20px rgba(200,104,107,.3)}
.btn-ghost{background:transparent;border:1.5px solid var(--line);color:var(--mid)}
.btn-ghost:hover{background:var(--rose-pale);border-color:var(--rose-light);color:var(--rose-deep)}
.btn-wa{background:#25D366;color:#fff}
.btn-wa:hover{background:#1ebe5c}
.btn-sm{padding:6px 12px;font-size:.78rem;border-radius:9px}
.btn-danger{background:var(--red-pale);color:var(--red)}
.btn-danger:hover{background:var(--red);color:#fff}
.btn-success{background:var(--green-pale);color:var(--green)}
.btn-success:hover{background:var(--green);color:#fff}
.btn-block{width:100%;justify-content:center}

/* ── CARDS / PANELS ──────────────────────────────────────── */
.card{background:var(--white);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:1.4rem}
.card-h{display:flex;align-items:center;justify-content:space-between;margin-bottom:1.1rem;gap:.6rem;flex-wrap:wrap}
.card-h h3{font-family:'Playfair Display',serif;font-size:1.1rem;color:var(--dark)}
.grid{display:grid;gap:1.1rem}
.g2{grid-template-columns:repeat(2,1fr)}
.g3{grid-template-columns:repeat(3,1fr)}
.g4{grid-template-columns:repeat(4,1fr)}

/* ── STAT CARDS ──────────────────────────────────────────── */
.stat{background:var(--white);border:1px solid var(--line);border-radius:var(--radius);padding:1.25rem 1.3rem;position:relative;overflow:hidden;box-shadow:var(--shadow)}
.stat::after{content:'';position:absolute;top:-30px;left:-30px;width:90px;height:90px;border-radius:50%;background:var(--rose-pale);opacity:.5}
.stat .si{font-size:1.4rem;margin-bottom:.5rem;position:relative}
.stat .sv{font-family:'Playfair Display',serif;font-size:1.9rem;font-weight:700;color:var(--dark);position:relative;line-height:1}
.stat .sl{font-size:.78rem;color:var(--light);margin-top:5px;position:relative}
.stat.rose::after{background:var(--rose-pale)}
.stat.green::after{background:var(--green-pale)}
.stat.amber::after{background:var(--amber-pale)}
.stat.blue::after{background:var(--blue-pale)}

/* ── BADGES / STATUS ─────────────────────────────────────── */
.tag{display:inline-flex;align-items:center;gap:5px;font-size:.74rem;font-weight:700;padding:4px 11px;border-radius:20px;white-space:nowrap}
.t-new,.t-pending{background:var(--amber-pale);color:var(--amber)}
.t-confirmed{background:var(--blue-pale);color:var(--blue)}
.t-completed,.t-paid{background:var(--green-pale);color:var(--green)}
.t-cancelled{background:var(--red-pale);color:var(--red)}
.t-visitor{background:var(--slate-pale);color:var(--slate)}
.t-client{background:var(--rose-pale);color:var(--rose-deep)}
.t-trainee{background:var(--blue-pale);color:var(--blue)}

/* ── TABLES ──────────────────────────────────────────────── */
.tbl-wrap{overflow-x:auto;border-radius:var(--radius);border:1px solid var(--line);background:var(--white);box-shadow:var(--shadow)}
table{width:100%;border-collapse:collapse;font-size:.86rem}
thead th{background:var(--rose-pale);color:var(--rose-deep);text-align:right;padding:12px 14px;font-weight:700;font-size:.8rem;white-space:nowrap}
tbody td{padding:12px 14px;border-top:1px solid var(--line);color:var(--mid);vertical-align:middle}
tbody tr:hover{background:var(--cream)}
.t-actions{display:flex;gap:5px;flex-wrap:wrap}
.empty{text-align:center;padding:3rem 1rem;color:var(--light)}
.empty .ei{font-size:2.6rem;margin-bottom:.6rem;opacity:.5}

/* ── FORMS ───────────────────────────────────────────────── */
.field{display:flex;flex-direction:column;gap:.4rem;margin-bottom:1rem}
.field label{font-size:.82rem;font-weight:700;color:var(--mid)}
.field label span{color:var(--rose)}
.field input,.field select,.field textarea{padding:11px 13px;border:1.5px solid var(--line);border-radius:11px;font-family:'Cairo';font-size:.9rem;outline:none;background:var(--white);color:var(--dark);transition:border-color .2s;width:100%}
.field input:focus,.field select:focus,.field textarea:focus{border-color:var(--rose)}
.field textarea{resize:vertical;min-height:80px}
.field .hint{font-size:.72rem;color:var(--light)}
.frow{display:grid;grid-template-columns:1fr 1fr;gap:.9rem}

/* ── TOOLBAR / FILTERS ───────────────────────────────────── */
.toolbar{display:flex;gap:.6rem;flex-wrap:wrap;align-items:center;margin-bottom:1.2rem}
.search{flex:1;min-width:180px;position:relative}
.search input{width:100%;padding:10px 14px 10px 38px;border:1.5px solid var(--line);border-radius:11px;font-family:'Cairo';font-size:.88rem;outline:none;background:var(--white)}
.search input:focus{border-color:var(--rose)}
.chips{display:flex;gap:6px;flex-wrap:wrap}
.chip{padding:8px 15px;border-radius:30px;font-size:.8rem;font-weight:600;background:var(--white);border:1.5px solid var(--line);color:var(--mid);cursor:pointer;transition:all .18s}
.chip:hover{border-color:var(--rose-light)}
.chip.active{background:var(--rose);color:#fff;border-color:var(--rose)}

/* ── MODAL ───────────────────────────────────────────────── */
.modal-bg{position:fixed;inset:0;background:rgba(44,36,32,.5);backdrop-filter:blur(3px);z-index:200;display:none;align-items:flex-start;justify-content:center;padding:2.5rem 1rem;overflow-y:auto}
.modal-bg.show{display:flex}
.modal{background:var(--white);border-radius:20px;width:100%;max-width:560px;box-shadow:0 24px 70px rgba(0,0,0,.25);animation:pop .25s ease}
.modal-h{padding:1.3rem 1.5rem;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between}
.modal-h h3{font-family:'Playfair Display',serif;font-size:1.2rem;color:var(--dark)}
.modal-x{background:var(--slate-pale);border:none;width:34px;height:34px;border-radius:9px;cursor:pointer;font-size:1.1rem;color:var(--mid)}
.modal-b{padding:1.5rem}
.modal-f{padding:1.1rem 1.5rem;border-top:1px solid var(--line);display:flex;gap:.6rem;justify-content:flex-start}
@keyframes pop{from{opacity:0;transform:translateY(-14px) scale(.98)}to{opacity:1;transform:none}}

/* ── MISC ────────────────────────────────────────────────── */
.flash{padding:12px 16px;border-radius:12px;margin-bottom:1.2rem;font-size:.86rem;font-weight:600;display:flex;align-items:center;gap:8px}
.flash.ok{background:var(--green-pale);color:var(--green)}
.flash.err{background:var(--red-pale);color:var(--red)}
.pill-row{display:flex;gap:.5rem;flex-wrap:wrap}
.muted{color:var(--light);font-size:.82rem}
.divider{height:1px;background:var(--line);margin:1.2rem 0}
.pay-box{background:var(--cream);border:1px solid var(--line);border-radius:13px;padding:1rem 1.1rem;margin-top:.5rem}
.pay-row{display:flex;justify-content:space-between;padding:6px 0;font-size:.88rem;color:var(--mid)}
.pay-row.total{font-weight:700;color:var(--dark);border-top:1px dashed var(--line);margin-top:5px;padding-top:9px}
.kv{display:flex;gap:8px;font-size:.85rem;color:var(--mid);padding:5px 0}
.kv b{color:var(--dark);min-width:90px;display:inline-block}

/* ── CALENDAR ────────────────────────────────────────────── */
.cal-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:1rem}
.cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:7px}
.cal-dow{text-align:center;font-size:.74rem;font-weight:700;color:var(--light);padding:6px 0}
.cal-cell{background:var(--white);border:1px solid var(--line);border-radius:12px;min-height:96px;padding:7px;position:relative;transition:all .15s;cursor:pointer}
.cal-cell:hover{border-color:var(--rose-light);box-shadow:var(--shadow)}
.cal-cell.other{opacity:.4}
.cal-cell.today{border-color:var(--rose);background:var(--rose-pale)}
.cal-cell .dnum{font-size:.78rem;font-weight:700;color:var(--mid);margin-bottom:4px}
.cal-cell.today .dnum{color:var(--rose-deep)}
.cal-ev{font-size:.66rem;background:var(--rose);color:#fff;border-radius:6px;padding:2px 5px;margin-bottom:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cal-ev.confirmed{background:var(--blue)}
.cal-ev.completed{background:var(--green)}
.cal-ev.pending{background:var(--amber)}
.cal-ev.cancelled{background:var(--slate);text-decoration:line-through}

/* ── BARS (charts) ───────────────────────────────────────── */
.bars{display:flex;align-items:flex-end;gap:10px;height:170px;padding-top:1rem}
.bar-col{flex:1;display:flex;flex-direction:column;align-items:center;gap:6px;height:100%;justify-content:flex-end}
.bar{width:100%;max-width:46px;background:linear-gradient(180deg,var(--rose-light),var(--rose));border-radius:8px 8px 0 0;min-height:4px;transition:height .5s ease;position:relative}
.bar-val{font-size:.7rem;font-weight:700;color:var(--rose-deep)}
.bar-lbl{font-size:.7rem;color:var(--light)}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media(max-width:920px){
  .g4{grid-template-columns:repeat(2,1fr)}
  .g3{grid-template-columns:1fr}
  .g2{grid-template-columns:1fr}
}
@media(max-width:760px){
  .sidebar{transform:translateX(100%)}
  .sidebar.open{transform:none;box-shadow:-10px 0 40px rgba(0,0,0,.15)}
  .main{margin-right:0}
  .menu-btn{display:block}
  .frow{grid-template-columns:1fr}
  .content{padding:1.1rem}
  .cal-cell{min-height:60px}
}

/* ── INBOX ───────────────────────────────────────────────── */
.inbox{display:flex;gap:1rem;height:calc(100vh - 180px);min-height:420px}
.inbox-list{width:320px;flex-shrink:0;background:var(--white);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);display:flex;flex-direction:column;overflow:hidden}
.inbox-list-h{display:flex;align-items:center;justify-content:space-between;padding:.9rem 1rem;border-bottom:1px solid var(--line)}
.inbox-search{padding:.6rem .8rem;border-bottom:1px solid var(--line)}
.inbox-search input{width:100%;padding:8px 12px;border:1.5px solid var(--line);border-radius:10px;font-family:'Cairo';font-size:.85rem;outline:none;background:var(--cream)}
.conv-item{display:flex;align-items:center;gap:10px;padding:11px 13px;border-bottom:1px solid var(--line);cursor:pointer;transition:background .15s}
.conv-item:hover{background:var(--cream)}
.conv-item.active{background:var(--rose-pale)}
.conv-av{width:42px;height:42px;border-radius:50%;background:var(--rose-light);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:1.1rem;flex-shrink:0;font-family:'Playfair Display',serif}
.conv-last{font-size:.78rem;color:var(--light);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}
.conv-badge{background:var(--rose);color:#fff;font-size:.66rem;font-weight:700;min-width:18px;height:18px;border-radius:20px;display:flex;align-items:center;justify-content:center;padding:0 5px}
.conv-mode{font-size:.9rem;flex-shrink:0}
.conv-mode.bot{opacity:.5}

.inbox-thread{flex:1;background:var(--white);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);display:flex;flex-direction:column;overflow:hidden;min-width:0}
.thread-h{display:flex;align-items:center;justify-content:space-between;gap:.6rem;padding:.8rem 1.1rem;border-bottom:1px solid var(--line);flex-wrap:wrap}
.thread-body{flex:1;overflow-y:auto;padding:1.1rem;display:flex;flex-direction:column;gap:8px;background:linear-gradient(var(--cream),var(--white))}
.thread-day{text-align:center;font-size:.7rem;color:var(--light);background:var(--slate-pale);align-self:center;padding:3px 12px;border-radius:20px;margin:6px 0}
.bubble{max-width:74%;padding:9px 13px;border-radius:14px;font-size:.88rem;line-height:1.6;position:relative;word-wrap:break-word}
.bubble.in{background:var(--white);border:1px solid var(--line);align-self:flex-start;border-bottom-right-radius:4px}
.bubble.out{background:var(--rose);color:#fff;align-self:flex-end;border-bottom-left-radius:4px}
.bubble-meta{display:block;font-size:.62rem;opacity:.6;margin-top:3px;text-align:left}
.thread-reply{display:flex;gap:.5rem;align-items:flex-end;padding:.7rem .9rem;border-top:1px solid var(--line);background:var(--white)}
.thread-reply textarea{flex:1;resize:none;padding:11px 14px;border:1.5px solid var(--line);border-radius:22px;font-family:'Cairo';font-size:.9rem;outline:none;max-height:120px;line-height:1.4}
.thread-reply textarea:focus{border-color:var(--rose)}
.thread-reply button{border-radius:50%;width:44px;height:44px;padding:0;flex-shrink:0;font-size:1.1rem}

/* ── MOBILE: تبديل بين القائمة والمحادثة ─────────────────── */
@media(max-width:760px){
  .inbox{height:calc(100vh - 150px);gap:0}
  .inbox-list{width:100%}
  .inbox.has-sel .inbox-list{display:none}
  .inbox:not(.has-sel) .inbox-thread{display:none}
  .bubble{max-width:85%}
}

/* تحسينات جوال عامة */
@media(max-width:760px){
  .topbar{padding:.8rem 1rem}
  .topbar h2{font-size:1.1rem}
  .content{padding:.9rem}
  .stat .sv{font-size:1.6rem}
  .modal{margin:0 .5rem}
}

/* زر الإشعارات في الإعدادات */
.notif-toggle{display:flex;align-items:center;justify-content:space-between;padding:10px 0;border-bottom:1px solid var(--line)}
.notif-toggle:last-child{border-bottom:none}
.switch{position:relative;display:inline-block;width:46px;height:26px;flex-shrink:0}
.switch input{opacity:0;width:0;height:0}
.switch .sl{position:absolute;cursor:pointer;inset:0;background:var(--slate-light);border-radius:26px;transition:.2s}
.switch .sl:before{content:'';position:absolute;height:20px;width:20px;right:3px;top:3px;background:#fff;border-radius:50%;transition:.2s}
.switch input:checked + .sl{background:var(--green)}
.switch input:checked + .sl:before{transform:translateX(-20px)}
@media(max-width:760px){ .mob-back{display:inline-flex!important} }

/* ── INBOX: وسائط + إيموجي + إرفاق ── */
.bubble-img{max-width:240px;max-height:280px;border-radius:10px;display:block;margin-bottom:4px;cursor:pointer}
.bubble-doc{display:inline-block;background:rgba(0,0,0,.05);padding:8px 12px;border-radius:8px;color:inherit;text-decoration:none;font-size:.85rem}
.reply-icon{background:transparent;border:none;font-size:1.3rem;cursor:pointer;padding:6px;line-height:1;flex-shrink:0}
.reply-icon:hover{transform:scale(1.15)}
.emoji-bar{flex-wrap:wrap;gap:4px;padding:8px 10px;background:var(--white);border-top:1px solid var(--line);max-height:130px;overflow-y:auto}
.emoji-bar span{font-size:1.4rem;cursor:pointer;padding:3px;border-radius:6px}
.emoji-bar span:hover{background:var(--rose-pale)}
.img-preview{align-items:center;gap:10px;padding:8px 12px;background:var(--rose-pale);border-top:1px solid var(--line)}
.img-preview img{width:54px;height:54px;object-fit:cover;border-radius:8px}
.img-preview button{background:var(--red);color:#fff;border:none;width:24px;height:24px;border-radius:50%;cursor:pointer}
.img-preview span{font-size:.8rem;color:var(--rose-deep)}
