/* =========================================================================
   Portal — application design system
   Layered over Bootstrap 5 (RTL/LTR). Tokens in oklch; theme-aware via
   [data-bs-theme]. Direction-agnostic: uses logical properties + CSS vars so
   the same rules serve rtl (fa/ar) and ltr (en). Motion respects
   prefers-reduced-motion.
   ========================================================================= */

/* ---- Vazirmatn (self-hosted, no CDN) ------------------------------------ */
/* woff2 files live under assets/vendor/vazirmatn/fonts. font-display: swap so
   text paints immediately in the system fallback, then swaps in Vazirmatn. */
@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../vendor/vazirmatn/fonts/Vazirmatn-400.woff2") format("woff2");
}
@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../vendor/vazirmatn/fonts/Vazirmatn-500.woff2") format("woff2");
}
@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../vendor/vazirmatn/fonts/Vazirmatn-600.woff2") format("woff2");
}
@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../vendor/vazirmatn/fonts/Vazirmatn-700.woff2") format("woff2");
}
@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../vendor/vazirmatn/fonts/Vazirmatn-800.woff2") format("woff2");
}

/* ---- Cairo (self-hosted) — Arabic UI face ------------------------------- */
@font-face {
  font-family: "Cairo";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("../vendor/cairo/fonts/cairo-arabic-400.woff2") format("woff2"),
       url("../vendor/cairo/fonts/cairo-latin-400.woff2") format("woff2");
}
@font-face {
  font-family: "Cairo";
  font-style: normal; font-weight: 500; font-display: swap;
  src: url("../vendor/cairo/fonts/cairo-arabic-500.woff2") format("woff2"),
       url("../vendor/cairo/fonts/cairo-latin-500.woff2") format("woff2");
}
@font-face {
  font-family: "Cairo";
  font-style: normal; font-weight: 600; font-display: swap;
  src: url("../vendor/cairo/fonts/cairo-arabic-600.woff2") format("woff2"),
       url("../vendor/cairo/fonts/cairo-latin-600.woff2") format("woff2");
}
@font-face {
  font-family: "Cairo";
  font-style: normal; font-weight: 700; font-display: swap;
  src: url("../vendor/cairo/fonts/cairo-arabic-700.woff2") format("woff2"),
       url("../vendor/cairo/fonts/cairo-latin-700.woff2") format("woff2");
}

/* ---- IBM Plex Sans (self-hosted) — Latin UI face for English ----------- */
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("../vendor/plex/fonts/plex-latin-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal; font-weight: 500; font-display: swap;
  src: url("../vendor/plex/fonts/plex-latin-500.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal; font-weight: 600; font-display: swap;
  src: url("../vendor/plex/fonts/plex-latin-600.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal; font-weight: 700; font-display: swap;
  src: url("../vendor/plex/fonts/plex-latin-700.woff2") format("woff2");
}

/* ---- Design tokens ------------------------------------------------------ */
:root {
  /* Accent: a calm teal-blue — deliberately not the AI purple/pink cliché. */
  --app-accent:        oklch(0.62 0.12 235);
  --app-accent-strong: oklch(0.55 0.13 235);
  --app-accent-soft:   oklch(0.62 0.12 235 / 0.12);
  --app-accent-ring:   oklch(0.62 0.12 235 / 0.35);

  /* Spacing rhythm (4px base). */
  --app-space-1: 0.25rem;
  --app-space-2: 0.5rem;
  --app-space-3: 0.75rem;
  --app-space-4: 1rem;
  --app-space-6: 1.5rem;
  --app-space-8: 2rem;
  --app-space-12: 3rem;

  /* Radius scale. */
  --app-radius-sm: 10px;
  --app-radius:    14px;
  --app-radius-lg: 20px;
  --app-radius-pill: 999px;

  /* Motion. */
  --app-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --app-dur-fast: 140ms;
  --app-dur: 220ms;
  --app-dur-slow: 460ms;

  --app-sidebar-w: 264px;
}

/* Light theme surfaces + shadows. */
[data-bs-theme="light"] {
  --app-bg:        oklch(0.985 0.003 250);
  --app-surface:   oklch(1 0 0);
  --app-surface-2: oklch(0.975 0.004 250);
  --app-border:    oklch(0.9 0.006 250);
  --app-border-strong: oklch(0.84 0.008 250);
  --app-text:      oklch(0.28 0.02 260);
  --app-muted:     oklch(0.55 0.02 260);

  --app-shadow-1: 0 1px 2px oklch(0.4 0.03 260 / 0.06);
  --app-shadow-2: 0 6px 24px oklch(0.4 0.03 260 / 0.08);
  --app-shadow-lift: 0 14px 40px oklch(0.4 0.05 260 / 0.14);
}

/* Dark theme surfaces + shadows. */
[data-bs-theme="dark"] {
  --app-bg:        oklch(0.18 0.012 260);
  --app-surface:   oklch(0.22 0.014 260);
  --app-surface-2: oklch(0.25 0.016 260);
  --app-border:    oklch(0.31 0.016 260);
  --app-border-strong: oklch(0.4 0.02 260);
  --app-text:      oklch(0.93 0.01 260);
  --app-muted:     oklch(0.7 0.015 260);

  --app-accent:        oklch(0.72 0.11 235);
  --app-accent-strong: oklch(0.78 0.11 235);
  --app-accent-soft:   oklch(0.72 0.11 235 / 0.16);

  --app-shadow-1: 0 1px 2px oklch(0 0 0 / 0.4);
  --app-shadow-2: 0 8px 30px oklch(0 0 0 / 0.45);
  --app-shadow-lift: 0 18px 46px oklch(0 0 0 / 0.55);
}

/* ---- Base ---------------------------------------------------------------- */
body {
  /* Per-language UI face is selected below via html[lang]. Default (fa) uses
     Vazirmatn; the fallbacks keep the UI correct before the woff2 files load. */
  font-family: "Vazirmatn", "Vazir", "IRANSans", "Sahel",
               system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
  background-color: var(--app-bg);
  color: var(--app-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Per-language UI font (self-hosted, no CDN):
   fa → Vazirmatn (default above), ar → Cairo, en → IBM Plex Sans. */
html[lang="ar"] body {
  font-family: "Cairo", "Vazirmatn", system-ui, "Segoe UI", Tahoma, Arial, sans-serif;
}
html[lang="en"] body {
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  letter-spacing: -0.006em;
}

h1, h2, h3, h4, h5, h6, .navbar-brand { font-weight: 700; }
h1, .h1, h2, .h2 { letter-spacing: -0.02em; }
p { text-wrap: pretty; }

::selection { background: var(--app-accent-soft); }

a { color: var(--app-accent-strong); }
a:hover { color: var(--app-accent); }

:focus-visible {
  outline: 3px solid var(--app-accent-ring);
  outline-offset: 2px;
  border-radius: var(--app-radius-sm);
}

/* ---- App shell (sidebar + main) ----------------------------------------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--app-sidebar-w) 1fr;
  min-height: 100vh;
}

.app-sidebar {
  background: var(--app-surface);
  border-inline-end: 1px solid var(--app-border);
  padding: var(--app-space-6) var(--app-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--app-space-6);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0; /* prevents grid blowout on long content */
}

.app-content {
  padding: var(--app-space-8) var(--app-space-8) var(--app-space-12);
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
}

@media (max-width: 991.98px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: min(84vw, var(--app-sidebar-w));
    z-index: 1045;
    transform: translateX(var(--app-drawer-off, -110%));
    transition: transform var(--app-dur) var(--app-ease);
    box-shadow: var(--app-shadow-lift);
  }
  html[dir="rtl"] .app-sidebar { --app-drawer-off: 110%; }
  .app-sidebar.is-open { transform: translateX(0); }
  .app-content { padding: var(--app-space-6) var(--app-space-4) var(--app-space-12); }
}

/* ---- Brand logomark ----------------------------------------------------- */
.app-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--app-space-3);
  text-decoration: none;
  color: var(--app-text);
}
.app-brand:hover { color: var(--app-text); }
.app-brand__mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(150deg, var(--app-accent) 0%, var(--app-accent-strong) 100%);
  box-shadow: var(--app-shadow-1), inset 0 1px 0 oklch(1 0 0 / 0.25);
  flex: none;
}
.app-brand__mark svg { width: 20px; height: 20px; }
.app-brand__name { font-size: 1.05rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.app-brand__tag { font-size: 0.72rem; color: var(--app-muted); margin-top: 2px; }

/* ---- Sidebar navigation ------------------------------------------------- */
.app-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.app-nav__section {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--app-muted);
  font-weight: 700;
  padding: var(--app-space-4) var(--app-space-3) var(--app-space-1);
}
.app-nav__link {
  display: flex;
  align-items: center;
  gap: var(--app-space-3);
  padding: 0.6rem var(--app-space-3);
  border-radius: var(--app-radius-sm);
  color: var(--app-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.94rem;
  position: relative;
  transition: background var(--app-dur-fast) var(--app-ease),
              color var(--app-dur-fast) var(--app-ease);
}
.app-nav__link:hover { background: var(--app-surface-2); color: var(--app-text); }
.app-nav__link .app-ico { color: var(--app-muted); transition: color var(--app-dur-fast) var(--app-ease); }
.app-nav__link:hover .app-ico { color: var(--app-accent); }
.app-nav__link.is-active {
  background: var(--app-accent-soft);
  color: var(--app-accent-strong);
}
.app-nav__link.is-active .app-ico { color: var(--app-accent-strong); }
.app-nav__link.is-active::before {
  content: "";
  position: absolute;
  inset-block: 22%;
  inset-inline-start: 0;
  width: 3px;
  border-radius: var(--app-radius-pill);
  background: var(--app-accent);
}

/* Expandable nav group (parent link + toggle + submenu). */
.app-nav__group { list-style: none; }
.app-nav__group-head {
  display: flex;
  align-items: center;
  gap: 2px;
}
.app-nav__group-head .app-nav__link { flex: 1 1 auto; }
.app-nav__toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: var(--app-radius-sm);
  background: transparent;
  color: var(--app-muted);
  cursor: pointer;
  transition: background var(--app-dur-fast) var(--app-ease),
              color var(--app-dur-fast) var(--app-ease);
}
.app-nav__toggle:hover { background: var(--app-surface-2); color: var(--app-accent); }
.app-nav__caret {
  display: inline-flex;
  width: 16px;
  height: 16px;
  transform: rotate(90deg); /* arrow points right by default; point down when closed */
  transition: transform var(--app-dur-fast) var(--app-ease);
}
.app-nav__caret svg { width: 100%; height: 100%; display: block; }
.app-nav__caret.is-open { transform: rotate(-90deg); }

