/* ═══════════════════════════════════════════
   VARIABLES — LIGHT (تم برند نویان: سرمه‌ای/مشکی)
═══════════════════════════════════════════ */
:root {
  --bg: #FAFAFB;
  --surface: #FFFFFF;
  --surface2: #F4F5F7;
  --surface3: #E8EAEE;
  --border: rgba(16,17,26,0.08);
  --border2: rgba(16,17,26,0.14);
  --text: #16171D;
  --text2: #5A5E6B;
  --text3: #8B8F9C;
  --purple: #4F46E5;
  --purple-d: #4338CA;
  --purple-light: #EEEDFC;
  --purple-mid: #A5A0E8;
  --gold: #A87F2E;
  --gold-light: #FBF3E1;
  --teal: #0E9F6E;
  --teal-light: #E3F6EE;
  --amber: #A87F2E;
  --amber-light: #FBF3E1;
  --red: #D92D3F;
  --red-light: #FDEBED;
  --blue: #2563EB;
  --blue-light: #E8EFFD;
  --radius-sm: 7px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  /* سایه‌ها عمداً بسیار ملایم‌اند — عمق از مرز (border) می‌آید نه از سایه */
  --shadow: 0 1px 2px rgba(16,17,26,.05);
  --shadow-md: 0 4px 12px rgba(16,17,26,.07),0 1px 3px rgba(16,17,26,.05);
  --shadow-lg: 0 16px 48px rgba(16,17,26,.16),0 4px 12px rgba(16,17,26,.08);
  --ring: 0 0 0 3px rgba(79,70,229,.15);
  /* مقیاس فاصله‌گذاری — همه‌جا از همین‌ها استفاده شود */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --sidebar-w: 244px;
  --topbar-h: 56px;
}

/* ═══════════════════════════════════════════
   DARK THEME
═══════════════════════════════════════════ */
body.dark {
  --bg: #0B0C10;
  --surface: #131419;
  --surface2: #1A1C22;
  --surface3: #24262F;
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.14);
  --text: #ECEDF1;
  --text2: #9CA0AD;
  --text3: #6B6F7D;
  --purple: #8B85F0;
  --purple-d: #6C63E8;
  --purple-light: rgba(139,133,240,0.16);
  --purple-mid: #6C6A8C;
  --gold: #D4B876;
  --gold-light: rgba(212,184,118,0.16);
  --teal: #2ED393;
  --teal-light: rgba(46,211,147,0.16);
  --amber: #D4B876;
  --amber-light: rgba(212,184,118,0.16);
  --red: #F0576A;
  --red-light: rgba(240,87,106,0.16);
  --blue: #5B93F5;
  --blue-light: rgba(91,147,245,0.16);
  --shadow: 0 1px 2px rgba(0,0,0,.35);
  --shadow-md: 0 4px 12px rgba(0,0,0,.45),0 1px 3px rgba(0,0,0,.35);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.65),0 4px 12px rgba(0,0,0,.45);
  --ring: 0 0 0 3px rgba(139,133,240,.22);
}

/* ═══════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════ */
*{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth}
body{font-family:'Vazirmatn','Segoe UI',Tahoma,sans-serif;background:var(--bg);color:var(--text);min-height:100vh;min-height:100dvh;transition:background .2s,color .2s;font-size:14px;
  -webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;
  font-feature-settings:"ss01","kern","liga";letter-spacing:-0.01em;line-height:1.6}
h1,h2,h3,h4,h5{letter-spacing:-0.02em}
button,input,select,textarea,optgroup{font-family:'Vazirmatn','Segoe UI',Tahoma,sans-serif}

/* ═══════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════ */
.login-page{min-height:100vh;min-height:100dvh;display:flex;align-items:center;justify-content:center;background:var(--bg);padding:1rem}
.login-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-xl);padding:2.5rem 2rem;width:100%;max-width:400px;box-shadow:var(--shadow-md);text-align:center}
.login-logo{width:60px;height:60px;border-radius:var(--radius-md);background:var(--purple);color:#fff;display:flex;align-items:center;justify-content:center;font-size:28px;margin:0 auto 1.25rem}
.login-card h2{font-size:20px;font-weight:700;margin-bottom:4px}
.login-sub{font-size:13px;color:var(--text3);margin-bottom:1.5rem}
.login-hint{margin-top:1.25rem;font-size:12px;color:var(--text3);display:flex;flex-direction:column;gap:4px;text-align:right;background:var(--surface2);padding:.75rem 1rem;border-radius:var(--radius-sm)}
.login-hint b{color:var(--text2)}
.alert-error{background:var(--red-light);color:var(--red);border-radius:var(--radius-sm);padding:.6rem 1rem;font-size:13px;margin-bottom:1rem;text-align:right}

/* ═══════════════════════════════════════════
   FORM ELEMENTS
═══════════════════════════════════════════ */
.form-group{margin-bottom:1rem;text-align:right}
.form-group label{display:block;font-size:12px;font-weight:600;color:var(--text2);margin-bottom:5px}
.input-icon{position:relative}
.input-icon>.ti{position:absolute;right:10px;top:50%;transform:translateY(-50%);color:var(--text3);font-size:16px;pointer-events:none}
.input-icon input,.input-icon select{width:100%;padding:9px 36px 9px 10px;border:1px solid var(--border2);border-radius:var(--radius-sm);font-family:inherit;font-size:13px;background:var(--surface);color:var(--text);transition:border-color .15s,box-shadow .15s}
input,select,textarea{font-family:inherit;background:var(--surface);color:var(--text);border:1px solid var(--border2);border-radius:var(--radius-sm);padding:8px 10px;font-size:13px;width:100%;transition:border-color .15s,box-shadow .15s}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--purple);box-shadow:0 0 0 3px rgba(107,92,231,.12)}
textarea{resize:vertical;min-height:80px}
select{cursor:pointer}

.form-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.form-row-3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:10px}

/* ═══════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════ */
.btn-primary{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:8px 16px;background:var(--purple);color:#fff;border:none;border-radius:var(--radius-sm);font-family:inherit;font-size:13px;font-weight:600;cursor:pointer;transition:background .12s}
.btn-primary:hover{background:var(--purple-d)}
.btn-secondary{display:inline-flex;align-items:center;gap:6px;padding:7px 14px;background:var(--surface);color:var(--text2);border:1px solid var(--border2);border-radius:var(--radius-sm);font-family:inherit;font-size:13px;font-weight:500;cursor:pointer;transition:background .12s,color .12s}
.btn-secondary:hover{background:var(--surface2);color:var(--text)}
.btn-danger{display:inline-flex;align-items:center;gap:6px;padding:7px 14px;background:var(--red-light);color:var(--red);border:1px solid transparent;border-radius:var(--radius-sm);font-family:inherit;font-size:13px;font-weight:500;cursor:pointer;transition:filter .12s}
.btn-danger:hover{filter:brightness(.96)}
.btn-success{display:inline-flex;align-items:center;gap:6px;padding:7px 14px;background:var(--teal-light);color:var(--teal);border:1px solid transparent;border-radius:var(--radius-sm);font-family:inherit;font-size:13px;font-weight:500;cursor:pointer;transition:filter .12s}
.btn-success:hover{filter:brightness(.96)}
.w-full{width:100%}
.action-btn{display:inline-flex;align-items:center;gap:4px;padding:4px 9px;border:1px solid var(--border2);border-radius:6px;background:var(--surface);color:var(--text2);font-family:inherit;font-size:12px;cursor:pointer;transition:background .12s,color .12s,border-color .12s;white-space:nowrap}
/* دکمه فقط-آیکون برای ستون عملیات جدول‌ها — چند دکمه برچسب‌دار در هر ردیف
   جدول را خیلی شلوغ می‌کرد. متن در tooltip باقی می‌ماند. */
.action-btn.icon{padding:0;width:28px;height:28px;justify-content:center;font-size:15px;gap:0}
.action-btn.danger:hover{background:var(--red-light);color:var(--red);border-color:transparent}
.row-actions{display:flex;gap:var(--s1);align-items:center;justify-content:flex-end}
.action-btn:hover{background:var(--purple-light);color:var(--purple);border-color:var(--purple-mid)}
.action-btn.danger:hover{background:var(--red-light);color:var(--red);border-color:var(--red)}
.action-btn .ti{font-size:13px}
.icon-btn{width:36px;height:36px;border-radius:var(--radius-sm);border:1px solid var(--border2);background:var(--surface);display:flex;align-items:center;justify-content:center;cursor:pointer;color:var(--text2);font-size:18px;transition:all .15s;flex-shrink:0}
.icon-btn:hover{background:var(--surface2);color:var(--text)}

/* ═══════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════ */
#appPage{display:flex;min-height:100vh;min-height:100dvh}
.sidebar{width:var(--sidebar-w);min-height:100vh;min-height:100dvh;background:var(--surface);border-left:1px solid var(--border);display:flex;flex-direction:column;flex-shrink:0;position:fixed;right:0;top:0;bottom:0;z-index:100;transition:transform .25s}
.sidebar-logo{padding:0 var(--s4);height:var(--topbar-h);display:flex;align-items:center;gap:10px;border-bottom:1px solid var(--border);flex-shrink:0}
.logo-icon{width:30px;height:30px;border-radius:8px;background:var(--purple);display:flex;align-items:center;justify-content:center;color:#fff;font-size:16px;flex-shrink:0}
.logo-text{font-size:13.5px;font-weight:650;color:var(--text);letter-spacing:-.01em;line-height:1.25}
.logo-sub{font-size:10.5px;color:var(--text3);line-height:1.25}
.sidebar-nav{padding:var(--s3) var(--s2);flex:1;overflow-y:auto;overscroll-behavior:contain}
.nav-label{font-size:10.5px;font-weight:600;color:var(--text3);letter-spacing:.04em;padding:0 10px;margin:var(--s4) 0 var(--s1)}
.sidebar-nav>.nav-label:first-child{margin-top:0}
.nav-item{display:flex;align-items:center;gap:10px;padding:7px 10px;border-radius:var(--radius-sm);cursor:pointer;font-size:13px;font-family:inherit;color:var(--text2);transition:background .12s,color .12s;border:none;background:transparent;width:100%;text-align:right;position:relative;font-weight:500;margin-bottom:1px}
.nav-item:hover{background:var(--surface2);color:var(--text)}
.nav-item.active{background:var(--purple-light);color:var(--purple);font-weight:600}
.nav-item .ti{font-size:17px;flex-shrink:0;opacity:.85}
.nav-item.active .ti{opacity:1}
.nav-badge{margin-right:auto;font-size:10px;font-weight:700;background:var(--red-light);color:var(--red);border-radius:20px;padding:1px 7px}
.sidebar-footer{padding:var(--s2);border-top:1px solid var(--border);flex-shrink:0}
.user-card{display:flex;align-items:center;gap:9px;padding:7px 8px;border-radius:var(--radius-sm);cursor:pointer;transition:background .12s}
.user-card:hover{background:var(--surface2)}
.avatar-circle{width:30px;height:30px;border-radius:50%;background:var(--purple);color:#fff;display:flex;align-items:center;justify-content:center;font-size:11.5px;font-weight:700;flex-shrink:0}
.user-info .name{font-size:12.5px;font-weight:600;color:var(--text);line-height:1.3}
.user-info .role-badge{font-size:10.5px;color:var(--text3);line-height:1.3}
.notif-dot{position:absolute;top:6px;left:6px;width:6px;height:6px;background:var(--red);border-radius:50%;border:1.5px solid var(--surface)}

/* ═══════════════════════════════════════════
   MAIN LAYOUT
═══════════════════════════════════════════ */
.main{margin-right:var(--sidebar-w);flex:1;min-height:100vh;min-height:100dvh;display:flex;flex-direction:column;transition:margin .25s;min-width:0}
.topbar{background:var(--surface);border-bottom:1px solid var(--border);padding:0 var(--s5);height:var(--topbar-h);display:flex;align-items:center;justify-content:space-between;position:sticky;top:0;z-index:50}
.topbar-right{display:flex;align-items:center;gap:10px}
.topbar-title{font-size:15px;font-weight:650;color:var(--text);letter-spacing:-.015em}
.topbar-date{font-size:11px;color:var(--text3)}
.topbar-actions{display:flex;gap:var(--s1);align-items:center}
/* دکمه‌های آیکونی تاپ‌بار */
.topbar-actions>button{width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--radius-sm);border:none;background:transparent;color:var(--text2);cursor:pointer;font-size:18px;transition:background .12s,color .12s;position:relative}
.topbar-actions>button:hover{background:var(--surface2);color:var(--text)}
.content{padding:var(--s5);flex:1;max-width:1560px;width:100%;margin:0 auto}

/* ═══════════════════════════════════════════
   CARDS & METRICS
═══════════════════════════════════════════ */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:var(--shadow);transition:border-color .15s}
.card-header{display:flex;justify-content:space-between;align-items:center;gap:var(--s3);padding:var(--s3) var(--s4);border-bottom:1px solid var(--border);min-height:48px}
.card-title{font-size:13.5px;font-weight:650;color:var(--text);display:flex;align-items:center;gap:var(--s2);letter-spacing:-.01em}
.card-title .ti{font-size:16px;color:var(--text3)}
.card-body{padding:var(--s4)}

/* ── متریک‌کارت‌ها ──
   سبک Linear: بدون نوار رنگی و بدون بلوک آیکون بزرگ. سلسله‌مراتب از
   تایپوگرافی می‌آید: برچسب کوچک، عدد بزرگ، چیپ وضعیت. آیکون فقط یک
   نشانه‌ی کم‌رنگ در گوشه است، نه عنصر اصلی. */
.metrics-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:var(--s3);margin:0 var(--s5) var(--s3)}
.metric-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:var(--s4);box-shadow:var(--shadow);position:relative;transition:border-color .15s,box-shadow .15s}
.metric-card:hover{border-color:var(--border2)}
.metric-card::after{content:none}
.metric-icon{position:absolute;top:var(--s4);left:var(--s4);width:28px;height:28px;border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:16px;margin:0;flex-shrink:0}
.mc-purple .metric-icon{background:var(--purple-light);color:var(--purple)}
.mc-teal .metric-icon{background:var(--teal-light);color:var(--teal)}
.mc-amber .metric-icon,.mc-gold .metric-icon{background:var(--amber-light);color:var(--amber)}
.mc-red .metric-icon{background:var(--red-light);color:var(--red)}
.mc-blue .metric-icon{background:var(--blue-light);color:var(--blue)}
.metric-label{font-size:12px;color:var(--text2);margin-bottom:var(--s2);font-weight:500;letter-spacing:-.005em}
.metric-value{font-size:27px;font-weight:700;color:var(--text);line-height:1.1;margin-bottom:var(--s2);letter-spacing:-.03em;font-feature-settings:"tnum","ss01"}
.metric-trend{display:inline-flex;align-items:center;gap:4px;font-size:11px;font-weight:600;padding:2px 8px;border-radius:20px}
.trend-up{background:var(--teal-light);color:var(--teal)}
.trend-down{background:var(--red-light);color:var(--red)}
.trend-neu{background:var(--surface2);color:var(--text2)}

