/* واجهة فاتحة — أزرق أساسي #007bff، خلفية #f8f9fa (مشابه لأنظمة الإدارة الحديثة) */
:root {
  --bg-page: #f8f9fa;
  --surface: #ffffff;
  --border: #e9ecef;
  --text: #212529;
  --muted: #6c757d;
  --primary: #007bff;
  --primary-hover: #0069d9;
  --primary-soft: #e7f1ff;
  --danger: #dc3545;
  --danger-soft: #fde8ea;
  --success: #28a745;
  --success-soft: #e6f4ea;
  --warning-soft: #fff8e6;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
  --radius: 12px;
  --radius-pill: 14px;
  font-family: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* ----- تخطيط التطبيق + الشريط العلوي ----- */
.app-shell .layout-stacked {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-bar {
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 0.85rem 1.25rem;
}

.top-bar-inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
  max-width: 1280px;
  margin-inline: auto;
  row-gap: 0.75rem;
}

.top-bar-user {
  flex-shrink: 0;
}

.top-bar-nav {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex: 0 1 auto;
  gap: 0.75rem;
  flex-wrap: wrap;
  min-width: 0;
  margin-inline-start: auto;
}

.btn-logout-circle {
  flex-shrink: 0;
  margin-inline-start: 1rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn-logout-circle:hover {
  background: var(--primary-soft);
  border-color: rgba(0, 123, 255, 0.35);
  color: var(--primary-hover);
  text-decoration: none;
}

.btn-logout-circle:active {
  transform: scale(0.96);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  background: var(--bg-page);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
}

.user-card-top {
  margin-bottom: 0;
  padding: 0.65rem 1rem;
  background: var(--surface);
  box-shadow: none;
}

.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4edda, #b8e0c4);
  color: #1e7e34;
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.user-info strong {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.8rem;
  color: var(--muted);
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1.15rem;
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid transparent;
}

.nav-item-topbar.nav-item-outline {
  background: var(--surface);
  border-color: #dee2e6;
  color: var(--muted);
  box-shadow: none;
}

.nav-item-topbar.nav-item-outline:hover {
  background: var(--bg-page);
  color: var(--text);
  border-color: #ced4da;
  text-decoration: none;
}

.nav-item-topbar.nav-item-outline .nav-icon {
  color: var(--muted);
  opacity: 1;
}

.nav-item:hover {
  text-decoration: none;
}

.nav-item.active {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(0, 123, 255, 0.38);
}

.nav-item.active:hover {
  color: #fff;
  background: var(--primary-hover);
  text-decoration: none;
}

.nav-item.active .nav-icon {
  color: #fff;
  opacity: 1;
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  opacity: 0.9;
  flex-shrink: 0;
}

.main-area {
  flex: 1;
  min-width: 0;
  padding: 1.25rem 1.5rem;
}

.content-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  padding: 1.75rem 2rem;
  max-width: 1200px;
  margin-inline: auto;
  min-height: calc(100vh - 140px);
}

h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 1.25rem;
  color: var(--text);
}

/* ----- صفحات الدخول ----- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg-page);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-md);
}

.auth-card h1 {
  margin-top: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

.auth-card form .btn.primary {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem 1.25rem;
}

.btn-biometric {
  width: 100%;
  margin-top: 0.85rem;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-biometric:hover {
  background: var(--bg-page);
  border-color: #ced4da;
}

.btn-biometric svg {
  color: var(--primary);
}

/* ----- تصميم صفحة الدخول (عصري) ----- */
.login-special-page {
  min-height: 100vh;
  margin: 0;
  padding: 1.5rem 1.25rem 2rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Cairo", "Segoe UI", Tahoma, sans-serif;
  overflow-x: hidden;
}

.login-special-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 90% 70% at 100% 0%, rgba(0, 123, 255, 0.35) 0%, transparent 55%),
    radial-gradient(ellipse 80% 60% at 0% 100%, rgba(34, 197, 94, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 50% 50%, rgba(255, 255, 255, 0.04) 0%, transparent 60%),
    linear-gradient(165deg, #0b1220 0%, #0f172a 45%, #0c1929 100%);
  pointer-events: none;
}

.login-special-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='2' cy='2' r='1'/%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.9;
}

.login-special-layout {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.login-special-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-special-logo {
  width: 96px;
  height: 96px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: #fff;
  padding: 6px;
  overflow: hidden;
}

.login-special-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 50%;
}

