/* ============================================
   منصة دوامي - ملف الأنماط الرئيسي
   ============================================ */

:root {
  --ink: #152c3b;
  --muted: #6d7e87;
  --line: #e7ecec;
  --bg: #f6f8f8;
  --teal: #008b89;
  --teal2: #006f70;
  --teal-light: #e3f4f2;
  --orange: #e78d27;
  --green: #20966b;
  --red: #d95151;
  --navy: #173a4e;
  --shadow: 0 8px 24px #163a4710;
  --shadow-hover: 0 14px 28px #163a4718;
  --radius: 12px;
  --transition: 0.25s ease;
}

/* ---------- الأساسيات ---------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  background: var(--bg);
  font-family: 'Cairo', Arial, sans-serif;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- التطبيق ---------- */
.app-shell {
  min-height: 100vh;
  display: flex;
}

/* ---------- الشريط الجانبي ---------- */
.sidebar {
  width: 270px;
  background: #fff;
  border-left: 1px solid var(--line);
  padding: 26px 15px;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar.open {
  transform: translateX(0) !important;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px 30px;
}

.brand-mark {
  background: var(--teal);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-weight: 800;
  font-size: 23px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand b {
  font-size: 17px;
  display: block;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

/* ---------- التنقل ---------- */
nav {
  display: grid;
  gap: 7px;
}

.nav-link {
  font: inherit;
  border: 0;
  background: transparent;
  text-align: right;
  padding: 13px 15px;
  border-radius: 9px;
  color: #51636c;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.nav-link span:first-child {
  font-size: 18px;
  line-height: 1;
}

.nav-link:hover {
  background: #f0f8f8;
  color: var(--teal2);
}

.nav-link.active {
  background: var(--teal-light);
  color: var(--teal2);
  font-weight: 700;
}

.nav-link em {
  font-style: normal;
  background: var(--red);
  color: #fff;
  border-radius: 9px;
  min-width: 15px;
  height: 15px;
  display: none;
  place-items: center;
  font-size: 8px;
  padding: 0 4px;
  margin-right: auto;
}

.nav-link em:not(:empty) {
  display: inline-grid;
}

.side-foot {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 18px 12px 0;
  color: var(--muted);
  font-size: 11px;
}

.secure-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  margin-left: 7px;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---------- المحتوى الرئيسي ---------- */
main {
  margin-right: 270px;
  width: calc(100% - 270px);
  min-height: 100vh;
}

/* ---------- الشريط العلوي ---------- */
.topbar {
  height: 76px;
  background: white;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 42px;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.92);
}

.menu {
  border: 0;
  background: transparent;
  font-size: 21px;
  color: var(--ink);
  display: none;
  padding: 4px 8px;
  border-radius: 6px;
}

.menu:hover {
  background: var(--line);
}

.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
}

.crumb > span {
  font-weight: 700;
}

.crumb small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

/* ---------- رأس الصفحة ---------- */
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.icon-button {
  border: 0;
  background: #f1f6f6;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  color: var(--teal);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--transition), transform var(--transition);
  position: relative;
}

.icon-button:hover {
  background: var(--teal-light);
  transform: translateY(-2px);
}

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #d6e6e4;
  color: var(--teal2);
  font-weight: 800;
  font-size: 15px;
  border: 0;
  transition: outline-color var(--transition), transform var(--transition);
  outline: 3px solid #e6f3f2;
}

.avatar:hover {
  transform: translateY(-2px);
  outline-color: #baddd9;
}

.avatar.small {
  width: 34px;
  height: 34px;
  font-size: 13px;
  outline: none;
}

/* ---------- شاشة تسجيل الدخول ---------- */
.login-screen {
  position: fixed;
  z-index: 50;
  inset: 0;
  background: radial-gradient(circle at 80% 15%, #c9e6e6 0, transparent 31%),
              linear-gradient(135deg, #eaf4f4, #f9fbfb);
  display: grid;