:root{
  --bg: #f5f6fa;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #1e293b;
  --text-muted: #64748b;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --critical: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --font-ar: 'Tajawal', 'Segoe UI', sans-serif;
  --font-en: 'Inter', 'Segoe UI', sans-serif;
}

*{ box-sizing:border-box; margin:0; padding:0; }

body{
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-en);
  min-height:100vh;
}
html[dir="rtl"] body{ font-family:var(--font-ar); }

a{ color:inherit; text-decoration:none; }
button{ font-family:inherit; cursor:pointer; }

/* ---------- Layout ---------- */
.app-shell{ display:flex; min-height:100vh; }

.sidebar{
  width:240px; flex-shrink:0;
  background:var(--surface);
  border-inline-end:1px solid var(--border);
  padding:20px 16px;
  display:flex; flex-direction:column; gap:4px;
}
.sidebar .brand{
  font-weight:800; font-size:18px; color:var(--primary);
  margin-bottom:24px; padding:0 8px;
}
.nav-item{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px; border-radius:8px;
  color:var(--text-muted); font-weight:600; font-size:14px;
}
.nav-item:hover{ background:var(--bg); color:var(--text); }
.nav-item.active{ background:#eef2ff; color:var(--primary); }

.main{ flex:1; padding:24px 32px; overflow-y:auto; }

.topbar{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:24px;
}
.topbar h1{ font-size:22px; font-weight:800; }
.topbar-actions{ display:flex; align-items:center; gap:12px; }

/* ---------- Buttons ---------- */
.btn{
  padding:9px 16px; border-radius:8px; border:1px solid transparent;
  font-weight:600; font-size:14px; transition:.15s;
}
.btn-primary{ background:var(--primary); color:#fff; }
.btn-primary:hover{ background:var(--primary-dark); }
.btn-outline{ background:var(--surface); border-color:var(--border); color:var(--text); }
.btn-outline:hover{ background:var(--bg); }
.btn-danger{ background:#fee2e2; color:var(--danger); }
.btn-sm{ padding:5px 10px; font-size:12px; }
.btn-icon{ width:36px; height:36px; border-radius:8px; background:var(--surface); border:1px solid var(--border); display:flex; align-items:center; justify-content:center; }

/* ---------- Cards / Grid ---------- */
.grid{ display:grid; gap:16px; }
.grid-4{ grid-template-columns:repeat(4,1fr); }
.grid-3{ grid-template-columns:repeat(3,1fr); }
@media(max-width:1000px){ .grid-4{grid-template-columns:repeat(2,1fr);} .grid-3{grid-template-columns:1fr;} }

.card{
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:18px; box-shadow:var(--shadow);
}
.stat-card{ display:flex; flex-direction:column; gap:6px; }
.stat-card .value{ font-size:28px; font-weight:800; }
.stat-card .label{ color:var(--text-muted); font-size:13px; font-weight:600; }

.project-card{ cursor:pointer; transition:.15s; }
.project-card:hover{ transform:translateY(-2px); box-shadow:0 4px 10px rgba(0,0,0,.08); }
.project-card .dot{ width:12px; height:12px; border-radius:50%; display:inline-block; margin-inline-end:8px; }
.project-card h3{ font-size:16px; margin-bottom:6px; }
.project-card p{ color:var(--text-muted); font-size:13px; margin-bottom:10px; }
.project-card .meta{ display:flex; justify-content:space-between; font-size:12px; color:var(--text-muted); }

/* ---------- Kanban ---------- */
.board{ display:flex; gap:16px; overflow-x:auto; padding-bottom:8px; }
.board-col{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); width:270px; flex-shrink:0; padding:12px; }
.board-col h4{ font-size:13px; font-weight:700; margin-bottom:10px; display:flex; align-items:center; gap:8px; }
.board-col h4 .dot{ width:9px; height:9px; border-radius:50%; }
.task-card{ background:var(--bg); border:1px solid var(--border); border-radius:8px; padding:10px; margin-bottom:8px; font-size:13px; cursor:pointer; }
.task-card:hover{ border-color:var(--primary); }
.task-card .title{ font-weight:600; margin-bottom:6px; }
.task-card .badges{ display:flex; gap:6px; flex-wrap:wrap; }

.badge{ font-size:11px; font-weight:700; padding:2px 8px; border-radius:20px; }
.badge-critical{ background:#fee2e2; color:var(--critical); }
.badge-high{ background:#ffedd5; color:#c2410c; }
.badge-medium{ background:#fef3c7; color:#92400e; }
.badge-low{ background:#dcfce7; color:#15803d; }

/* ---------- Forms / Modals ---------- */
.overlay{
  position:fixed; inset:0; background:rgba(15,23,42,.4);
  display:flex; align-items:center; justify-content:center; z-index:50;
}
.modal{ background:var(--surface); border-radius:var(--radius); width:440px; max-width:92vw; padding:24px; box-shadow:0 10px 40px rgba(0,0,0,.15); max-height:88vh; overflow-y:auto; }
.modal h2{ font-size:18px; margin-bottom:18px; }

.field{ margin-bottom:14px; }
.field label{ display:block; font-size:13px; font-weight:600; margin-bottom:6px; color:var(--text-muted); }
.field input, .field select, .field textarea{
  width:100%; padding:9px 12px; border:1px solid var(--border); border-radius:8px;
  font-size:14px; font-family:inherit; background:var(--surface); color:var(--text);
}
.field textarea{ resize:vertical; min-height:70px; }
.field-row{ display:flex; gap:10px; }
.field-row .field{ flex:1; }

.auth-wrap{ min-height:100vh; display:flex; align-items:center; justify-content:center; background:var(--bg); }
.auth-card{ width:380px; max-width:92vw; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:32px; box-shadow:var(--shadow); }
.auth-card .brand{ font-weight:800; font-size:20px; color:var(--primary); margin-bottom:6px; text-align:center; }
.auth-card .sub{ text-align:center; color:var(--text-muted); font-size:13px; margin-bottom:24px; }
.auth-switch{ text-align:center; margin-top:16px; font-size:13px; color:var(--text-muted); }
.auth-switch a{ color:var(--primary); font-weight:700; cursor:pointer; }
.error-box{ background:#fee2e2; color:var(--danger); padding:10px 12px; border-radius:8px; font-size:13px; margin-bottom:14px; }

/* ---------- Comments ---------- */
.comment{ display:flex; gap:10px; margin-bottom:14px; }
.avatar{ width:34px; height:34px; border-radius:50%; background:var(--primary); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:13px; flex-shrink:0; }
.comment .bubble{ background:var(--bg); border-radius:10px; padding:8px 12px; font-size:13px; flex:1; }
.comment .meta{ color:var(--text-muted); font-size:11px; margin-top:4px; }

.lang-switch{ display:flex; border:1px solid var(--border); border-radius:8px; overflow:hidden; }
.lang-switch button{ padding:6px 12px; font-size:12px; font-weight:700; background:var(--surface); color:var(--text-muted); border:none; }
.lang-switch button.active{ background:var(--primary); color:#fff; }

.empty-state{ text-align:center; padding:60px 20px; color:var(--text-muted); }

.activity-item{ display:flex; justify-content:space-between; font-size:13px; padding:8px 0; border-bottom:1px solid var(--border); }
.activity-item:last-child{ border-bottom:none; }
