/* ============================================================
   Personal OS — Design System
   بنفسجي + كروت ناعمة + RTL  (مستوحى من التصميم المرجعي)
   ============================================================ */

:root {
  --primary:   #6C5CE7;
  --primary-d: #5849d6;
  --bg:        #F4F6FB;
  --bg-blue:   #DCEAFB;
  --card:      #FFFFFF;
  --success:   #2ECC71;
  --warning:   #FFB84C;
  --accent:    #FF6B81;
  --text:      #1B2559;
  --text-2:    #8A94A6;
  --line:      #EEF1F7;
  --radius:    24px;
  --radius-sm: 16px;
  --shadow:    0 8px 24px rgba(27, 37, 89, 0.06);
  --shadow-h:  0 12px 32px rgba(108, 92, 231, 0.18);
}

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

body {
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  display: flex;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 240px;
  background: var(--card);
  border-left: 1px solid var(--line);
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.brand {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 24px;
  padding: 0 12px;
}
.brand span { color: var(--text); }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 600;
  font-size: 15px;
  transition: .15s;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: var(--shadow-h); }
.nav-item .ic { font-size: 18px; }
.sidebar-foot { margin-top: auto; }

/* ---------- Main ---------- */
.main {
  flex: 1;
  padding: 28px 32px;
  max-width: 1200px;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-head h1 { font-size: 28px; font-weight: 800; }
.page-head .sub { color: var(--text-2); font-size: 14px; margin-top: 2px; }

/* ---------- Grid & Cards ---------- */
.grid { display: grid; gap: 20px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card h3 { font-size: 16px; margin-bottom: 16px; }
.card.purple { background: linear-gradient(135deg, #7B6EF6, #6C5CE7); color: #fff; }
.card.blue   { background: linear-gradient(135deg, #5AA9F6, #4C8DF6); color: #fff; }
.card.pink   { background: linear-gradient(135deg, #FF8FA3, #FF6B81); color: #fff; }

/* ---------- Stat card ---------- */
.stat-label { font-size: 13px; color: var(--text-2); }
.stat-value { font-size: 30px; font-weight: 800; margin-top: 4px; }
.card.purple .stat-label, .card.blue .stat-label, .card.pink .stat-label { color: rgba(255,255,255,.85); }
.stat-mini {
  display:flex; align-items:center; gap:12px;
  background: var(--bg); border-radius: var(--radius-sm); padding: 14px;
}
.stat-mini .ic-box {
  width:44px; height:44px; border-radius:14px; display:flex;
  align-items:center; justify-content:center; font-size:20px; flex-shrink:0;
}

/* ---------- Buttons ---------- */
.btn {
  display:inline-flex; align-items:center; gap:8px; justify-content:center;
  background: var(--primary); color:#fff; border:none;
  padding: 12px 22px; border-radius: 999px;
  font-family: inherit; font-weight:700; font-size:14px; cursor:pointer;
  transition:.15s;
}
.btn:hover { background: var(--primary-d); }
.btn.full { width:100%; }
.btn.ghost { background: var(--bg); color: var(--text); }
.btn.sm { padding: 7px 14px; font-size: 13px; }
.btn.danger { background: var(--accent); }
.btn.green  { background: var(--success); }

/* ---------- List items ---------- */
.list-item {
  display:flex; align-items:center; gap:14px;
  padding: 14px; border-radius: var(--radius-sm);
  background: var(--bg); margin-bottom: 10px;
}
.list-item .ic-box {
  width:42px; height:42px; border-radius:13px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center; font-size:18px;
  background:#fff;
}
.list-item .li-body { flex:1; min-width:0; }
.list-item .li-title { font-weight:700; font-size:15px; }
.list-item .li-sub { font-size:12px; color:var(--text-2); margin-top:2px; }
.list-item .li-amount { font-weight:800; font-size:15px; white-space:nowrap; }
.list-item.done .li-title { text-decoration: line-through; color: var(--text-2); }

/* ---------- Badges / pills ---------- */
.pill {
  display:inline-block; padding:4px 12px; border-radius:999px;
  font-size:12px; font-weight:700;
}
.pill.todo  { background:#EEF1F7; color:#8A94A6; }
.pill.doing { background:#FFF3DF; color:#FFB84C; }
.pill.done  { background:#E5F9ED; color:#2ECC71; }
.pill.high  { background:#FFE9ED; color:#FF6B81; }
.pill.med   { background:#FFF3DF; color:#FFB84C; }
.pill.low   { background:#EEF1F7; color:#8A94A6; }

/* ---------- Progress ring (conic) ---------- */
.ring {
  width:90px; height:90px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  position:relative; flex-shrink:0;
}
.ring::before {
  content:''; position:absolute; inset:10px;
  background: var(--card); border-radius:50%;
}
.ring .ring-val { position:relative; font-weight:800; font-size:18px; }
.card.purple .ring::before, .card.blue .ring::before, .card.pink .ring::before { background: rgba(255,255,255,.15); }
.card.purple .ring .ring-val, .card.blue .ring .ring-val, .card.pink .ring .ring-val { color:#fff; }

/* progress bar */
.bar { height:10px; background:var(--bg); border-radius:999px; overflow:hidden; }
.bar > span { display:block; height:100%; background:var(--primary); border-radius:999px; }

/* streak chip */
.streak { display:inline-flex; align-items:center; gap:6px; font-weight:800; color:var(--warning); }

/* ---------- Forms ---------- */
.form-row { margin-bottom:14px; }
.form-row label { display:block; font-size:13px; font-weight:700; margin-bottom:6px; color:var(--text-2); }
.input, select, textarea {
  width:100%; padding:12px 14px; border:1px solid var(--line);
  border-radius: var(--radius-sm); font-family:inherit; font-size:14px;
  background: var(--bg); color: var(--text);
}
.input:focus, select:focus, textarea:focus { outline:none; border-color:var(--primary); }
.inline-form { display:flex; gap:10px; flex-wrap:wrap; align-items:flex-end; }
.inline-form .form-row { margin:0; flex:1; min-width:140px; }

/* ---------- Table ---------- */
table { width:100%; border-collapse:collapse; }
th, td { text-align:right; padding:12px; border-bottom:1px solid var(--line); font-size:14px; }
th { color:var(--text-2); font-size:13px; font-weight:700; }

/* ---------- Date strip ---------- */
.date-strip { display:flex; gap:8px; overflow-x:auto; padding-bottom:6px; }
.date-cell {
  min-width:46px; text-align:center; padding:8px; border-radius:14px;
  background:var(--bg); font-size:13px; flex-shrink:0;
}
.date-cell .d { font-weight:800; font-size:16px; }
.date-cell.today { background:var(--success); color:#fff; }

/* ---------- Login ---------- */
.login-wrap {
  margin:auto; width:100%; max-width:380px;
  background:var(--card); border-radius:var(--radius);
  padding:36px; box-shadow:var(--shadow);
}
.login-wrap h1 { text-align:center; color:var(--primary); margin-bottom:6px; }
.login-wrap p { text-align:center; color:var(--text-2); margin-bottom:24px; font-size:14px; }

/* ---------- Utilities ---------- */
.flex { display:flex; }
.between { justify-content:space-between; }
.center { align-items:center; }
.gap { gap:12px; }
.mt { margin-top:16px; }
.mb { margin-bottom:16px; }
.muted { color:var(--text-2); }
.right { text-align:left; } /* في RTL يعني ناحية اليسار */
.small { font-size:13px; }
.empty { text-align:center; color:var(--text-2); padding:30px; }

@media (max-width: 900px) {
  .cols-4 { grid-template-columns: repeat(2,1fr); }
  .cols-3 { grid-template-columns: 1fr; }
  .cols-2 { grid-template-columns: 1fr; }
  .sidebar { width:70px; }
  .sidebar .label, .brand span { display:none; }
}