/* ═══════════════════════════════════════════
   TABLE
═══════════════════════════════════════════ */
.table-wrap{overflow-x:auto}
table{width:100%;border-collapse:collapse;min-width:600px}
thead{background:transparent}
th{padding:9px var(--s4);font-size:11.5px;font-weight:600;color:var(--text3);text-align:right;white-space:nowrap;border-bottom:1px solid var(--border);background:var(--surface2)}
th:first-child{border-top-right-radius:var(--radius-sm)}
th:last-child{border-top-left-radius:var(--radius-sm)}
td{padding:11px var(--s4);font-size:13px;color:var(--text);border-top:1px solid var(--border);vertical-align:middle}
tbody tr:first-child td{border-top:none}
tbody tr:hover td{background:var(--surface2)}
.td-mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;background:var(--surface2);padding:2px 7px;border-radius:5px;display:inline-block;color:var(--text2)}

/* ═══════════════════════════════════════════
   TOOLBAR
═══════════════════════════════════════════ */
.table-toolbar{padding:var(--s3) var(--s4);border-bottom:1px solid var(--border);display:flex;gap:var(--s2);flex-wrap:wrap;align-items:center}
.search-wrap{position:relative;flex:1 1 200px;min-width:180px}
.search-wrap .ti{position:absolute;left:9px;top:50%;transform:translateY(-50%);color:var(--text3);font-size:15px;pointer-events:none}
.search-wrap input{padding-left:32px;width:100%}
/* قانون سراسری input{width:100%} باعث می‌شد هر select داخل تولبار یک سطر
   کامل بگیرد و تولبار سه‌طبقه شود. اینجا خنثی می‌شود. */
.table-toolbar select,.table-toolbar input:not(.search-wrap input){width:auto;flex:0 0 auto;min-width:140px}
/* دکمه‌ها همیشه انتهای تولبار */
.table-toolbar>.btn-primary:last-child,.table-toolbar>button+button{flex:0 0 auto}
.table-toolbar>.btn-secondary:not(:last-child)~*{flex:0 0 auto}
.toolbar-spacer{margin-inline-start:auto}

/* ═══════════════════════════════════════════
   BADGES
═══════════════════════════════════════════ */
.badge{display:inline-flex;align-items:center;gap:5px;padding:3px 9px;border-radius:20px;font-size:11px;font-weight:600;white-space:nowrap}
.badge::before{content:'';width:6px;height:6px;border-radius:50%;flex-shrink:0}
.b-green{background:var(--teal-light);color:var(--teal)}.b-green::before{background:var(--teal)}
.b-amber{background:var(--amber-light);color:var(--amber)}.b-amber::before{background:var(--amber)}
.b-red{background:var(--red-light);color:var(--red)}.b-red::before{background:var(--red)}
.b-blue{background:var(--blue-light);color:var(--blue)}.b-blue::before{background:var(--blue)}
.b-gray{background:var(--surface2);color:var(--text3)}.b-gray::before{background:var(--text3)}
.b-purple{background:var(--purple-light);color:var(--purple)}.b-purple::before{background:var(--purple)}

/* ═══════════════════════════════════════════
   AVATAR
═══════════════════════════════════════════ */
.avatar-sm{width:30px;height:30px;border-radius:50%;background:var(--purple-light);color:var(--purple);display:inline-flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;flex-shrink:0}
.name-cell{display:flex;align-items:center;gap:9px}

/* ═══════════════════════════════════════════
   PROGRESS
═══════════════════════════════════════════ */
.progress-wrap{display:flex;align-items:center;gap:7px}
.progress-bar{width:75px;height:5px;background:var(--surface3);border-radius:3px;overflow:hidden;flex-shrink:0}
.progress-fill{height:100%;border-radius:3px;transition:width .3s}

/* ═══════════════════════════════════════════
   MODAL
═══════════════════════════════════════════ */
.modal-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:999;align-items:center;justify-content:center;backdrop-filter:blur(3px);padding:1rem}
.modal-overlay.open{display:flex}
.modal-box{background:var(--surface);border-radius:var(--radius-xl);border:1px solid var(--border);box-shadow:var(--shadow-md);padding:1.75rem;width:100%;max-width:520px;max-height:90vh;overflow-y:auto;animation:modalIn .2s ease}
@keyframes modalIn{from{opacity:0;transform:translateY(12px) scale(.97)}to{opacity:1;transform:translateY(0) scale(1)}}
.modal-header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:1.25rem}
.modal-title{font-size:16px;font-weight:700;color:var(--text)}
.modal-close{width:30px;height:30px;border-radius:var(--radius-sm);border:1px solid var(--border2);background:transparent;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--text3);font-size:18px;flex-shrink:0}
.modal-close:hover{background:var(--surface2);color:var(--text)}
.modal-row{display:flex;justify-content:space-between;align-items:center;padding:8px 0;border-bottom:1px solid var(--border);font-size:13px}
.modal-row:last-of-type{border-bottom:none}
.modal-key{color:var(--text3);display:flex;align-items:center;gap:6px;white-space:nowrap}
.modal-key .ti{font-size:15px}
.modal-val{font-weight:500;text-align:left;word-break:break-all}
.modal-actions{display:flex;gap:8px;margin-top:1.25rem;flex-wrap:wrap}
.toggle-switch{position:relative;display:inline-block;width:44px;height:24px;flex-shrink:0}
.toggle-switch input{opacity:0;width:0;height:0}
.toggle-slider{position:absolute;cursor:pointer;inset:0;background:var(--border2);border-radius:24px;transition:.2s}
.toggle-slider:before{content:'';position:absolute;width:18px;height:18px;right:3px;bottom:3px;background:#fff;border-radius:50%;transition:.2s}
.toggle-switch input:checked+.toggle-slider{background:var(--primary)}
.toggle-switch input:checked+.toggle-slider:before{transform:translateX(-20px)}
.divider{border:none;border-top:1px solid var(--border);margin:1rem 0}

/* ═══════════════════════════════════════════
   CHARTS
═══════════════════════════════════════════ */
.charts-row{display:grid;grid-template-columns:2fr 1fr;gap:1rem;margin-bottom:1.25rem}
.chart-wrap{position:relative;width:100%;height:220px}

/* ═══════════════════════════════════════════
   TIMELINE
═══════════════════════════════════════════ */
.timeline{list-style:none}
.tl-item{display:flex;gap:11px;padding:10px 0;position:relative}
.tl-item:not(:last-child)::after{content:'';position:absolute;right:18px;top:30px;bottom:-4px;width:1px;background:var(--border)}
.tl-icon{width:27px;height:27px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:13px;flex-shrink:0;position:relative;z-index:1}
.tl-green{background:var(--teal-light);color:var(--teal)}
.tl-amber{background:var(--amber-light);color:var(--amber)}
.tl-red{background:var(--red-light);color:var(--red)}
.tl-blue{background:var(--blue-light);color:var(--blue)}
.tl-purple{background:var(--purple-light);color:var(--purple)}
.tl-text .tl-title{font-size:13px;font-weight:500;margin-bottom:2px}
.tl-text .tl-sub{font-size:11px;color:var(--text3)}
.tl-text .tl-amt{font-size:13px;font-weight:700;color:var(--teal);margin-top:2px}

/* ═══════════════════════════════════════════
   PAYSLIP
═══════════════════════════════════════════ */
.payslip{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);overflow:hidden}
.payslip-header{background:var(--purple);color:#fff;padding:1.5rem 1.75rem}
.payslip-header h3{font-size:18px;font-weight:700;margin-bottom:4px}
.payslip-header p{font-size:13px;opacity:.8}
.payslip-body{padding:1.25rem 1.75rem}
.payslip-section{margin-bottom:1.25rem}
.payslip-section h4{font-size:12px;font-weight:700;color:var(--text3);text-transform:uppercase;letter-spacing:.05em;margin-bottom:.75rem;padding-bottom:.5rem;border-bottom:1px solid var(--border)}
.payslip-row{display:flex;justify-content:space-between;align-items:center;padding:5px 0;font-size:13px}
.payslip-row .lbl{color:var(--text2)}
.payslip-row .amt{font-weight:600;font-variant-numeric:tabular-nums}
.payslip-row .amt.earn{color:var(--teal)}
.payslip-row .amt.ded{color:var(--red)}
.payslip-total{background:var(--surface2);border-radius:var(--radius-md);padding:1rem 1.25rem;display:flex;justify-content:space-between;align-items:center;margin-top:1rem}
.payslip-total .lbl{font-size:14px;font-weight:600}
.payslip-total .amt{font-size:20px;font-weight:700;color:var(--purple)}

/* ═══════════════════════════════════════════
   DONUT LEGEND
═══════════════════════════════════════════ */
.donut-legend{display:flex;flex-direction:column;gap:9px;margin-top:1rem}
.legend-item{display:flex;align-items:center;justify-content:space-between;font-size:13px}
.legend-dot{width:9px;height:9px;border-radius:50%;margin-left:7px;flex-shrink:0}
.legend-label{display:flex;align-items:center;color:var(--text2)}
.legend-val{font-weight:700;color:var(--text)}

/* ═══════════════════════════════════════════
   EMPTY / LOADING
═══════════════════════════════════════════ */
.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:3rem 1rem;color:var(--text3);gap:.75rem}
.empty-state .ti{font-size:40px}
.empty-state p{font-size:14px}
.spin{animation:spin .8s linear infinite;display:inline-block}
@keyframes spin{to{transform:rotate(360deg)}}