/* Submenu list, indented under the parent. */
.app-nav__sub {
  margin-top: 2px;
  padding-inline-start: calc(18px + var(--app-space-3));
}
.app-nav__sublink {
  font-size: 0.9rem;
  padding-block: 0.45rem;
  color: var(--app-muted);
}
.app-nav__sublink:hover { color: var(--app-text); }
.app-nav__sublink.is-active { color: var(--app-accent-strong); }
/* Unread-count pill pushed to the trailing edge of a nav link. */
.app-nav__badge {
  margin-inline-start: auto;
  min-width: 1.25rem;
  padding: 0 0.4rem;
  border-radius: var(--app-radius-pill);
  background: var(--app-accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.app-ico { width: 18px; height: 18px; flex: none; }
.app-ico svg { width: 100%; height: 100%; display: block; }

.app-sidebar__footer { margin-top: auto; }

/* ---- Topbar ------------------------------------------------------------- */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  gap: var(--app-space-3);
  padding: var(--app-space-3) var(--app-space-6);
  background: color-mix(in oklch, var(--app-surface) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--app-border);
}
.app-topbar__title { font-weight: 700; font-size: 1rem; margin: 0; }
.app-topbar__icon {
  width: 22px; height: 22px;
  color: var(--app-accent-strong);
  flex: none;
}
.app-topbar__spacer { flex: 1; }

/* =========================================================================
   Topbar trailing controls — one shared height so every pill lines up on a
   single row. `--app-topbar-control` is the single knob for the control size.
   Every control (switchers, notification trigger, user avatar) is a flex item
   stretched to this height, so their centre lines always match regardless of
   each control's own internal box model.
   ========================================================================= */
.app-topbar { --app-topbar-control: 38px; }

.app-topbar__actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--app-space-2);
}
.app-topbar__switchers {
  align-items: center;
  gap: var(--app-space-2);
}

/* Shared pill baseline: identical height + vertical centering for the bell,
   the notification trigger, and the user-menu trigger. */
.app-topbar__control {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--app-topbar-control);
  min-width: var(--app-topbar-control);
  padding: 0;
  margin: 0;
  border: 1px solid var(--app-border-strong);
  border-radius: var(--app-radius-pill);
  background: var(--app-surface);
  color: var(--app-text);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--app-dur-fast) var(--app-ease),
              color var(--app-dur-fast) var(--app-ease),
              box-shadow var(--app-dur-fast) var(--app-ease);
}
.app-topbar__control:hover { background: var(--app-surface-2); color: var(--app-accent); }
.app-topbar__control:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--app-accent-soft);
}
.app-topbar__control .app-ico { width: 20px; height: 20px; }