.login-special-title {
  color: #f8fafc;
  font-size: clamp(1.45rem, 4vw, 1.85rem);
  font-weight: 700;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
  line-height: 1.4;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.35);
}

.login-special-tagline {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: rgba(226, 232, 240, 0.82);
  line-height: 1.55;
  max-width: 28em;
  margin-inline: auto;
}

.login-special-card {
  background: rgba(255, 255, 255, 0.97);
  border-radius: 22px;
  padding: 1.5rem 1.5rem 1.65rem;
  width: 100%;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.06),
    0 24px 48px -12px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(20px);
}

.login-special-alert {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.login-special-form {
  margin: 0;
}

.login-special-group {
  margin-bottom: 1.15rem;
}

.login-special-group:last-of-type {
  margin-bottom: 0.25rem;
}

.login-special-group label {
  display: block;
  text-align: right;
  color: #334155;
  font-weight: 600;
  font-size: 0.82rem;
  margin-bottom: 0.45rem;
  letter-spacing: 0.01em;
}

.login-special-field {
  position: relative;
  display: block;
}

.login-special-field-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  inset-inline-end: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  pointer-events: none;
}

.login-special-input-ltr {
  text-align: left;
}

.btn-special-submit {
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.88rem 1.25rem;
  border: none;
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, #0056b3 100%);
  box-shadow:
    0 4px 14px rgba(0, 123, 255, 0.35),
    0 1px 0 rgba(255, 255, 255, 0.12) inset;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-special-submit:hover {
  filter: brightness(1.05);
  box-shadow: 0 8px 22px rgba(0, 123, 255, 0.4);
}

.btn-special-submit:active {
  transform: scale(0.98);
}

.btn-special-faceid {
  margin-top: 1.25rem;
  width: 100%;
  max-width: 420px;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 250, 252, 0.92);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.btn-special-faceid small {
  font-weight: 500;
  opacity: 0.75;
  font-size: 0.82em;
}

.btn-special-faceid:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
}

.btn-special-faceid:active {
  transform: scale(0.99);
}

@media (max-width: 380px) {
  .login-special-card {
    padding: 1.25rem 1.15rem;
  }

  .login-special-title {
    font-size: 1.35rem;
  }
}

label {
  display: block;
  margin-bottom: 0.85rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
select,
textarea {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

/* يتجاوز الحقول العامة داخل صفحة الدخول */
.login-special-page .login-special-field input[type="email"],
.login-special-page .login-special-field input[type="password"] {
  margin-top: 0;
  padding: 0.8rem 2.75rem 0.8rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
  color: #0f172a;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.login-special-page .login-special-field input[type="email"]:hover,
.login-special-page .login-special-field input[type="password"]:hover {
  border-color: #cbd5e1;
}

.login-special-page .login-special-field input[type="email"]:focus,
.login-special-page .login-special-field input[type="password"]:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.18);
}

.login-special-page .login-special-field input::placeholder {
  color: #94a3b8;
}

textarea {
  resize: vertical;
}

/* ----- أزرار ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.35);
}

.btn.primary:hover {
  background: var(--primary-hover);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
}

.btn.ghost {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn.ghost:hover {
  background: var(--bg-page);
  color: var(--text);
  text-decoration: none;
  border-color: #ced4da;
}

.btn.secondary {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(0, 123, 255, 0.25);
}

.btn.secondary:hover {
  background: #d6e8ff;
  color: var(--primary-hover);
  text-decoration: none;
}

.btn.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(220, 53, 69, 0.35);
}

.btn.danger:hover {
  background: #f5c6cb;
  color: #bd2130;
  text-decoration: none;
}

.btn.small {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  border-radius: 10px;
}

.error {
  color: #721c24;
  background: var(--danger-soft);
  border: 1px solid rgba(220, 53, 69, 0.25);
  padding: 0.7rem 1rem;
  border-radius: 10px;
}

.success {
  color: #155724;
  background: var(--success-soft);
  border: 1px solid rgba(40, 167, 69, 0.25);
  padding: 0.7rem 1rem;
  border-radius: 10px;
}

.notice {
  color: var(--muted);
}

.container {
  max-width: none;
  margin: 0;
  padding: 0;
}

.actions-bar {
  margin-bottom: 1.25rem;
}

/* ----- لوحة المهام (مطابقة تخطيط المرجع) ----- */
.dashboard-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-title-dashboard {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text);
}