/* ═══════════════════════════════════════════
   TOAST
═══════════════════════════════════════════ */
.toast{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);padding:.75rem 1rem;box-shadow:var(--shadow-md);display:flex;align-items:center;gap:9px;font-size:13px;min-width:220px;animation:toastIn .25s ease}
@keyframes toastIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
.toast.success{border-right:3px solid var(--teal)}
.toast.error{border-right:3px solid var(--red)}
.toast.info{border-right:3px solid var(--purple)}

/* ═══════════════════════════════════════════
   SALARY CALC WIDGET
═══════════════════════════════════════════ */
.salary-breakdown{display:grid;grid-template-columns:1fr 1fr;gap:1rem;margin-top:1rem}
.sb-box{background:var(--surface2);border-radius:var(--radius-md);padding:1rem}
.sb-box h4{font-size:12px;font-weight:700;margin-bottom:.75rem;display:flex;align-items:center;gap:6px}
.sb-row{display:flex;justify-content:space-between;padding:4px 0;font-size:12px;color:var(--text2)}
.sb-row b{color:var(--text);font-weight:600}

/* ═══════════════════════════════════════════
   TABS
═══════════════════════════════════════════ */
/* کنترل بخش‌بندی‌شده (segmented control) — سبک Linear */
.tabs{display:inline-flex;gap:2px;background:var(--surface2);padding:3px;border-radius:var(--radius-md);
  margin-bottom:var(--s4);flex-wrap:wrap;border:1px solid var(--border);max-width:100%}
.tab-btn{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border-radius:7px;border:none;
  background:transparent;cursor:pointer;font-size:12.5px;font-weight:500;color:var(--text2);
  font-family:inherit;transition:background .12s,color .12s;white-space:nowrap}
.tab-btn .ti{font-size:15px;opacity:.8}
.tab-btn:hover:not(.active){color:var(--text)}
.tab-btn.active{background:var(--surface);color:var(--text);font-weight:600;box-shadow:var(--shadow)}
.tab-btn.active .ti{opacity:1;color:var(--purple)}

/* ═══════════════════════════════════════════
   ANNOUNCEMENTS
═══════════════════════════════════════════ */
.announcement-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:1rem 1.25rem;margin-bottom:.75rem;position:relative;overflow:hidden}
.announcement-card::before{content:'';position:absolute;top:0;right:0;width:4px;height:100%}
.announcement-card.normal::before{background:var(--blue)}
.announcement-card.important::before{background:var(--amber)}
.announcement-card.urgent::before{background:var(--red)}
.announcement-card.unread{box-shadow:0 0 0 2px var(--gold-light)}
.announcement-header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:6px}
.announcement-title{font-size:14px;font-weight:700;color:var(--text);display:flex;align-items:center;gap:7px}
.announcement-body{font-size:13px;color:var(--text2);line-height:1.7;white-space:pre-wrap}
.announcement-meta{font-size:11px;color:var(--text3);margin-top:8px;display:flex;gap:10px;align-items:center}
.unread-dot{width:7px;height:7px;border-radius:50%;background:var(--red);flex-shrink:0}

/* ═══════════════════════════════════════════
   BIRTHDAY BANNER
═══════════════════════════════════════════ */
.birthday-banner{background:linear-gradient(135deg,var(--gold-light),var(--surface2));border:1px solid var(--gold);border-radius:var(--radius-lg);padding:1rem 1.25rem;margin-bottom:1.25rem;display:flex;align-items:center;gap:12px}
.birthday-banner .bicon{font-size:28px;flex-shrink:0}
.birthday-banner .btext{font-size:13px;color:var(--text);font-weight:500}
.birthday-banner .btext b{color:var(--gold)}

/* ═══════════════════════════════════════════
   ACTIVE REQUESTS BOX (Dashboard)
═══════════════════════════════════════════ */
.requests-box-item{display:flex;align-items:center;gap:10px;padding:9px 0;border-bottom:1px solid var(--border)}
.requests-box-item:last-child{border-bottom:none}
.req-icon{width:30px;height:30px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:14px;flex-shrink:0}
.req-icon.leave{background:var(--blue-light);color:var(--blue)}
.req-icon.advance{background:var(--amber-light);color:var(--amber)}
.req-icon.remote{background:var(--teal-light);color:var(--teal)}
.req-text{flex:1;min-width:0}
.req-text .rt-title{font-size:12px;font-weight:500;color:var(--text)}
.req-text .rt-sub{font-size:11px;color:var(--text3)}

/* ═══════════════════════════════════════════
   LEAVE BALANCE WIDGET
═══════════════════════════════════════════ */
.leave-balance-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:1.25rem}
.lb-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:1rem}
.lb-stat{text-align:center;background:var(--surface2);border-radius:var(--radius-md);padding:.75rem .5rem}
.lb-stat .lbl{font-size:11px;color:var(--text3);margin-bottom:4px}
.lb-stat .val{font-size:18px;font-weight:700;color:var(--text)}
.lb-bar-wrap{margin-top:.5rem}
.lb-bar{width:100%;height:10px;background:var(--surface3);border-radius:5px;overflow:hidden;position:relative}
.lb-bar-fill{height:100%;border-radius:5px;transition:width .3s}
.lb-bar-label{display:flex;justify-content:space-between;font-size:11px;color:var(--text3);margin-top:5px}

/* ═══════════════════════════════════════════
   RECEIVABLES LIST (Dashboard)
═══════════════════════════════════════════ */
.receivable-row{display:flex;justify-content:space-between;align-items:center;padding:8px 0;border-bottom:1px solid var(--border);font-size:12px}
.receivable-row:last-child{border-bottom:none}
.receivable-row .rc-name{font-weight:500;color:var(--text)}
.receivable-row .rc-due{color:var(--text3);font-size:11px}
.receivable-row .rc-amt{font-weight:700}

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */
@media(max-width:1024px){
  .metrics-grid{grid-template-columns:repeat(2,1fr)}
  .charts-row{grid-template-columns:1fr}
  .salary-breakdown{grid-template-columns:1fr}
}
@media(max-width:768px){
  .sidebar{transform:translateX(100%)}
  .sidebar.open{transform:translateX(0)}
  .main{margin-right:0}
  .metrics-grid{grid-template-columns:1fr 1fr}
  .form-row,.form-row-3{grid-template-columns:1fr}
  .modal-box{padding:1.25rem}
}

/* ═══════════════════════════════════════════
   MINI PRINT BUTTONS (stamp choice)
═══════════════════════════════════════════ */
.mini-print-btn{flex:1;display:inline-flex;align-items:center;justify-content:center;gap:4px;padding:5px 8px;border:1px solid var(--border2);border-radius:var(--radius-sm);background:var(--surface);color:var(--text2);font-family:inherit;font-size:11px;cursor:pointer;transition:all .15s}
.mini-print-btn:hover{background:var(--purple);color:#fff;border-color:var(--purple)}

/* ═══════════════════════════════════════════
   LOGIN GUIDE LINK
═══════════════════════════════════════════ */
.login-guide-link{display:flex;align-items:center;justify-content:center;gap:7px;margin-top:14px;padding:11px;background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius-sm);color:var(--purple);text-decoration:none;font-size:13px;font-weight:500;transition:all .15s}
.login-guide-link:hover{background:var(--purple);color:#fff;border-color:var(--purple)}

/* ═══════════════════════════════════════════
   PROJECT MANAGEMENT MODULE
═══════════════════════════════════════════ */
/* Jalali Date Picker */
.jdp-wrap{position:relative}
.jdp-icon{position:absolute;left:10px;top:50%;transform:translateY(-50%);color:var(--text3);cursor:pointer;pointer-events:auto}
.jdp-pop{background:var(--surface);border:1px solid var(--border2);border-radius:var(--radius-md);box-shadow:var(--shadow-md);padding:12px;width:260px}
.jdp-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}
.jdp-title{font-size:14px;font-weight:600;color:var(--text)}
.jdp-nav{background:var(--surface2);border:none;border-radius:6px;width:28px;height:28px;cursor:pointer;color:var(--text2);display:flex;align-items:center;justify-content:center}
.jdp-nav:hover{background:var(--purple);color:#fff}
.jdp-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:2px}
.jdp-weekdays{margin-bottom:4px}
.jdp-wd{text-align:center;font-size:11px;color:var(--text3);padding:4px 0;font-weight:600}
.jdp-cell{text-align:center;padding:6px 0;font-size:12px;border-radius:6px;cursor:pointer;color:var(--text);transition:all .1s}
.jdp-cell:hover:not(.jdp-empty){background:var(--purple-light)}
.jdp-empty{cursor:default}
.jdp-sel{background:var(--purple);color:#fff;font-weight:700}
.jdp-today{border:1px solid var(--purple)}
.jdp-foot{display:flex;gap:6px;margin-top:10px;border-top:1px solid var(--border);padding-top:10px}
.jdp-today-btn,.jdp-close-btn{flex:1;padding:6px;border-radius:6px;border:none;cursor:pointer;font-family:inherit;font-size:12px}
.jdp-today-btn{background:var(--purple);color:#fff}
.jdp-close-btn{background:var(--surface2);color:var(--text2)}
.jdp-title-btn{border:none;background:var(--surface2);cursor:pointer;padding:4px 10px;border-radius:6px;font-family:inherit;transition:all .1s}
.jdp-title-btn:hover{background:var(--purple);color:#fff}
.jdp-months{grid-template-columns:repeat(3,1fr);gap:6px}
.jdp-mcell{text-align:center;padding:11px 0;font-size:12px;border-radius:8px;cursor:pointer;color:var(--text);background:var(--surface2);transition:all .1s}
.jdp-mcell:hover{background:var(--purple-light)}
.jdp-mcell.jdp-sel{background:var(--purple);color:#fff;font-weight:700}

/* Project Grid */
.pm-project-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px}
.pm-project-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:16px;cursor:pointer;transition:all .15s;box-shadow:var(--shadow)}
.pm-project-card:hover{transform:translateY(-2px);box-shadow:var(--shadow-md)}
.pm-pc-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.pm-pc-code{font-family:monospace;font-size:11px;color:var(--text3)}
.pm-pc-badge{font-size:10px;padding:2px 8px;border-radius:10px;font-weight:600}
.pm-pc-title{font-size:15px;font-weight:700;color:var(--text);margin-bottom:6px}
.pm-pc-customer{font-size:12px;color:var(--text2);margin-bottom:10px;display:flex;align-items:center;gap:5px}
.pm-pc-leads{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px}
.pm-lead{font-size:11px;color:var(--text3);display:flex;align-items:center;gap:4px;background:var(--surface2);padding:3px 8px;border-radius:10px}
.pm-pc-progress{margin-top:auto}

/* Kanban */
.pm-board-header{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:16px 20px;display:flex;justify-content:space-between;align-items:flex-start;gap:16px}
.kanban-board{display:flex;gap:14px;overflow-x:auto;padding-bottom:16px;margin-top:1rem;align-items:flex-start}
.kanban-col{background:var(--surface2);border-radius:var(--radius-lg);min-width:260px;max-width:260px;flex-shrink:0}
.kanban-col.drag-over{background:var(--purple-light);outline:2px dashed var(--purple)}
.kanban-col-head{display:flex;justify-content:space-between;align-items:center;padding:12px 14px;font-size:13px;font-weight:600;color:var(--text)}
.kanban-count{background:var(--surface3);color:var(--text2);font-size:11px;padding:2px 8px;border-radius:10px}
.kanban-col-body{padding:0 10px 10px;min-height:60px;display:flex;flex-direction:column;gap:8px}
.kanban-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);padding:11px;cursor:pointer;transition:all .12s}
.kanban-card:hover{box-shadow:var(--shadow-md);border-color:var(--border2)}
.kc-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px}
.kc-code{font-family:monospace;font-size:10px;color:var(--text3)}
.kc-title{font-size:13px;color:var(--text);margin-bottom:8px;line-height:1.5}
.kc-meta{display:flex;flex-direction:column;gap:4px;margin-bottom:6px}
.kc-assignee,.kc-due{font-size:11px;color:var(--text2);display:flex;align-items:center;gap:4px}
.kc-overdue{color:var(--red)!important}
.kc-checklist{font-size:11px;color:var(--text3);display:flex;align-items:center;gap:4px;margin-bottom:5px}
.kc-footer{display:flex;gap:10px;align-items:center;font-size:11px;color:var(--text3)}
.kc-footer span{display:flex;align-items:center;gap:3px}
.kc-prog{margin-right:auto;color:var(--teal);font-weight:600}

