:root {
  --green: #0b3d2e;
  --green-2: #146c43;
  --gold: #c9a227;
  --navy: #0b1f3a;
  --blue: #1e5a9a;
  --blue-2: #2f7fd4;
  --blue-soft: rgba(47, 127, 212, 0.22);
  --ink: #1c2430;
  --muted: #5c6b7a;
  --line: #d7deea;
  --bg: #f4f1ea;
  --paper: #ffffff;
  --danger: #9b1c1c;
  --warn: #9a6700;
  --ok: #0f6b3b;
  --shadow: 0 10px 30px rgba(11, 31, 58, 0.08);
  --radius: 16px;
  --topbar: #ffffff;
  --sidebar-w: 300px;
}
html[data-theme="dark"] {
  --ink: #e8eef7;
  --muted: #9aacbf;
  --line: #2a3d58;
  --bg: #0c1422;
  --paper: #152033;
  --navy: #d7deea;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --topbar: #101a2b;
  --ok: #5dce8f;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "IBM Plex Sans Arabic", "Noto Naskh Arabic", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

a { color: var(--green); text-decoration: none; }
img { max-width: 100%; }

.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}
.auth-hero {
  background:
    linear-gradient(160deg, rgba(11, 61, 46, 0.92), rgba(11, 31, 58, 0.88)),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c9a227' fill-opacity='0.08'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  color: #fff;
  padding: 64px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: visible;
}
.auth-hero h1 { font-size: 32px; line-height: 1.45; margin: 24px 0 12px; word-break: break-word; }
.crest, .brand-mark, .splash-crest {
  width: auto;
  height: auto;
  border: 0 !important;
  border-radius: 0 !important;
  display: block;
  background: transparent !important;
  font-size: 0;
  line-height: 0;
  -webkit-mask-image: none !important;
  mask-image: none !important;
  overflow: visible !important;
}
.brand-slot {
  display: block;
  width: 220px !important;
  height: 220px !important;
  margin: 0 auto 18px;
  background: #fff;
  border-radius: 50% !important;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden !important;
  position: relative;
  z-index: 2;
  flex-shrink: 0 !important;
}
.brand-slot--splash {
  width: 220px !important;
  height: 220px !important;
}
.brand-slot--hero {
  width: 220px !important;
  height: 220px !important;
  margin: 0 0 16px;
  flex-shrink: 0 !important;
}
.brand-slot--sidebar {
  width: 48px !important;
  height: 48px !important;
  margin: 0 !important;
  flex: 0 0 48px !important;
}
.brand-logo,
.brand-logo--full,
.brand-logo--mark {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  object-fit: contain !important;
  object-position: center !important;
  border-radius: 50% !important;
  background: #fff !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  transform: none !important;
}
.brand-slot--splash .brand-logo,
.brand-slot--hero .brand-logo {
  padding: 10% !important;
}
.sidebar .crest,
.sidebar .brand-mark,
.sidebar .brand-slot--sidebar {
  width: 48px !important;
  height: 48px !important;
  flex: 0 0 48px !important;
  max-width: 48px !important;
}
.splash-glow,
.splash-ring {
  display: none !important;
}
.auth-hero p { opacity: 0.88; max-width: 520px; line-height: 1.9; }
.auth-meta { font-size: 13px; color: #e8d48a; }
.auth-panel { display: grid; place-items: center; padding: 40px 28px; }
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.auth-card { width: min(460px, 100%); padding: 32px; }
.kicker {
  color: var(--green-2); font-weight: 700; font-size: 12px;
  letter-spacing: 0.8px; margin-bottom: 8px;
}
h2 { margin: 0 0 8px; font-size: 24px; color: var(--navy); }
.sub { color: var(--muted); margin-bottom: 22px; }

label { display: block; font-size: 13px; margin: 12px 0 6px; color: var(--navy); font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%;
  border: 1px solid #cfd7e3;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  background: #fbfcfe;
}
.input:focus { outline: 2px solid #c9a22755; border-color: var(--gold); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check-row { display: flex; align-items: center; gap: 8px; margin: 14px 0; font-size: 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 12px 18px; cursor: pointer;
  font-family: inherit; font-weight: 700;
}
.btn-primary { background: var(--green); color: #fff; width: 100%; margin-top: 10px; }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--navy); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 8px 12px; font-size: 13px; width: auto; }
.help { text-align: center; margin-top: 16px; color: var(--muted); font-size: 14px; }
.errorlist { color: var(--danger); padding: 0; list-style: none; font-size: 13px; }
.messages { list-style: none; padding: 0; }
.messages li { padding: 10px 12px; border-radius: 10px; margin-bottom: 10px; background: #e8f5ee; color: var(--ok); }
.messages li.error, .messages .error { background: #fde8e8; color: var(--danger); }

.app {
  display: block;
  min-height: 100vh;
  position: relative;
}
/* المحتوى يترك فراغ لليمين مكان الشريط */
.app > main {
  min-width: 0;
  min-height: 100vh;
  margin-right: var(--sidebar-w);
  margin-left: 0;
  box-sizing: border-box;
}
html[dir="ltr"] .app > main {
  margin-right: 0;
  margin-left: var(--sidebar-w);
}
/* الشريط مثبت بالكامل على يمين الشاشة */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  left: auto !important;
  bottom: 0 !important;
  width: var(--sidebar-w) !important;
  max-width: var(--sidebar-w);
  height: 100vh;
  max-height: 100vh;
  background:
    linear-gradient(165deg, rgba(11, 31, 58, 0.96), rgba(7, 19, 38, 0.98)),
    radial-gradient(120% 80% at 0% 0%, rgba(47, 127, 212, 0.18), transparent 55%);
  color: #e8eef7;
  padding: 18px 12px 16px;
  overflow: hidden;
  isolation: isolate;
  z-index: 1250;
  border-left: 1px solid rgba(147, 180, 220, 0.12);
  box-sizing: border-box;
}
html[dir="ltr"] .sidebar {
  right: auto !important;
  left: 0 !important;
  border-left: 0;
  border-right: 1px solid rgba(147, 180, 220, 0.12);
}
.brand {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  padding: 4px 2px 14px;
  border-bottom: 1px solid #1d3358;
  flex: 0 0 auto;
}
.brand-text {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.25;
}
.brand strong {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  line-height: 1.3;
}
.brand small {
  color: #c9a227;
  display: block;
  font-size: 11px;
  margin-top: 2px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 2px 4px 12px;
  overscroll-behavior: contain;
}
.nav .sec {
  margin: 12px 8px 3px;
  padding-top: 8px;
  border-top: 1px solid rgba(142,160,189,0.22);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #c9a227;
}
.nav .sec:first-child {
  margin-top: 4px;
  padding-top: 0;
  border-top: 0;
}
.nav-rail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: #d5deee;
  font-size: 12.25px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1.4;
  text-align: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.nav-rail > span:first-child {
  flex: 1 1 auto;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.nav-rail:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
  border-color: rgba(201,162,39,0.28);
}
.nav-rail.active,
.nav-rail[aria-expanded="true"] {
  background: linear-gradient(180deg, #dfb83a, #c9a227);
  color: #0b1f3a;
  border-color: #e8c85a;
  box-shadow: 0 6px 14px rgba(201, 162, 39, 0.22);
}
.nav-rail__hint {
  flex: 0 0 auto;
  font-size: 16px;
  line-height: 1;
  opacity: 0.8;
}

/* Overlay — يفتح من اليمين بجانب الشريط + أنيميشن ناعم */
.nav-overlay-root {
  position: fixed;
  inset: 0;
  z-index: 1200;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1),
    visibility 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}
.nav-overlay-root.is-open {
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
}
.nav-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 12, 22, 0.48);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}
.nav-overlay-root.is-open .nav-overlay-backdrop {
  opacity: 1;
}
.nav-overlay {
  position: fixed !important;
  top: 0 !important;
  bottom: 0 !important;
  right: var(--sidebar-w) !important;
  left: auto !important;
  width: 360px;
  max-width: calc(100vw - var(--sidebar-w) - 8px);
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 16px;
  box-sizing: border-box;
  color: #e8eef7;
  border-radius: 16px 0 0 16px;
  border: 1px solid rgba(201, 162, 39, 0.22);
  border-right: 0;
  background:
    linear-gradient(165deg, rgba(14, 28, 48, 0.94), rgba(10, 20, 36, 0.96)),
    rgba(12, 22, 38, 0.88);
  box-shadow: -16px 0 40px rgba(5, 12, 24, 0.45);
  backdrop-filter: blur(22px) saturate(1.12);
  -webkit-backdrop-filter: blur(22px) saturate(1.12);
  transform: translateX(22px);
  opacity: 0;
  overflow: hidden;
  transition:
    transform 0.4s cubic-bezier(0.25, 1, 0.5, 1),
    opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  z-index: 1210;
}
html[dir="ltr"] .nav-overlay {
  left: var(--sidebar-w) !important;
  right: auto !important;
  border-radius: 0 16px 16px 0;
  border-right: 1px solid rgba(201, 162, 39, 0.22);
  border-left: 0;
  box-shadow: 16px 0 40px rgba(5, 12, 24, 0.45);
  transform: translateX(-22px);
}
.nav-overlay-root.is-open .nav-overlay {
  transform: translateX(0) !important;
  opacity: 1;
}
.nav-overlay__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
  padding: 2px 2px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(201, 162, 39, 0.28);
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1) 0.04s,
    transform 0.4s cubic-bezier(0.25, 1, 0.5, 1) 0.04s;
}
.nav-overlay-root.is-open .nav-overlay__head {
  opacity: 1;
  transform: translateY(0);
}
.nav-overlay__titles { min-width: 0; flex: 1 1 auto; text-align: right; }
.nav-overlay__eyebrow {
  margin: 0 0 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: #c9a227;
}
.nav-overlay__title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  line-height: 1.35;
}
.nav-overlay__close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.nav-overlay__close:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(201,162,39,0.4);
  transform: scale(1.04);
}
.nav-overlay__nav {
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 6px 2px 4px;
  overscroll-behavior: contain;
  direction: rtl;
  text-align: right;
}
.nav-overlay__nav[hidden] { display: none !important; }
.nav-overlay__card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  padding: 11px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #fff;
  text-decoration: none;
  box-sizing: border-box;
  width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: right;
  opacity: 0;
  transform: translateX(22px);
  transition:
    background 0.35s cubic-bezier(0.25, 1, 0.5, 1),
    border-color 0.35s cubic-bezier(0.25, 1, 0.5, 1),
    box-shadow 0.35s cubic-bezier(0.25, 1, 0.5, 1),
    transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}
