@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');
*{box-sizing:border-box;}
body{margin:0;font-family:'Vazirmatn',Tahoma,Arial,sans-serif;background:#f3f5f8;color:#222;}
a{text-decoration:none;color:inherit;}

.layout{display:flex;min-height:100vh;}
.sidebar{width:230px;background:#1f2937;color:#fff;display:flex;flex-direction:column;padding:18px 0;flex-shrink:0;}
.sidebar .brand{padding:0 14px 14px;border-bottom:1px solid #374151;margin-bottom:10px;}
.sidebar .brand-title{padding:0 4px 12px;font-size:16px;font-weight:bold;}
.warehouse-switches{display:flex;flex-direction:column;gap:7px;}
.warehouse-switch-btn{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;padding:9px 10px;border:1px solid #475569;border-radius:7px;background:#111827;color:#e2e8f0;font-size:12px;font-weight:600;transition:background .15s,border-color .15s;}
.warehouse-switch-btn:hover{background:#334155;border-color:#64748b;color:#fff;}
.warehouse-switch-icon{font-size:17px;line-height:1;}
.sidebar nav{flex:1;display:flex;flex-direction:column;gap:2px;}
.sidebar nav a{padding:12px 18px;color:#cbd5e1;font-size:14px;border-right:3px solid transparent;}
.sidebar nav a:hover{background:#2a3548;color:#fff;}
.sidebar nav a.active{background:#2a3548;color:#fff;border-right-color:#3b82f6;}
.user-box{padding:14px 18px;border-top:1px solid #374151;font-size:13px;display:flex;justify-content:space-between;align-items:center;}
.user-box a{color:#f87171;}

.content{flex:1;padding:24px;max-width:1200px;}

.alert{padding:12px 16px;border-radius:8px;margin-bottom:18px;font-size:14px;}
.alert-success{background:#dcfce7;color:#166534;}
.alert-error{background:#fee2e2;color:#991b1b;}
.alert-warning{background:#fef9c3;color:#854d0e;}

.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:16px;margin-bottom:24px;}
.card{background:#fff;border-radius:12px;padding:18px;box-shadow:0 1px 3px rgba(0,0,0,.08);}
.card .num{font-size:26px;font-weight:bold;color:#1f2937;}
.card .label{color:#6b7280;font-size:13px;margin-top:4px;}
.card.warn .num{color:#dc2626;}

h1,h2,h3{color:#1f2937;}
.page-title{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px;}

table{width:100%;border-collapse:collapse;background:#fff;border-radius:10px;overflow:hidden;box-shadow:0 1px 3px rgba(0,0,0,.08);}
th,td{padding:10px 12px;text-align:right;font-size:13.5px;border-bottom:1px solid #eef0f3;}
th{background:#f9fafb;color:#374151;font-weight:600;}
tr:hover td{background:#fafbfc;}

.badge{display:inline-block;padding:3px 10px;border-radius:20px;font-size:12px;font-weight:600;}
.badge-in{background:#dcfce7;color:#166534;}
.badge-out{background:#fee2e2;color:#991b1b;}
.badge-loan_out{background:#fef3c7;color:#92400e;}
.badge-loan_return{background:#dbeafe;color:#1e40af;}
.badge-adjust{background:#ede9fe;color:#5b21b6;}
.badge-order_deduct{background:#fce7f3;color:#9d174d;}
.badge-delivery_record{background:#f0fdf4;color:#166534;}

.btn{display:inline-block;padding:9px 18px;border-radius:8px;border:none;cursor:pointer;font-size:14px;font-family:inherit;}
.btn-primary{background:#2563eb;color:#fff;}
.btn-primary:hover{background:#1d4ed8;}
.btn-success{background:#16a34a;color:#fff;}
.btn-danger{background:#dc2626;color:#fff;}
.btn-secondary{background:#e5e7eb;color:#374151;}
.btn-sm{padding:5px 12px;font-size:12px;}

form.box, .panel{background:#fff;padding:22px;border-radius:12px;box-shadow:0 1px 3px rgba(0,0,0,.08);max-width:600px;}
label{display:block;margin:14px 0 6px;font-size:13.5px;color:#444;}
input[type=text],input[type=number],input[type=search],input[type=password],input[type=date],select,textarea{
  width:100%;padding:10px;border:1px solid #ddd;border-radius:7px;font-family:inherit;font-size:14px;
}
.filters{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:16px;background:#fff;padding:14px;border-radius:10px;}
.filters > div{flex:1;min-width:140px;}
.filters label{margin-top:0;}

.tabs{display:flex;gap:6px;margin-bottom:16px;}
.tabs a{padding:8px 16px;border-radius:8px;background:#fff;font-size:13.5px;color:#444;}
.tabs a.active{background:#2563eb;color:#fff;}

.text-muted{color:#9ca3af;}
.text-success{color:#166534;font-weight:600;}
.status-processing{background:#dbeafe;color:#1e40af;}
.status-completed{background:#dcfce7;color:#166534;}
.status-on-hold{background:#fef3c7;color:#92400e;}
.status-cancelled{background:#e5e7eb;color:#374151;}
.status-refunded{background:#ede9fe;color:#5b21b6;}
.status-failed{background:#fee2e2;color:#991b1b;}
.flex{display:flex;gap:10px;align-items:center;}
.mt{margin-top:16px;}
.right{float:left;}
.pagination{display:flex;gap:6px;margin-top:14px;}
.pagination a,.pagination span{padding:6px 12px;background:#fff;border-radius:6px;font-size:13px;}
.pagination .active{background:#2563eb;color:#fff;}

/* ===== تقویم شمسی ===== */
.jdp-popup{background:#fff;border-radius:10px;box-shadow:0 6px 24px rgba(0,0,0,.18);padding:10px;width:240px;z-index:9999;font-size:13px;}
.jdp-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;font-weight:600;}
.jdp-nav{background:#f1f5f9;border:none;border-radius:6px;width:26px;height:26px;cursor:pointer;font-size:14px;}
.jdp-week{display:grid;grid-template-columns:repeat(7,1fr);text-align:center;color:#9ca3af;margin-bottom:4px;}
.jdp-days{display:grid;grid-template-columns:repeat(7,1fr);gap:2px;}
.jdp-day{text-align:center;padding:6px 0;border-radius:6px;cursor:pointer;}
.jdp-day:hover{background:#2563eb;color:#fff;}
.jdp-foot{text-align:center;margin-top:8px;}
.jdp-today{background:#eef2ff;color:#2563eb;border:none;border-radius:6px;padding:5px 14px;cursor:pointer;font-size:12px;}

/* ===== همبرگری و ریسپانسیو ===== */
.hamburger{
  display:none;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  gap:5px;
  background:transparent;
  border:none;
  cursor:pointer;
  padding:6px;
  width:40px;
  height:40px;
}
.hamburger span{
  display:block;
  width:24px;
  height:2px;
  background:#fff;
  border-radius:2px;
  transition:all .25s ease;
}
.hamburger.open span:nth-child(1){transform:translateY(7px) rotate(45deg);}
.hamburger.open span:nth-child(2){opacity:0;}
.hamburger.open span:nth-child(3){transform:translateY(-7px) rotate(-45deg);}

.topbar{display:none;}
.sidebar-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:1001;}

@media (max-width: 900px){
  .layout{flex-direction:column;}
  .topbar{
    display:flex;align-items:center;justify-content:space-between;
    background:#1f2937;color:#fff;padding:8px 14px;
    position:sticky;top:0;z-index:1001;
  }
  .topbar-title{font-size:15px;font-weight:bold;}
  .hamburger{display:flex;}
  .sidebar{
    position:fixed;top:0;right:-260px;height:100%;width:240px;z-index:1002;
    transition:right .25s ease;box-shadow:2px 0 12px rgba(0,0,0,.2);
    overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;
  }
  .sidebar nav{flex:0 0 auto;padding-bottom:12px;}
  .sidebar .user-box{flex-shrink:0;}
  .sidebar.open{right:0;}
  .sidebar-overlay.open{display:block;}
  .content{padding:14px;max-width:100%;}
  .cards{grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px;}
  table{display:block;overflow-x:auto;white-space:nowrap;}
  .filters{flex-direction:column;}
  .filters > div{width:100%;}
  form.box,.panel{max-width:100%;padding:16px;}
  .page-title{flex-direction:column;align-items:flex-start;gap:10px;}
  .tabs{overflow-x:auto;flex-wrap:nowrap;}
}
@media (max-width: 480px){
  .card .num{font-size:20px;}
  .btn{padding:8px 12px;font-size:13px;}
}

/* ===== جستجوی زنده محصول (Autocomplete) ===== */
.ac-wrap{position:relative;}
.ac-results{position:absolute;top:100%;right:0;left:0;background:#fff;border-radius:8px;box-shadow:0 6px 20px rgba(0,0,0,.15);max-height:280px;overflow-y:auto;z-index:50;margin-top:4px;display:none;}
.ac-results.show{display:block;}
.ac-item{padding:10px 12px;cursor:pointer;border-bottom:1px solid #f1f5f9;font-size:13.5px;}
.ac-item:hover{background:#f3f4f6;}
.ac-item .muted{color:#9ca3af;font-size:12px;}

/* ===== نوار پیشرفت ===== */
.progress-wrap{background:#eef0f3;border-radius:20px;height:22px;overflow:hidden;margin:14px 0;}
.progress-bar{background:linear-gradient(90deg,#2563eb,#3b82f6);height:100%;width:0%;transition:width .3s;display:flex;align-items:center;justify-content:center;color:#fff;font-size:12px;}
.sync-log{background:#0f172a;color:#a3e635;font-family:monospace;font-size:12px;border-radius:8px;padding:10px;max-height:180px;overflow-y:auto;margin-top:10px;}

/* ===== برچسب مرحله و وضعیت ===== */
.stage-badge{display:inline-block;padding:4px 12px;border-radius:20px;font-size:12px;background:#e0e7ff;color:#3730a3;}
.status-publish{background:#dcfce7;color:#166534;}
.status-draft{background:#fef3c7;color:#92400e;}
.status-pending{background:#fee2e2;color:#991b1b;}
.status-private{background:#e5e7eb;color:#374151;}

/* ===== بنر نصب PWA ===== */
#pwaInstallBanner{
  position:fixed;bottom:0;right:0;left:0;
  background:#1f2937;color:#fff;
  padding:14px 16px;
  z-index:9999;
  box-shadow:0 -4px 20px rgba(0,0,0,.3);
  animation:slideUp .35s ease;
}
@keyframes slideUp{from{transform:translateY(100%)}to{transform:translateY(0)}}
.pwa-banner-inner{
  display:flex;align-items:center;gap:12px;max-width:560px;margin:0 auto;
}
.pwa-icon{width:48px;height:48px;border-radius:12px;flex-shrink:0;}
.pwa-text{flex:1;display:flex;flex-direction:column;gap:2px;}
.pwa-text strong{font-size:14px;}
.pwa-text span{font-size:12px;color:#94a3b8;}
.pwa-btns{display:flex;gap:8px;flex-shrink:0;}
.pwa-btn-yes{
  padding:9px 18px;background:#3b82f6;color:#fff;
  border:none;border-radius:8px;font-size:13px;cursor:pointer;
  font-family:inherit;white-space:nowrap;
}
.pwa-btn-yes:hover{background:#2563eb;}
.pwa-btn-no{
  padding:9px 14px;background:transparent;color:#94a3b8;
  border:1px solid #374151;border-radius:8px;font-size:13px;cursor:pointer;
  font-family:inherit;white-space:nowrap;
}
.pwa-btn-no:hover{color:#fff;border-color:#6b7280;}
@media(max-width:480px){
  .pwa-banner-inner{flex-wrap:wrap;}
  .pwa-btns{width:100%;justify-content:flex-end;}
}

/* ===== یادآوری کارها/یادداشت‌ها ===== */
#taskReminderToast{
  position:fixed;bottom:20px;left:20px;z-index:9999;max-width:340px;
  animation:taskToastIn .25s ease-out;
}
@keyframes taskToastIn{from{opacity:0;transform:translateY(15px)}to{opacity:1;transform:translateY(0)}}
.task-toast-inner{
  background:#1f2937;color:#f3f4f6;border-radius:12px;padding:16px;
  box-shadow:0 10px 30px rgba(0,0,0,.35);border:1px solid #374151;
}
.task-toast-head{font-weight:700;margin-bottom:8px;font-size:14px;}
.task-toast-list{max-height:160px;overflow-y:auto;font-size:13px;color:#d1d5db;margin-bottom:12px;}
.task-toast-item{padding:4px 0;border-bottom:1px solid #374151;}
.task-toast-item:last-child{border-bottom:none;}
.task-toast-btns{display:flex;gap:8px;justify-content:flex-end;}
@media(max-width:480px){
  #taskReminderToast{left:10px;right:10px;bottom:10px;max-width:none;}
}

/* ===== Notification Bell & Panel ===== */
.notif-bell, .notif-bell-desk {
  position:relative;background:transparent;border:none;cursor:pointer;
  font-size:20px;padding:4px 8px;border-radius:8px;color:#fff;line-height:1;
}
.notif-bell:hover,.notif-bell-desk:hover{background:rgba(255,255,255,.15);}
.notif-bell-desk{font-size:18px;padding:3px 6px;}
.notif-badge{
  background:#dc2626;color:#fff;border-radius:10px;font-size:10px;
  padding:1px 5px;font-weight:700;vertical-align:super;
}
#notifPanelBox{
  position:fixed;top:60px;left:14px;width:300px;background:#fff;border-radius:12px;
  box-shadow:0 8px 30px rgba(0,0,0,.18);padding:16px;z-index:1600;max-height:400px;overflow-y:auto;
}
.notif-item{
  padding:10px 0;border-bottom:1px solid #f3f4f6;cursor:pointer;
}
.notif-item:hover{background:#f9fafb;}
.notif-item:last-child{border:none;}
.notif-title{font-size:13.5px;font-weight:600;color:#1f2937;}
.notif-msg{font-size:12px;color:#6b7280;margin-top:2px;}
.notif-time{font-size:11px;color:#9ca3af;margin-top:3px;}
.notif-toast{
  background:#1f2937;color:#fff;padding:13px 16px;border-radius:10px;
  box-shadow:0 4px 20px rgba(0,0,0,.3);font-family:Tahoma,sans-serif;
  font-size:13.5px;border-right:4px solid #3b82f6;direction:rtl;
  opacity:0;transform:translateX(-20px);transition:all .3s ease;
}
.notif-toast.show{opacity:1;transform:translateX(0);}

/* ===== دکمه برگشت موبایل ===== */
#mobileBackBtn {
  display: none;
  position: fixed;
  bottom: 22px;
  right: 50%;
  transform: translateX(50%);
  z-index: 1200;
  background: #1f2937;
  color: #fff;
  border: none;
  border-radius: 28px;
  padding: 12px 28px;
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,0,0,.28);
  display: none;
  align-items: center;
  gap: 8px;
  transition: background .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
#mobileBackBtn:active { background: #374151; transform: translateX(50%) scale(.96); }
@media (max-width: 900px) {
  #mobileBackBtn { display: flex; }
  .content { padding-bottom: 72px; } /* فضا برای دکمه */
}
@media (min-width: 901px) {
  #mobileBackBtn { display: none !important; }
}