/* Task Detail */
.modal-box.modal-lg{max-width:760px;width:90vw}
.tk-detail-grid{display:grid;grid-template-columns:1fr 240px;gap:20px}
@media(max-width:640px){.tk-detail-grid{grid-template-columns:1fr}}
.tk-section{margin-bottom:18px}
.tk-label{font-size:12px;font-weight:600;color:var(--text3);display:block;margin-bottom:6px}
.tk-desc{font-size:13px;color:var(--text2);line-height:1.8;background:var(--surface2);padding:10px;border-radius:8px}
.tk-check-item{display:flex;align-items:center;gap:8px;padding:5px 0}
.tk-comment{background:var(--surface2);border-radius:8px;padding:8px 12px;margin-bottom:8px}
.tk-comment-head{display:flex;justify-content:space-between;font-size:11px;color:var(--text3);margin-bottom:4px}
.tk-comment-body{font-size:13px;color:var(--text)}
.tk-side{background:var(--surface2);border-radius:var(--radius-md);padding:14px}
.tk-field{margin-bottom:12px}

/* Roles */
.pm-roles-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:14px}
.pm-role-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:16px}
.pm-role-head{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:10px}
.pm-role-label{font-size:14px;font-weight:700;color:var(--text)}
.pm-role-name{font-family:monospace;font-size:11px;color:var(--text3)}
.pm-role-perms{font-size:12px;color:var(--text2);margin-bottom:8px}
.pm-perm-chips{display:flex;gap:5px;flex-wrap:wrap}
.pm-perm-chip{font-size:10px;background:var(--surface2);color:var(--text2);padding:2px 7px;border-radius:8px}
.pm-perm-list{display:grid;grid-template-columns:1fr 1fr;gap:6px;max-height:300px;overflow-y:auto}
.pm-perm-toggle{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--text);cursor:pointer;padding:6px;border-radius:6px}
.pm-perm-toggle:hover{background:var(--surface2)}
.pm-perm-toggle input{width:auto}
.pm-member-select{display:flex;flex-wrap:wrap;gap:6px;max-height:140px;overflow-y:auto;padding:8px;background:var(--surface2);border-radius:8px}
.pm-member-chip{display:flex;align-items:center;gap:5px;font-size:12px;background:var(--surface);padding:5px 10px;border-radius:14px;cursor:pointer;border:1px solid var(--border)}
.pm-member-chip input{width:auto}

/* Status Editor */
.status-row{display:flex;align-items:center;gap:10px;padding:8px;background:var(--surface2);border-radius:8px;margin-bottom:8px}
.status-done-toggle{display:flex;align-items:center;gap:5px;font-size:12px;color:var(--text2);white-space:nowrap}
.status-done-toggle input{width:auto}