/* Language / theme <select> pills — matched to the same height + baseline. */
.app-topbar .form-select-sm {
  box-sizing: border-box;
  height: var(--app-topbar-control);
  padding-block: 0;
  border-radius: var(--app-radius-pill);
  border-color: var(--app-border-strong);
  background-color: var(--app-surface);
  line-height: calc(var(--app-topbar-control) - 2px);
  vertical-align: middle;
}
.app-topbar__switchers form,
.app-topbar__switchers > div { display: inline-flex; align-items: center; }

/* ---- Notification dropdown --------------------------------------------- */
.app-notif { position: relative; display: inline-flex; }
.app-notif__trigger { position: relative; }
.app-notif__badge {
  position: absolute;
  top: -3px;
  inset-inline-end: -3px;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.28rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--app-radius-pill);
  background: var(--app-danger, #dc3545);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--app-surface);
}
.app-notif__panel {
  position: absolute;
  inset-block-start: calc(100% + 8px);
  inset-inline-end: 0;
  width: min(22rem, calc(100vw - 2rem));
  background: var(--app-surface);
  border: 1px solid var(--app-border-strong);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-2, var(--app-shadow-1));
  overflow: hidden;
  z-index: 1050;
}
/* On narrow screens the panel is too wide to hang off the trigger without
   spilling past the viewport, so pin it to the screen edges instead: fixed
   under the topbar, stretching edge-to-edge with a small gutter. */
@media (max-width: 575.98px) {
  .app-notif__panel {
    position: fixed;
    inset-block-start: 64px;
    inset-inline: 0.75rem;
    width: auto;
    max-height: calc(100vh - 80px);
    max-height: calc(100dvh - 80px);
    display: flex;
    flex-direction: column;
  }
  .app-notif__body { flex: 1 1 auto; max-height: none; }
}
.app-notif__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--app-space-2);
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--app-border);
}
.app-notif__title { font-weight: 700; font-size: 0.92rem; }
.app-notif__markall {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--app-accent);
  cursor: pointer;
  transition: background var(--app-dur-fast) var(--app-ease),
              color var(--app-dur-fast) var(--app-ease);
}
.app-notif__markall:hover { background: var(--app-accent-soft); }
.app-notif__markall:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--app-accent-soft);
}
.app-notif__markall .app-ico { width: 18px; height: 18px; }

.app-notif__body { max-height: min(60vh, 24rem); overflow-y: auto; }
.app-notif__state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem 1rem;
  color: var(--app-muted);
  font-size: 0.85rem;
  text-align: center;
}
.app-notif__state .app-ico { width: 28px; height: 28px; opacity: 0.6; }
.app-notif__spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--app-border-strong);
  border-top-color: var(--app-accent);
  border-radius: 50%;
  animation: app-notif-spin 0.7s linear infinite;
}
@keyframes app-notif-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .app-notif__spinner { animation-duration: 1.8s; }
}

.app-notif__list { list-style: none; margin: 0; padding: 0.25rem; }
.app-notif__item + .app-notif__item { border-top: 1px solid var(--app-border); }
/* Unread rows get a soft accent tint + a leading accent rail so the latest
   unread notifications stand out from the read ones in the same list. */
.app-notif__item.is-unread .app-notif__link { background: var(--app-accent-soft); }
.app-notif__item.is-unread .app-notif__link:hover {
  background: color-mix(in oklch, var(--app-accent-soft) 70%, var(--app-surface-2));
}
.app-notif__link {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.65rem;
  border-radius: var(--app-radius-sm);
  color: var(--app-text);
  text-decoration: none;
}
.app-notif__link:hover { background: var(--app-surface-2); }
.app-notif__dot {
  flex: none;
  width: 8px; height: 8px;
  margin-top: 0.45rem;
  border-radius: 50%;
  background: var(--app-accent);
}
.app-notif__content { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.app-notif__item-title {
  font-weight: 600;
  font-size: 0.86rem;
  line-height: 1.35;
}
/* Read rows read as secondary: lighter title weight + muted color. */
.app-notif__item:not(.is-unread) .app-notif__item-title { font-weight: 500; color: var(--app-muted); }
.app-notif__item-msg {
  font-size: 0.8rem;
  color: var(--app-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.app-notif__foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem;
  border-top: 1px solid var(--app-border);
  color: var(--app-accent);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.app-notif__foot:hover { background: var(--app-surface-2); }
.app-notif__foot .app-ico { width: 16px; height: 16px; }
/* Point the arrow toward the reading direction's end. */
[dir="rtl"] .app-notif__foot-arrow { transform: scaleX(-1); }

/* ---- User menu --------------------------------------------------------- */
.app-usermenu { position: relative; display: inline-flex; }
/* The avatar trigger is a perfect circle at the shared control height — a
   square box (width == height) with a fully round border and no pill min-width
   so it never stretches into an ellipse. The trigger drops its own border and
   padding so the avatar's own circle is the only visible shape. */
.app-usermenu__trigger {
  width: var(--app-topbar-control);
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  overflow: hidden;
  background: transparent;
}
.app-usermenu__trigger:hover { background: transparent; }
/* Avatar fills the trigger so it matches the shared control height. */
.app-usermenu__trigger .app-avatar {
  --avatar-size: var(--app-topbar-control);
  width: var(--app-topbar-control);
  height: var(--app-topbar-control);
  box-shadow: inset 0 0 0 1px var(--app-border-strong);
}
.app-usermenu__trigger:hover .app-avatar { box-shadow: inset 0 0 0 1px var(--app-accent); }
.app-usermenu__trigger .app-avatar__img { width: 100%; height: 100%; object-fit: cover; }

.app-usermenu__dropdown {
  position: absolute;
  inset-block-start: calc(100% + 6px);
  inset-inline-end: 0;
  min-width: 12rem;
  padding: var(--app-space-2);
  background: var(--app-surface);
  border: 1px solid var(--app-border-strong);
  border-radius: var(--app-radius-sm);
  box-shadow: var(--app-shadow-1);
  z-index: 1040;
}
.app-usermenu__header {
  padding: 0.4rem 0.6rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--app-text);
  border-bottom: 1px solid var(--app-border);
  margin-bottom: 0.25rem;
}
.app-usermenu__item {
  display: flex;
  align-items: center;
  gap: var(--app-space-3);
  padding: 0.5rem 0.6rem;
  border-radius: var(--app-radius-sm);
  color: var(--app-text);
  text-decoration: none;
  font-size: 0.9rem;
}
.app-usermenu__item:hover { background: var(--app-surface-2); color: var(--app-text); }
.app-usermenu__item .app-ico { width: 18px; height: 18px; color: var(--app-muted); }
.app-usermenu__item--danger { color: var(--app-danger, #dc3545); }
.app-usermenu__item--danger .app-ico { color: var(--app-danger, #dc3545); }
.app-usermenu__divider {
  height: 1px;
  background: var(--app-border);
  margin: 0.25rem 0;
}

.app-drawer-toggle {
  display: none;
  border: 1px solid var(--app-border-strong);
  background: var(--app-surface);
  color: var(--app-text);
  border-radius: var(--app-radius-sm);
  width: 40px; height: 40px;
  place-items: center;
  cursor: pointer;
}
@media (max-width: 991.98px) { .app-drawer-toggle { display: grid; } }

.app-scrim {
  position: fixed; inset: 0;
  background: oklch(0.2 0.02 260 / 0.45);
  backdrop-filter: blur(2px);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--app-dur) var(--app-ease), visibility var(--app-dur);
}
.app-scrim.is-open { opacity: 1; visibility: visible; }

/* ---- Live in-app notification toasts ------------------------------------ */
/* Fixed region pinned to the physical top-left of the viewport (per request),
   above the sidebar/scrim so toasts are always visible while the page is open.
   Uses physical `left` deliberately so the placement is top-left in every
   locale, including the RTL (fa) shell. Populated by
   assets/js/notification-toasts.js with Bootstrap .toast elements. */
.app-toast-region {
  position: fixed;
  top: calc(var(--app-space-3, 1rem));
  left: var(--app-space-3, 1rem);
  z-index: 1090;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(22rem, calc(100vw - 2rem));
  pointer-events: none;
}
.app-toast-region .toast { pointer-events: auto; }
.app-toast-region .toast__link { text-decoration: none; }

/* ---- Footer ------------------------------------------------------------- */
.app-footer {
  border-top: 1px solid var(--app-border);
  padding: var(--app-space-6) var(--app-space-8);
  color: var(--app-muted);
  font-size: 0.85rem;
}

/* ---- Home hero ---------------------------------------------------------- */
.home-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--app-radius-lg);
  border: 1px solid var(--app-border);
  background:
    radial-gradient(120% 140% at 100% 0%, var(--app-accent-soft) 0%, transparent 55%),
    var(--app-surface);
  padding: clamp(1.5rem, 4vw, 2.75rem);
  box-shadow: var(--app-shadow-1);
}
html[dir="ltr"] .home-hero {
  background:
    radial-gradient(120% 140% at 0% 0%, var(--app-accent-soft) 0%, transparent 55%),
    var(--app-surface);
}
.home-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--app-space-2);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--app-accent-strong);
  background: var(--app-accent-soft);
  padding: 0.3rem 0.75rem;
  border-radius: var(--app-radius-pill);
  margin-bottom: var(--app-space-4);
}
.home-hero__eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--app-accent);
  box-shadow: 0 0 0 4px var(--app-accent-soft);
}
.home-hero h1 {
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  margin: 0 0 var(--app-space-3);
}
.home-hero__lead {
  color: var(--app-muted);
  font-size: 1.05rem;
  max-width: 54ch;
  margin: 0;
}
.home-hero__glow {
  position: absolute;
  inset-block-start: -40%;
  inset-inline-end: -10%;
  width: 420px; height: 420px;
  background: radial-gradient(circle, var(--app-accent-soft), transparent 68%);
  filter: blur(6px);
  pointer-events: none;
}