html[dir="ltr"] .nav-overlay__card {
  text-align: left;
  transform: translateX(-22px);
}
/* يُشغَّل من JS عبر class is-animating */
.nav-overlay__card.is-animating {
  animation: navCardIn 0.4s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}
html[dir="ltr"] .nav-overlay__card.is-animating {
  animation-name: navCardInLtr;
}
@keyframes navCardIn {
  0% {
    opacity: 0;
    transform: translateX(22px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes navCardInLtr {
  0% {
    opacity: 0;
    transform: translateX(-22px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}
.nav-overlay__card.is-shown {
  opacity: 1;
  transform: translateX(0);
}
.nav-overlay__card.is-shown:hover,
.nav-overlay__card.is-animating:hover {
  background: rgba(47, 127, 212, 0.16);
  border-color: rgba(47, 127, 212, 0.45);
  transform: translateY(-2px) scale(1.02) !important;
  box-shadow:
    0 8px 22px rgba(30, 90, 154, 0.28),
    0 0 0 1px rgba(130, 190, 255, 0.22),
    0 0 18px rgba(47, 127, 212, 0.22);
}
.nav-overlay__card.is-active {
  background: linear-gradient(180deg, #dfb83a, #c9a227);
  color: #0b1f3a;
  border-color: #e8c85a;
  box-shadow: 0 6px 16px rgba(201, 162, 39, 0.24);
}
.nav-overlay__card.is-active.is-shown:hover,
.nav-overlay__card.is-active.is-animating:hover {
  background: linear-gradient(180deg, #e4c04a, #d0ab32);
  border-color: #f0d56a;
  box-shadow:
    0 8px 22px rgba(201, 162, 39, 0.32),
    0 0 16px rgba(47, 127, 212, 0.18);
}
.nav-overlay__card-label {
  font-size: 12.75px;
  font-weight: 700;
  line-height: 1.4;
}
.nav-overlay__card-hint {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  opacity: 0.78;
  color: #b7c6d8;
}
.nav-overlay__card.is-active .nav-overlay__card-hint {
  color: #2a3a52;
  opacity: 0.9;
}
body.nav-overlay-lock { overflow: hidden; }
@media (max-width: 980px) {
  .nav-overlay,
  html[dir="ltr"] .nav-overlay {
    right: 0 !important;
    left: auto !important;
    width: calc(100vw - 56px);
    max-width: 380px;
    border-radius: 18px 0 0 18px;
    transform: translateX(105%);
  }
  html[dir="ltr"] .nav-overlay {
    left: 0 !important;
    right: auto !important;
    border-radius: 0 18px 18px 0;
    transform: translateX(-105%);
  }
  .nav-overlay-root.is-open .nav-overlay {
    transform: translateX(0) !important;
  }
}


/* تبويبات دمج الأقسام داخل الصفحة (احتياطي للصفحات التي ما زالت تستخدمها) */
.ops-hub {
  margin-bottom: 18px;
}
.ops-hub__head {
  margin: 0 0 12px;
}
.ops-hub__eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 800;
  color: #8a6a10;
  letter-spacing: 0.02em;
}
.ops-hub__title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--navy);
}
.hub-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, #0d1828, #121c2b);
  border: 1px solid #2a3f5c;
  box-shadow: 0 10px 28px rgba(7, 19, 38, 0.22);
}
.hub-tabs--ops {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  margin-bottom: 0;
}
.hub-tabs--users {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}
.hub-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 12px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: #b7c6d8;
  font-weight: 800;
  font-size: 13.5px;
  line-height: 1.35;
  border: 1px solid transparent;
  text-align: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.hub-tab:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
  border-color: rgba(201,162,39,0.28);
  transform: translateY(-1px);
}
.hub-tab.is-active {
  background: linear-gradient(180deg, #dfb83a, #c9a227);
  color: #0b1f3a;
  border-color: #e8c85a;
  box-shadow: 0 8px 18px rgba(201, 162, 39, 0.28);
}
.hub-panel { margin-top: 4px; }
.hub-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 22px 24px;
  border: 1px solid rgba(11, 61, 46, 0.25);
  background: linear-gradient(180deg, #ffffff, #f4fcf7);
}
.hub-cta__text h2 { margin: 0 0 6px; font-size: 22px; color: var(--navy); }
.hub-cta__btn {
  width: auto;
  margin: 0;
  min-width: 180px;
  min-height: 52px;
  font-size: 16px;
}

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px; background: var(--topbar); border-bottom: 3px solid var(--gold);
}
.topbar h1 { font-size: 18px; margin: 0; color: var(--navy); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.theme-toggle, .bell {
  position: relative; width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--line); display: grid; place-items: center;
  background: var(--paper); color: var(--navy); cursor: pointer; font-size: 16px;
}
.bell-wrap { position: relative; }
.badge {
  position: absolute; top: -6px; left: -6px; background: #b42318; color: #fff;
  border-radius: 99px; min-width: 18px; height: 18px; font-size: 11px; display: grid; place-items: center;
}
.badge.is-live { animation: badgePulse 0.8s ease 4; }
@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}
.notice-panel {
  position: absolute; top: 50px; left: 0; width: min(360px, 86vw);
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); z-index: 25; overflow: hidden;
}
.notice-head, .notice-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--ink);
}
.notice-foot { display: block; text-align: center; border-bottom: 0; border-top: 1px solid var(--line); font-size: 13px; }
.notice-list { max-height: 320px; overflow: auto; }
.notice-item {
  display: block; padding: 10px 12px; border-bottom: 1px solid var(--line);
  color: var(--ink); font-size: 13px;
}
.notice-item.unread { background: color-mix(in srgb, var(--gold) 14%, var(--paper)); }
.notice-item small { display: block; color: var(--muted); margin-top: 4px; }
.who { display: flex; align-items: center; gap: 10px; }
.avatar, .avatar-lg {
  border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 700;
  overflow: hidden; border: 2px solid var(--gold);
}
.avatar { width: 40px; height: 40px; }
.avatar-lg { width: 88px; height: 88px; font-size: 28px; }
.avatar img, .avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.content {
  padding: 24px;
  direction: rtl;
  text-align: right;
}
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, 1fr); }
.kpi {
  padding: 18px; background: var(--paper); border-radius: var(--radius); border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: right;
}
.kpi span { color: var(--muted); font-size: 12.5px; }
.kpi b { display: block; font-size: 24px; margin-top: 8px; color: var(--navy); text-align: right; }
.panel { padding: 18px; text-align: right; }
.panel h3 { margin: 0 0 14px; color: var(--navy); text-align: right; font-size: 16px; }
.table-wrap {
  overflow: auto;
  direction: rtl;
  text-align: right;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
  direction: rtl;
}
th, td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right !important;
  font-size: 13px;
  vertical-align: middle;
}
th {
  background: color-mix(in srgb, var(--gold) 18%, var(--paper));
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
}