/* ═══════════════════════════════════════════
   CHAT
═══════════════════════════════════════════ */
.chat-layout{display:grid;grid-template-columns:300px 1fr;gap:0;height:calc(100vh - var(--topbar-h) - 3rem);height:calc(100dvh - var(--topbar-h) - 3rem);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);overflow:hidden}
.chat-sidebar{border-left:1px solid var(--border);display:flex;flex-direction:column;background:var(--surface2);min-height:0}
.chat-sidebar-head{padding:10px 12px;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:6px}
.chat-channel-btn{flex:1;display:flex;align-items:center;gap:8px;padding:9px 12px;border:none;background:var(--surface);border-radius:var(--radius-sm);cursor:pointer;font-family:inherit;font-size:13px;font-weight:600;color:var(--text2);transition:all .15s}
.chat-channel-btn.active{background:var(--purple);color:#fff}
.chat-sidebar-icon-btn{padding:7px 9px;border:none;background:var(--surface);border-radius:var(--radius-sm);cursor:pointer;color:var(--text2);transition:.15s;flex-shrink:0}
.chat-sidebar-icon-btn:hover{background:var(--purple);color:#fff}
.chat-section-label{padding:8px 10px 4px;font-size:10px;font-weight:700;color:var(--text3);text-transform:uppercase;letter-spacing:.5px}
.chat-avatar-group{background:var(--teal,#0d9488)}
.chat-contacts{flex:1;overflow-y:auto;padding:8px;min-height:0}
.chat-contact{display:flex;align-items:center;gap:10px;padding:10px;border-radius:var(--radius-sm);cursor:pointer;transition:background .15s;position:relative}
.chat-contact:hover{background:var(--surface3)}
.chat-contact.active{background:var(--purple-light)}
.chat-avatar-wrap{position:relative;flex-shrink:0}
.chat-avatar{width:38px;height:38px;border-radius:50%;background:var(--purple);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700}
.online-dot{position:absolute;bottom:1px;right:1px;width:10px;height:10px;background:#22c55e;border-radius:50%;border:2px solid var(--surface2)}
.chat-contact-info{flex:1;min-width:0}
.chat-contact-name{font-size:13px;font-weight:600;color:var(--text)}
.chat-contact-last{font-size:11px;color:var(--text3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-unread-badge{background:var(--red);color:#fff;font-size:10px;min-width:18px;height:18px;border-radius:9px;display:flex;align-items:center;justify-content:center;padding:0 5px}
.chat-main{display:flex;flex-direction:column;min-width:0;min-height:0}
.chat-header{padding:12px 16px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between}
.chat-header-info{display:flex;align-items:center;gap:10px;font-weight:600;font-size:14px}
.chat-header-name{font-weight:700;font-size:14px}
.chat-status{font-size:11px;font-weight:400}
.chat-status.online{color:#22c55e}
.chat-status.offline{color:var(--text3)}
.chat-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;color:var(--text3)}
.chat-messages{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:4px;min-height:0}
.chat-msg{max-width:72%;display:flex;flex-direction:column;position:relative}
.chat-msg.mine{align-self:flex-start;align-items:flex-start}
.chat-msg.theirs{align-self:flex-end;align-items:flex-end}
.chat-msg-sender{font-size:11px;color:var(--purple);font-weight:600;margin-bottom:2px}
.chat-bubble{padding:9px 14px;border-radius:16px;font-size:13px;line-height:1.7;word-break:break-word;position:relative}
.chat-msg.mine .chat-bubble{background:var(--purple);color:#fff;border-bottom-right-radius:4px}
.chat-msg.theirs .chat-bubble{background:var(--surface3);color:var(--text);border-bottom-left-radius:4px}
.chat-msg.deleted .chat-bubble{opacity:.55;font-style:italic}
.chat-msg.highlight .chat-bubble{outline:2px solid var(--yellow);outline-offset:2px}
.chat-bubble-text{white-space:pre-wrap}
.chat-time{font-size:9px;color:var(--text3);margin-top:3px;display:flex;align-items:center;gap:4px;opacity:.8}
.chat-msg.mine .chat-time{color:rgba(255,255,255,.65)}
.chat-edited-tag{font-size:10px;opacity:.7}
.chat-tick{font-size:12px}
/* avatar next to messages in group/public chat */
.chat-msg.with-avatar{flex-direction:row;gap:8px;max-width:78%}
.chat-msg.with-avatar.theirs{flex-direction:row-reverse}
.chat-avatar-wrap-msg{flex-shrink:0;cursor:pointer;align-self:flex-end;margin-bottom:2px}
.chat-msg-content{display:flex;flex-direction:column;flex:1;min-width:0}
.chat-avatar-img{border-radius:50%;object-fit:cover;display:block;border:1px solid var(--border)}
.chat-avatar-fallback{border-radius:50%;background:var(--purple);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;flex-shrink:0}
/* shared record card inside a chat bubble */
.chat-share-card{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:10px;background:rgba(255,255,255,.12);cursor:pointer;transition:background .15s;min-width:200px}
.chat-msg.theirs .chat-share-card{background:var(--surface);border:1px solid var(--border)}
.chat-share-card:hover{background:rgba(255,255,255,.22)}
.chat-msg.theirs .chat-share-card:hover{background:var(--surface2)}
.chat-share-icon{width:34px;height:34px;border-radius:9px;background:var(--purple);color:#fff;display:flex;align-items:center;justify-content:center;font-size:16px;flex-shrink:0}
.chat-share-body{flex:1;min-width:0}
.chat-share-title{font-weight:700;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-share-subtitle{font-size:11px;opacity:.75;margin-top:1px}
.chat-share-line{font-size:11px;opacity:.65;margin-top:1px}
.chat-share-arrow{opacity:.6;font-size:14px;flex-shrink:0}

/* ── منشن # در چت ── */
/* dropdown روی پیام‌ها overlay می‌شود (absolute) تا نوار تایپ را از کادر چت بیرون نراند */
.chat-main{position:relative}
.chat-mention-drop{position:absolute;bottom:56px;left:8px;right:8px;max-height:260px;overflow-y:auto;background:var(--surface);border:1px solid var(--border2);border-radius:var(--radius-md);box-shadow:var(--shadow-md);z-index:40}
.chat-mention-item{display:flex;align-items:center;gap:10px;padding:8px 12px;cursor:pointer;transition:background .12s}
.chat-mention-item:hover{background:var(--purple-light)}
.chat-mention-item .ti{font-size:17px;color:var(--purple);flex-shrink:0}
.cmi-body{min-width:0;flex:1}
.cmi-title{font-size:13px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cmi-sub{font-size:11px;color:var(--text3)}
.chat-mention-bar{display:flex;align-items:center;gap:8px;padding:6px 12px;margin:0 10px 4px;background:var(--purple-light);border:1px solid var(--purple-mid);border-radius:var(--radius-md);font-size:12px}
.chat-mention-bar .ti{color:var(--purple);font-size:15px}
.cmb-title{flex:1;font-weight:600;color:var(--purple);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-mention-bar button{background:none;border:none;cursor:pointer;color:var(--text2);padding:2px;display:flex}
.chat-mention-bar button:hover{color:var(--red)}
/* reply preview inside bubble */
.chat-reply-preview{background:rgba(0,0,0,.08);border-radius:8px;padding:5px 9px;margin-bottom:6px;border-right:3px solid rgba(255,255,255,.4);max-width:100%}
.chat-msg.theirs .chat-reply-preview{border-right-color:var(--purple)}
.reply-sender{display:block;font-size:10px;font-weight:700;opacity:.8}
.reply-body{display:block;font-size:11px;opacity:.75;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;max-width:220px}
/* action buttons on hover */
.chat-msg-actions{position:absolute;top:-28px;right:0;display:none;gap:4px;background:var(--surface);border:1px solid var(--border);border-radius:8px;padding:3px}
.chat-msg:hover .chat-msg-actions{display:flex}
.chat-msg-actions button{border:none;background:none;cursor:pointer;padding:2px 5px;border-radius:4px;color:var(--text2);font-size:12px}
.chat-msg-actions button:hover{background:var(--surface3)}
.chat-reply-btn{position:absolute;top:-28px;left:36px;display:none;border:none;background:var(--surface);border:1px solid var(--border);border-radius:8px;padding:3px 7px;cursor:pointer;color:var(--text2);font-size:12px}
.chat-msg:hover .chat-reply-btn{display:block}
.chat-emoji-btn{position:absolute;top:-28px;left:0;display:none;border:none;background:var(--surface);border:1px solid var(--border);border-radius:8px;padding:3px 7px;cursor:pointer;color:var(--text2);font-size:12px}
.chat-msg:hover .chat-emoji-btn{display:block}
/* reactions */
.chat-reactions{display:flex;flex-wrap:wrap;gap:3px;margin-top:4px}
.react-btn{background:var(--surface2);border:1px solid var(--border);border-radius:12px;padding:2px 8px;cursor:pointer;font-size:13px;transition:.15s}
.react-btn:hover,.react-btn.mine{background:var(--purple-light);border-color:var(--purple)}
/* emoji picker */
.emoji-picker-popup{position:absolute;z-index:200;background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:8px;display:flex;flex-wrap:wrap;gap:4px;box-shadow:0 4px 20px rgba(0,0,0,.15);bottom:calc(100% + 4px);right:0}
.emoji-picker-popup button{background:none;border:none;cursor:pointer;font-size:20px;padding:3px;border-radius:6px}
.emoji-picker-popup button:hover{background:var(--surface3)}
/* typing bar */
.chat-older-loader{text-align:center;padding:8px;color:var(--text3);font-size:14px}
.group-member-list{display:flex;flex-direction:column;gap:6px;max-height:260px;overflow-y:auto;border:1px solid var(--border);border-radius:var(--radius-sm);padding:8px}
.group-member-item{display:flex;align-items:center;gap:8px;padding:6px 4px;border-radius:6px;cursor:pointer}
.group-member-item:hover{background:var(--surface2)}
.group-member-item input[type=checkbox]{accent-color:var(--purple);width:15px;height:15px;flex-shrink:0}
.typing-bar{padding:4px 16px;font-size:11px;color:var(--text3);display:flex;align-items:center;gap:6px;min-height:24px}
.typing-dots{display:inline-flex;gap:3px;align-items:center}
.typing-dots span{width:5px;height:5px;background:var(--text3);border-radius:50%;animation:td .9s infinite}
.typing-dots span:nth-child(2){animation-delay:.2s}
.typing-dots span:nth-child(3){animation-delay:.4s}
@keyframes td{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-5px)}}
/* reply bar above input */
.chat-reply-bar{display:flex;align-items:center;gap:8px;padding:6px 14px;background:var(--surface2);border-top:1px solid var(--border)}
.chat-reply-bar button{background:none;border:none;cursor:pointer;color:var(--text3);padding:2px}
/* input area */
.chat-input-bar{display:flex;align-items:center;gap:8px;padding:12px 14px;border-top:1px solid var(--border)}
.chat-input-bar input{flex:1}
.chat-attach-btn{cursor:pointer;color:var(--text2);font-size:18px;padding:6px;border-radius:8px;transition:.15s}
.chat-attach-btn:hover{background:var(--surface3)}
/* attachments */
.chat-img-wrap{position:relative;display:inline-block;margin-top:4px}
.chat-img{max-width:240px;max-height:200px;border-radius:10px;display:block;cursor:pointer}
.chat-img-download{position:absolute;top:6px;left:6px;width:26px;height:26px;border-radius:50%;background:rgba(0,0,0,.55);color:#fff;display:flex;align-items:center;justify-content:center;font-size:13px}
.chat-img-download:hover{background:rgba(0,0,0,.75)}
.chat-file-attach{display:flex;align-items:center;gap:6px;margin-top:6px;padding:6px 10px;background:rgba(0,0,0,.1);border-radius:8px;color:inherit;text-decoration:none;font-size:12px}
/* search results */
.search-result-item{padding:8px;border-radius:6px;cursor:pointer;border-bottom:1px solid var(--border)}
.search-result-item:hover{background:var(--surface3)}
.sr-sender{font-size:11px;font-weight:600;color:var(--purple)}
.sr-body{font-size:12px;color:var(--text);margin:2px 0}
.sr-time{font-size:10px;color:var(--text3)}
@media(max-width:680px){.chat-layout{grid-template-columns:1fr}.chat-sidebar{display:none}}

/* ═══════════════════════════════════════════
   FILE CENTER
═══════════════════════════════════════════ */
.file-dropzone{border:2px dashed var(--border2);border-radius:var(--radius-lg);padding:36px;text-align:center;cursor:pointer;transition:all .15s}
.file-dropzone:hover,.file-dropzone.drag{border-color:var(--purple);background:var(--purple-light)}

/* ═══════════════════════════════════════════
   ✨ REFINEMENT — سبک Linear/Notion
   اصل: عمق از «مرز» می‌آید نه از سایه و گرادیان.
   حرکت فقط روی رنگ/شفافیت است، نه جابه‌جایی عناصر — چون بالا‌پریدن
   کارت‌ها هنگام hover در صفحه‌های پرداده خسته‌کننده و شلوغ می‌شود.
═══════════════════════════════════════════ */

/* اسکرول‌بار سفارشی */
*::-webkit-scrollbar{width:10px;height:10px}
*::-webkit-scrollbar-track{background:transparent}
*::-webkit-scrollbar-thumb{background:var(--surface3);border-radius:6px;border:3px solid transparent;background-clip:content-box}
*::-webkit-scrollbar-thumb:hover{background:var(--text3);background-clip:content-box}
*{scrollbar-width:thin;scrollbar-color:var(--surface3) transparent}

/* انیمیشن ورود محتوا — ملایم و بدون تاخیر پلکانی */
@keyframes fadeUp{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
#mainContent>*{animation:fadeIn .2s ease}

/* دکمه‌ها */
.btn-primary:active,.btn-secondary:active,.btn-danger:active,.btn-success:active{transform:translateY(.5px)}
.action-btn:hover{background:var(--surface2);color:var(--text);border-color:var(--border2)}
.btn-primary:focus-visible,.btn-secondary:focus-visible,.action-btn:focus-visible,
.nav-item:focus-visible,.tab-btn:focus-visible{outline:none;box-shadow:var(--ring)}

/* فیلد فوکوس */
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--purple)!important;box-shadow:var(--ring)}
input::placeholder,textarea::placeholder{color:var(--text3)}

/* مودال */
@keyframes modalPop{from{opacity:0;transform:scale(.98) translateY(6px)}to{opacity:1;transform:scale(1) translateY(0)}}
.modal-overlay.open .modal-box{animation:modalPop .18s cubic-bezier(.2,.8,.3,1)}

/* جدول */
table tbody tr{transition:background .1s}

/* empty state */
.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--s3);padding:var(--s6) var(--s4);color:var(--text3);text-align:center}
.empty-state i{font-size:28px;opacity:.4}
.empty-state p{font-size:13px}

/* divider */
.divider{border:none;border-top:1px solid var(--border);margin:var(--s4) 0}

/* لودینگ */
.spin{animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* تکمیل استایل‌های جزئی */
.jdp-trigger{cursor:pointer;background:var(--surface)}
.tk-main{min-width:0}
.tk-comments{max-height:220px;overflow-y:auto;padding-left:4px}

/* کارت‌های پروژه/کانبان: بدون پرش، فقط تغییر مرز */
.kanban-card{transition:border-color .12s,background .12s}
.kanban-card:hover{border-color:var(--border2)}
.pm-project-card{transition:border-color .12s,box-shadow .12s}
.pm-project-card:hover{border-color:var(--border2);box-shadow:var(--shadow-md)}

/* آواتار چت */
.chat-avatar{background:var(--purple)}

/* احترام به تنظیم کاهش حرکت سیستم کاربر */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;
    transition-duration:.01ms!important;scroll-behavior:auto!important}
}

/* ═══════════════════════════════════════════
   ✨ LOGIN PAGE — ارتقای ظاهر
═══════════════════════════════════════════ */
.login-page{background:radial-gradient(ellipse at top,var(--purple-light),var(--bg) 60%);position:relative;overflow:hidden}
.login-page::before{content:'';position:absolute;width:500px;height:500px;background:radial-gradient(circle,var(--purple-light),transparent 70%);top:-150px;right:-100px;opacity:.6;pointer-events:none}
.login-page::after{content:'';position:absolute;width:400px;height:400px;background:radial-gradient(circle,var(--gold-light),transparent 70%);bottom:-120px;left:-80px;opacity:.5;pointer-events:none}
.login-card{position:relative;z-index:1;animation:fadeUp .5s ease;backdrop-filter:blur(10px)}
.login-logo{background:linear-gradient(135deg,var(--purple),var(--purple-d));box-shadow:0 8px 24px rgba(22,33,62,.3);animation:fadeUp .6s ease}
body.dark .login-logo{color:#1A1206}
.login-card h2{letter-spacing:-.02em;background:linear-gradient(135deg,var(--text),var(--text2));-webkit-background-clip:text;background-clip:text}
.login-guide-link{transition:all .2s}
.login-guide-link:hover{transform:translateY(-1px);box-shadow:var(--shadow)}

/* ═══════════════════════════════════════════
   PROFILE & AVATAR
═══════════════════════════════════════════ */
.avatar-img{object-fit:cover;padding:0!important}
.user-card{display:flex;align-items:center;gap:6px}
.user-logout{background:transparent;border:none;color:var(--text3);cursor:pointer;padding:6px;border-radius:var(--radius-sm);transition:all .15s;flex-shrink:0}
.user-logout:hover{background:var(--red-light);color:var(--red)}
.profile-avatar-section{display:flex;align-items:center;gap:16px;margin-bottom:1.25rem;padding-bottom:1.25rem;border-bottom:1px solid var(--border)}
.profile-avatar-img{width:80px;height:80px;border-radius:50%;object-fit:cover;border:3px solid var(--purple-light)}
.profile-avatar-placeholder{width:80px;height:80px;border-radius:50%;background:var(--surface2);display:flex;align-items:center;justify-content:center;font-size:36px;color:var(--text3);border:3px solid var(--border)}
.profile-readonly{background:var(--surface2);border-radius:var(--radius-md);padding:12px 16px;margin-bottom:1rem}
.pr-row{display:flex;justify-content:space-between;padding:5px 0;font-size:13px;border-bottom:1px solid var(--border)}
.pr-row:last-child{border-bottom:none}
.pr-row span{color:var(--text3)}
.pr-row b{color:var(--text)}

/* ═══════════════════════════════════════════
   WELLBEING MODULE
═══════════════════════════════════════════ */
.wb-shell{display:flex;flex-direction:column;gap:1.25rem}
/* همان segmented control بخش .tabs — برای یکدستی با بقیه ماژول‌ها */
.wb-tabs{display:inline-flex;flex-wrap:wrap;gap:2px;background:var(--surface2);padding:3px;
  border-radius:var(--radius-md);border:1px solid var(--border);max-width:100%}
.wb-tab{background:transparent;border:none;padding:6px 12px;border-radius:7px;cursor:pointer;
  font-size:12.5px;font-weight:500;color:var(--text2);display:inline-flex;align-items:center;gap:6px;
  font-family:inherit;transition:background .12s,color .12s;white-space:nowrap}
.wb-tab .ti{font-size:15px;opacity:.8}
.wb-tab:hover:not(.active){color:var(--text)}
.wb-tab.active{background:var(--surface);color:var(--text);font-weight:600;box-shadow:var(--shadow)}
.wb-tab.active .ti{opacity:1;color:var(--purple)}
.wb-content{display:flex;flex-direction:column;gap:1.25rem}
.wb-panel{background:var(--surface2);border-radius:var(--radius-md);padding:1rem 1.25rem;border:1px solid var(--border)}
.wb-panel-head{font-weight:600;font-size:14px;color:var(--text);display:flex;align-items:center;gap:.5rem;margin-bottom:.85rem}
.wb-panel-head button{margin-right:auto}
.wb-empty{color:var(--text3);font-size:13px;text-align:center;padding:1rem}
.wb-empty-panel{background:var(--surface2);border-radius:var(--radius-md);padding:2rem;text-align:center;color:var(--text3);border:1px solid var(--border)}

/* stat cards */
.wb-main-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:.75rem}
.wb-stat-card{background:var(--surface2);border-radius:var(--radius-md);padding:1rem;text-align:center;border:1px solid var(--border);position:relative;overflow:hidden}
.wb-stat-icon{font-size:24px;margin-bottom:.4rem}
.wb-stat-val{font-size:24px;font-weight:700;color:var(--text)}
.wb-stat-lbl{font-size:12px;color:var(--text3);margin-top:.2rem}
.wb-stat-gold .wb-stat-icon{color:#f59e0b}
.wb-stat-blue .wb-stat-icon{color:var(--blue)}
.wb-stat-green .wb-stat-icon{color:var(--green)}
.wb-stat-purple .wb-stat-icon{color:var(--purple)}

/* events banner */
.wb-events-banner{background:linear-gradient(135deg,#7c3aed20,#06b6d420);border:1px solid var(--purple-light);border-radius:var(--radius-md);padding:.75rem 1rem;display:flex;flex-wrap:wrap;gap:.5rem}
.wb-event-item{font-size:13px;color:var(--text);background:var(--surface);border-radius:var(--radius-sm);padding:.3rem .7rem;border:1px solid var(--border)}

/* two col */
.wb-two-col{display:grid;grid-template-columns:1fr 1fr;gap:1rem}
@media(max-width:640px){.wb-two-col{grid-template-columns:1fr}}

/* leaderboard */
.wb-lb-list{display:flex;flex-direction:column;gap:.4rem}
.wb-lb-row{display:flex;align-items:center;gap:.6rem;padding:.4rem 0;border-bottom:1px solid var(--border)}
.wb-lb-row:last-child{border-bottom:none}
.wb-lb-rank{font-size:18px;width:28px;flex-shrink:0}
.wb-lb-name{flex:1;font-size:13px;font-weight:500}
.wb-lb-coins{font-size:13px;color:var(--purple);font-weight:600}

/* recognition feed */
.wb-rec-feed{display:flex;flex-direction:column;gap:.6rem}
.wb-rec-item{display:flex;align-items:flex-start;gap:.75rem;padding:.5rem 0;border-bottom:1px solid var(--border)}
.wb-rec-item:last-child{border-bottom:none}
.wb-rec-avatar{width:32px;height:32px;border-radius:50%;background:var(--purple);color:#fff;display:flex;align-items:center;justify-content:center;font-size:14px;font-weight:600;flex-shrink:0}
.wb-rec-body{flex:1;min-width:0}
.wb-rec-meta{font-size:12px;color:var(--text2);margin-bottom:.2rem}
.wb-rec-msg{font-size:13px;color:var(--text);margin-bottom:.3rem}
.wb-rec-tags{display:flex;flex-wrap:wrap;gap:.3rem}
.wb-tag{font-size:11px;background:var(--purple-light);color:var(--purple);border-radius:20px;padding:.2rem .6rem}

/* earn panel */
.wb-earn-panel{}
.wb-earn-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:.75rem}
.wb-earn-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);padding:1.1rem;text-align:center;cursor:pointer;transition:all .2s}
.wb-earn-card:hover{border-color:var(--purple);background:var(--purple-light);transform:translateY(-2px)}
.wb-earn-icon{font-size:28px;color:var(--purple);margin-bottom:.5rem}
.wb-earn-label{font-size:13px;font-weight:600;color:var(--text);margin-bottom:.3rem}
.wb-earn-coins{font-size:12px;color:var(--green);font-weight:700}

/* mood */
.wb-mood-wrap{display:grid;grid-template-columns:1fr 1fr;gap:1rem}
@media(max-width:640px){.wb-mood-wrap{grid-template-columns:1fr}}
.wb-mood-done{background:var(--green-light);color:var(--green);border-radius:var(--radius-sm);padding:.5rem .75rem;font-size:13px;margin-bottom:.75rem}
.wb-mood-form{}
.wb-mood-q{font-size:14px;font-weight:600;margin-bottom:.75rem}
.wb-mood-emojis{display:flex;gap:.5rem;justify-content:center;margin-bottom:1rem}
.wb-mood-emoji{display:flex;flex-direction:column;align-items:center;gap:.3rem;cursor:pointer;padding:.5rem .75rem;border-radius:var(--radius-md);border:2px solid transparent;transition:all .15s;font-size:24px}
.wb-mood-emoji:hover{background:var(--surface3);border-color:var(--border)}
.wb-mood-emoji.selected{background:var(--purple-light);border-color:var(--purple)}
.wb-mood-lbl{font-size:10px;color:var(--text2)}
.wb-sliders{display:flex;flex-direction:column;gap:.75rem}
.wb-slider-row label{display:block;font-size:12px;color:var(--text2);margin-bottom:.3rem}
.wb-slider-row input[type=range]{width:100%;accent-color:var(--purple)}
.wb-mood-history{display:flex;flex-direction:column;gap:.4rem;max-height:380px;overflow-y:auto}
.wb-mood-hist-row{display:flex;align-items:center;gap:.75rem;padding:.4rem 0;border-bottom:1px solid var(--border);font-size:13px}
.wb-mood-hist-row:last-child{border-bottom:none}
.wb-hist-date{color:var(--text3);flex-shrink:0;font-size:12px}
.wb-hist-emoji{font-size:20px}
.wb-hist-bars{display:flex;gap:.75rem;color:var(--text2);font-size:12px}

/* coins */
.wb-coins-wrap{display:flex;flex-direction:column;gap:1rem}
.wb-coin-balance-card{background:linear-gradient(135deg,var(--purple),#6366f1);border-radius:var(--radius-md);padding:1.5rem;text-align:center;color:#fff}
.wb-coin-big{font-size:40px;font-weight:800;display:flex;align-items:center;justify-content:center;gap:.4rem}
.wb-coin-sub{font-size:14px;opacity:.8;margin-top:.3rem}
.wb-coin-sub2{font-size:12px;opacity:.6;margin-top:.2rem}
.wb-give-form{display:flex;flex-direction:column;gap:.5rem}
.wb-give-row{display:flex;gap:.5rem}
.wb-tags-select{display:flex;flex-wrap:wrap;gap:.4rem;margin-top:.3rem}
.wb-tag-opt{font-size:12px;padding:.3rem .7rem;border-radius:20px;border:1px solid var(--border);cursor:pointer;color:var(--text2);transition:all .15s;user-select:none}
.wb-tag-opt:hover{border-color:var(--purple);color:var(--purple)}
.wb-tag-opt.selected{background:var(--purple);color:#fff;border-color:var(--purple)}
.wb-tx-list{display:flex;flex-direction:column;gap:.35rem;max-height:350px;overflow-y:auto}
.wb-tx-row{display:grid;grid-template-columns:auto 1fr auto auto;gap:.5rem .75rem;align-items:center;padding:.4rem 0;border-bottom:1px solid var(--border);font-size:12px}
.wb-tx-row:last-child{border-bottom:none}
.wb-tx-type{font-weight:600;white-space:nowrap}
.wb-tx-reason{color:var(--text2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.wb-tx-amount{font-weight:700;white-space:nowrap}
.wb-tx-pos .wb-tx-amount{color:var(--green)}
.wb-tx-neg .wb-tx-amount{color:var(--red)}
.wb-tx-date{color:var(--text3);white-space:nowrap}

/* recognition */
.wb-rec-wrap{display:flex;flex-direction:column;gap:1rem}
.wb-rec-form{display:flex;flex-direction:column;gap:.4rem}
.wb-honor-wall{display:flex;gap:.75rem;flex-wrap:wrap;justify-content:center}
.wb-honor-card{text-align:center;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);padding:1rem;min-width:110px}
.wb-honor-rank{font-size:24px;margin-bottom:.4rem}
.wb-honor-avatar{width:44px;height:44px;border-radius:50%;background:var(--purple);color:#fff;font-size:18px;font-weight:700;display:flex;align-items:center;justify-content:center;margin:0 auto .4rem}
.wb-honor-name{font-size:13px;font-weight:600}
.wb-honor-dept{font-size:11px;color:var(--text3)}
.wb-honor-count{font-size:12px;color:var(--purple);font-weight:600;margin-top:.3rem}
.wb-rec-card{display:flex;gap:.75rem;padding:.65rem 0;border-bottom:1px solid var(--border)}
.wb-rec-card:last-child{border-bottom:none}
.wb-rec-from{background:var(--teal,#0d9488)}
.wb-rec-arrow{color:var(--text3)}
.wb-rec-coins{background:var(--purple-light);color:var(--purple);border-radius:12px;padding:.1rem .5rem;font-size:11px;font-weight:700;margin-right:.4rem}
.wb-rec-date{font-size:11px;color:var(--text3);margin-top:.2rem}

/* surveys */
.wb-surveys-wrap{display:flex;flex-direction:column;gap:1rem}
.wb-survey-desc{font-size:13px;color:var(--text2);margin-bottom:.75rem}
.wb-survey-create{display:flex;flex-direction:column;gap:.5rem;margin-top:.5rem}
.wb-survey-qs{display:flex;flex-direction:column;gap:.75rem}
.wb-survey-q-row{padding:.5rem 0;border-bottom:1px solid var(--border)}
.wb-survey-q-row:last-of-type{border-bottom:none}
.wb-survey-q-text{font-size:13px;font-weight:500;color:var(--text);margin-bottom:.5rem}
.wb-rating-row{display:flex;gap:.4rem}
.wb-rating-btn{width:36px;height:36px;border-radius:50%;border:2px solid var(--border);background:transparent;cursor:pointer;font-weight:700;font-size:14px;color:var(--text2);transition:all .15s}
.wb-rating-btn:hover{border-color:var(--purple);color:var(--purple)}
.wb-rating-btn.selected{background:var(--purple);border-color:var(--purple);color:#fff}
.wb-bool-row{display:flex;gap:.5rem}
.wb-bool-btn{padding:.35rem .9rem;border-radius:var(--radius-sm);border:2px solid var(--border);background:transparent;cursor:pointer;font-size:13px;color:var(--text2);transition:all .15s}
.wb-bool-btn.selected{background:var(--purple);border-color:var(--purple);color:#fff}
.wb-q-builder{display:flex;align-items:center;gap:.5rem;margin-top:.5rem}
.wb-result-q{padding:.75rem 0;border-bottom:1px solid var(--border)}
.wb-result-q:last-child{border-bottom:none}
.wb-result-text{font-size:13px;font-weight:600;margin-bottom:.5rem}
.wb-result-avg{display:flex;align-items:center;gap:.75rem}
.wb-result-bar{height:10px;background:var(--purple);border-radius:5px;transition:width .3s}
.wb-result-answers{display:flex;flex-direction:column;gap:.3rem}
.wb-result-ans-item{font-size:12px;background:var(--surface);padding:.3rem .6rem;border-radius:var(--radius-sm)}
.wb-result-count{font-size:11px;color:var(--text3);margin-top:.3rem}

/* rewards */
.wb-rewards-wrap{display:flex;flex-direction:column;gap:1rem}
.wb-rewards-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:.75rem}
.wb-reward-card{background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius-md);padding:1.1rem;text-align:center;display:flex;flex-direction:column;gap:.4rem;transition:box-shadow .2s}
.wb-reward-card:hover{box-shadow:0 4px 20px #7c3aed20}
.wb-reward-icon{font-size:32px}
.wb-reward-name{font-size:14px;font-weight:600;color:var(--text)}
.wb-reward-desc{font-size:12px;color:var(--text2)}
.wb-reward-cost{font-size:13px;font-weight:700;color:var(--purple)}
.wb-reward-stock{font-size:11px;color:var(--text3)}
.wb-reward-actions{display:flex;justify-content:center;gap:.4rem;margin-top:.4rem}
.wb-redp-list{display:flex;flex-direction:column;gap:.4rem}
.wb-redp-row{display:flex;justify-content:space-between;align-items:center;padding:.5rem 0;border-bottom:1px solid var(--border);font-size:13px}

/* celebrations */
.wb-celeb-wrap{display:flex;flex-direction:column;gap:1rem}
.wb-today-events{background:linear-gradient(135deg,#fef3c720,#fde68a20);border:1px solid #fde68a;border-radius:var(--radius-md);padding:1rem}
.wb-today-head{font-weight:700;font-size:15px;margin-bottom:.6rem}
.wb-today-item{font-size:13px;padding:.3rem 0;border-bottom:1px solid #fde68a50}
.wb-today-item:last-child{border-bottom:none}
.wb-celeb-form{display:flex;flex-direction:column;gap:.4rem}
.wb-celeb-list{display:flex;flex-direction:column;gap:.5rem}
.wb-celeb-item{display:flex;align-items:flex-start;gap:.75rem;padding:.5rem 0;border-bottom:1px solid var(--border)}
.wb-celeb-item:last-child{border-bottom:none}
.wb-celeb-icon{font-size:24px;flex-shrink:0}
.wb-celeb-body{flex:1}
.wb-celeb-name{font-weight:600;font-size:13px}
.wb-celeb-msg{font-size:12px;color:var(--text2);margin-top:.2rem}
.wb-celeb-date{font-size:11px;color:var(--text3);margin-top:.2rem}

/* ═══════════════════════════════════════════
   MOBILE OVERLAY & BOTTOM NAV
═══════════════════════════════════════════ */
.sidebar-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:99;backdrop-filter:blur(2px)}
.sidebar-overlay.show{display:block}

.mobile-bottom-nav{
  position:fixed;bottom:0;left:0;right:0;z-index:200;
  background:var(--surface);border-top:1px solid var(--border);
  display:flex;align-items:stretch;
  padding-bottom:env(safe-area-inset-bottom);
  box-shadow:0 -4px 20px rgba(0,0,0,.08);
}
.mbn-item{
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:3px;padding:8px 4px;border:none;background:transparent;
  color:var(--text3);font-family:inherit;font-size:10px;cursor:pointer;
  transition:color .15s;position:relative;min-height:56px;
}
.mbn-item .ti{font-size:22px;line-height:1}
.mbn-item.active{color:var(--purple)}
.mbn-item .mbn-badge{
  position:absolute;top:6px;right:50%;transform:translateX(8px);
  min-width:16px;height:16px;border-radius:8px;
  background:var(--red);color:#fff;font-size:10px;font-weight:700;
  display:flex;align-items:center;justify-content:center;padding:0 4px;
}

/* ═══════════════════════════════════════════
   COMPREHENSIVE MOBILE RESPONSIVE
═══════════════════════════════════════════ */
@media(max-width:768px){
  :root{--topbar-h:54px}

  /* Layout */
  .sidebar{
    width:280px;transform:translateX(100%);
    z-index:200;box-shadow:var(--shadow-md);
  }
  .sidebar.open{transform:translateX(0)}
  .main{margin-right:0;padding-bottom:64px}

  /* Topbar */
  .topbar{padding:0 .875rem}
  .topbar-title{font-size:14px}

  /* Content */
  .content{padding:.875rem}

  /* Metrics */
  .metrics-grid{grid-template-columns:1fr 1fr;gap:.625rem;margin-bottom:.875rem}
  .metric-card{padding:1rem}
  .metric-value{font-size:20px!important}
  .metric-label{font-size:12px}
  .metric-icon{width:36px;height:36px;font-size:17px;margin-bottom:.6rem}

  /* Charts row */
  .charts-row{grid-template-columns:1fr;gap:.75rem}

  /* Forms */
  .form-row,.form-row-3{grid-template-columns:1fr}

  /* Modal */
  .modal-overlay{align-items:flex-end;padding:0}
  .modal-box{
    width:100%!important;max-width:100%!important;
    border-radius:var(--radius-xl) var(--radius-xl) 0 0;
    max-height:92vh;overflow-y:auto;
    padding:1.25rem 1rem;
    margin-bottom:env(safe-area-inset-bottom);
  }
  .modal-box.modal-lg{width:100%!important;max-width:100%!important}

  /* Tables → scroll */
  .table-wrap,.card-body{overflow-x:auto;-webkit-overflow-scrolling:touch}
  table{min-width:520px}

  /* Cards */
  .card-header{padding:.75rem 1rem}
  .card-body{padding:.875rem}

  /* Kanban */
  .kanban-board{flex-direction:column}
  .kanban-col{min-width:unset;max-width:unset;width:100%}

  /* PM project grid */
  .pm-project-grid{grid-template-columns:1fr}

  /* Chat — subtract the fixed mobile bottom nav so the input bar isn't hidden behind it */
  .chat-layout{grid-template-columns:1fr;height:calc(100vh - var(--topbar-h) - 64px - env(safe-area-inset-bottom) - 1.75rem);height:calc(100dvh - var(--topbar-h) - 64px - env(safe-area-inset-bottom) - 1.75rem)}
  .chat-sidebar{
    display:none;position:fixed;inset:0;z-index:300;
    width:280px;right:0;background:var(--surface);border-left:1px solid var(--border);
    transform:translateX(100%);transition:transform .25s;
  }
  .chat-sidebar.show{display:flex;transform:translateX(0)}
  .chat-input-bar{padding:8px 10px}
  .chat-input-bar input{font-size:14px}

  /* Salary / payroll breakdown */
  .salary-breakdown{grid-template-columns:1fr}

  /* Wellbeing */
  .wb-two-col{grid-template-columns:1fr}
  .wb-mood-wrap{grid-template-columns:1fr}
  .wb-stat-grid{grid-template-columns:1fr 1fr}

  /* Toast */
  #toastContainer{left:.75rem;right:.75rem;bottom:72px}
  .toast{font-size:13px;padding:.6rem .875rem}

  /* Task detail modal */
  .tk-detail-grid{grid-template-columns:1fr}
  .modal-box.modal-lg{width:100%!important}

  /* Buttons: larger touch targets */
  .btn-primary,.btn-secondary,.btn-danger,.btn-success{padding:10px 16px;font-size:14px}
  .action-btn{padding:6px 12px;font-size:13px}
  .icon-btn{width:40px;height:40px}

  /* Tables: hide less-important columns handled via data attrs in JS */
  /* Input */
  input,select,textarea{font-size:16px} /* prevents iOS zoom */

  /* Scrollbar: hide on mobile */
  *::-webkit-scrollbar{width:0;height:0}

  /* Hide mobile-bottom-nav-covered elements */
  .sidebar-footer{padding-bottom:.5rem}

  /* Topbar menu btn: always visible */
  #topbarMenuBtn{display:flex!important}
}

@media(max-width:480px){
  .metrics-grid{grid-template-columns:1fr 1fr}
  .metric-card{padding:.75rem}
  .metric-value{font-size:18px!important}

  .wb-tab{font-size:12px;padding:.4rem .5rem}
  .wb-tabs{gap:.2rem}

  /* Login */
  .login-card{padding:2rem 1.25rem;border-radius:var(--radius-lg)}
}

/* ═══════════════════════════════════════════
   PWA INSTALL BANNER
═══════════════════════════════════════════ */
#pwaInstallBanner{
  display:none;position:fixed;bottom:70px;left:50%;transform:translateX(-50%);
  background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);
  box-shadow:var(--shadow-md);padding:.875rem 1.25rem;
  display:none;align-items:center;gap:.875rem;z-index:500;
  max-width:340px;width:calc(100% - 2rem);animation:fadeUp .35s ease;
}
#pwaInstallBanner.show{display:flex}
#pwaInstallBanner .pwa-icon{font-size:28px;flex-shrink:0}
#pwaInstallBanner .pwa-text{flex:1;font-size:13px;font-weight:500}
#pwaInstallBanner .pwa-sub{font-size:11px;color:var(--text3);margin-top:2px}
#pwaInstallBanner .pwa-btns{display:flex;gap:.4rem;margin-top:.5rem}

/* Chat mobile: show contacts button — بالاتر از نوار تایپ تا روی دکمه ارسال نیفتد */
.chat-contacts-toggle{
  display:none;position:fixed;bottom:calc(150px + env(safe-area-inset-bottom));right:12px;z-index:250;
  width:44px;height:44px;border-radius:50%;background:var(--purple);
  color:#fff;border:none;font-size:20px;box-shadow:var(--shadow-md);
  align-items:center;justify-content:center;cursor:pointer;opacity:.92;
}
@media(max-width:768px){.chat-contacts-toggle{display:flex}}

/* ═══════════════════════════════════════════
   COIN BADGE IN SIDEBAR
═══════════════════════════════════════════ */
.coin-badge{
  display:inline-flex;align-items:center;gap:3px;
  background:var(--gold-light);color:var(--gold);
  border-radius:10px;padding:2px 7px;font-size:11px;font-weight:700;
  cursor:pointer;transition:.15s;margin-top:3px;
}
.coin-badge:hover{background:var(--gold);color:#fff}
.coin-badge .ti{font-size:12px}

/* ═══════════════════════════════════════════
   DASHBOARD — چیدمان و ویجت‌ها
═══════════════════════════════════════════ */
/* ستون اصلی + ستون کناری. قبلاً همه کارت‌ها تمام‌عرض و پشت‌سرهم بودند
   که اسکرول عمودی زیادی می‌ساخت؛ حالا محتوای فرعی کنار می‌نشیند. */
.dash-grid{display:grid;grid-template-columns:minmax(0,1.9fr) minmax(0,1fr);gap:var(--s3);align-items:start}
.dash-col{display:flex;flex-direction:column;gap:var(--s3);min-width:0}

/* نوار استوری: باریک، بدون کارت بزرگ */
.dash-strip{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);
  box-shadow:var(--shadow);padding:var(--s2) var(--s3);margin-bottom:var(--s3)}
/* در داشبورد حلقه‌ها کوچک‌تر از صفحه «نویان دیلی» هستند تا نوار جای زیادی نگیرد */
.dash-strip .daily-stories{gap:var(--s3)}
.dash-strip .story-ring{width:46px;height:46px;padding:2px}
.dash-strip .story-name{font-size:10.5px}

/* ویجت حال‌وهوا: یک نوار جمع‌وجور، نه کارت تمام‌قد */
.dash-mood-head{display:flex;align-items:center;justify-content:space-between;gap:var(--s2);
  font-size:12.5px;font-weight:600;color:var(--text);margin-bottom:var(--s3)}
.dash-mood-head .ti{color:var(--text3);font-size:15px}
.dash-mood-emojis{display:flex;gap:var(--s1);justify-content:space-between}
.dash-mood-btn{display:flex;align-items:center;justify-content:center;flex:1;
  padding:7px 0;border:1px solid var(--border);border-radius:var(--radius-sm);
  background:var(--surface2);cursor:pointer;transition:background .12s,border-color .12s;font-family:inherit}
.dash-mood-btn:hover{border-color:var(--purple);background:var(--purple-light)}
.dash-mood-emoji{font-size:21px;line-height:1}
.dash-mood-done{display:flex;align-items:center;gap:var(--s3)}

@media(max-width:1100px){
  .dash-grid{grid-template-columns:1fr}
}
@media(max-width:480px){
  .dash-mood-emoji{font-size:19px}
}

/* ═══════════════════════════════════════════
   تقویم سازمانی
═══════════════════════════════════════════ */
.cal-legend{display:flex;flex-wrap:wrap;gap:14px;margin-bottom:10px;font-size:12px;color:var(--text2)}
.cal-legend span{display:inline-flex;align-items:center;gap:5px}
.cal-dot{width:10px;height:10px;border-radius:3px;display:inline-block}
.cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:4px}
.cal-head{margin-bottom:4px;font-size:12px;font-weight:700;color:var(--text3);text-align:center}
.cal-head div{padding:4px}
.cal-cell{min-height:86px;background:var(--surface2);border-radius:var(--radius-sm);padding:5px;overflow:hidden;transition:background .12s}
.cal-cell[onclick]{cursor:pointer}
.cal-cell[onclick]:hover{background:var(--surface3)}
.cal-empty{background:transparent}
.cal-today{outline:2px solid var(--purple);background:var(--purple-light)}
.cal-friday .cal-daynum{color:var(--red)}
.cal-daynum{font-size:12px;font-weight:700;margin-bottom:3px}
.cal-events{display:flex;flex-direction:column;gap:2px}
.cal-ev{font-size:10px;padding:1px 5px;border-radius:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#fff}
.cal-ev-amber{background:var(--amber)}
.cal-ev-blue{background:var(--blue)}
.cal-ev-purple{background:var(--purple)}
.cal-ev-teal{background:var(--teal)}
.cal-ev-red{background:var(--red)}
.cal-more{font-size:10px;color:var(--text3)}
.cal-day-ev{display:flex;align-items:center;gap:8px;padding:8px 12px;border-radius:var(--radius-sm);color:#fff;font-size:13px}
@media(max-width:768px){
  .cal-cell{min-height:56px;padding:3px}
  .cal-ev{font-size:8px;padding:1px 3px}
  .cal-daynum{font-size:11px}
}

/* ═══════════════════════════════════════════
   نویان دیلی
═══════════════════════════════════════════ */
.daily-wrap{max-width:620px;margin:0 auto}
.daily-stories{display:flex;gap:14px;overflow-x:auto;padding:2px}
.story-item{display:flex;flex-direction:column;align-items:center;gap:4px;cursor:pointer;flex-shrink:0}
.story-ring{width:62px;height:62px;border-radius:50%;padding:3px;background:linear-gradient(45deg,var(--purple),var(--red),var(--amber));display:flex;align-items:center;justify-content:center}
.story-ring.seen{background:var(--surface3)}
.story-ring img,.story-avatar-fb{width:100%;height:100%;border-radius:50%;object-fit:cover;border:2px solid var(--surface)}
.story-avatar-fb{background:var(--purple);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:16px}
.story-name{font-size:11px;color:var(--text2);max-width:66px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.story-viewer{display:flex;flex-direction:column;gap:10px}
.story-progress{display:flex;gap:4px}
.story-progress span{flex:1;height:3px;border-radius:2px;background:var(--surface3)}
.story-progress span.done{background:var(--purple)}
.story-head{display:flex;align-items:center;gap:8px}
.story-img{width:100%;max-height:60vh;object-fit:contain;border-radius:var(--radius-md);background:var(--surface2)}
.story-body{font-size:14px;line-height:1.8;white-space:pre-wrap}
.story-nav{display:flex;justify-content:space-between;align-items:center;gap:8px}
.daily-card{margin-bottom:1rem;overflow:hidden}
.daily-card-head{display:flex;align-items:center;gap:10px;padding:12px 14px}
.daily-avatar,.daily-avatar-fb{width:40px;height:40px;border-radius:50%;object-fit:cover;flex-shrink:0}
.daily-avatar-fb{background:var(--purple);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:14px}
.daily-img{width:100%;max-height:480px;object-fit:cover;display:block}
.daily-body{padding:12px 14px;font-size:14px;line-height:1.9;white-space:pre-wrap}
.daily-actions{display:flex;align-items:center;gap:12px;padding:8px 14px;border-top:1px solid var(--border)}

/* ── ویجت‌های داشبورد ── */
.dash-two-col{display:grid;grid-template-columns:1.4fr 1fr;gap:1rem;margin-top:1.25rem}
@media(max-width:768px){.dash-two-col{grid-template-columns:1fr}}
.dash-msg-row{display:flex;align-items:center;gap:10px;padding:8px 4px;border-bottom:1px solid var(--border);cursor:pointer;border-radius:8px;transition:background .12s}
.dash-msg-row:hover{background:var(--surface2)}
.dash-msg-row:last-child{border-bottom:none}
.mini-cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:2px;margin-top:4px}
.mini-cal-day{position:relative;text-align:center;padding:5px 0;font-size:12px;border-radius:7px;color:var(--text2)}
.mini-cal-day.today{background:var(--purple);color:#fff;font-weight:700}
.mini-cal-day.has-ev{cursor:pointer;font-weight:600;color:var(--text)}
.mini-cal-day.has-ev:hover{background:var(--purple-light)}
.mini-cal-dot{position:absolute;bottom:2px;right:50%;transform:translateX(50%);width:4px;height:4px;border-radius:50%;background:var(--red)}
.mini-cal-day.today .mini-cal-dot{background:#fff}

/* ── پرونده پرسنل ── */
.dossier-stats{display:grid;grid-template-columns:repeat(6,1fr);gap:8px;margin-bottom:1rem}
@media(max-width:768px){.dossier-stats{grid-template-columns:repeat(3,1fr)}}
.ds-item{background:var(--surface2);border-radius:var(--radius-md);padding:10px 6px;text-align:center}
.ds-val{font-size:16px;font-weight:800;color:var(--purple)}
.ds-lbl{font-size:10px;color:var(--text3);margin-top:2px}
.dossier-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
@media(max-width:768px){.dossier-grid{grid-template-columns:1fr}}
.dossier-sec{background:var(--surface2);border-radius:var(--radius-md);padding:12px}
.dossier-sec h4{font-size:12px;font-weight:700;color:var(--text2);margin-bottom:8px;display:flex;align-items:center;gap:5px}
.dossier-sec .modal-row{padding:3px 0;font-size:12px}

/* ── پیوست تسک ── */
.tk-file-row{display:flex;align-items:center;gap:var(--s2);padding:7px 8px;border:1px solid var(--border);
  border-radius:var(--radius-sm);margin-bottom:6px;background:var(--surface2)}
.tk-file-row>.ti{font-size:19px;color:var(--text3);flex-shrink:0}
.tk-file-name{font-size:12.5px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tk-file-meta{font-size:11px;color:var(--text3)}

/* ── کامنت‌های نویان دیلی ── */
.daily-comments{border-top:1px solid var(--border);padding:var(--s2) var(--s3) var(--s3)}
.dc-row{display:flex;align-items:flex-start;gap:var(--s2);padding:6px 0}
.dc-row+.dc-row{border-top:1px solid var(--border)}
.dc-main{min-width:0;flex:1}
.dc-head{display:flex;align-items:baseline;gap:var(--s2);font-size:12.5px}
.dc-time{font-size:10.5px;color:var(--text3)}
.dc-body{font-size:13px;color:var(--text2);line-height:1.7;word-break:break-word;white-space:pre-wrap}
.dc-empty{font-size:12px;color:var(--text3);padding:8px 0;text-align:center}
.dc-form{display:flex;gap:6px;margin-top:var(--s2)}
.dc-form input{flex:1}
.dc-form .btn-primary{flex:0 0 auto;padding:8px 12px}

/* ═══════════════════════════════════════════
   BRANDING + SUBSCRIPTION
═══════════════════════════════════════════ */
/* لوگوی اختصاصی شرکت: کادر پس‌زمینه‌دار حذف می‌شود تا لوگوهای روشن هم دیده شوند */
.login-logo.has-img,
.sidebar-logo .logo-icon.has-img{background:none;box-shadow:none;padding:0}
.login-logo.has-img img{width:100%;height:100%;object-fit:contain;border-radius:var(--radius-md)}
.sidebar-logo .logo-icon.has-img img{width:100%;height:100%;object-fit:contain;border-radius:var(--radius-sm)}

.sub-banner{display:flex;align-items:center;gap:10px;background:var(--amber-light);
  color:var(--amber);border:1px solid var(--amber-light);border-radius:var(--radius-md);
  padding:.7rem 1rem;font-size:13px;margin:0 var(--s5) var(--s3)}
.sub-banner.danger{background:var(--red-light);color:var(--red);border-color:rgba(220,38,38,.2)}
.sub-banner span{flex:1}
.sub-banner .icon-btn{width:26px;height:26px;color:inherit;flex:0 0 auto}

/* ═══════════════════════════════════════════
   PAYROLL FORM GROUPS
═══════════════════════════════════════════ */
.pr-group-title{font-size:12px;font-weight:700;color:var(--text2);margin-bottom:.75rem;
  display:flex;align-items:center;gap:6px}
.pr-group-title i{color:var(--purple)}
.pr-law{font-weight:400;font-size:10px;color:var(--text3)}

/* اعتبارسنجی فیلد (اطلاعات بانکی) */
.field-hint{font-size:11px;color:var(--text3);margin-top:4px;min-height:1em}
.field-hint.bad{color:var(--red)}
input.input-bad{border-color:var(--red)}
.chk-row{display:flex;align-items:center;gap:7px;font-size:13px;margin-bottom:.5rem;cursor:pointer}
.chk-row input{width:auto}

/* ═══════════════════════════════════════════
   PAYROLL RUN TABLE
═══════════════════════════════════════════ */
.pr-run-table{font-size:12px}
.pr-run-table th{white-space:nowrap;font-size:11px}
.pr-run-table td{padding:5px 7px}
.pr-cell{width:64px;padding:3px 5px;font-size:12px;text-align:center}
.pr-run-table tr.pr-excluded{opacity:.5}
.pr-run-table tr.pr-has-error td{background:var(--red-light)}
/* مودال عریض برای جدول‌های مقایسه‌ای */
.modal-box:has(.modal-wide){max-width:min(920px,95vw)}
/* دفتر کل: سطح اول پررنگ */
.gl-top td{font-weight:700;background:var(--surface2)}