/* ---- Section heading ---------------------------------------------------- */
.section-head {
  display: flex;
  align-items: baseline;
  gap: var(--app-space-3);
  margin: var(--app-space-8) 0 var(--app-space-4);
}
.section-head h2 { font-size: 1.05rem; margin: 0; }
.section-head__rule { flex: 1; height: 1px; background: var(--app-border); }

/* ---- Quick-link cards --------------------------------------------------- */
.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: var(--app-space-4);
}
.link-card {
  display: flex;
  align-items: flex-start;
  gap: var(--app-space-4);
  padding: var(--app-space-6);
  border-radius: var(--app-radius);
  border: 1px solid var(--app-border);
  background: var(--app-surface);
  color: var(--app-text);
  text-decoration: none;
  box-shadow: var(--app-shadow-1);
  transition: transform var(--app-dur) var(--app-ease),
              box-shadow var(--app-dur) var(--app-ease),
              border-color var(--app-dur) var(--app-ease);
  position: relative;
  overflow: hidden;
}
.link-card::after {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--app-accent), transparent);
  transform: scaleX(0);
  transform-origin: inline-start;
  transition: transform var(--app-dur) var(--app-ease);
}
.link-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--app-shadow-lift);
  border-color: var(--app-border-strong);
  color: var(--app-text);
}
.link-card:hover::after { transform: scaleX(1); }
.link-card__icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--app-accent-soft);
  color: var(--app-accent-strong);
  flex: none;
  transition: transform var(--app-dur) var(--app-ease);
}
.link-card:hover .link-card__icon { transform: scale(1.06) rotate(-3deg); }
.link-card__icon svg { width: 22px; height: 22px; }
.link-card__body { min-width: 0; }
.link-card__title { font-weight: 700; font-size: 1rem; margin: 0 0 2px; }
.link-card__meta { color: var(--app-muted); font-size: 0.85rem; margin: 0; }
.link-card__arrow {
  margin-inline-start: auto;
  align-self: center;
  color: var(--app-muted);
  transition: transform var(--app-dur) var(--app-ease), color var(--app-dur) var(--app-ease);
}
html[dir="rtl"] .link-card__arrow { transform: scaleX(-1); }
.link-card:hover .link-card__arrow {
  color: var(--app-accent);
  transform: translateX(3px);
}
html[dir="rtl"] .link-card:hover .link-card__arrow { transform: scaleX(-1) translateX(3px); }

/* ---- Service-desk cards (پیشخوان خدمت) ---------------------------------- */
.svc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: var(--app-space-4);
}
.svc-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: var(--app-space-3);
  text-align: center;
  padding: var(--app-space-6) var(--app-space-4);
  min-height: 148px;
  border-radius: var(--app-radius);
  border: 1px solid var(--app-border);
  background: var(--app-surface);
  color: var(--app-text);
  text-decoration: none;
  box-shadow: var(--app-shadow-1);
  transition: transform var(--app-dur) var(--app-ease),
              box-shadow var(--app-dur) var(--app-ease),
              border-color var(--app-dur) var(--app-ease);
  position: relative;
  overflow: hidden;
}
.svc-card::after {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--app-accent), transparent);
  transform: scaleX(0);
  transform-origin: inline-start;
  transition: transform var(--app-dur) var(--app-ease);
}
.svc-card:hover,
.svc-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--app-shadow-lift);
  border-color: var(--app-border-strong);
  color: var(--app-text);
  outline: none;
}
.svc-card:hover::after,
.svc-card:focus-visible::after { transform: scaleX(1); }
.svc-card__icon {
  width: 54px; height: 54px;
  border-radius: 16px;
  display: grid; place-items: center;
  background: var(--app-accent-soft);
  color: var(--app-accent-strong);
  flex: none;
  transition: transform var(--app-dur) var(--app-ease);
}
.svc-card:hover .svc-card__icon { transform: scale(1.08) rotate(-3deg); }
.svc-card__icon svg { width: 28px; height: 28px; }
.svc-card__title {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--app-text);
}