/* محاذاة يمين كاملة — الجداول والمحتوى مع الشريط */
html[dir="rtl"] main,
html[dir="rtl"] .content,
html[dir="rtl"] .panel,
html[dir="rtl"] .card,
html[dir="rtl"] .topbar,
html[dir="rtl"] .finx,
html[dir="rtl"] .fin-app,
html[dir="rtl"] .fin-detail,
html[dir="rtl"] .messages,
html[dir="rtl"] .filters,
html[dir="rtl"] .finx-head,
html[dir="rtl"] .finx-filters {
  direction: rtl;
  text-align: right;
}
html[dir="rtl"] .topbar h1,
html[dir="rtl"] .panel h3,
html[dir="rtl"] .content h1,
html[dir="rtl"] .content h2,
html[dir="rtl"] .content h3,
html[dir="rtl"] .content p,
html[dir="rtl"] .content label,
html[dir="rtl"] .content .sub,
html[dir="rtl"] .kpi span,
html[dir="rtl"] .kpi b,
html[dir="rtl"] .finx-title,
html[dir="rtl"] .finx-subtitle {
  text-align: right;
}
html[dir="rtl"] table,
html[dir="rtl"] .finx-table,
html[dir="rtl"] .fin-table,
html[dir="rtl"] .table-wrap,
html[dir="rtl"] .finx-table-wrap,
html[dir="rtl"] .fin-table-wrap {
  direction: rtl;
  text-align: right;
}
html[dir="rtl"] th,
html[dir="rtl"] td,
html[dir="rtl"] .finx-table th,
html[dir="rtl"] .finx-table td,
html[dir="rtl"] .fin-table th,
html[dir="rtl"] .fin-table td {
  text-align: right !important;
}
html[dir="rtl"] .finx,
html[dir="rtl"] .fin-app,
html[dir="rtl"] .finx-form-panel,
html[dir="rtl"] .content > .card,
html[dir="rtl"] .content > .panel,
html[dir="rtl"] .content > .finx,
html[dir="rtl"] .content > form,
html[dir="rtl"] .content > .grid,
html[dir="rtl"] .content > .table-wrap {
  margin-left: auto;
  margin-right: 0;
  width: 100%;
}
html[dir="rtl"] .topbar {
  flex-direction: row;
}
html[dir="rtl"] input,
html[dir="rtl"] textarea,
html[dir="rtl"] select,
html[dir="rtl"] .input {
  text-align: right;
  direction: rtl;
}
html[dir="ltr"] .content,
html[dir="ltr"] .table-wrap,
html[dir="ltr"] table {
  direction: ltr;
  text-align: left;
}
html[dir="ltr"] th,
html[dir="ltr"] td {
  text-align: left !important;
}
.pill {
  display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.st-PENDING { background: #fff4d6; color: #854d0e; }
.st-UNDER_REVIEW { background: #fff4d6; color: #854d0e; }
.st-APPROVED { background: #e6f6ed; color: #146c43; }
.st-RETURNED { background: #fde8e8; color: #9b1c1c; }
.st-REJECTED { background: #fde8e8; color: #9b1c1c; }

/* —— القسم المالي — نفس تصميم بطاقة المهام —— */
.finx {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  max-width: 980px;
  margin: 0;
}
html[dir="rtl"] .finx { margin-left: auto; margin-right: 0; }
html[dir="ltr"] .finx { margin-left: 0; margin-right: auto; }
.finx * { box-sizing: border-box; }

.finx-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}
.finx-eyebrow { display: none; }
.finx-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.35;
  color: var(--navy);
  font-weight: 800;
}
.finx-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.finx-muted { color: var(--muted); font-size: 14px; line-height: 1.7; }
.finx-section-title {
  margin: 0 0 14px;
  font-size: 18px;
  color: var(--navy);
  font-weight: 800;
}

.finx-privacy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  min-width: min(360px, 100%);
}
.finx-privacy.is-open { border-color: #b7e0c7; background: #f4fcf7; }
.finx-privacy__text { display: grid; gap: 2px; min-width: 0; }
.finx-privacy__text strong { font-size: 14px; color: var(--navy); font-weight: 800; }
.finx-privacy__text span { font-size: 13px; color: var(--muted); }
.finx-lock {
  padding: 8px 12px;
  border-radius: 10px;
  background: #f4f1ea;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.finx-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, #0d1828, #121c2b);
  border: 1px solid #2a3f5c;
  box-shadow: 0 10px 28px rgba(7, 19, 38, 0.22);
}
.finx-tabs--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.finx-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 14px 12px;
  border-radius: 999px;
  text-decoration: none;
  color: #b7c6d8;
  font-weight: 800;
  font-size: 15px;
  line-height: 1.35;
  text-align: center;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
}
.finx-tab:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
  border-color: rgba(201,162,39,0.28);
}
.finx-tab.is-active {
  background: linear-gradient(180deg, #dfb83a, #c9a227);
  color: #0b1f3a;
  border-color: #e8c85a;
}

.finx-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow);
}
.finx-panel + .finx-panel { margin-top: 0; }
.finx-panel__intro { margin-bottom: 18px; }
.finx-panel__intro h2,
.finx-panel__intro h3 {
  margin: 0 0 8px;
  font-size: 22px;
  color: var(--navy);
  font-weight: 800;
}
.finx-panel__intro p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}
.finx-panel__intro--row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.finx-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.finx-stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.finx-stat__label { font-size: 13px; font-weight: 700; color: var(--muted); }
.finx-stat__value {
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.finx-stat__meta {
  margin-top: auto;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.finx-stat--pending { border-color: #e8d39a; background: #fffdf5; }
.finx-stat--pending .finx-stat__value { color: #854d0e; }
.finx-stat--ok { border-color: #b7e0c7; background: #f4fcf7; }
.finx-stat--ok .finx-stat__value { color: #146c43; }
.finx-stat--bad { border-color: #e7b6b6; background: #fff7f7; }
.finx-stat--bad .finx-stat__value { color: #9b1c1c; }
.finx-stat--gold { border-color: rgba(201,162,39,0.45); background: #fff9e6; }
.finx-stat--gold .finx-stat__value { color: #8a6a10; }

.finx-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}
.finx-card-link {
  display: grid;
  gap: 6px;
  padding: 18px 20px;
  border-radius: var(--radius);
  text-decoration: none;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--ink);
  transition: border-color 0.15s, transform 0.15s;
}
.finx-card-link:hover { border-color: var(--green); transform: translateY(-1px); }
.finx-card-link strong { font-size: 18px; color: var(--navy); }
.finx-card-link span { font-size: 14px; color: var(--muted); }
.finx-card-link--green { border-color: #b7e0c7; background: #f4fcf7; }

.finx-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.finx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  width: auto;
  margin: 0;
  line-height: 1.3;
}
.finx-btn--primary { background: var(--green); color: #fff; border-color: var(--green); }
.finx-btn--gold { background: var(--gold); color: var(--navy); }
.finx-btn--dark { background: var(--navy); color: #fff; }
.finx-btn--outline {
  background: transparent;
  color: var(--navy);
  border-color: var(--line);
}
.finx-btn--ghost {
  background: transparent;
  color: var(--navy);
  border-color: var(--line);
}
.finx-btn--danger { background: var(--danger); color: #fff; }
.finx-btn--block { width: 100%; }
.finx-btn--sm { min-height: 40px; padding: 8px 14px; font-size: 14px; }
.finx-btn--pill { border-radius: 999px; }
.finx-type-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: rgba(201,162,39,0.16);
  color: #8a6a10;
  border: 1px solid rgba(201,162,39,0.35);
}
.finx-type-pill--withfee {
  background: rgba(11,61,46,0.1);
  color: #0b3d2e;
  border-color: rgba(11,61,46,0.25);
}
.finx-type-pill--fee {
  background: rgba(11,31,58,0.08);
  color: #0b1f3a;
  border-color: rgba(11,31,58,0.2);
}
.finx-approver-chip {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 14px 18px;
  border-radius: 999px;
  background: #f4fcf7;
  border: 1px solid #b7e0c7;
  font-weight: 800;
  font-size: 16px;
  color: var(--navy);
}
.finx-approver-chip--role {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-height: 0;
  padding: 18px 22px;
  border-radius: 22px;
  background: linear-gradient(145deg, #0b1f3a 0%, #0b3d2e 100%);
  border: 1px solid rgba(201,162,39,0.45);
  color: #fff;
  box-shadow: 0 12px 28px rgba(11, 31, 58, 0.16);
}
.finx-approver-chip__eyebrow {
  display: inline-flex;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(201,162,39,0.22);
  color: #f8e7a8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.finx-approver-chip--role strong {
  font-size: 20px;
  line-height: 1.35;
  color: #fff;
  font-weight: 800;
}
.finx-approver-chip--role em {
  font-style: normal;
  font-size: 14px;
  color: #c5d0dc;
  font-weight: 600;
}

.finx-create {
  display: grid;
  gap: 12px;
  max-width: 100%;
}
.finx-create-wrap { max-width: 860px; }
.finx-create-head { margin-bottom: 22px; }
.finx-create-head h2 {
  margin: 6px 0 10px;
  font-size: 28px;
  color: var(--navy);
  font-weight: 800;
}
.finx-create-head .sub { font-size: 16px; line-height: 1.7; }
.finx-fee-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.finx-fee-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 220px;
  padding: 28px 26px;
  border-radius: 28px;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(145deg, #0b1f3a 0%, #0b3d2e 100%);
  border: 1px solid rgba(201,162,39,0.45);
  box-shadow: 0 14px 32px rgba(11, 31, 58, 0.18);
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.finx-fee-card--alt {
  background: linear-gradient(145deg, #0b3d2e 0%, #12324a 100%);
}
.finx-fee-card:hover {
  transform: translateY(-3px);
  border-color: #c9a227;
  box-shadow: 0 18px 40px rgba(11, 31, 58, 0.24);
}
.finx-fee-card__badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(201,162,39,0.2);
  color: #f8e7a8;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.finx-fee-card__title {
  font-size: 26px;
  line-height: 1.3;
  color: #fff;
  font-weight: 800;
}
.finx-fee-card__desc {
  font-size: 16px;
  line-height: 1.65;
  color: #c5d0dc;
}
.finx-fee-card__meta {
  margin-top: auto;
  font-style: normal;
  font-size: 15px;
  font-weight: 800;
  color: #f8e7a8;
}
.finx-fee-card__go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-height: 48px;
  margin-top: 6px;
  border-radius: 999px;
  background: #c9a227;
  color: #0b1f3a;
  font-weight: 800;
  font-size: 16px;
}
.finx-split--solo { grid-template-columns: 1fr; max-width: 520px; }
.finx-choice {
  display: grid;
  gap: 6px;
  padding: 18px 20px;
  border-radius: 12px;
  border: 1px solid #cfd7e3;
  background: #fbfcfe;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.finx-choice--lg { min-height: 88px; }
.finx-choice:hover { border-color: var(--green); background: #fff; }
.finx-choice strong { font-size: 18px; color: var(--navy); }
.finx-choice span { color: var(--muted); font-size: 14px; line-height: 1.6; }
.finx-choice em { color: var(--green-2); font-style: normal; font-size: 13px; font-weight: 700; }
.finx-choice-group {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}
.finx-choice-group__title {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--line);
}
.finx-choice-group__title strong { color: var(--navy); font-size: 16px; }
.finx-choice-group__title span { color: var(--muted); font-size: 13px; }
.finx-choice--sub { background: #fbfcfe; }
.finx-choice--sub strong { font-size: 16px; }

.finx-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.finx-input,
.finx-filters .input,
.finx .input {
  width: auto;
  min-width: 150px;
  margin: 0;
}
.finx-filters input[type="search"] { flex: 1; min-width: 180px; }

.finx-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}
.finx-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  table-layout: fixed;
}
.finx-table-wrap { direction: rtl; }
.finx-table { direction: rtl; }
.finx-table th {
  background: #f7f9fc;
  color: var(--navy);
  font-size: 13px;
  font-weight: 800;
  padding: 14px 12px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.finx-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: middle;
  text-align: right;
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.finx-table tbody tr:last-child td { border-bottom: 0; }
.finx-table tbody tr:hover td { background: #fafbfc; }
.finx-num { font-variant-numeric: tabular-nums; }
.is-masked,
.fin-masked {
  letter-spacing: 0.16em;
  color: #64748b !important;
  font-weight: 700;
  user-select: none;
}
.finx-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 8px;
  background: #fff4d6;
  color: #854d0e;
  font-size: 12px;
  font-weight: 800;
}
.finx-state {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}
.finx-state--pending { background: #fff4d6; color: #854d0e; }
.finx-state--approved { background: #e6f6ed; color: #146c43; }
.finx-state--rejected { background: #fde8e8; color: #9b1c1c; }
.finx-link {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
}
.finx-empty {
  white-space: normal !important;
  padding: 28px 16px !important;
  color: var(--muted);
  font-size: 14px !important;
  text-align: center;
}

.finx-audit { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.finx-audit h3 { margin: 0 0 14px; color: var(--navy); font-size: 16px; }
.finx-audit ul,
.finx-audit-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.finx-audit li,
.finx-audit-list li {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fbfcfe;
}
.finx-audit time,
.finx-audit-list time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.finx-audit strong,
.finx-audit-list strong { display: block; color: var(--navy); margin-bottom: 4px; font-size: 14px; }
.finx-audit span,
.finx-audit-list span { color: var(--muted); font-size: 13px; }

.finx-dialog {
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  max-width: 460px;
  width: calc(100% - 24px);
  background: transparent;
}
.finx-dialog::backdrop { background: rgba(28, 36, 48, 0.45); }
.finx-dialog__card {
  background: var(--paper);
  color: var(--ink);
  padding: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.finx-dialog__card .finx-eyebrow {
  display: block;
  color: var(--green-2);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}
.finx-dialog__card h3 { margin: 0 0 8px; color: var(--navy); font-size: 22px; }
.finx-dialog__sub { margin: 0 0 14px; color: var(--muted); line-height: 1.7; font-size: 14px; }
.finx-dialog__card label { display: block; margin: 12px 0 6px; color: var(--navy); font-weight: 600; font-size: 13px; }
.finx-dialog__actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

.finx-form-panel {
  max-width: 860px;
  width: 100%;
  margin: 0;
  padding: 32px 36px;
  border-radius: 28px;
}
html[dir="rtl"] .finx-form-panel { margin-left: auto; margin-right: 0; }
html[dir="ltr"] .finx-form-panel { margin-left: 0; margin-right: auto; }
.finx-form-head { margin-bottom: 18px; }
.finx-form-head h2 {
  margin: 14px 0 10px;
  font-size: 28px;
  color: var(--navy);
  font-weight: 800;
}
.finx-form-head p,
.finx-form-panel > .sub {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}
.fin-yesno {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 6px;
}
.fin-yesno__opt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  cursor: pointer;
  font-weight: 600;
}
.fin-yesno__opt:has(input:checked) {
  border-color: color-mix(in srgb, var(--green) 55%, var(--line));
  background: color-mix(in srgb, var(--green) 10%, var(--paper));
  color: var(--green);
}
.fin-yesno__opt input { margin: 0; accent-color: var(--green); }

.fin-form .fin-field { margin: 0 0 8px; }
.fin-form .fin-field label {
  display: block;
  margin: 14px 0 8px;
  font-weight: 800;
  color: var(--navy);
  font-size: 15px;
}
.fin-field__hint {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}
.fin-field--approve {
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: transparent;
}
.fin-flow-card {
  margin: 0 0 22px;
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid #b7e0c7;
  background: #f4fcf7;
}
.fin-flow-card strong { display: block; color: var(--navy); margin-bottom: 10px; font-size: 16px; font-weight: 800; }
.fin-flow-card ol { margin: 0; padding-right: 20px; color: var(--muted); font-size: 15px; line-height: 1.85; }
.fin-terms__box {
  max-height: 220px;
  overflow: auto;
  padding: 16px 18px;
  border: 1px solid #cfd7e3;
  border-radius: 18px;
  background: #fbfcfe;
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink);
  white-space: pre-wrap;
}
.fin-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fin-sign {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfe;
}
.fin-sign span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; font-weight: 700; }
.fin-sign img { height: 64px; background: #fff; border-radius: 8px; display: block; }
.fin-sign small { display: block; margin-top: 6px; color: var(--muted); }
.fin-form .input,
.fin-form textarea,
.fin-form select,
.fin-select,
select.fin-select {
  width: 100%;
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid #cfd7e3;
  padding: 14px 16px;
  font-size: 16px;
  font-family: inherit;
  background: #fbfcfe;
}
.fin-form textarea { min-height: 140px; resize: vertical; border-radius: 18px; }
.fin-select:focus,
.fin-form .input:focus,
.fin-form select:focus,
.fin-form textarea:focus {
  outline: 2px solid #c9a22755;
  border-color: var(--gold);
}
.fin-unit {
  display: inline;
  margin-right: 4px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.fin-attach {
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
}
.fin-form-actions {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}
.fin-form-actions .btn-primary,
.fin-form-actions .finx-btn--primary {
  width: 100%;
  margin-top: 4px;
  min-height: 54px;
  font-size: 17px;
  border-radius: 999px;
}
.fin-form-actions__links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.fin-detail__hero {
  border-radius: var(--radius);
  padding: 24px 28px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.fin-detail__badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.fin-detail__supplier { margin: 0 0 6px; font-size: 22px; color: var(--navy); font-weight: 800; }
.fin-detail__amount {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 800;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}
.fin-detail__meta { color: var(--muted) !important; font-size: 13px !important; margin: 0; }
.fin-detail__grid {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 16px;
}
.fin-detail__main { display: flex; flex-direction: column; gap: 16px; }
.fin-detail__aside { display: flex; flex-direction: column; gap: 16px; }
.fin-details-box {
  background: #fbfcfe;
  border: 1px solid #cfd7e3;
  border-radius: 12px;
  padding: 14px;
  line-height: 1.8;
  margin-bottom: 14px;
  white-space: pre-wrap;
  font-size: 14px;
}
.fin-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fin-meta {
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.fin-meta span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; font-weight: 600; }
.fin-meta b { color: var(--navy); font-size: 14px; }
.fin-meta--wide { grid-column: 1 / -1; }
.fin-attach-form { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.fin-reject-form { margin-top: 12px; display: grid; gap: 8px; }
.fin-reject-form label { font-weight: 600; color: var(--navy); font-size: 13px; margin: 0; }
.finx-side-actions { display: flex; flex-direction: column; gap: 8px; }

.fin-timeline { list-style: none; padding: 0; margin: 0; border-right: 3px solid #e8eef5; }
.fin-timeline li { position: relative; padding: 0 16px 16px 0; margin-right: 10px; }
.fin-timeline li::before {
  content: "";
  position: absolute;
  right: -8px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #cfd7e3;
  border: 2px solid #fff;
}
.fin-timeline li.is-done::before { background: #146c43; }
.fin-timeline li.is-on::before { background: var(--gold); box-shadow: 0 0 0 4px #fff4d6; }
.fin-timeline strong { display: block; color: var(--navy); margin-bottom: 2px; font-size: 14px; }
.fin-timeline span { display: block; color: var(--muted); font-size: 13px; }

.finance-type-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 8px;
  background: #fff4d6;
  color: #854d0e;
  font-weight: 800;
  font-size: 12px;
}
.finance-type-badge--nofee { background: #e6f6ed; color: #146c43; }
.finance-type-badge--withfee { background: #fff4d6; color: #854d0e; }
.finance-type-badge--fee { background: #eef2f7; color: #334155; }
.finance-approve-box {
  border: 1px solid var(--line) !important;
  background: var(--paper) !important;
}
.finance-icon { display: none; }
.fin-num { font-variant-numeric: tabular-nums; }
.fin-app { max-width: 980px; margin: 0; display: flex; flex-direction: column; gap: 16px; }
html[dir="rtl"] .fin-app { margin-left: auto; margin-right: 0; }
html[dir="ltr"] .fin-app { margin-left: 0; margin-right: auto; }
.fin-privacy-bar, .fin-kicker, .fin-hero, .fin-glass, .fin-section, .finance-grid, .finance-card, .fin-type-stack, .fin-fee-group { /* legacy unused */ }

@media (max-width: 980px) {
  .finx-tabs,
  .finx-tabs--4 { grid-template-columns: repeat(2, 1fr); }
  .hub-tabs--ops { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hub-tabs--users { grid-template-columns: 1fr 1fr; }
  .finx-stats { grid-template-columns: 1fr 1fr; }
  .fin-detail__grid { grid-template-columns: 1fr; }
  .finx-fee-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .finx-head { flex-direction: column; }
  .finx-tabs,
  .finx-tabs--4 { grid-template-columns: 1fr; }
  .hub-tabs--ops { grid-template-columns: 1fr; }
  .hub-tabs--users { grid-template-columns: 1fr; }
  .hub-tab { font-size: 13px; min-height: 48px; }
  .finx-split { grid-template-columns: 1fr; }
  .finx-panel,
  .finx-form-panel { padding: 20px; }
  .fin-meta-grid { grid-template-columns: 1fr; }
  .finx-audit li,
  .finx-audit-list li { grid-template-columns: 1fr; }
  .finx-fee-card__title { font-size: 22px; }
}
@media (max-width: 560px) {
  .finx-stats { grid-template-columns: 1fr; }
}

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters .input { width: auto; min-width: 160px; }

/* اختيار المسؤولين — متوافق مع Django 5 (div) والإصدارات الأقدم (ul) */
.task-form .assignee-checks,
.assignee-checks {
  list-style: none;
  margin: 0;
  padding: 12px;
  border: 1px solid #cfd7e3;
  border-radius: 14px;
  background: #fbfcfe;
  max-height: 320px;
  overflow: auto;
  display: grid;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}
.task-form .assignee-checks > div,
.task-form .assignee-checks > li,
.assignee-checks > div,
.assignee-checks > li {
  margin: 0;
  padding: 0;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e8eef5;
}
.task-form .assignee-checks label,
.assignee-checks label {
  display: flex !important;
  align-items: center;
  gap: 12px;
  margin: 0 !important;
  padding: 12px 14px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  border-radius: 12px;
  color: var(--navy);
  user-select: none;
}
.task-form .assignee-checks label:hover,
.assignee-checks label:hover {
  background: #f4fcf7;
  border-color: #b7e0c7;
}
.task-form .assignee-checks input[type="checkbox"],
.assignee-checks input[type="checkbox"] {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px;
  margin: 0 !important;
  accent-color: var(--green);
  flex-shrink: 0;
  cursor: pointer;
  pointer-events: auto;
}
.timeline { border-right: 3px solid var(--gold); padding-right: 16px; }
.comment { background: #f7f9fc; border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.file-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #fff; font-size: 13px; }
.toast-stack {
  position: fixed; left: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 40;
}
.toast { background: var(--navy); color: #fff; padding: 12px 14px; border-radius: 12px; border-right: 4px solid var(--gold); max-width: 320px; }
.split { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 16px; }
.chart-box { position: relative; height: 280px; }
.chart-box canvas { width: 100% !important; height: 100% !important; }
.mobile-toggle { display: none; }

@media (max-width: 980px) {
  .auth-wrap, .kpis, .split, .row-2 { grid-template-columns: 1fr; }
  .app > main {
    margin-right: 0 !important;
    margin-left: 0 !important;
  }
  .sidebar {
    right: calc(-1 * var(--sidebar-w)) !important;
    left: auto !important;
    width: var(--sidebar-w) !important;
    max-width: 88vw;
    z-index: 1300;
    transition: right 0.25s ease;
  }
  .sidebar.open { right: 0 !important; }
  html[dir="ltr"] .sidebar {
    right: auto !important;
    left: calc(-1 * var(--sidebar-w)) !important;
    transition: left 0.25s ease;
  }
  html[dir="ltr"] .sidebar.open {
    left: 0 !important;
    right: auto !important;
  }
  .mobile-toggle { display: inline-flex; }
  .auth-hero { display: none; }
  .content { padding: 16px; }
}

.splash {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(201,162,39,.28), transparent 42%),
    linear-gradient(160deg, #07180f 0%, #0b3d2e 42%, #0b1f3a 100%);
  color: #fff;
  overflow: hidden;
  animation: splashHold 3.4s ease forwards;
}
.splash-done .splash { display: none; }
.splash.is-out {
  animation: splashOut 0.9s ease forwards;
  pointer-events: none;
}
.splash-glow {
  position: absolute; width: 480px; height: 480px; border-radius: 50%;
  background: radial-gradient(circle, rgba(201,162,39,.35), transparent 68%);
  animation: pulse 2.4s ease-in-out infinite;
}
.splash-ring {
  position: absolute; width: 220px; height: 220px; border-radius: 50%;
  border: 1px solid rgba(201,162,39,.45);
  animation: spinRing 8s linear infinite;
}
.splash-inner { position: relative; text-align: center; z-index: 1; }
.splash-kicker {
  color: #e8d48a; letter-spacing: 1px; font-size: 13px;
  animation: rise 1.1s ease 0.15s both;
}
.splash-hello {
  font-size: clamp(36px, 7vw, 64px); margin: 8px 0 10px; color: #fff;
  animation: rise 1.2s ease 0.28s both;
}
.splash-brand {
  opacity: 0.86; animation: rise 1.2s ease 0.42s both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: .7; }
  50% { transform: scale(1.12); opacity: 1; }
}
@keyframes spinRing { to { transform: rotate(360deg); } }
@keyframes splashOut {
  to { opacity: 0; filter: blur(8px); transform: scale(1.04); visibility: hidden; }
}
@keyframes splashHold { 0%, 100% { opacity: 1; } }

.welcome-hero {
  background: linear-gradient(120deg, #0b3d2e, #0b1f3a);
  color: #fff; border-radius: var(--radius);
  padding: 22px 28px; border: 1px solid rgba(201,162,39,.55);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.welcome-hero h2 { color: #fff; font-size: clamp(22px, 3vw, 32px); margin: 4px 0 8px; }
.welcome-hero .sub { color: #d7deea; }
.welcome-hero .kicker { color: #e8d48a; }
.welcome-enter { animation: rise 0.8s ease both; }

.modal-overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(7, 19, 38, .62);
  display: grid; place-items: center; padding: 18px;
}
.modal-card {
  width: min(560px, 100%); background: #fff; border-radius: 20px;
  padding: 26px; box-shadow: 0 24px 60px rgba(0,0,0,.25);
  border-top: 4px solid var(--gold); animation: rise .45s ease both;
}
.tour-steps { display: grid; gap: 10px; margin: 16px 0; }
.tour-step {
  display: none; gap: 12px; align-items: flex-start;
  padding: 12px; border-radius: 12px; background: #f7f4ee;
}
.tour-step.is-active { display: flex; }
.tour-step span {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 32px;
  display: grid; place-items: center; background: var(--green); color: #fff; font-weight: 700;
}
.tour-step p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.tour-nav, .tour-actions { display: flex; gap: 8px; justify-content: space-between; align-items: center; }
.tour-actions { margin-top: 14px; }
.tour-actions .btn-primary { width: auto; margin-top: 0; }
html[data-theme="dark"] .input, html[data-theme="dark"] select.input, html[data-theme="dark"] textarea.input {
  background: #101a2b; color: var(--ink); border-color: #2a3d58;
}
html[data-theme="dark"] .comment { background: #101a2b; }
html[data-theme="dark"] .modal-card { background: #152033; color: var(--ink); }
html[dir="ltr"] body { font-family: "Source Sans 3", "IBM Plex Sans Arabic", sans-serif; }
.about-hero {
  background: linear-gradient(120deg, #0b3d2e, #0b1f3a);
  color: #fff; border-radius: var(--radius);
  padding: 28px 32px; border: 1px solid rgba(201,162,39,.55);
  margin-bottom: 18px;
}
.about-hero h2 { color: #fff; margin: 6px 0 10px; }
.about-hero p { color: #d7deea; max-width: 820px; line-height: 1.9; }
.about-grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 16px; margin-bottom: 16px; }
.assistants-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.officer-card { text-align: center; }
.officer-card .avatar-lg { margin: 8px auto 12px; }
.officer-card h3 { margin: 0 0 6px; }
.owner-card { border-top: 4px solid var(--gold); }
.officer-card.vacant { opacity: 0.78; border-style: dashed; }
.about-copy p { line-height: 1.95; color: var(--ink); }
@media (max-width: 980px) {
  .about-grid, .assistants-row { grid-template-columns: 1fr; }
}
html[dir="ltr"] th, html[dir="ltr"] td { text-align: left; }
html[dir="ltr"] .splash-hello span { display: block; font-size: 0.45em; opacity: .8; }
.lang-switch {
  display: grid; place-items: center; min-width: 40px; height: 42px; padding: 0 8px;
  border-radius: 12px; border: 1px solid var(--line); color: var(--navy); font-weight: 700; font-size: 12px;
  background: var(--paper);
}
.lang-switch.is-on { background: var(--green); color: #fff; border-color: var(--green); }
.gis-map { height: 480px; border-radius: 14px; margin-top: 10px; z-index: 1; }
.notes-drawer { position: fixed; bottom: 18px; right: 18px; z-index: 35; }
html[dir="ltr"] .notes-drawer { right: auto; left: 18px; }
.notes-tab {
  border: 0; background: var(--green); color: #fff; border-radius: 999px; padding: 10px 16px;
  font-weight: 700; cursor: pointer; font-family: inherit;
}
.notes-box {
  display: none; width: min(320px, 86vw); margin-top: 8px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: var(--shadow);
}
.notes-drawer.open .notes-box { display: block; }
.notes-box textarea { min-height: 140px; }
.splash-hello span { display: block; font-size: 0.42em; font-weight: 600; opacity: .85; margin-top: 6px; }

.nafath-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.nafath-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(160deg, #0b3d2e, #146c43);
  color: #e8d48a; font-weight: 800; font-size: 13px;
  display: grid; place-items: center; border: 1px solid var(--gold);
}
.nafath-number {
  margin: 18px auto; width: 120px; height: 120px; border-radius: 24px;
  display: grid; place-items: center;
  font-size: 48px; font-weight: 800; color: var(--navy);
  background: color-mix(in srgb, var(--gold) 22%, var(--paper));
  border: 2px solid var(--gold); letter-spacing: 2px;
  box-shadow: var(--shadow);
}
.nafath-phone { position: relative; height: 88px; margin: 8px 0 16px; display: grid; place-items: center; }
.nafath-pulse {
  position: absolute; width: 70px; height: 70px; border-radius: 50%;
  border: 2px solid rgba(20, 108, 67, .35); animation: nafathPulse 1.8s ease-out infinite;
}
.nafath-pulse.delay { animation-delay: .6s; }
.nafath-device {
  position: relative; z-index: 1; background: var(--navy); color: #fff;
  border-radius: 14px; padding: 10px 14px; font-size: 13px; font-weight: 700;
}
.nafath-status { text-align: center; color: var(--muted); min-height: 24px; }
.nafath-status.is-ok { color: var(--ok); font-weight: 700; }
.nafath-wait .input { text-align: center; letter-spacing: 0.35em; font-size: 18px; font-weight: 700; }
@keyframes nafathPulse {
  from { transform: scale(0.7); opacity: .8; }
  to { transform: scale(1.55); opacity: 0; }
}

/* ── Page & content entrance (fade + slide, staggered) ── */
:root {
  --page-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --page-dur: 0.42s;
  --page-stagger: 0.12s;
  --page-from-y: 18px;
  --page-from-x: 16px; /* RTL: من اليمين */
}

html[dir="ltr"] {
  --page-from-x: -16px;
}

@keyframes pageEnterIn {
  from {
    opacity: 0;
    transform: translate3d(var(--page-from-x), var(--page-from-y), 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  /* قبل تشغيل JS: أخفِ منطقة المحتوى لمنع وميض */
  html.page-enter-pending .app .content,
  html.page-enter-pending .app .topbar h1 {
    opacity: 0;
  }

  .page-enter-item {
    opacity: 0;
    animation: pageEnterIn var(--page-dur) var(--page-ease) both;
    animation-delay: calc(var(--enter-i, 0) * var(--page-stagger));
    will-change: opacity, transform;
  }

  .page-enter-item.page-enter-done {
    opacity: 1;
    transform: none;
    animation: none;
    will-change: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-enter-item {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
}

/* —— مساعد المنصة الذكي —— */
.guide-ai__hero { margin-bottom: 16px; }
.guide-ai__chat { display: flex; flex-direction: column; gap: 12px; }
.guide-ai__messages {
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px;
}
.guide-ai__bubble {
  max-width: min(92%, 560px);
  padding: 12px 14px;
  border-radius: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}
.guide-ai__bubble strong { display: block; margin-bottom: 6px; color: var(--navy); }
.guide-ai__bubble p { margin: 0; }
.guide-ai__bubble--bot {
  background: color-mix(in srgb, var(--green) 8%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--green) 22%, var(--line));
  align-self: flex-start;
}
.guide-ai__bubble--user {
  background: color-mix(in srgb, var(--gold) 16%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--line));
  align-self: flex-end;
}
.guide-ai__bubble a { font-weight: 700; }
.guide-ai__suggestions,
.guide-ai__topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.guide-ai__chip,
.guide-ai__topic {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.guide-ai__chip:hover,
.guide-ai__topic:hover {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  background: color-mix(in srgb, var(--green) 8%, var(--paper));
}
.guide-ai__form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.guide-ai__form .input { flex: 1; }
.guide-ai__form .btn { width: auto; margin: 0; white-space: nowrap; }

.guide-fab {
  position: fixed;
  z-index: 80;
  left: 18px;
  bottom: 18px;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--green), #0f5c40);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 12px 28px rgba(11, 61, 46, 0.28);
  cursor: pointer;
}
html[dir="ltr"] .guide-fab { left: auto; right: 18px; }
.guide-fab:hover { transform: translateY(-1px); }

.guide-dock {
  position: fixed;
  z-index: 81;
  left: 18px;
  bottom: 84px;
  width: min(380px, calc(100vw - 36px));
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(11, 31, 58, 0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
html[dir="ltr"] .guide-dock { left: auto; right: 18px; }
.guide-dock.is-open { display: flex; }
.guide-dock__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--green) 10%, var(--paper));
  border-bottom: 1px solid var(--line);
}
.guide-dock__head strong { color: var(--navy); }
.guide-dock__head a,
.guide-dock__head button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.guide-dock .guide-ai__messages { min-height: 180px; max-height: 280px; padding: 12px; }
.guide-dock .guide-ai__suggestions { padding: 0 12px 8px; }
.guide-dock .guide-ai__form { padding: 0 12px 12px; }

@media (max-width: 720px) {
  .guide-fab { left: 12px; bottom: 12px; }
  html[dir="ltr"] .guide-fab { right: 12px; left: auto; }
  .guide-dock { left: 12px; right: 12px; width: auto; bottom: 76px; }
  html[dir="ltr"] .guide-dock { left: 12px; right: 12px; }
}

.voice-studio { max-width: 820px; }
.voice-studio__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 8px;
}
.voice-studio__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.voice-studio__actions .btn { width: auto; margin: 0; }
.voice-studio__preview {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--green) 25%, var(--line));
  background: color-mix(in srgb, var(--green) 8%, var(--paper));
  line-height: 1.7;
}
.voice-studio textarea.input { min-height: 140px; }