.btn-dashboard-new {
  padding: 0.65rem 1.5rem;
  border-radius: 12px;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(0, 123, 255, 0.35);
}

.tasks-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  overflow-y: hidden;
  box-shadow: var(--shadow-sm);
}

.tasks-table .task-title-cell {
  max-width: 420px;
  vertical-align: top;
}

.tasks-table th.task-title-col-head {
  width: auto;
}

.tasks-table .task-title-cell .task-title-inline {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  flex-direction: row;
  width: 100%;
}

.tasks-table .task-title-cell .task-title-text-block {
  flex: 1;
  min-width: 0;
}

.tasks-table .task-num-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0.2rem 0.45rem;
  box-sizing: border-box;
  font-weight: 800;
  font-size: 1.85rem;
  line-height: 1;
  color: var(--danger);
  border: 3px solid var(--danger);
  border-radius: 4px;
  background: rgba(220, 53, 69, 0.06);
}

.task-title-main {
  font-weight: 700;
  font-size: 1.1rem;
  color: #1e7e34;
  line-height: 1.4;
}

.task-desc {
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
  font-weight: 400;
}

.due-hijri {
  display: inline-block;
  margin-top: 0.2rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: #5c4d7a;
  line-height: 1.35;
  direction: ltr;
  unicode-bidi: isolate;
}

.due-gregorian {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--muted);
}

.data-table th.task-assignees-head,
.data-table td.task-assignees-cell {
  text-align: left;
  vertical-align: middle;
}

.data-table td.task-assignees-cell {
  white-space: nowrap;
  line-height: 1.45;
}

.col-complete-head {
  width: 1%;
  min-width: 118px;
  text-align: center;
  white-space: nowrap;
}

.col-complete-cell {
  vertical-align: middle;
  text-align: center;
}

.form-complete-toggle {
  display: inline-block;
  margin: 0;
}

/* عمود الحالة: قيد التنفيذ (نفس أسلوب مكتملة، أصفر) | مكتملة (أخضر) */
.btn-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 118px;
  padding: 0.55rem 1.2rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.92rem;
  box-sizing: border-box;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-status-progress {
  font-family: inherit;
  background: var(--warning-soft);
  color: #856404;
  border: 1px solid rgba(212, 160, 23, 0.55);
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease, background 0.15s ease;
}

.btn-status-progress:hover {
  filter: brightness(0.97);
  background: #fff3cd;
}

.btn-status-progress:active {
  transform: scale(0.98);
}