/* ---- News columns (panel home: News / Events / Articles) ---------------- */
.news-col { height: 100%; }
.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.news-item + .news-item { border-top: 1px solid var(--app-border); }
.news-item__link {
  display: flex;
  align-items: flex-start;
  gap: var(--app-space-3);
  padding: var(--app-space-3) 0;
  text-decoration: none;
  color: var(--app-text);
  transition: color var(--app-dur) var(--app-ease);
}
.news-item__thumb {
  width: 64px;
  height: 64px;
  flex: none;
  border-radius: var(--app-radius-sm);
  overflow: hidden;
  background: var(--app-surface-2);
}
.news-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--app-dur) var(--app-ease);
}
.news-item__thumb--placeholder {
  display: grid;
  place-items: center;
  color: var(--app-accent-strong);
  background: var(--app-accent-soft);
}
.news-item__thumb--placeholder svg { width: 26px; height: 26px; }
.news-item__body { min-width: 0; }
.news-item__date {
  display: block;
  font-size: 0.72rem;
  color: var(--app-muted);
  margin-bottom: 2px;
}
.news-item__title {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.55;
  /* Clamp to two lines so uneven titles keep the columns tidy. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-item__link:hover { color: var(--app-accent-strong); }
.news-item__link:hover .news-item__thumb img { transform: scale(1.05); }

/* Empty state. */
.empty-state {
  text-align: center;
  padding: var(--app-space-12) var(--app-space-6);
  border: 1px dashed var(--app-border-strong);
  border-radius: var(--app-radius);
  color: var(--app-muted);
  background: var(--app-surface-2);
}

/* ---- Entrance animations ------------------------------------------------ */
@keyframes app-fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.reveal {
  opacity: 0;
  animation: app-fade-up var(--app-dur-slow) var(--app-ease) forwards;
  animation-delay: var(--reveal-delay, 0ms);
}

/* Stagger helper: set --i on each item; delay = i * step. */
.stagger > * {
  opacity: 0;
  animation: app-fade-up var(--app-dur-slow) var(--app-ease) forwards;
  animation-delay: calc(var(--i, 0) * 60ms);
}

/* Selects/switchers in header get a consistent tool-like feel. */
.form-select, .form-control, .btn {
  border-radius: var(--app-radius-sm);
}
.btn { font-weight: 600; }

/* ---- Reduced motion ----------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal, .stagger > * { opacity: 1 !important; transform: none !important; }
  .link-card:hover { transform: none; }
}

/* ---- Cascading location picker (combobox) ------------------------------- */
.loc-combo { position: relative; }

.loc-combo__control {
  width: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.loc-combo__control:disabled { cursor: not-allowed; opacity: 0.6; }

.loc-combo__panel {
  position: absolute;
  z-index: 20;
  inset-inline: 0;
  margin-top: 4px;
  background: var(--app-surface);
  border: 1px solid var(--app-border-strong);
  border-radius: var(--app-radius-sm);
  box-shadow: var(--app-shadow-2);
  padding: var(--app-space-2);
  max-height: 280px;
  display: flex;
  flex-direction: column;
  gap: var(--app-space-2);
}
.loc-combo__search { flex: none; }

.loc-combo__list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
}
.loc-combo__option {
  width: 100%;
  text-align: start;
  border: 0;
  background: transparent;
  color: var(--app-text);
  padding: 0.5rem 0.6rem;
  border-radius: var(--app-radius-sm);
  cursor: pointer;
  font-size: 0.92rem;
  transition: background var(--app-dur-fast) var(--app-ease);
}
.loc-combo__option:hover { background: var(--app-surface-2); }
.loc-combo__option.is-selected {
  background: var(--app-accent-soft);
  color: var(--app-accent-strong);
  font-weight: 600;
}
.loc-combo__empty {
  color: var(--app-muted);
  font-size: 0.88rem;
  padding: 0.5rem 0.6rem;
}

.loc-picker.is-invalid .loc-combo__control { border-color: var(--bs-danger, #dc3545); }

/* Alpine cloak: hide un-initialized components before Alpine boots. */
[x-cloak] { display: none !important; }

/* ---- Location management tree ------------------------------------------- */
.loc-tree {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background: var(--app-surface);
  padding: var(--app-space-2);
}
.loc-node { border-radius: var(--app-radius-sm); }
.loc-node__row {
  display: flex;
  align-items: center;
  gap: var(--app-space-2);
  padding: 0.4rem 0.5rem;
  border-radius: var(--app-radius-sm);
  transition: background var(--app-dur-fast) var(--app-ease);
}
.loc-node__row:hover { background: var(--app-surface-2); }

.loc-node__toggle {
  border: 0;
  background: transparent;
  color: var(--app-muted);
  cursor: pointer;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: var(--app-radius-sm);
  flex: none;
}
.loc-node__toggle .app-ico {
  transition: transform var(--app-dur) var(--app-ease);
}
html[dir="rtl"] .loc-node__toggle .app-ico { transform: scaleX(-1); }
.loc-node__toggle .app-ico.is-open { transform: rotate(90deg); }
html[dir="rtl"] .loc-node__toggle .app-ico.is-open { transform: scaleX(-1) rotate(90deg); }

.loc-node__badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
  border-radius: var(--app-radius-pill);
  background: var(--app-surface-2);
  color: var(--app-muted);
  border: 1px solid var(--app-border);
  flex: none;
}
.loc-node__badge--country  { color: var(--app-accent-strong); background: var(--app-accent-soft); border-color: transparent; }
.loc-node__name { font-weight: 600; }
.loc-node__path { color: var(--app-muted); font-size: 0.78rem; }
.loc-node__actions { margin-inline-start: auto; display: flex; gap: 0.35rem; flex: none; }
.loc-node__children {
  margin-inline-start: 1.1rem;
  padding-inline-start: 0.6rem;
  border-inline-start: 1px dashed var(--app-border-strong);
}
.loc-node__edit {
  padding: 0.5rem 0.5rem 0.75rem 2.4rem;
}
html[dir="rtl"] .loc-node__edit { padding: 0.5rem 2.4rem 0.75rem 0.5rem; }

@media (max-width: 575.98px) {
  .loc-node__path { display: none; }
  .loc-node__actions { margin-inline-start: auto; }
}

/* ---- DataTables — align with the app theme + RTL ------------------------ */
.dataTables_wrapper {
  margin-top: var(--app-space-2);
}
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--app-border-strong);
  border-radius: var(--app-radius-sm);
  background: var(--app-surface);
  color: var(--app-text);
  padding: 0.3rem 0.55rem;
}
.dataTables_wrapper .dataTables_filter { margin-bottom: var(--app-space-3); }
table.dataTable thead th {
  border-bottom: 2px solid var(--app-border-strong);
  font-weight: 700;
}
.dataTables_wrapper .dataTables_info { color: var(--app-muted); font-size: 0.85rem; }
.page-link { border-radius: var(--app-radius-sm) !important; }
.page-item.active .page-link {
  background-color: var(--app-accent);
  border-color: var(--app-accent);
}
/* DataTables adds dir handling automatically; keep filter/length aligned to
   the start edge in both directions. */
html[dir="rtl"] .dataTables_wrapper .dataTables_filter { text-align: left; }
html[dir="rtl"] .dataTables_wrapper .dataTables_length { text-align: right; }

/* ---- Content card (news / article / event) ------------------------------ */
.content-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background: var(--app-surface);
  overflow: hidden;
  text-decoration: none;
  color: var(--app-text);
  transition:
    transform var(--app-dur) var(--app-ease),
    box-shadow var(--app-dur) var(--app-ease),
    border-color var(--app-dur) var(--app-ease);
}
.content-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--app-shadow-lift);
  border-color: var(--app-border-strong);
  color: var(--app-text);
}

/* ---------- Thumbnail wrapper ------------------------------------------ */
.content-card__thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--app-surface-2);
  flex: none;
}

/* Actual image — zooms gently on hover */
.content-card__thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 500ms var(--app-ease), filter 400ms var(--app-ease);
  filter: brightness(0.97);
}
.content-card:hover .content-card__thumb-img {
  transform: scale(1.06);
  filter: brightness(1);
}

/* Gradient scrim at the bottom of the image so the badge/type reads clearly */
.content-card__thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 40%,
    oklch(0.1 0.02 260 / 0.45) 100%
  );
  pointer-events: none;
}

/* Type badge sits in the bottom-start corner, on top of the scrim */
.content-card__badge {
  position: absolute;
  inset-block-end: var(--app-space-2);
  inset-inline-start: var(--app-space-2);
  z-index: 1;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: var(--app-radius-pill);
  backdrop-filter: blur(6px);
  background: oklch(1 0 0 / 0.18);
  border: 1px solid oklch(1 0 0 / 0.25);
  color: #fff;
}

/* Placeholder when no featured image is available */
.content-card__thumb--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    135deg,
    var(--app-surface-2) 0%,
    color-mix(in oklch, var(--app-accent-soft) 60%, var(--app-surface-2)) 100%
  );
}
.content-card__thumb--placeholder .placeholder-ico {
  width: 44px;
  height: 44px;
  color: var(--app-accent-strong);
  opacity: 0.55;
  transition: opacity var(--app-dur) var(--app-ease), transform var(--app-dur) var(--app-ease);
}
.content-card:hover .content-card__thumb--placeholder .placeholder-ico {
  opacity: 0.8;
  transform: scale(1.12);
}

/* ---------- Body -------------------------------------------------------- */
.content-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--app-space-4);
  gap: var(--app-space-1);
}
.content-card__date {
  font-size: 0.73rem;
  color: var(--app-muted);
  letter-spacing: 0.01em;
}
.content-card__title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.45;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--app-dur-fast) var(--app-ease);
}
.content-card:hover .content-card__title { color: var(--app-accent-strong); }
.content-card__excerpt {
  font-size: 0.82rem;
  color: var(--app-muted);
  line-height: 1.6;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

/* Reduced-motion override */
@media (prefers-reduced-motion: reduce) {
  .content-card__thumb-img { transition: none; }
  .content-card { transition: none; }
}

.content-article { max-width: 820px; }
.content-article__hero {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--app-radius);
  border: 1px solid var(--app-border);
  margin-bottom: var(--app-space-4);
}
.content-article__body { font-size: 1.05rem; line-height: 1.9; }

.content-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--app-space-3);
}
.content-gallery__item {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: var(--app-radius-sm);
  border: 1px solid var(--app-border);
}

.app-slider { border-radius: var(--app-radius-lg); overflow: hidden; box-shadow: var(--app-shadow-1); }
.app-slider__img { height: clamp(220px, 42vw, 460px); object-fit: cover; }
.app-slider__caption {
  background: linear-gradient(to top, oklch(0 0 0 / 0.6), transparent);
  border-radius: var(--app-radius);
  inset-inline: 10%;
}

/* ---- Public landing ----------------------------------------------------- */
.public-body { background: var(--app-bg); }
.public-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: color-mix(in oklch, var(--app-surface) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--app-border);
}

.landing-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(3rem, 9vw, 7rem) 0 clamp(2.5rem, 7vw, 5rem);
  background:
    radial-gradient(120% 120% at 100% 0%, var(--app-accent-soft) 0%, transparent 55%),
    var(--app-bg);
}
html[dir="ltr"] .landing-hero {
  background:
    radial-gradient(120% 120% at 0% 0%, var(--app-accent-soft) 0%, transparent 55%),
    var(--app-bg);
}
.landing-hero__eyebrow {
  display: inline-flex; align-items: center; gap: var(--app-space-2);
  font-size: 0.8rem; font-weight: 600;
  color: var(--app-accent-strong);
  background: var(--app-accent-soft);
  padding: 0.35rem 0.85rem;
  border-radius: var(--app-radius-pill);
  margin-bottom: var(--app-space-4);
}
.landing-hero__eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--app-accent); box-shadow: 0 0 0 4px var(--app-accent-soft); }
.landing-hero__title {
  font-size: clamp(2rem, 5.5vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 var(--app-space-4);
  max-width: 20ch;
}
.landing-hero__lead {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--app-muted);
  max-width: 58ch;
  margin: 0 0 var(--app-space-6);
}
.landing-hero__cta { display: flex; flex-wrap: wrap; gap: var(--app-space-3); }
.landing-hero__glow {
  position: absolute;
  inset-block-start: -30%;
  inset-inline-end: -10%;
  width: 520px; height: 520px;
  background: radial-gradient(circle, var(--app-accent-soft), transparent 68%);
  pointer-events: none;
}

.landing-section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.landing-section--alt { background: var(--app-surface); border-block: 1px solid var(--app-border); }
.landing-about { font-size: 1.05rem; line-height: 1.9; max-width: 70ch; color: var(--app-text); }
.landing-map {
  border-radius: var(--app-radius);
  overflow: hidden;
  border: 1px solid var(--app-border);
  height: 100%;
  min-height: 280px;
}
.landing-map iframe { width: 100%; height: 100%; min-height: 280px; border: 0; display: block; }