.btn-status-done {
  font-family: inherit;
  background: var(--success-soft);
  color: #1e7e34;
  border: 1px solid rgba(40, 167, 69, 0.4);
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.btn-status-done:hover {
  filter: brightness(0.97);
  background: #d4edda;
}

.btn-status-done:active {
  transform: scale(0.98);
}

.dashboard-task-actions {
  gap: 0.45rem;
}

/* تعديل: خلفية فاتحة + أيقونة زرقاء */
.icon-btn-edit-light {
  background: #e8f4fc !important;
  color: var(--primary) !important;
  border: 1px solid rgba(0, 123, 255, 0.28) !important;
  box-shadow: none !important;
}

.icon-btn-edit-light:hover {
  filter: none !important;
  background: #d6ecfc !important;
  color: #0056b3 !important;
}

.icon-btn-edit-light svg {
  stroke: currentColor !important;
}

/* حذف: أزرق غامق + أيقونة بيضاء */
.icon-btn-del-dark {
  background: linear-gradient(180deg, #1565c0 0%, #0d47a1 100%) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 2px 6px rgba(13, 71, 161, 0.35) !important;
}

.icon-btn-del-dark:hover {
  filter: brightness(1.08) !important;
}

.icon-btn-del-dark svg {
  stroke: #fff !important;
}

/* خلفية المهام من التدرج على الخلايا؛ لا نلوّن صفّ الـ tr */
.tasks-table tbody tr.task-row,
.tasks-table tbody tr.task-row:nth-child(even) {
  background: transparent;
}

.tasks-table tbody tr.task-row:hover {
  background: transparent;
}

.empty {
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  background: var(--surface);
}

.data-table thead th {
  background: var(--bg-page);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: none;
}

.data-table th,
.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
}

.data-table tbody tr:nth-child(even) {
  background: #fcfcfd;
}

.data-table tbody tr:hover {
  background: var(--primary-soft);
}

.data-table.tasks-table tbody tr.task-row:hover {
  background: transparent;
}

/* كل صفوف المهام: نفس تدرج «مكتملة» */
.tasks-table tbody tr.task-row td {
  background: linear-gradient(
    125deg,
    #ecfdf5 0%,
    #e0f2fe 48%,
    #f5f3ff 100%
  );
  opacity: 1;
  color: #334155;
  border-bottom-color: rgba(16, 185, 129, 0.15);
}

.tasks-table tbody tr.task-row:hover td {
  background: linear-gradient(
    125deg,
    #d1fae5 0%,
    #dbeafe 48%,
    #ede9fe 100%
  );
}

/* مهام مكتملة: خلفية عصرية مميزة (رمادي–بنفسجي هادئ) */
.tasks-table tbody tr.task-row.row-done td {
  background: linear-gradient(
    128deg,
    #f8fafc 0%,
    #f1f0ff 42%,
    #ede9fe 100%
  );
  border-bottom-color: rgba(99, 102, 241, 0.14);
}

.tasks-table tbody tr.task-row.row-done:hover td {
  background: linear-gradient(
    128deg,
    #f1f5f9 0%,
    #e8e6ff 45%,
    #e0e7ff 100%
  );
}

.tasks-table tbody tr.task-row.row-done .task-title-main {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.15em;
  color: #64748b;
}

.desc-row td {
  padding-top: 0;
  padding-bottom: 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
  background: #fafbfc !important;
}

.prio {
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
}

.prio-low {
  background: var(--success-soft);
  color: #1e7e34;
}

.prio-medium {
  background: var(--warning-soft);
  color: #856404;
}

.prio-high {
  background: var(--danger-soft);
  color: #721c24;
}

.cell-actions {
  white-space: nowrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.col-actions-head {
  width: 1%;
  min-width: 88px;
  text-align: end;
}

.cell-actions.col-actions-left {
  vertical-align: middle;
  text-align: end;
  padding-inline-start: 1rem;
}

.table-icon-actions {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

/* أيقونات خطية بيضاء على خلفية زرقاء (مثل المرجع) */
.icon-btn-table {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  background: #1a5ee6;
  box-shadow: 0 1px 4px rgba(26, 94, 230, 0.35);
  transition: filter 0.15s ease, transform 0.1s ease;
}

.icon-btn-table:hover {
  filter: brightness(1.08);
  text-decoration: none;
  color: #fff;
}

.icon-btn-table:active {
  transform: scale(0.96);
}

.icon-btn-table svg {
  flex-shrink: 0;
}

.icon-btn-table-edit,
.icon-btn-table-del {
  background: linear-gradient(180deg, #2563eb 0%, #1a5ee6 100%);
}

.table-inline-delete {
  display: inline-flex;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  vertical-align: middle;
  align-items: center;
}

.cell-actions a {
  font-weight: 600;
}

.cell-actions a,
.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 0;
  text-decoration: none;
}

.cell-actions a:hover,
.link-btn:hover {
  text-decoration: underline;
}

.inline-form {
  display: inline;
}

.stack-form label {
  margin-bottom: 1rem;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.checkbox input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--primary);
  border-radius: 4px;
  cursor: pointer;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.delete-form {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--border);
}

.section-block {
  margin-bottom: 1.75rem;
  max-width: none;
  padding: 1.25rem 1.5rem;
  background: var(--bg-page);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.section-block h2 {
  font-size: 1.1rem;
  margin-top: 0;
  font-weight: 700;
  color: var(--text);
}

.inline-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.inline-row label {
  flex: 1;
  min-width: 180px;
}

.copy-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0;
  padding: 0.85rem 1rem;
  background: var(--primary-soft);
  border-radius: 10px;
  border: 1px solid rgba(0, 123, 255, 0.2);
}

.copy-box code {
  word-break: break-all;
  font-size: 0.8rem;
  color: #004085;
}

form button[type="submit"] {
  font-family: inherit;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.form-field {
  margin-bottom: 1rem;
}

.field-label {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.assignee-list {
  max-height: 16rem;
  overflow-y: auto;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.assignee-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.55rem 0;
  margin: 0;
  cursor: pointer;
  color: var(--text);
  font-size: 0.95rem;
  border-radius: 8px;
}

.assignee-row:hover {
  background: var(--bg-page);
}

.assignee-row input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.2rem;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.assignee-text {
  flex: 1;
  line-height: 1.5;
}

.assignee-mail {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ----- نموذج مهمة جديدة / تعديل (تخطيط عصري) ----- */
.task-form-shell {
  max-width: 560px;
  margin-inline: auto;
}

.task-form-header {
  margin-bottom: 1.2rem;
}

.task-form-title {
  margin: 0 0 0.4rem;
  font-size: 1.72rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}

.task-form-lead {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.65;
  max-width: 44ch;
}

.task-form-error {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: var(--danger-soft);
  border: 1px solid rgba(220, 53, 69, 0.28);
  font-weight: 600;
}

.task-form-card {
  margin: 0;
  padding: 1.5rem 1.35rem 1.55rem;
  background: linear-gradient(165deg, #ffffff 0%, #f7f9fc 50%, #eef2f8 100%);
  border: 1px solid rgba(0, 123, 255, 0.14);
  border-radius: 18px;
  box-shadow:
    0 10px 40px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.task-form-card.stack-form label:not(.checkbox):not(.assignee-row) {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
}

.task-form-card input[type="text"],
.task-form-card textarea,
.task-form-card select {
  width: 100%;
  margin-top: 0.45rem;
  padding: 0.78rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.15s ease;
}

.task-form-card input[type="text"]:hover,
.task-form-card textarea:hover,
.task-form-card select:hover {
  border-color: #cbd5e1;
}

.task-form-card input[type="text"]:focus,
.task-form-card textarea:focus,
.task-form-card select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.2);
  background: #fff;
}

.task-form-card textarea {
  min-height: 7.5rem;
  resize: vertical;
  line-height: 1.55;
}

.task-form-card label.checkbox {
  color: var(--text);
  font-weight: 600;
  margin-bottom: 0.85rem;
  padding: 0.75rem 1rem;
  background: rgba(0, 123, 255, 0.06);
  border-radius: 12px;
  border: 1px solid rgba(0, 123, 255, 0.12);
}

.task-form-card .task-due-picker-trigger {
  border: 2px solid #e2e8f0;
  background: #fff;
  border-radius: 12px;
}

.task-form-card .task-due-picker-trigger:focus {
  box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.2);
}

.task-form-card .assignee-list {
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfcff 0%, #ffffff 100%);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.85);
}

.task-form-card .assignee-row:hover {
  background: var(--primary-soft);
}

.task-form-actions {
  margin-top: 1.35rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(15, 23, 42, 0.07);
}

.task-form-submit {
  box-shadow: 0 4px 16px rgba(0, 123, 255, 0.32);
}

.task-form-delete {
  margin-top: 1.35rem;
  padding: 1rem 1.2rem;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff5f5 0%, #fde8ea 100%);
  border: 1px dashed rgba(220, 53, 69, 0.45);
}

/* ----- نافذة تأكيد الحذف (عربي + ألوان واضحة) ----- */
body.modal-delete-open {
  overflow: hidden;
}

.modal-delete-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(33, 37, 41, 0.55);
  backdrop-filter: blur(3px);
}

.modal-delete-overlay[hidden] {
  display: none !important;
}

.modal-delete-dialog {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.06);
  padding: 1.75rem 1.75rem 1.5rem;
  text-align: right;
  border-top: 4px solid #dc3545;
  animation: modal-delete-in 0.2s ease-out;
}

@keyframes modal-delete-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-delete-icon-wrap {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: #fde8ea;
  color: #c82333;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-delete-icon {
  flex-shrink: 0;
}

.modal-delete-heading {
  margin: 0 0 0.65rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  text-align: right;
}

.modal-delete-text {
  margin: 0 0 1.5rem;
  font-size: 1rem;
  line-height: 1.65;
  color: #495057;
  text-align: right;
}

.modal-delete-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: flex-start;
}

.modal-delete-btn-cancel {
  flex: 1;
  min-width: 120px;
  padding: 0.65rem 1.1rem;
  font-weight: 600;
  border-radius: 12px;
  background: #f8f9fa;
  color: var(--text);
  border: 1px solid #dee2e6;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.modal-delete-btn-cancel:hover {
  background: #e9ecef;
  border-color: #ced4da;
}

.modal-delete-btn-confirm {
  flex: 1;
  min-width: 120px;
  padding: 0.65rem 1.1rem;
  font-weight: 700;
  border-radius: 12px;
  background: #dc3545;
  color: #fff;
  border: 1px solid #c82333;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.35);
  transition: background 0.15s ease, filter 0.15s ease;
}

.modal-delete-btn-confirm:hover {
  background: #c82333;
  filter: brightness(1.02);
}

.modal-delete-btn-confirm:focus-visible,
.modal-delete-btn-cancel:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .top-bar {
    padding: 0.75rem 1rem;
  }

  .top-bar-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .top-bar-user {
    flex: 1;
    min-width: 0;
  }

  .user-card-top {
    width: 100%;
    margin-bottom: 0;
  }

  .top-bar-nav {
    flex: 1 1 100%;
    width: 100%;
    justify-content: center;
    margin-inline-start: 0;
    order: 3;
    margin-top: 0.5rem;
  }

  .nav-item-topbar {
    flex: 1;
    justify-content: center;
    min-width: 0;
  }

  .btn-logout-circle {
    margin-inline-start: auto;
    align-self: center;
    order: 2;
  }

  .main-area {
    padding: 1rem;
  }

  .content-card {
    padding: 1.25rem;
    min-height: auto;
  }

  /* Responsive Tables */
  .table-wrap {
    border: none;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
  }

  .data-table,
  .data-table thead,
  .data-table tbody,
  .data-table th,
  .data-table td,
  .data-table tr {
    display: block;
  }

  .data-table thead tr {
    display: none;
  }

  .data-table tr {
    background: var(--surface) !important;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    padding: 0.5rem;
  }

  .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    text-align: left;
    min-height: 3rem;
  }

  .data-table td:last-child {
    border-bottom: 0;
  }

  .data-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--muted);
    font-size: 0.85rem;
    text-align: right;
    margin-inline-end: 1rem;
    flex-shrink: 0;
  }

  .tasks-table .task-title-cell {
    max-width: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .tasks-table .task-title-cell::before {
    margin-bottom: 0.25rem;
  }

  .tasks-table .task-title-inline {
    align-items: flex-start;
    gap: 0.5rem;
  }

  .tasks-table .task-num-box {
    font-size: 1.65rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
  }

  /* نفس محاذاة التاريخ والأولوية: التسمية يمين والقيمة يسار (space-between) */
  .tasks-table .task-assignees-cell {
    justify-content: space-between;
    align-items: center;
    gap: 0;
  }

  .tasks-table .task-assignees-cell .task-assignees-value {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    text-align: left;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tasks-table .task-assignees-cell::before {
    flex-shrink: 0;
  }

  .col-complete-cell {
    text-align: left;
  }

  .cell-actions.col-actions-left {
    text-align: left;
    padding-inline-start: 1rem;
  }

  .table-icon-actions {
    justify-content: flex-end;
  }
}

/* ----- منتقي تاريخ المهمة (ميلادي / هجري) ----- */
.task-due-picker {
  position: relative;
  margin-bottom: 1rem;
}

.task-due-picker-label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.task-due-picker-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.task-due-picker-trigger {
  width: 100%;
  max-width: 100%;
  text-align: right;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.task-due-picker-trigger:hover {
  border-color: #ced4da;
}

.task-due-picker-trigger:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

.task-due-picker-panel {
  position: absolute;
  z-index: 10050;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  max-width: 340px;
  margin-inline: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 0.65rem 0.75rem 0.75rem;
}

.task-due-picker-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.task-due-picker-title {
  flex: 1 1 auto;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  min-width: 0;
}

.task-due-picker-nav {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-page);
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.task-due-picker-nav:hover {
  background: var(--primary-soft);
  border-color: rgba(0, 123, 255, 0.35);
}

.task-due-picker-mode {
  flex: 1 1 100%;
  margin-top: 0.25rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  cursor: pointer;
  font-family: inherit;
}

.task-due-picker-mode:hover {
  filter: brightness(0.97);
}

.task-due-picker-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 0.35rem;
  direction: rtl;
}

.task-due-picker-wd {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  padding: 0.2rem 0;
}

.task-due-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  direction: rtl;
}

.task-due-picker-cell {
  aspect-ratio: 1;
  max-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}

.task-due-picker-cell:hover:not(:disabled) {
  background: var(--primary-soft);
}

.task-due-picker-cell.is-selected {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.task-due-picker-cell.is-empty {
  cursor: default;
  visibility: hidden;
}

.task-due-picker-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 0.65rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.task-due-picker-foot-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: inherit;
  padding: 0.25rem 0.35rem;
}

.task-due-picker-foot-btn:hover {
  text-decoration: underline;
}