/* ---- Locale-aware date picker ------------------------------------------ */
.date-picker { position: relative; }
.date-picker__panel {
  position: absolute;
  z-index: 1055;
  inset-inline-start: 0;
  margin-top: 0.25rem;
  width: min(20rem, 90vw);
}
.date-picker__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.date-picker__weekday {
  font-size: 0.72rem;
  padding: 0.25rem 0;
}
.date-picker__day {
  padding: 0.3rem 0;
  line-height: 1.1;
}

/* ---------------------------------------------------------------------------
   Avatar (profile picture) — used in the profile header, user management list
   and detail, wherever a person is shown. Renders either the uploaded image or
   a colored initials placeholder (partials/avatar.php). Sizes: sm/md/lg/xl.
   --------------------------------------------------------------------------- */
.app-avatar {
  --avatar-size: 2.75rem;
  display: inline-grid;
  place-items: center;
  inline-size: var(--avatar-size);
  block-size: var(--avatar-size);
  border-radius: 50%;
  overflow: hidden;
  flex: none;
  background: var(--app-accent-soft);
  color: var(--app-accent-strong);
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  user-select: none;
  box-shadow: inset 0 0 0 1px oklch(0 0 0 / 0.06);
}
.app-avatar--sm { --avatar-size: 2rem;    font-size: 0.72rem; }
.app-avatar--md { --avatar-size: 2.75rem; font-size: 0.95rem; }
.app-avatar--lg { --avatar-size: 4rem;    font-size: 1.4rem; }
.app-avatar--xl { --avatar-size: 6rem;    font-size: 2rem; }

.app-avatar__img {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  display: block;
}
.app-avatar__initials { display: block; }

/* Default-person silhouette shown when a user has no profile picture. The SVG
   inherits the tint `color` (like the old initials) and is sized relative to
   the avatar so it scales across sm/md/lg/xl. */
.app-avatar__icon {
  display: grid;
  place-items: center;
  inline-size: 100%;
  block-size: 100%;
}
.app-avatar__icon svg {
  inline-size: 62%;
  block-size: 62%;
}

/* Deterministic placeholder tints so each user keeps a stable colour. */
.app-avatar[data-tint="0"] { background: oklch(0.62 0.12 235 / 0.16); color: oklch(0.45 0.13 235); }
.app-avatar[data-tint="1"] { background: oklch(0.65 0.13 145 / 0.16); color: oklch(0.45 0.14 145); }
.app-avatar[data-tint="2"] { background: oklch(0.68 0.15 30 / 0.16);  color: oklch(0.5 0.16 30); }
.app-avatar[data-tint="3"] { background: oklch(0.65 0.14 300 / 0.16); color: oklch(0.48 0.15 300); }
.app-avatar[data-tint="4"] { background: oklch(0.72 0.13 80 / 0.18);  color: oklch(0.5 0.13 80); }
.app-avatar[data-tint="5"] { background: oklch(0.63 0.13 190 / 0.16); color: oklch(0.45 0.14 190); }
.app-avatar[data-tint="6"] { background: oklch(0.64 0.14 350 / 0.16); color: oklch(0.48 0.15 350); }
.app-avatar[data-tint="7"] { background: oklch(0.6 0.12 265 / 0.16);  color: oklch(0.45 0.13 265); }

/* Slightly stronger tints in dark mode for legibility. */
html[data-bs-theme="dark"] .app-avatar { box-shadow: inset 0 0 0 1px oklch(1 0 0 / 0.08); }
html[data-bs-theme="dark"] .app-avatar[data-tint="0"] { color: oklch(0.8 0.12 235); }
html[data-bs-theme="dark"] .app-avatar[data-tint="1"] { color: oklch(0.82 0.13 145); }
html[data-bs-theme="dark"] .app-avatar[data-tint="2"] { color: oklch(0.82 0.15 30); }
html[data-bs-theme="dark"] .app-avatar[data-tint="3"] { color: oklch(0.82 0.14 300); }
html[data-bs-theme="dark"] .app-avatar[data-tint="4"] { color: oklch(0.85 0.13 80); }
html[data-bs-theme="dark"] .app-avatar[data-tint="5"] { color: oklch(0.82 0.13 190); }
html[data-bs-theme="dark"] .app-avatar[data-tint="6"] { color: oklch(0.83 0.14 350); }
html[data-bs-theme="dark"] .app-avatar[data-tint="7"] { color: oklch(0.8 0.12 265); }

/* Profile header card gets a soft accent wash behind the avatar. */
.profile-header {
  background:
    radial-gradient(120% 160% at 100% 0%, var(--app-accent-soft) 0%, transparent 60%),
    var(--app-surface, var(--bs-body-bg));
}
html[dir="ltr"] .profile-header {
  background:
    radial-gradient(120% 160% at 0% 0%, var(--app-accent-soft) 0%, transparent 60%),
    var(--app-surface, var(--bs-body-bg));
}
.profile-header .app-avatar {
  box-shadow: 0 0 0 4px var(--bs-body-bg), 0 0 0 5px var(--app-accent-ring, transparent);
}

/* ---- Impersonation banner ---------------------------------------------- */
/* Persistent bar shown while an admin/developer is viewing the panel as another
   user (see partials/impersonation_banner.php). Scoped, theme-aware styling —
   the icon size is HARD-CAPPED here so the inline SVG (which has no intrinsic
   width/height) can never blow up to fill the row. */
.impersonation-banner {
  /* Amber accent that reads on both light and dark themes. */
  --imp-accent:  oklch(0.72 0.15 75);
  --imp-soft:    oklch(0.72 0.15 75 / 0.14);
  --imp-border:  oklch(0.72 0.15 75 / 0.35);
  --imp-text:    oklch(0.42 0.09 75);

  display: flex;
  align-items: center;
  gap: var(--app-space-3);
  flex-wrap: wrap;
  padding: 0.55rem var(--app-space-4);
  background: var(--imp-soft);
  border-block-end: 1px solid var(--imp-border);
  color: var(--imp-text);
  font-size: 0.9rem;
  line-height: 1.4;
}
[data-bs-theme="dark"] .impersonation-banner {
  --imp-soft:   oklch(0.72 0.15 75 / 0.18);
  --imp-border: oklch(0.72 0.15 75 / 0.4);
  --imp-text:   oklch(0.9 0.06 80);
}

/* Small, fixed badge for the leading icon — this is what tames the giant SVG. */
.impersonation-banner__icon {
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
  border-radius: var(--app-radius-pill);
  background: var(--imp-accent);
  color: #fff;
}
.impersonation-banner__icon svg {
  width: 1rem;
  height: 1rem;
  display: block;
}
/* Decorative icon must never intercept the click meant for the button. */
.impersonation-banner__icon { pointer-events: none; }

.impersonation-banner__label {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 600;
}

.impersonation-banner__stop {
  margin: 0;
  flex: none;
}
.impersonation-banner__stop-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--app-space-2);
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--imp-border);
  border-radius: var(--app-radius-pill);
  background: transparent;
  color: var(--imp-text);
  font: inherit;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition:
    background var(--app-dur-fast) var(--app-ease),
    color var(--app-dur-fast) var(--app-ease),
    box-shadow var(--app-dur-fast) var(--app-ease);
}
.impersonation-banner__stop-btn:hover {
  background: var(--imp-accent);
  color: #fff;
  border-color: var(--imp-accent);
}
.impersonation-banner__stop-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--imp-soft);
}
.impersonation-banner__stop-ico {
  display: inline-flex;
  flex: none;
  /* Keep clicks on the SVG/paths from being swallowed — route them to <button>. */
  pointer-events: none;
}
.impersonation-banner__stop-ico svg {
  width: 0.95rem;
  height: 0.95rem;
  display: block;
}

/* =========================================================================
   Notifications page (app/Views/notifications/index.php)
   A scannable feed of notification cards. Uses the app tokens so it is
   theme-aware (light/dark) and direction-agnostic (logical properties for
   rtl fa/ar + ltr en). Motion respects prefers-reduced-motion.
   ========================================================================= */

/* ---- Page header -------------------------------------------------------- */
.notif-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--app-space-4);
  flex-wrap: wrap;
  margin-block-end: var(--app-space-6);
}
.notif-head__title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 var(--app-space-1);
}
.notif-head__subtitle {
  color: var(--app-muted);
  margin: 0;
  font-size: 0.92rem;
}
.notif-head__actions {
  display: flex;
  align-items: center;
  gap: var(--app-space-3);
  flex-wrap: wrap;
}
.notif-head__actions .btn { display: inline-flex; align-items: center; gap: var(--app-space-2); }
.notif-head__actions .app-ico { width: 16px; height: 16px; }

/* Unread summary chip. */
.notif-head__count {
  display: inline-flex;
  align-items: center;
  gap: var(--app-space-2);
  padding: 0.28rem 0.7rem;
  border-radius: var(--app-radius-pill);
  background: var(--app-accent-soft);
  color: var(--app-accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}
.notif-head__count-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--app-radius-pill);
  background: var(--app-accent);
  flex: none;
}

/* ---- Feed --------------------------------------------------------------- */
.notif-feed {
  display: flex;
  flex-direction: column;
  gap: var(--app-space-3);
}

.notif-item {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: var(--app-space-4);
  padding: var(--app-space-4) var(--app-space-4) var(--app-space-4) var(--app-space-4);
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-1);
  transition: box-shadow var(--app-dur-fast) var(--app-ease),
              border-color var(--app-dur-fast) var(--app-ease),
              transform var(--app-dur-fast) var(--app-ease);
}
.notif-item:hover {
  box-shadow: var(--app-shadow-2);
  border-color: var(--app-border-strong);
}

/* Unread: soft tint + a leading accent rail (logical inline-start = right in rtl). */
.notif-item.is-unread {
  background: color-mix(in oklch, var(--app-surface) 92%, var(--app-accent) 8%);
  border-color: var(--app-accent-ring);
}
.notif-item.is-unread::before {
  content: "";
  position: absolute;
  inset-block: var(--app-space-3);
  inset-inline-start: 0;
  width: 3px;
  border-radius: var(--app-radius-pill);
  background: var(--app-accent);
}

/* Type medallion. */
.notif-item__medallion {
  width: 42px;
  height: 42px;
  border-radius: var(--app-radius-sm);
  display: grid;
  place-items: center;
  background: var(--app-surface-2);
  color: var(--app-muted);
  flex: none;
}
.notif-item__medallion svg { width: 20px; height: 20px; }
.notif-item.is-unread .notif-item__medallion {
  background: var(--app-accent-soft);
  color: var(--app-accent-strong);
}

.notif-item__body { min-width: 0; }

.notif-item__head {
  display: flex;
  align-items: center;
  gap: var(--app-space-2);
  margin-block-end: 0.15rem;
}
.notif-item__title {
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
  color: var(--app-text);
}
.notif-item__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--app-radius-pill);
  background: var(--app-accent);
  flex: none;
}

.notif-item__message {
  color: var(--app-muted);
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0 0 var(--app-space-2);
  overflow-wrap: anywhere;
}

.notif-item__meta {
  display: flex;
  align-items: center;
  gap: var(--app-space-2);
  flex-wrap: wrap;
  font-size: 0.76rem;
  color: var(--app-muted);
}
.notif-item__type {
  padding: 0.12rem 0.5rem;
  border-radius: var(--app-radius-pill);
  background: var(--app-surface-2);
  border: 1px solid var(--app-border);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.notif-item__date { white-space: nowrap; }

.notif-item__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--app-space-1);
  flex: none;
}
/* Icon-only button: square, centred glyph, no text. Label lives in title +
   aria-label (native tooltip + screen-reader name). Reusable across the app. */
.btn-icon {
  display: inline-grid;
  place-items: center;
  padding: 0;
  width: 2rem;
  height: 2rem;
  flex: none;
}
.btn-icon .app-ico { width: 16px; height: 16px; }
.btn-icon .app-ico svg { width: 16px; height: 16px; }
/* Arrow points along reading direction: flip for rtl. */
html[dir="rtl"] .notif-item__open .app-ico { transform: scaleX(-1); }

/* Stack to a single column on small screens; actions drop below the body. */
@media (max-width: 575.98px) {
  .notif-item {
    grid-template-columns: auto 1fr;
    gap: var(--app-space-3);
  }
  .notif-item__actions {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    margin-block-start: var(--app-space-1);
  }
}

/* ---- Empty state -------------------------------------------------------- */
.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--app-space-2);
  padding: var(--app-space-12) var(--app-space-4);
  background: var(--app-surface);
  border: 1px dashed var(--app-border-strong);
  border-radius: var(--app-radius-lg);
}
.notif-empty__icon {
  width: 56px;
  height: 56px;
  border-radius: var(--app-radius);
  display: grid;
  place-items: center;
  background: var(--app-surface-2);
  color: var(--app-muted);
  margin-block-end: var(--app-space-2);
}
.notif-empty__icon svg { width: 26px; height: 26px; }
.notif-empty__title {
  font-weight: 700;
  color: var(--app-text);
  margin: 0;
}
.notif-empty__hint {
  color: var(--app-muted);
  font-size: 0.88rem;
  margin: 0;
  max-width: 32ch;
}

@media (prefers-reduced-motion: reduce) {
  .notif-item { transition: none; }
}
