/* =========================================================
   Aljhood Glass — design tokens & base components
   Training Management System (نظام إدارة التدريب) — RTL
   Font: IBM Plex Sans Arabic (Google Fonts)
   <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap" rel="stylesheet">
   ========================================================= */

:root {
  /* Brand (sampled from the Aljhood logo) */
  --aj-teal: #1F7073;        /* primary: buttons, active states */
  --aj-teal-700: #175659;    /* hover */
  --aj-teal-900: #0F4547;    /* dark text on teal tints, toasts */
  --aj-teal-tint: rgba(31,112,115,.12);
  --aj-gold: #F0BB41;        /* accent: highlights, progress, notification dot — never as text on light bg */
  --aj-gold-ink: #5C430A;    /* text on gold tints */
  --aj-gold-tint: rgba(240,187,65,.28);
  --aj-gray: #808383;
  --aj-gray-light: #CECED0;

  /* Text */
  --aj-ink: #142222;
  --aj-ink-2: #1E2B2B;
  --aj-muted: #4A5757;       /* secondary text — passes 4.5:1 on glass */
  --aj-placeholder: #6B7676;

  /* Status */
  --aj-danger: #B3261E;
  --aj-danger-ink: #8E1C15;
  --aj-danger-tint: rgba(179,38,30,.12);

  /* Glass */
  --aj-glass: rgba(255,255,255,.30);        /* big panels: sidebar, header, page container */
  --aj-glass-border: rgba(255,255,255,.60);
  --aj-card: rgba(255,255,255,.58);         /* cards inside panels */
  --aj-card-border: rgba(255,255,255,.85);
  --aj-field: rgba(255,255,255,.68);
  --aj-blur-panel: blur(30px) saturate(150%);
  --aj-blur-card: blur(22px);
  --aj-shadow-panel: 0 30px 70px -30px rgba(15,69,71,.40);
  --aj-shadow-card: 0 12px 30px -18px rgba(15,69,71,.35);

  /* Radii */
  --aj-r-pill: 999px;
  --aj-r-panel: 32px;
  --aj-r-card: 24px;
  --aj-r-field: 14px;
  --aj-r-tile: 12px;

  /* Chart palette (ordered; differs in lightness, not only hue) */
  --aj-c1: #1F7073; --aj-c2: #F0BB41; --aj-c3: #0F4547; --aj-c4: #8FC3C4;
  --aj-c5: #808383; --aj-c6: #B88A1E; --aj-c7: #CECED0;
}

/* ---------- Base ---------- */
html[dir="rtl"] body, body {
  margin: 0;
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  color: var(--aj-ink);
}
*, *::before, *::after { box-sizing: border-box; }
a { color: var(--aj-teal-700); }
a:hover { color: var(--aj-teal-900); }

.aj-bg {
  min-height: 100vh;
  background: #dfe3e1 url("assets/tms-bg.c7014aeff907.jpg") center / cover fixed no-repeat;
}

/* ---------- Glass surfaces ---------- */
.aj-glass {
  background: var(--aj-glass);
  backdrop-filter: var(--aj-blur-panel);
  -webkit-backdrop-filter: var(--aj-blur-panel);
  border: 1px solid var(--aj-glass-border);
  box-shadow: var(--aj-shadow-panel);
}
.aj-card {
  background: var(--aj-card);
  backdrop-filter: var(--aj-blur-card);
  -webkit-backdrop-filter: var(--aj-blur-card);
  border: 1px solid var(--aj-card-border);
  border-radius: var(--aj-r-card);
  box-shadow: var(--aj-shadow-card);
  transition: transform .25s ease, box-shadow .25s ease;
}
.aj-card.is-lift:hover { transform: translateY(-4px); box-shadow: 0 22px 40px -18px rgba(15,69,71,.45); }

/* ---------- Buttons ---------- */
.aj-btn {
  font: inherit; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: var(--aj-r-pill);
  border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .15s, background .2s, box-shadow .2s;
}
.aj-btn:active { transform: scale(.97); }
.aj-btn:focus-visible { outline: 2px solid var(--aj-teal-900); outline-offset: 2px; }
.aj-btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.aj-btn--primary { background: var(--aj-teal); color: #fff; }
.aj-btn--primary:hover { background: var(--aj-teal-700); color: #fff; }
.aj-btn--white { background: #fff; color: var(--aj-ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.aj-btn--glass { background: rgba(255,255,255,.5); border-color: rgba(255,255,255,.9); color: var(--aj-ink); }
.aj-btn--glass:hover { background: rgba(255,255,255,.85); }
.aj-btn--dashed { background: transparent; border: 1.5px dashed rgba(31,112,115,.55); color: var(--aj-teal-700); }
.aj-btn--danger { background: var(--aj-danger-tint); color: var(--aj-danger-ink); }
.aj-btn--sm { height: 36px; padding: 0 14px; font-size: 13px; }
.aj-btn--lg { height: 52px; padding: 0 24px; font-size: 15px; }
.aj-btn--icon { width: 44px; padding: 0; }

/* ---------- Form fields ---------- */
.aj-label { font-size: 13px; font-weight: 600; color: var(--aj-ink-2); }
.aj-req { color: #A11F18; }
.aj-hint { font-size: 13px; color: var(--aj-muted); }
.aj-error { font-size: 12px; font-weight: 600; color: #A11F18; }
.aj-field {
  position: relative; display: flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 0 14px; border-radius: var(--aj-r-field);
  background: var(--aj-field); border: 1px solid rgba(255,255,255,.95);
  color: var(--aj-muted); transition: background .2s, border-color .2s;
}
.aj-field:hover { background: rgba(255,255,255,.85); }
.aj-field:focus-within { background: #fff; outline: 2px solid var(--aj-teal); outline-offset: 2px; }
.aj-field.is-invalid { border-color: var(--aj-danger); background: rgba(255,240,238,.9); }
.aj-field input, .aj-field select, .aj-field textarea {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none; padding: 0;
  font: inherit; font-size: 14px; color: var(--aj-ink);
}
.aj-field select { appearance: none; -webkit-appearance: none; padding-left: 26px; height: 46px; cursor: pointer; }
.aj-field textarea { resize: vertical; padding: 12px 0; line-height: 1.6; min-height: 96px; }
.aj-field ::placeholder { color: var(--aj-placeholder); }
.aj-field .aj-caret { position: absolute; left: 14px; pointer-events: none; }   /* chevron for selects (RTL) */
.aj-field--pill { border-radius: var(--aj-r-pill); }                              /* search inputs */

/* File drop zone (wrap a real <input type="file"> inside a <label>) */
.aj-drop {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 64px;
  padding: 12px 16px; border-radius: 16px; border: 1.5px dashed rgba(31,112,115,.45);
  background: rgba(255,255,255,.45); cursor: pointer; transition: all .2s;
}
.aj-drop:hover { background: rgba(255,255,255,.75); border-color: var(--aj-teal); }
.aj-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.aj-drop.has-file { border-style: solid; background: rgba(31,112,115,.08); }

/* Toggle switch (RTL: knob starts on the right) */
.aj-toggle { position: relative; width: 50px; height: 30px; border-radius: 999px; border: 0; padding: 0; cursor: pointer; background: rgba(74,87,87,.35); transition: background .2s; }
.aj-toggle::after { content: ''; position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .22s cubic-bezier(.3,1.4,.6,1); }
.aj-toggle[aria-checked="true"] { background: var(--aj-teal); }
.aj-toggle[aria-checked="true"]::after { transform: translateX(-20px); }

/* Segmented control */
.aj-segs { display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; background: rgba(255,255,255,.5); border: 1px solid rgba(255,255,255,.9); }
.aj-seg { font: inherit; font-size: 13px; font-weight: 600; height: 36px; padding: 0 16px; border-radius: 999px; border: 0; background: transparent; color: #384545; cursor: pointer; }
.aj-seg[aria-selected="true"], .aj-seg[aria-checked="true"] { background: var(--aj-teal); color: #fff; }

/* Selectable option cards (e.g. activity type) */
.aj-option { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px; border-radius: 18px; border: 1.5px solid rgba(255,255,255,.95); background: rgba(255,255,255,.5); cursor: pointer; text-align: right; font: inherit; transition: all .2s; }
.aj-option:hover { background: rgba(255,255,255,.8); transform: translateY(-2px); }
.aj-option[aria-checked="true"] { background: #fff; border-color: var(--aj-teal); box-shadow: 0 10px 24px -14px rgba(15,69,71,.6); }

/* ---------- Badges & chips ---------- */
.aj-badge { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.aj-badge--active { background: rgba(31,112,115,.14); color: var(--aj-teal-900); }
.aj-badge--inactive { background: var(--aj-danger-tint); color: var(--aj-danger-ink); }
.aj-badge--neutral { background: rgba(128,131,131,.18); color: #2E3B3B; }
.aj-badge--gold { background: var(--aj-gold-tint); color: var(--aj-gold-ink); }
.aj-chip { font: inherit; font-size: 13px; font-weight: 600; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.9); background: rgba(255,255,255,.45); color: var(--aj-ink-2); cursor: pointer; }
.aj-chip[aria-pressed="true"] { background: var(--aj-teal); border-color: var(--aj-teal); color: #fff; }

/* ---------- Sidebar (right side in RTL) ---------- */
.aj-sidebar { width: 268px; border-radius: 28px; padding: 16px 12px; display: flex; flex-direction: column; gap: 14px; transition: width .3s cubic-bezier(.2,1,.3,1); }
.aj-sidebar.is-collapsed:not(.is-peek) { width: 84px; }
.aj-sidebar.is-collapsed:not(.is-peek) .aj-nav__label, .aj-sidebar.is-collapsed:not(.is-peek) .aj-nav__sub, .aj-sidebar.is-collapsed:not(.is-peek) .aj-nav__chev { display: none; }
.aj-nav__item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 6px; border: 0; background: transparent; border-radius: 16px; font: inherit; font-size: 15px; font-weight: 600; color: var(--aj-ink-2); text-decoration: none; cursor: pointer; text-align: right; transition: background .2s; }
.aj-nav__item:hover { background: rgba(255,255,255,.55); color: var(--aj-teal-900); }
.aj-nav__item.is-active { background: #fff; color: var(--aj-teal-900); box-shadow: 0 6px 16px -10px rgba(15,69,71,.5); }
.aj-nav__tile { width: 38px; height: 38px; border-radius: var(--aj-r-tile); display: inline-flex; align-items: center; justify-content: center; flex: none; background: var(--aj-teal-tint); color: var(--aj-teal-700); }
.aj-nav__item.is-active .aj-nav__tile { background: var(--aj-teal); color: #fff; }
.aj-nav__sub { display: flex; flex-direction: column; gap: 2px; padding: 4px 50px 8px 0; }
.aj-nav__sub a { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 12px; font-size: 14px; font-weight: 500; color: #2E3B3B; text-decoration: none; }
.aj-nav__sub a::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--aj-gray); }
.aj-nav__sub a.is-active { background: var(--aj-teal-tint); color: var(--aj-teal-900); font-weight: 600; }
.aj-nav__sub a.is-active::before { background: var(--aj-gold); box-shadow: 0 0 0 3px rgba(240,187,65,.3); }
@media (max-width: 860px) { .aj-sidebar, .aj-sidebar.is-collapsed { width: 100%; } }

/* ---------- Table ---------- */
.aj-table-wrap { overflow-x: auto; }
.aj-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.aj-table th { position: sticky; top: 0; font-size: 12px; font-weight: 600; color: #384545; text-align: right; padding: 12px; white-space: nowrap; background: rgba(255,255,255,.85); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(15,69,71,.1); }
.aj-table td { padding: 12px; border-bottom: 1px solid rgba(15,69,71,.07); vertical-align: middle; }
.aj-table tbody tr:hover { background: rgba(255,255,255,.55); }
.aj-table tr.is-selected { background: rgba(31,112,115,.08); }

/* ---------- Menus, toasts ---------- */
.aj-menu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 20; min-width: 190px; padding: 6px; border-radius: 16px; background: rgba(255,255,255,.95); backdrop-filter: blur(24px); border: 1px solid #fff; box-shadow: 0 20px 40px -12px rgba(15,69,71,.4); animation: aj-pop .18s ease-out; }
.aj-menu__item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; font: inherit; font-size: 14px; color: var(--aj-ink); text-align: right; padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.aj-menu__item:hover { background: rgba(31,112,115,.08); }
.aj-menu__item--danger { color: var(--aj-danger-ink); }
.aj-toast { position: fixed; left: 24px; bottom: 24px; z-index: 50; padding: 12px 18px; border-radius: 18px; background: rgba(15,69,71,.94); color: #fff; font-size: 14px; box-shadow: 0 20px 40px -12px rgba(0,0,0,.4); animation: aj-rise .35s cubic-bezier(.2,1.2,.4,1); }

/* ---------- Motion ---------- */
@keyframes aj-pop  { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes aj-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes aj-enter { from { opacity: 0; transform: translateY(24px) scale(.98); filter: blur(10px); } to { opacity: 1; transform: none; filter: none; } }
.aj-enter { animation: aj-enter .6s cubic-bezier(.2,1,.3,1); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* =========================================================
   Default layer — styles plain HTML inside .aj-content so legacy
   templates look right without aj- classes.
   Selectors are `.aj-content :where(el)` (specificity 0,1,0): they beat
   Tailwind's preflight resets but tie with Tailwind utility classes, so
   utilities still win when this file is loaded before Tailwind's own
   stylesheet. Legacy class names (.btn, .alert, .badge, .card,
   .pagination) are mapped to the same tokens.
   ========================================================= */

.aj-content { color: var(--aj-ink); font-size: 14px; line-height: 1.6; }

/* Headings */
.aj-content :where(h1, h2, h3, h4) { color: var(--aj-ink); font-weight: 700; line-height: 1.3; }

/* Tables */
.aj-content :where(table) { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.aj-content :where(th) { font-size: 12px; font-weight: 600; color: #384545; text-align: right; padding: 12px; white-space: nowrap; background: rgba(255,255,255,.85); border-bottom: 1px solid rgba(15,69,71,.1); }
.aj-content :where(td) { padding: 12px; border-bottom: 1px solid rgba(15,69,71,.07); vertical-align: middle; }
.aj-content :where(tbody tr):hover { background: rgba(255,255,255,.55); }

/* Form fields */
.aj-content :where(label) { font-size: 13px; font-weight: 600; color: var(--aj-ink-2); }
.aj-content :where(input:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"], [type="submit"], [type="button"], [type="reset"], [type="range"], [type="color"]), select, textarea) {
  min-height: 48px; padding: 0 14px; border-radius: var(--aj-r-field);
  background: var(--aj-field); border: 1px solid rgba(255,255,255,.95);
  color: var(--aj-ink); font: inherit; font-size: 14px;
  transition: background .2s, border-color .2s;
}
.aj-content :where(textarea) { padding: 12px 14px; min-height: 96px; line-height: 1.6; resize: vertical; }
.aj-content :where(input, select, textarea)::placeholder { color: var(--aj-placeholder); }
.aj-content :where(input:not([type=checkbox]):not([type=radio]), select, textarea):hover { background: rgba(255,255,255,.85); }          /* not the boxes: their background IS the tick */
.aj-content :where(input[type=checkbox], input[type=radio]):focus-visible { outline: 2px solid var(--aj-teal); outline-offset: 2px; }
.aj-content :where(input:not([type=checkbox]):not([type=radio]), select, textarea):focus { background: #fff; outline: 2px solid var(--aj-teal); outline-offset: 2px; }
/* a control inside a field box: the box draws the focus ring, so the control inside draws none (no second border within the first) */
.aj-content .aj-field :is(input, select, textarea):focus,
.aj-content .aj-field :is(input, select, textarea):focus-visible,
.aj-content .aj-form .aj-field :is(input, select, textarea):focus { outline: 0 !important; box-shadow: none !important; background: transparent !important; }
.aj-content :where(input, select, textarea):disabled,
.aj-content :where(input, select, textarea)[readonly] { opacity: .65; cursor: not-allowed; }
.aj-content :where(input[type="checkbox"], input[type="radio"]) { accent-color: var(--aj-teal); width: 18px; height: 18px; cursor: pointer; }
.aj-content :where(input[type="file"]) { font: inherit; font-size: 13px; color: var(--aj-muted); }
.aj-content :where(input[type="file"])::file-selector-button { font: inherit; font-weight: 600; margin-inline-end: 12px; height: 36px; padding: 0 14px; border-radius: var(--aj-r-pill); border: 1px solid rgba(255,255,255,.9); background: rgba(255,255,255,.5); color: var(--aj-ink); cursor: pointer; }
.aj-content :where(input[type="file"])::file-selector-button:hover { background: rgba(255,255,255,.85); }
.aj-content :where(select) { cursor: pointer; }

/* Buttons — plain buttons and legacy .btn. Buttons that carry Tailwind
   background classes (bg-*) are left to those classes. */
.aj-content :where(button:not([class*="bg-"]), input[type="submit"], input[type="button"], input[type="reset"], .btn) {
  font: inherit; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: var(--aj-r-pill);
  border: 1px solid rgba(255,255,255,.9); background: rgba(255,255,255,.5); color: var(--aj-ink);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .15s, background .2s, box-shadow .2s;
}
.aj-content :where(button:not([class*="bg-"]), input[type="submit"], input[type="button"], input[type="reset"], .btn):hover { background: rgba(255,255,255,.85); }
.aj-content :where(button, input[type="submit"], input[type="button"], .btn):active { transform: scale(.97); }
.aj-content :where(button, input[type="submit"], input[type="button"], .btn):focus-visible { outline: 2px solid var(--aj-teal-900); outline-offset: 2px; }
.aj-content :where(button, input[type="submit"], input[type="button"], .btn):disabled,
.aj-content .btn.disabled { opacity: .5; cursor: not-allowed; transform: none; }
.aj-content :where(button[type="submit"]:not([class*="bg-"]), input[type="submit"], .btn-primary) { background: var(--aj-teal); border-color: transparent; color: #fff; }
.aj-content :where(button[type="submit"]:not([class*="bg-"]), input[type="submit"], .btn-primary):hover { background: var(--aj-teal-700); color: #fff; }
.aj-content :where(.btn-secondary, .btn-light, .btn-outline) { background: rgba(255,255,255,.5); color: var(--aj-ink); }
.aj-content :where(.btn-danger, .btn-delete) { background: var(--aj-danger-tint); border-color: transparent; color: var(--aj-danger-ink); }
.aj-content :where(.btn-sm) { height: 36px; padding: 0 14px; font-size: 13px; }
.aj-content :where(.btn-lg) { height: 52px; padding: 0 24px; font-size: 15px; }

/* Alerts / Django messages */
.aj-content :where(.alert) { padding: 12px 16px; border-radius: var(--aj-r-field); border: 1px solid rgba(255,255,255,.9); background: var(--aj-card); color: var(--aj-ink); font-size: 14px; }
.aj-content :where(.alert-success, .alert.success) { background: rgba(31,112,115,.14); color: var(--aj-teal-900); }
.aj-content :where(.alert-warning, .alert.warning) { background: var(--aj-gold-tint); color: var(--aj-gold-ink); }
.aj-content :where(.alert-danger, .alert-error, .alert.error) { background: var(--aj-danger-tint); color: var(--aj-danger-ink); }
.aj-content :where(.alert-info, .alert.info) { background: rgba(128,131,131,.18); color: #2E3B3B; }
.aj-content :where(.errorlist) { list-style: none; margin: 4px 0 0; padding: 0; font-size: 12px; font-weight: 600; color: #A11F18; }

/* Badges */
.aj-content :where(.badge) { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: rgba(128,131,131,.18); color: #2E3B3B; }
.aj-content :where(.badge-success, .badge-active) { background: rgba(31,112,115,.14); color: var(--aj-teal-900); }
.aj-content :where(.badge-danger, .badge-inactive) { background: var(--aj-danger-tint); color: var(--aj-danger-ink); }
.aj-content :where(.badge-warning) { background: var(--aj-gold-tint); color: var(--aj-gold-ink); }

/* Cards */
.aj-content :where(.card) {
  background: var(--aj-card); backdrop-filter: var(--aj-blur-card); -webkit-backdrop-filter: var(--aj-blur-card);
  border: 1px solid var(--aj-card-border); border-radius: var(--aj-r-card); box-shadow: var(--aj-shadow-card);
}
.aj-content :where(.card-header, .card-body, .card-footer) { padding: 16px 20px; }
.aj-content :where(.card-header) { font-weight: 700; border-bottom: 1px solid rgba(15,69,71,.07); }

/* Pagination */
.aj-content :where(.pagination) { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; list-style: none; padding: 0; margin: 0; }
.aj-content :where(.pagination a, .pagination span, .pagination .page-link) {
  display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 12px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.9); background: rgba(255,255,255,.45);
  color: var(--aj-ink-2); font-size: 13px; font-weight: 600; text-decoration: none;
}
.aj-content :where(.pagination a:hover, .pagination .page-link:hover) { background: rgba(255,255,255,.85); }
.aj-content :where(.pagination .active, .pagination .current, .pagination .active > *, .pagination [aria-current="page"]) { background: var(--aj-teal); border-color: var(--aj-teal); color: #fff; }
.aj-content :where(.pagination .disabled, .pagination .disabled > *) { opacity: .5; pointer-events: none; }

/* =========================================================
   App shell — sidebar + top bar + content panel (templates/layouts/base.html)
   ========================================================= */
.aj-shell { min-height: 100vh; padding: 20px; display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.aj-sidebar { flex: none; position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; }
.aj-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.aj-topbar { border-radius: var(--aj-r-pill); padding: 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.aj-page { border-radius: var(--aj-r-panel); padding: 28px; display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.aj-page-footer { margin-top: auto; padding-top: 12px; font-size: 13px; color: var(--aj-muted); text-align: center; }

.aj-sidebar__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 10px; }
.aj-sidebar__head .aj-logo-full { height: 46px; width: auto; }
.aj-sidebar__head .aj-logo-mark { height: 40px; width: auto; margin: 0 auto; display: none; }
.aj-sidebar.is-collapsed:not(.is-peek) .aj-logo-full { display: none; }
.aj-sidebar.is-collapsed:not(.is-peek) .aj-logo-mark { display: block; }
.aj-nav { display: flex; flex-direction: column; gap: 4px; }
.aj-nav__label { flex: 1; text-align: right; }
.aj-nav__chev { transition: transform .25s; }
.aj-nav__item[aria-expanded="true"] .aj-nav__chev { transform: rotate(180deg); }
.aj-nav__sub[hidden] { display: none; }
.aj-sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid rgba(15,69,71,.1); }
.aj-sidebar.is-collapsed:not(.is-peek) .aj-nav__item { justify-content: center; }
/* the footer of the sidebar: collapse and logout side by side as buttons */
.aj-sidebar__foot { flex-direction: row; align-items: stretch; gap: 8px; }
.aj-foot-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 14px; border: 1px solid rgba(255,255,255,.9); background: rgba(255,255,255,.55); font: inherit; font-size: 14px; font-weight: 600; color: var(--aj-ink-2); text-decoration: none; cursor: pointer; transition: background .2s; }
.aj-foot-btn:hover { background: rgba(255,255,255,.9); color: var(--aj-teal-900); }
.aj-foot-btn:focus-visible { outline: 2px solid var(--aj-teal-900); outline-offset: 2px; }
.aj-foot-btn--icon { width: 44px; flex: none; padding: 0; }
.aj-foot-btn--danger { flex: 1; min-width: 0; background: rgba(255,240,238,.88); border-color: rgba(179,38,30,.18); color: var(--aj-danger-ink); }
.aj-foot-btn--danger:hover { background: #fff; color: var(--aj-danger-ink); }
.aj-sidebar.is-collapsed:not(.is-peek) .aj-sidebar__foot { flex-direction: column; align-items: center; }
.aj-sidebar.is-collapsed:not(.is-peek) .aj-foot-btn--danger { flex: none; width: 44px; padding: 0; }
.aj-sidebar.is-collapsed #ajCollapseIcon { transform: rotate(180deg); }
#ajCollapseIcon { transition: transform .3s; }
.aj-nav__tile--gray { background: rgba(128,131,131,.16); color: #384545; }
.aj-nav__tile--danger { background: var(--aj-danger-tint); color: var(--aj-danger-ink); }

.aj-icon-btn { width: 44px; height: 44px; padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.9); background: rgba(255,255,255,.5); color: var(--aj-ink); cursor: pointer; }
.aj-icon-btn:hover { background: rgba(255,255,255,.85); }
.aj-icon-btn:focus-visible, .aj-user:focus-visible { outline: 2px solid var(--aj-teal-900); outline-offset: 2px; }
.aj-user { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 6px 0 16px; border-radius: var(--aj-r-pill); background: #fff; border: 0; font: inherit; cursor: pointer; color: var(--aj-ink); }
.aj-user__avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--aj-teal); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; overflow: hidden; }
.aj-user__avatar img { width: 100%; height: 100%; object-fit: cover; }
.aj-user__name { font-size: 14px; font-weight: 600; }
.aj-dropdown { position: relative; }
.aj-menu { inset-inline-end: auto; inset-inline-start: auto; left: 0; right: auto; }
.aj-menu[hidden] { display: none; }
.aj-menu a.aj-menu__item { text-decoration: none; }
.aj-menu__sep { height: 1px; margin: 4px 6px; background: rgba(15,69,71,.1); }
.aj-menu__head { padding: 8px 12px; font-size: 12px; color: var(--aj-muted); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aj-menu__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; min-width: 260px; }
.aj-menu__grid a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 12px; font-size: 12px; font-weight: 600; color: var(--aj-ink-2); text-decoration: none; text-align: center; }
.aj-menu__grid a:hover { background: rgba(31,112,115,.08); }
.aj-mobile-toggle { display: none; }
@media (max-width: 860px) {
  .aj-shell { padding: 12px; gap: 12px; }
  .aj-sidebar { position: static; max-height: none; display: none; }
  .aj-sidebar.is-open { display: flex; }
  .aj-mobile-toggle { display: inline-flex; }
  .aj-page { padding: 18px; border-radius: 24px; }
  .aj-user__name { display: none; }
}
@media print { .aj-sidebar, .aj-topbar, .aj-page-footer { display: none !important; } .aj-bg { background: #fff; } .aj-shell, .aj-page { padding: 0; box-shadow: none; backdrop-filter: none; border: 0; } }

/* =========================================================
   Login screen (templates/user_profile/login.html)
   ========================================================= */
.aj-auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 32px 16px; }
.aj-login { width: 100%; max-width: 1040px; border-radius: 36px; overflow: hidden; display: flex; flex-wrap: wrap; background: rgba(255,255,255,.34); box-shadow: 0 40px 90px -30px rgba(15,69,71,.45); }
.aj-login__brand { flex: 1 1 380px; min-width: 0; padding: 48px 44px; background: rgba(23,86,89,.82); color: #fff; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; position: relative; overflow: hidden; }
.aj-login__brand > * { position: relative; }
.aj-login__brand .aj-deco { position: absolute; border-radius: 50%; pointer-events: none; }
.aj-login__brand h1 { margin: 0; font-size: 38px; font-weight: 700; line-height: 1.25; color: #fff; }
.aj-login__brand p { margin: 0; font-size: 16px; line-height: 1.8; color: rgba(255,255,255,.88); max-width: 340px; }
.aj-login__pills { display: flex; gap: 10px; flex-wrap: wrap; }
.aj-pill { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); font-size: 13px; font-weight: 500; }
.aj-pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--aj-gold); }
.aj-login__form { flex: 1 1 420px; min-width: 0; padding: 48px 44px; display: flex; flex-direction: column; gap: 22px; }
.aj-login__form h2 { margin: 0; font-size: 30px; font-weight: 700; }
.aj-login__form .aj-sub { margin: 8px 0 0; font-size: 15px; color: #384545; }
.aj-login__group { display: flex; flex-direction: column; gap: 8px; }
.aj-login__group .aj-label { font-size: 14px; }
.aj-field--lg { min-height: 54px; padding: 0 18px; border-radius: 16px; }
.aj-field--lg input { font-size: 15px; }
.aj-field.is-invalid + .aj-error, .aj-error[hidden] { }
.aj-error[hidden] { display: none; }
.aj-field-btn svg[hidden] { display: none; }
.aj-field-btn { border: 0; background: transparent; padding: 6px; border-radius: 8px; cursor: pointer; color: #384545; display: inline-flex; }
.aj-field-btn:hover { background: rgba(0,0,0,.06); }
.aj-field-btn:focus-visible { outline: 2px solid var(--aj-teal-900); outline-offset: 2px; }
.aj-login__row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.aj-check { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--aj-ink-2); cursor: pointer; padding: 6px; border-radius: 10px; }
.aj-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.aj-check__box { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--aj-muted); background: rgba(255,255,255,.75); display: inline-flex; align-items: center; justify-content: center; color: transparent; transition: all .15s; }
.aj-check input:checked + .aj-check__box { background: var(--aj-teal); border-color: var(--aj-teal); color: #fff; }
.aj-check input:focus-visible + .aj-check__box { outline: 2px solid var(--aj-teal-900); outline-offset: 3px; }
.aj-link { font: inherit; font-size: 14px; font-weight: 600; color: var(--aj-teal-700); background: transparent; border: 0; cursor: pointer; padding: 6px; border-radius: 8px; text-decoration: underline; text-underline-offset: 4px; }
.aj-link:focus-visible { outline: 2px solid var(--aj-teal-900); outline-offset: 3px; }
.aj-notice { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: var(--aj-gold-tint); border: 1px solid rgba(240,187,65,.6); font-size: 14px; line-height: 1.7; color: #3D2D06; }
.aj-notice--danger { background: var(--aj-danger-tint); border-color: rgba(179,38,30,.35); color: var(--aj-danger-ink); }
.aj-notice[hidden] { display: none; }
.aj-notice svg { flex: none; margin-top: 2px; }
.aj-btn--block { width: 100%; }
.aj-btn--primary.aj-btn--lg { box-shadow: 0 12px 24px -10px rgba(31,112,115,.7); }
@keyframes aj-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.aj-shake { animation: aj-shake .4s; }
.aj-auth__footer { font-size: 13px; color: var(--aj-ink-2); font-weight: 500; text-align: center; }

/* Explicit aj- component classes must beat the default element layer above. */
.aj-content .aj-btn { height: 44px; padding: 0 18px; border-radius: var(--aj-r-pill); font-size: 14px; }
.aj-content .aj-btn--sm { height: 36px; padding: 0 14px; font-size: 13px; }
.aj-content .aj-btn--lg { height: 52px; padding: 0 24px; font-size: 15px; }
.aj-content .aj-btn--icon { width: 44px; padding: 0; }
.aj-content .aj-btn--primary { background: var(--aj-teal); border-color: transparent; color: #fff; }
.aj-content .aj-btn--primary:hover { background: var(--aj-teal-700); color: #fff; }
.aj-content .aj-btn--white { background: #fff; border-color: transparent; color: var(--aj-ink); }
.aj-content .aj-btn--glass { background: rgba(255,255,255,.5); border-color: rgba(255,255,255,.9); color: var(--aj-ink); }
.aj-content .aj-btn--glass:hover { background: rgba(255,255,255,.85); }
.aj-content .aj-btn--dashed { background: transparent; border: 1.5px dashed rgba(31,112,115,.55); color: var(--aj-teal-700); }
.aj-content .aj-btn--danger { background: var(--aj-danger-tint); border-color: transparent; color: var(--aj-danger-ink); }
.aj-content .aj-menu__item { height: auto; min-height: 0; padding: 9px 12px; border: 0; border-radius: 10px; background: transparent; justify-content: flex-start; font-weight: 400; }
.aj-content .aj-menu__item:hover { background: rgba(31,112,115,.08); }
.aj-content .aj-menu__item--danger { color: var(--aj-danger-ink); }

/* =========================================================
   Dashboard (templates/apps/control_panel.html)
   ========================================================= */
.aj-title { margin: 0; font-size: 32px; font-weight: 700; }
.aj-subtitle { margin: 4px 0 0; font-size: 14px; color: #384545; }
.aj-page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.aj-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; }
.aj-panel { flex: 1 1 420px; min-width: 0; padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.aj-panel__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.aj-h2 { margin: 0; font-size: 18px; font-weight: 700; }
.aj-kpi { flex: 1 1 220px; min-width: 0; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.aj-kpi__top { display: flex; justify-content: space-between; align-items: flex-start; }
.aj-kpi__tile { width: 46px; height: 46px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; }
.aj-kpi__label { font-size: 14px; color: #384545; font-weight: 500; }
.aj-kpi__value { font-size: 34px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.aj-kpi__text { font-size: 17px; font-weight: 700; line-height: 1.4; }
.aj-tile--teal { background: var(--aj-teal); color: #fff; }
.aj-tile--tint { background: var(--aj-teal-tint); color: var(--aj-teal-700); }
.aj-tile--gold { background: var(--aj-gold); color: #142222; }
.aj-tile--gray { background: rgba(128,131,131,.18); color: #384545; }
.aj-badge--soft { background: rgba(255,255,255,.75); color: #384545; }
.aj-card-menu { position: relative; }
.aj-card-menu .aj-icon-btn { width: 36px; height: 36px; }

.aj-donut-wrap { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.aj-donut { position: relative; width: 210px; height: 210px; flex: none; margin: 0 auto; }
.aj-donut__center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 50px; pointer-events: none; }
.aj-donut__value { font-size: 30px; font-weight: 700; line-height: 1.1; }
.aj-donut__label { font-size: 12px; line-height: 1.4; color: var(--aj-muted); }
.aj-legend-list { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; }
.aj-legend { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 500; color: var(--aj-ink-2); padding: 7px 10px; border-radius: 10px; cursor: pointer; text-align: right; }
.aj-content .aj-legend { height: auto; justify-content: flex-start; border-radius: 10px; padding: 7px 10px; background: transparent; border: 0; font-size: 13px; font-weight: 500; }
.aj-content .aj-legend:hover, .aj-content .aj-legend.is-on { background: rgba(31,112,115,.1); }
.aj-legend__dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.aj-legend__name { flex: 1; min-width: 0; }
.aj-legend__pct { font-weight: 700; }

.aj-chart-box { position: relative; flex: 1; min-height: 240px; }
.aj-empty { position: absolute; inset: 0 0 30px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; }
.aj-empty__icon { width: 52px; height: 52px; border-radius: 16px; background: var(--aj-gold-tint); color: var(--aj-gold-ink); display: inline-flex; align-items: center; justify-content: center; }
.aj-months { display: flex; gap: 8px; padding: 8px 4px 0; }
.aj-months span { flex: 1; text-align: center; font-size: 11px; color: var(--aj-muted); }
.aj-baseline { display: flex; align-items: flex-end; gap: 8px; padding: 0 4px; border-bottom: 1px solid rgba(15,69,71,.18); flex: 1; min-height: 200px; }
.aj-baseline i { flex: 1; height: 6px; border-radius: 6px 6px 0 0; background: rgba(31,112,115,.18); }

.aj-meter { display: flex; flex-direction: column; gap: 8px; }
.aj-meter__top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.aj-meter__top span:first-child { font-weight: 600; }
.aj-meter__top span:last-child { font-weight: 700; }
.aj-meter__track { height: 12px; border-radius: 12px; background: rgba(15,69,71,.08); overflow: hidden; }
.aj-meter__fill { height: 100%; border-radius: 12px; transition: width .8s cubic-bezier(.2,1,.3,1); }
.aj-note { margin-top: auto; padding: 14px 16px; border-radius: 16px; background: rgba(31,112,115,.1); font-size: 14px; line-height: 1.7; color: var(--aj-teal-900); }

.aj-hrow { display: flex; align-items: center; gap: 12px; }
.aj-hrow__name { flex: 0 0 190px; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aj-hrow__track { flex: 1; height: 22px; border-radius: 8px; background: rgba(15,69,71,.06); overflow: hidden; }
.aj-hrow__fill { height: 100%; border-radius: 8px; transition: width .8s cubic-bezier(.2,1,.3,1); }
.aj-hrow__val { flex: 0 0 22px; font-size: 14px; font-weight: 700; text-align: left; }

.aj-stack { display: flex; flex-direction: column; gap: 10px; }
.aj-stack__title { font-size: 14px; font-weight: 600; }
.aj-stack__bar { display: flex; height: 14px; border-radius: 14px; overflow: hidden; gap: 2px; }
.aj-stack__legend { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.aj-stack__legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--aj-ink-2); }
.aj-stack__legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
@media (max-width: 560px) { .aj-hrow__name { flex-basis: 110px; } .aj-title { font-size: 26px; } }

/* =========================================================
   Activity form screens (templates/apps/activity_definition.html)
   ========================================================= */
.aj-steps { display: flex; align-items: center; gap: 4px; min-width: 0; overflow-x: auto; }
.aj-step { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 6px 0 16px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--aj-muted); text-decoration: none; white-space: nowrap; }
.aj-step__num { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; border: 1.5px solid var(--aj-gray); color: var(--aj-muted); }
.aj-step.is-current { background: #fff; color: var(--aj-ink); }
.aj-step.is-current .aj-step__num { background: var(--aj-teal); border-color: var(--aj-teal); color: #fff; }
.aj-steps__sep { color: var(--aj-muted); display: inline-flex; }

.aj-split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.aj-split__main { flex: 1 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.aj-summary { flex: 0 0 290px; position: sticky; top: 20px; padding: 20px; display: flex; flex-direction: column; gap: 16px; align-self: flex-start; }
@media (max-width: 1100px) { .aj-summary { position: static; flex: 1 1 100%; } }

.aj-section { padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.aj-section__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.aj-section__title { display: flex; align-items: center; gap: 12px; }
.aj-section__title h2 { margin: 0; font-size: 18px; font-weight: 700; }
.aj-section__title p { margin: 2px 0 0; font-size: 13px; color: var(--aj-muted); }
.aj-section__icon { width: 40px; height: 40px; border-radius: var(--aj-r-tile); display: inline-flex; align-items: center; justify-content: center; background: var(--aj-teal-tint); color: var(--aj-teal-700); flex: none; }
.aj-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.aj-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .aj-grid, .aj-grid--3 { grid-template-columns: minmax(0, 1fr); } }
.aj-fw { gap: 8px; min-width: 0; }
.aj-fw .validation-error { font-size: 12px; font-weight: 600; color: #A11F18; }

.aj-switch { display: inline-flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; }
.aj-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.aj-options { display: grid; gap: 10px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .aj-options { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .aj-options { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* the type of an activity: eight options, four in a row (افتراضي وصفي في الصف الأول، هجين ومدمج في الثاني) */
.aj-options--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .aj-options--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.aj-content .aj-option { height: auto; min-height: 0; padding: 12px; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 6px; border-radius: 16px; border: 1.5px solid rgba(255,255,255,.95); background: rgba(255,255,255,.5); color: var(--aj-ink); font-weight: 400; white-space: normal; text-align: right; }
.aj-content .aj-option.bg-gray-200, .aj-content .aj-option.bg-blue-500 { background: rgba(255,255,255,.5); color: var(--aj-ink); }
.aj-content .aj-option:hover { background: rgba(255,255,255,.8); transform: translateY(-2px); }
.aj-content .aj-option[aria-checked="true"] { background: #fff; border-color: var(--aj-teal); box-shadow: 0 10px 24px -14px rgba(15,69,71,.6); }
.aj-option__tile { width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--aj-teal-tint); color: var(--aj-teal-700); }
.aj-option[aria-checked="true"] .aj-option__tile { background: var(--aj-teal); color: #fff; }
.aj-option__title { font-size: 14px; font-weight: 700; }
.aj-option__sub { font-size: 11.5px; line-height: 1.4; color: var(--aj-muted); }

/* Account sub-cards. The page script clones .activity-account-form, so the numbering is a CSS counter. */
#activity-accounts-container { counter-reset: aj-acct; display: flex; flex-direction: column; gap: 14px; }
.aj-account { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; padding: 18px; border-radius: 20px; background: rgba(255,255,255,.5); border: 1px solid rgba(255,255,255,.9); }
.aj-account::before { counter-increment: aj-acct; content: "حساب " counter(aj-acct); grid-column: 1 / -1; justify-self: start; display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 999px; background: var(--aj-gold-tint); color: var(--aj-gold-ink); font-size: 13px; font-weight: 700; }
.aj-account > .flex.justify-end { grid-column: 1 / -1; margin: 0; }
.aj-span-2 { grid-column: span 2; }
@media (max-width: 900px) { .aj-account { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .aj-account { grid-template-columns: minmax(0, 1fr); } .aj-span-2 { grid-column: auto; } }
.aj-attached { display: flex; gap: 8px; align-items: stretch; }
.aj-attached > :first-child { flex: 1; min-width: 0; }
.aj-attached .currency-field { flex: 0 0 120px; }
.aj-content .aj-pay.mb-6 { margin-bottom: 0; }
.aj-pay__opts { display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; background: rgba(255,255,255,.5); border: 1px solid rgba(255,255,255,.9); align-self: flex-start; }
.aj-pay__opt { position: relative; cursor: pointer; }
.aj-pay__opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.aj-pay__opt span { display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border-radius: 999px; font-size: 13px; font-weight: 600; color: #384545; }
.aj-pay__opt input:checked + span { background: var(--aj-teal); color: #fff; }
.aj-pay__opt input:focus-visible + span { outline: 2px solid var(--aj-teal-900); outline-offset: 2px; }

/* File drop zones: a real <input type="file"> stretched over the zone */
.aj-drop { gap: 12px; }
.aj-drop__icon { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--aj-teal-tint); color: var(--aj-teal-700); flex: none; }
.aj-drop__text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.aj-drop__title { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aj-drop__hint { font-size: 12px; color: var(--aj-muted); }
.aj-drop__remove { position: relative; z-index: 1; }
.aj-drop-wrap { display: flex; align-items: stretch; gap: 8px; }
.aj-drop-wrap > .aj-drop { flex: 1; min-width: 0; }
.aj-form .aj-drop input[type="file"] { padding: 0; min-height: 0; border: 0; background: transparent; }

/* Controls inside the activity form: normalise the Tailwind classes the widgets carry. */
.aj-form :is(input:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"]), textarea) { width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--aj-r-field); background: var(--aj-field); border: 1px solid rgba(255,255,255,.95); color: var(--aj-ink); font: inherit; font-size: 14px; box-shadow: none; }
.aj-form textarea { padding: 12px 14px; min-height: 96px; line-height: 1.6; resize: vertical; }
.aj-form :is(input:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"]), textarea, select):hover { background: rgba(255,255,255,.85); }
.aj-form :is(input:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"]), textarea, select):focus { background: #fff; outline: 2px solid var(--aj-teal); outline-offset: 2px; box-shadow: none; }
.aj-form select { width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--aj-r-field); background-color: var(--aj-field); border: 1px solid rgba(255,255,255,.95); font: inherit; font-size: 14px; color: var(--aj-ink); }
.aj-form .border-red-500 { border-color: var(--aj-danger) !important; background: rgba(255,240,238,.9) !important; }
.aj-form .border-green-500 { border-color: rgba(31,112,115,.6) !important; }
.aj-form .aj-pay.border-red-500 { border-radius: 16px; }
.aj-form.shake { animation: aj-shake .4s; }

/* Select2 (loaded by the page): match the field look */
.aj-content .select2-container { width: 100% !important; }
.aj-content .select2-container--default .select2-selection--single { height: 48px; display: flex; align-items: center; border-radius: var(--aj-r-field); background: var(--aj-field); border: 1px solid rgba(255,255,255,.95); box-shadow: none; }
.aj-content .select2-container--default .select2-selection--single .select2-selection__rendered { flex: 1; line-height: 46px; padding: 0 14px 0 30px; color: var(--aj-ink); text-align: right; font-size: 14px; }
.aj-content .select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--aj-placeholder); }
.aj-content .select2-container--default .select2-selection--single .select2-selection__arrow { height: 46px; left: 10px; right: auto; }
.aj-content .select2-container--default .select2-selection--single .select2-selection__clear { margin-left: 8px; margin-right: 0; float: left; color: var(--aj-muted); }
.aj-content .select2-container--default:hover .select2-selection--single { background: rgba(255,255,255,.85); }
.aj-content .select2-container--default.select2-container--focus .select2-selection--single,
.aj-content .select2-container--default.select2-container--open .select2-selection--single { background: #fff; outline: 2px solid var(--aj-teal); outline-offset: 2px; border-color: rgba(255,255,255,.95); box-shadow: none; }
/* the picker of a time only: hour then minute from the left, as in the field (in RTL it showed 16 : 09 for 09:16) */
.flatpickr-calendar.noCalendar { direction: ltr; }

/* the search box inside a multiple select2: it takes the look of the field around it (it was drawn as a small bordered box) */
.select2-container--default .select2-selection--multiple .select2-search--inline .select2-search__field {
  border: 0 !important; background: transparent !important; box-shadow: none !important; outline: 0 !important;
  min-height: 0 !important; height: auto !important; padding: 0 !important; margin: 8px 6px !important;
  font: inherit; color: var(--aj-ink); min-width: 120px; width: 100% !important; text-align: right;
}
.select2-container--default .select2-selection--multiple .select2-search--inline { float: right; min-width: 120px; }
.select2-container--default .select2-selection--multiple .select2-selection__rendered { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 8px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice { margin: 0; }
body .select2-dropdown { border-radius: 14px; border: 1px solid #fff; background: rgba(255,255,255,.98); box-shadow: 0 20px 40px -12px rgba(15,69,71,.4); overflow: hidden; font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; }
body .select2-container--default .select2-results__option--highlighted[aria-selected], body .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background: var(--aj-teal); color: #fff; }
body .select2-container--default .select2-results__option[aria-selected="true"] { background: var(--aj-teal-tint); color: var(--aj-ink); }
body .select2-container--default .select2-search--dropdown .select2-search__field { border-radius: 10px; border: 1px solid rgba(15,69,71,.2); padding: 8px 10px; }

/* Summary panel */
.aj-summary__label { font-size: 12px; color: var(--aj-muted); }
.aj-summary__name { margin: 2px 0 0; font-size: 18px; font-weight: 700; line-height: 1.4; word-break: break-word; }
.aj-summary__code { margin-top: 2px; font-size: 12px; color: var(--aj-muted); direction: ltr; text-align: right; }
.aj-ring { position: relative; width: 62px; height: 62px; flex: none; }
.aj-ring svg { transform: rotate(-90deg); }
.aj-ring__val { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; }
.aj-summary__progress { display: flex; align-items: center; gap: 14px; }
.aj-summary__progress p { margin: 0; font-size: 13px; color: var(--aj-muted); line-height: 1.6; }
.aj-check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.aj-check-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.aj-check-list__mark { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--aj-gray-light); color: transparent; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.aj-check-list li.is-done .aj-check-list__mark { background: var(--aj-teal); border-color: var(--aj-teal); color: #fff; }
.aj-check-list li small { margin-inline-start: auto; font-size: 12px; color: var(--aj-muted); }
.aj-notice--success { background: rgba(31,112,115,.14); border-color: rgba(31,112,115,.35); color: var(--aj-teal-900); }
.aj-notice--warning { background: var(--aj-gold-tint); }

/* Component buttons inside .aj-content must not pick up the default button layer (same specificity, later in file). */
.aj-content .aj-toggle { display: inline-block; position: relative; width: 50px; height: 30px; padding: 0; border: 0; border-radius: 999px; background: rgba(74,87,87,.35); gap: 0; }
.aj-content .aj-toggle:hover { background: rgba(74,87,87,.5); }
.aj-content .aj-toggle:active { transform: none; }
.aj-content .aj-toggle[aria-checked="true"], .aj-content .aj-toggle[aria-checked="true"]:hover { background: var(--aj-teal); }
.aj-content .aj-toggle:focus-visible { outline: 2px solid var(--aj-teal-900); outline-offset: 3px; }
.aj-content .aj-seg { height: 36px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: #384545; font-size: 13px; font-weight: 600; }
.aj-content .aj-seg:hover { background: rgba(255,255,255,.6); }
.aj-content .aj-seg[aria-selected="true"], .aj-content .aj-seg[aria-checked="true"] { background: var(--aj-teal); color: #fff; }
.aj-content .aj-chip { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.9); background: rgba(255,255,255,.45); color: var(--aj-ink-2); font-size: 13px; font-weight: 600; }
.aj-content .aj-chip[aria-pressed="true"] { background: var(--aj-teal); border-color: var(--aj-teal); color: #fff; }
.aj-content .aj-icon-btn { width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.aj-content .aj-card-menu .aj-icon-btn { width: 36px; height: 36px; }

/* Dropdowns live inside glass surfaces; backdrop-filter makes each surface its own stacking context,
   so the surface that owns an open menu has to sit above the surfaces painted after it. */
.aj-topbar { position: relative; z-index: 30; }
.aj-card { position: relative; }
.aj-card:has(.aj-menu:not([hidden])) { z-index: 20; }

/* backdrop-filter on an element makes it the containing block of its position:fixed descendants, which would
   trap drawers, dialogs and toasts rendered inside the content. The panel therefore blurs through a pseudo-element. */
.aj-page.aj-glass { backdrop-filter: none; -webkit-backdrop-filter: none; position: relative; }
.aj-page.aj-glass::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; backdrop-filter: var(--aj-blur-panel); -webkit-backdrop-filter: var(--aj-blur-panel); }

/* =========================================================
   Planning table (templates/apps/activity_planning.html)
   ========================================================= */
.aj-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.aj-toolbar__search { flex: 1 1 320px; max-width: 460px; }
.aj-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.aj-chip__n { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; margin-inline-start: 8px; border-radius: 999px; background: rgba(15,69,71,.1); font-size: 12px; }
.aj-content .aj-chip[aria-pressed="true"] .aj-chip__n { background: rgba(255,255,255,.25); }

.aj-tablecard { border-radius: var(--aj-r-card); background: var(--aj-card); border: 1px solid var(--aj-card-border); box-shadow: var(--aj-shadow-card); overflow: hidden; }
.aj-grid-table { width: 100%; min-width: 980px; }
.aj-grid-table th { background: rgba(255,255,255,.7); }
.aj-grid-table td { vertical-align: middle; }
.aj-row-main { cursor: pointer; }
.aj-row-main.is-selected { background: rgba(31,112,115,.08); }
.aj-row-main.is-open td { border-bottom-color: transparent; }
.aj-code { font-size: 12px; white-space: nowrap; direction: ltr; text-align: right; color: #384545; }
.aj-cell-name { font-weight: 600; max-width: 280px; }
.aj-cell-sub { margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--aj-muted); }
.aj-badge--outline { background: rgba(255,255,255,.7); border: 1px solid rgba(15,69,71,.12); color: var(--aj-ink-2); }
.aj-badge--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.aj-accts { display: flex; flex-direction: column; gap: 2px; min-width: 150px; max-width: 240px; }
.aj-accts__name { font-weight: 500; }
.aj-accts__more { font-size: 12px; color: var(--aj-muted); }
.aj-rev { font-size: 13px; font-weight: 700; color: var(--aj-teal-900); direction: ltr; text-align: right; }
.aj-cell-actions { white-space: nowrap; width: 1%; }
.aj-cell-actions .aj-icon-btn { width: 34px; height: 34px; }
.aj-content .aj-cell-actions .aj-icon-btn { width: 34px; height: 34px; }
.aj-expand svg { transition: transform .2s; }
.aj-expand[aria-expanded="true"] svg { transform: rotate(180deg); }
.aj-cb { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--aj-muted); background: rgba(255,255,255,.75) center / 14px no-repeat; cursor: pointer; vertical-align: middle; transition: all .15s; padding: 0; }
.aj-cb:checked, .aj-cb:indeterminate { background-color: var(--aj-teal); border-color: var(--aj-teal); }
.aj-cb:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
.aj-cb:indeterminate { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round'%3E%3Cpath d='M6 12h12'/%3E%3C/svg%3E"); }
.aj-cb:focus-visible { outline: 2px solid var(--aj-teal-900); outline-offset: 2px; }
.aj-content input.aj-cb { width: 22px; height: 22px; }

.aj-detail td { padding: 0 16px 16px; background: rgba(255,255,255,.35); }
.aj-detail__grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; padding: 16px; border-radius: 18px; background: rgba(31,112,115,.07); border: 1px solid rgba(255,255,255,.7); }
@media (max-width: 800px) { .aj-detail__grid { grid-template-columns: minmax(0, 1fr); } }
.aj-detail h4 { margin: 0 0 10px; font-size: 14px; font-weight: 700; }
.aj-acct { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: #fff; margin-bottom: 8px; }
.aj-acct__icon { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--aj-teal-tint); color: var(--aj-teal-700); flex: none; }
.aj-acct__name { flex: 1; min-width: 0; font-weight: 500; }
.aj-acct__amt { font-size: 13px; font-weight: 700; color: var(--aj-teal-900); direction: ltr; white-space: nowrap; }
.aj-dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.aj-dl dt { color: var(--aj-muted); }
.aj-dl dd { margin: 0; font-weight: 600; text-align: left; }

.aj-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid rgba(15,69,71,.07); }
.aj-pager__info { font-size: 13px; color: var(--aj-muted); }
.aj-pager__pages { display: flex; align-items: center; gap: 6px; }
.aj-content .aj-pg { min-width: 38px; height: 38px; padding: 0 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.9); background: rgba(255,255,255,.55); color: var(--aj-ink-2); font-size: 13px; font-weight: 600; }
.aj-content .aj-pg:hover { background: rgba(255,255,255,.9); }
.aj-content .aj-pg[aria-current="page"] { background: var(--aj-teal); border-color: var(--aj-teal); color: #fff; }
.aj-content .aj-pg:disabled { opacity: .45; cursor: default; }
.aj-pager__gap { color: var(--aj-muted); padding: 0 2px; }

.aj-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 999px; background: var(--aj-teal); color: #fff; }
.aj-bulk[hidden] { display: none; }
.aj-bulk strong { font-size: 14px; }
.aj-bulk__actions { display: flex; gap: 8px; margin-inline-start: auto; }
.aj-content .aj-bulk .aj-btn--glass { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.3); color: #fff; }
.aj-content .aj-bulk .aj-btn--glass:hover { background: rgba(255,255,255,.28); }

.aj-rowmenu { position: fixed; z-index: 60; inset-inline-end: auto; top: 0; left: 0; }
.aj-rowmenu .aj-menu__item { width: 100%; }

/* Dialog (planning table: column settings) */
.aj-modal { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15,69,71,.35); }
.aj-modal[hidden] { display: none; }
.aj-modal__panel { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; padding: 22px; display: flex; flex-direction: column; gap: 16px; background: rgba(255,255,255,.92); }

/* =========================================================
   Profile (templates/user_profile/profile.html)
   ========================================================= */
.pf { display: flex; flex-direction: column; gap: 22px; }
.pf-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.pf-head h1 { margin: 0; font-size: 30px; font-weight: 700; }
.pf-head p { margin: 4px 0 0; font-size: 14px; color: #384545; }
.pf-grid { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.pf-side { flex: 1 1 280px; max-width: 360px; min-width: 0; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 20px; }
.pf-main { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.pf-card { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.pf-sec { display: flex; align-items: center; gap: 12px; }
.pf-sec h2 { margin: 0; font-size: 18px; font-weight: 700; }
.pf-sec p { margin: 2px 0 0; font-size: 13px; color: #4A5757; }
.pf-ic { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; background: rgba(31,112,115,.12); color: #175659; }
.pf-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.pf-f { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.pf-ltr { direction: ltr; text-align: right; }
.pf-ro { background: rgba(31,112,115,.07) !important; }
.pf-ro input { color: #2E3B3B; }
.pf-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 2px; padding-top: 18px; border-top: 1px solid rgba(15,69,71,.08); }
.pf-dirty { font-size: 13px; color: #5C430A; display: none; align-items: center; gap: 6px; }
.pf-dirty::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #F0BB41; }
.pf-dirty.is-on { display: inline-flex; }

.pf-id { padding: 28px 22px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.pf-avatar { width: 104px; height: 104px; border-radius: 50%; background: #1F7073; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 42px; font-weight: 700; box-shadow: 0 0 0 6px rgba(255,255,255,.75), 0 0 0 9px rgba(240,187,65,.75); margin-bottom: 12px; }
.pf-name { font-size: 20px; font-weight: 700; }
.pf-user { font-size: 14px; color: #4A5757; direction: ltr; }
.pf-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.pf-meta { width: 100%; margin: 14px 0 0; padding-top: 14px; border-top: 1px solid rgba(15,69,71,.1); display: flex; flex-direction: column; gap: 10px; }
.pf-meta div { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.pf-meta dt { color: #4A5757; }
.pf-meta dd { margin: 0; font-weight: 600; direction: ltr; }
.pf-tip { padding: 16px 18px; display: flex; gap: 12px; align-items: flex-start; font-size: 13px; line-height: 1.7; color: #1E2B2B; }

.pf-meter { display: flex; gap: 6px; }
.pf-meter span { flex: 1; height: 5px; border-radius: 5px; background: rgba(15,69,71,.12); transition: background .3s; }
.pf-rules { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px 16px; }
.pf-rules li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #4A5757; transition: color .2s; }
.pf-rules li::before { content: ''; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid #808383; flex: none; transition: all .2s; }
.pf-rules li.ok { color: #0F4547; font-weight: 600; }
.pf-rules li.ok::before { background: #1F7073 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 11px no-repeat; border-color: #1F7073; }
.pf-match { font-size: 12px; font-weight: 600; display: none; }
.pf-match.ok { display: block; color: #0B6B53; }
.pf-match.bad { display: block; color: #A11F18; }
.aj-content .pf-eye { height: auto; width: auto; border: 0; background: transparent; padding: 6px; border-radius: 8px; cursor: pointer; color: #384545; display: inline-flex; }
.aj-content .pf-eye:hover { background: rgba(0,0,0,.06); }
.aj-content .pf-eye:focus-visible { outline: 2px solid #0F4547; outline-offset: 2px; }

/* no yellow Chrome autofill inside glass fields */
.aj-field input:-webkit-autofill, .aj-field input:-webkit-autofill:hover, .aj-field input:-webkit-autofill:focus { -webkit-text-fill-color: #142222; -webkit-box-shadow: 0 0 0 1000px transparent inset; transition: background-color 9999s ease-out 0s; }

@media (max-width: 860px) { .pf-side { position: static; max-width: none; } }

/* Planning table: chips and pager are links now (the server does the filtering and paging) */
.aj-content a.aj-chip { display: inline-flex; align-items: center; text-decoration: none; }
.aj-content .aj-chip.is-active { background: var(--aj-teal); border-color: var(--aj-teal); color: #fff; }
.aj-content .aj-chip.is-active .aj-chip__n { background: rgba(255,255,255,.25); }
.aj-content .aj-chip--scope { margin-inline-start: 6px; border-style: dashed; }
.aj-content a.aj-pg, .aj-content span.aj-pg { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.aj-content .aj-pg.is-on { background: var(--aj-teal-tint); border-color: rgba(31,112,115,.4); color: var(--aj-teal-900); }
.aj-content .aj-pg.is-off { opacity: .45; }
.aj-content .aj-pg[aria-current="page"] { background: var(--aj-teal); border-color: var(--aj-teal); color: #fff; }

/* Column settings dialog: visible / hidden panels with drag and drop */
.aj-modal__panel--wide { max-width: 760px; }
.aj-colpanels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 640px) { .aj-colpanels { grid-template-columns: minmax(0, 1fr); } }
.aj-colpanel { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 18px; background: rgba(255,255,255,.5); border: 1px solid rgba(255,255,255,.9); min-height: 120px; }
.aj-colpanel h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--aj-teal-900); }
.aj-colpanel h3 .aj-chip__n { margin-inline-start: auto; }
.aj-collist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 56px; }
.aj-collist:empty::before { content: "اسحب الأعمدة إلى هنا"; display: block; padding: 18px 8px; text-align: center; font-size: 12px; color: var(--aj-muted); border: 1.5px dashed rgba(31,112,115,.35); border-radius: 12px; }
.aj-colitem { display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 10px; border-radius: 12px; background: #fff; border: 1px solid rgba(15,69,71,.08); font-size: 14px; font-weight: 600; cursor: grab; user-select: none; }
.aj-colitem:active { cursor: grabbing; }
.aj-colitem.is-ghost { opacity: .35; }
.aj-colitem__grip { display: inline-flex; color: var(--aj-muted); }
.aj-colitem__name { flex: 1; min-width: 0; }
.aj-colitem__acts { display: inline-flex; gap: 2px; }
.aj-content .aj-colitem__acts button { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #384545; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.aj-content .aj-colitem__acts button:hover { background: var(--aj-teal-tint); }
.aj-content .aj-colitem__acts button:focus-visible { outline: 2px solid var(--aj-teal-900); outline-offset: 1px; }

/* Planning table: actions cell and multi-line cells */
.aj-actions { display: inline-flex; align-items: center; gap: 4px; }
.aj-cell-line { white-space: nowrap; }
.aj-cell-line + .aj-cell-line { margin-top: 2px; }
.aj-rev--col { display: inline-block; }

/* =========================================================
   Activity edit page (templates/apps/activity_edit.html)
   ========================================================= */
.ed { display: flex; flex-direction: column; gap: 20px; }
.ed-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ed-crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #4A5757; flex-wrap: wrap; margin-bottom: 6px; }
.ed-crumbs a { color: #175659; text-decoration: none; font-weight: 500; }
.ed-crumbs a:hover { text-decoration: underline; }
.ed-head h1 { margin: 0; font-size: 28px; font-weight: 700; line-height: 1.35; }
.ed-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.ed-code { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 999px; background: #fff; font-size: 13px; font-weight: 700; color: #0F4547; direction: ltr; border: 1px solid rgba(15,69,71,.12); }
.ed-grid { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.ed-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.ed-side { flex: 1 1 280px; max-width: 340px; min-width: 0; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 20px; }
.ed-card { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.ed-sec { display: flex; align-items: center; gap: 12px; }
.ed-sec h2 { margin: 0; font-size: 18px; font-weight: 700; }
.ed-sec p { margin: 2px 0 0; font-size: 13px; color: #4A5757; }
.ed-ic { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; background: rgba(31,112,115,.12); color: #175659; }
.ed-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.ed-f { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.ed-f.full { grid-column: 1 / -1; }
.ed-f .aj-field select, .ed-f .aj-field input, .ed-f .aj-field textarea { width: 100%; }
.ed-ltr input { direction: ltr; text-align: right; }
.ed-caret { position: absolute; left: 14px; pointer-events: none; color: #4A5757; }

/* option cards built from the field choices */
.ed-opts { display: flex; flex-wrap: wrap; gap: 10px; }
.ed-opt { position: relative; flex: 1 1 140px; min-width: 0; cursor: pointer; }
.ed-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.ed-opt span { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 14px; border-radius: 16px; border: 1.5px solid rgba(255,255,255,.95); background: rgba(255,255,255,.5); font-size: 14px; font-weight: 600; color: #1E2B2B; transition: all .2s; }
.ed-opt span::before { content: ''; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid #808383; background: #fff; flex: none; transition: all .15s; }
.ed-opt:hover span { background: rgba(255,255,255,.8); }
.ed-opt input:checked + span { background: #fff; border-color: #1F7073; color: #0F4547; box-shadow: 0 10px 22px -14px rgba(15,69,71,.6); }
.ed-opt input:checked + span::before { border: 6px solid #1F7073; }
.ed-opt input:focus-visible + span { outline: 2px solid #0F4547; outline-offset: 2px; }

/* switch built on a real checkbox */
.ed-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 16px; background: rgba(255,255,255,.55); border: 1px solid rgba(255,255,255,.9); cursor: pointer; position: relative; }
.ed-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ed-switch .t { position: relative; width: 50px; height: 30px; border-radius: 999px; background: rgba(74,87,87,.35); flex: none; transition: background .2s; }
.ed-switch .t::after { content: ''; position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .22s cubic-bezier(.3,1.4,.6,1); }
.ed-switch input:checked ~ .t { background: #1F7073; }
.ed-switch input:checked ~ .t::after { transform: translateX(-20px); }
.ed-switch input:focus-visible ~ .t { outline: 2px solid #0F4547; outline-offset: 2px; }
.ed-switch b { font-size: 14px; font-weight: 600; }
.ed-switch small { display: block; font-size: 12px; color: #4A5757; font-weight: 400; }

/* notes tabs */
.ed-tabs { display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; background: rgba(255,255,255,.5); border: 1px solid rgba(255,255,255,.9); align-self: flex-start; flex-wrap: wrap; }
.aj-content .ed-tab { font: inherit; font-size: 13px; font-weight: 600; height: 36px; padding: 0 16px; border-radius: 999px; border: 0; background: transparent; color: #384545; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.aj-content .ed-tab[aria-selected="true"] { background: #1F7073; color: #fff; }
.ed-tab .dot { width: 7px; height: 7px; border-radius: 50%; background: #F0BB41; display: none; }
.ed-tab.has .dot { display: inline-block; }
.aj-content .ed-tab:focus-visible { outline: 2px solid #0F4547; outline-offset: 2px; }

/* files */
.ed-files { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.ed-cur { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(31,112,115,.08); font-size: 13px; }
.ed-cur a { font-weight: 600; color: #0F4547; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.ed-cur a:hover { text-decoration: underline; }
.ed-clear { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #8E1C15; cursor: pointer; }
.ed-fname { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* side panel */
.ed-panel { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.ed-kv { display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.ed-kv div { display: flex; justify-content: space-between; gap: 8px; }
.ed-kv dt { color: #4A5757; }
.ed-kv dd { margin: 0; font-weight: 600; }
.ed-dirty { display: none; align-items: center; gap: 8px; font-size: 13px; color: #5C430A; padding: 10px 12px; border-radius: 12px; background: rgba(240,187,65,.22); }
.ed-dirty.on { display: flex; }
.ed-dirty::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #F0BB41; flex: none; }
.ed-errors { padding: 14px 16px; border-radius: 16px; background: rgba(255,240,238,.92); border: 1px solid rgba(179,38,30,.4); color: #7A1812; font-size: 14px; line-height: 1.7; }
.ed-errors a { color: #7A1812; font-weight: 600; }

/* delete dialog */
.ed-dialog { border: 0; padding: 0; border-radius: 28px; max-width: 440px; width: calc(100% - 32px); background: rgba(255,255,255,.92); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); box-shadow: 0 40px 80px -20px rgba(15,69,71,.5); }
.ed-dialog::backdrop { background: rgba(15,40,40,.3); backdrop-filter: blur(6px); }
.ed-dialog[open] { animation: aj-enter .35s cubic-bezier(.2,1,.3,1); }
.ed-danger { background: #B3261E; color: #fff; }
.aj-content .ed-danger { background: #B3261E; border-color: transparent; color: #fff; }
.aj-content .ed-danger:hover { background: #8E1C15; }
.ed-related { margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(240,187,65,.22); font-size: 13px; line-height: 1.7; color: #3D2D06; }
@media (max-width: 860px) { .ed-side { position: static; max-width: none; } }

/* =========================================================
   Activity detail page (templates/apps/activity_detail.html)
   ========================================================= */
.dt { display: flex; flex-direction: column; gap: 20px; }
.dt-crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #4A5757; flex-wrap: wrap; }
.dt-crumbs a { color: #175659; text-decoration: none; font-weight: 500; }
.dt-crumbs a:hover { text-decoration: underline; }
.dt-hero { padding: 28px; display: flex; flex-direction: column; gap: 20px; position: relative; overflow: hidden; }
.dt-hero::after { content: ''; position: absolute; width: 260px; height: 260px; border-radius: 50%; background: rgba(240,187,65,.16); left: -90px; top: -120px; pointer-events: none; }
.dt-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; position: relative; z-index: 1; }
.dt-title h1 { margin: 0; font-size: 30px; font-weight: 700; line-height: 1.35; }
.dt-title .en { margin: 4px 0 0; font-size: 15px; color: #4A5757; direction: ltr; text-align: right; }
.dt-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.aj-content .dt-code { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px; background: #fff; font-size: 13px; font-weight: 700; color: #0F4547; direction: ltr; border: 1px solid rgba(15,69,71,.12); cursor: pointer; font-family: inherit; }
.aj-content .dt-code:hover { border-color: #1F7073; background: #fff; }
.aj-content .dt-code:focus-visible { outline: 2px solid #0F4547; outline-offset: 2px; }
.dt-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dt-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; position: relative; z-index: 1; }
.dt-stat { padding: 14px 16px; border-radius: 18px; background: rgba(255,255,255,.62); border: 1px solid rgba(255,255,255,.95); display: flex; flex-direction: column; gap: 4px; }
.dt-stat span { font-size: 12px; color: #4A5757; font-weight: 500; }
.dt-stat strong { font-size: 20px; font-weight: 700; line-height: 1.3; }
.dt-stat .ltr { direction: ltr; text-align: right; }
.dt-grid { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.dt-col-main { flex: 999 1 540px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.dt-col-side { flex: 1 1 300px; max-width: 380px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.dt-card { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.dt-sec { display: flex; align-items: center; gap: 12px; }
.dt-sec h2 { margin: 0; font-size: 17px; font-weight: 700; }
.dt-sec .count { margin-inline-start: auto; font-size: 12px; font-weight: 600; color: #4A5757; }
.dt-ic { width: 38px; height: 38px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; background: rgba(31,112,115,.12); color: #175659; }
.dt-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0; margin: 0; border-radius: 16px; overflow: hidden; background: rgba(255,255,255,.55); border: 1px solid rgba(255,255,255,.95); }
.dt-kv div { padding: 14px 16px; border-bottom: 1px solid rgba(15,69,71,.07); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dt-kv dt { font-size: 12px; color: #4A5757; font-weight: 500; }
.dt-kv dd { margin: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.dt-kv dd.ltr { direction: ltr; text-align: right; }
.dt-acc { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: #fff; border: 1px solid rgba(15,69,71,.08); transition: transform .2s, box-shadow .2s; }
.dt-acc:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -16px rgba(15,69,71,.5); }
.dt-acc .logo { width: 44px; height: 44px; border-radius: 14px; background: rgba(31,112,115,.12); color: #175659; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.dt-acc .nm { font-size: 15px; font-weight: 700; line-height: 1.4; }
.dt-acc .sub { font-size: 12px; color: #4A5757; }
.dt-acc .amt { margin-inline-start: auto; text-align: left; flex: none; }
.dt-acc .amt b { display: block; font-size: 17px; font-weight: 700; color: #0F4547; direction: ltr; }
.dt-acc .amt small { font-size: 11px; color: #4A5757; }
.dt-person { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.dt-person + .dt-person { border-top: 1px solid rgba(15,69,71,.07); }
.dt-av { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; font-size: 15px; font-weight: 700; background: #1F7073; color: #fff; }
.dt-av.gold { background: #F0BB41; color: #142222; }
.dt-av.gray { background: rgba(128,131,131,.22); color: #1E2B2B; }
.dt-person .r { font-size: 12px; color: #4A5757; }
.dt-person .n { font-size: 14px; font-weight: 600; }
.dt-file { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: #fff; border: 1px solid rgba(15,69,71,.08); text-decoration: none; color: #142222; transition: border-color .2s; }
.dt-file:hover { border-color: #1F7073; color: #142222; }
.dt-file .n { font-size: 14px; font-weight: 600; }
.dt-file .s { font-size: 12px; color: #4A5757; }
.dt-file .go { margin-inline-start: auto; color: #175659; }
.dt-file.missing { background: transparent; border-style: dashed; color: #4A5757; }
.dt-file.missing .n { color: #384545; font-weight: 500; }
.dt-empty { padding: 28px 16px; border-radius: 16px; border: 1.5px dashed rgba(31,112,115,.3); display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: #384545; font-size: 14px; }
.dt-notes { margin: 0; white-space: pre-line; font-size: 14px; line-height: 1.8; }
@media print {
  .dt-actions, .dt-crumbs { display: none !important; }
  .aj-card { box-shadow: none !important; backdrop-filter: none !important; background: #fff !important; border: 1px solid #ddd !important; }
}

/* Toast notifications (showToast): a stack in the bottom corner, same dark-teal pill as .aj-toast */
.aj-snacks { position: fixed; left: 24px; bottom: 24px; z-index: 80; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.aj-snack { pointer-events: auto; display: flex; align-items: center; gap: 12px; min-width: 280px; max-width: 460px; padding: 12px 14px 12px 18px; border-radius: 18px; background: rgba(15,69,71,.94); color: #fff; font-size: 14px; box-shadow: 0 20px 40px -12px rgba(0,0,0,.4); animation: aj-rise .35s cubic-bezier(.2,1.2,.4,1); transition: opacity .25s, transform .25s; }
.aj-snack.is-leaving { opacity: 0; transform: translateY(8px); }
.aj-snack__icon { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; background: var(--aj-gold); color: #142222; }
.aj-snack--error .aj-snack__icon { background: #F4B4AE; color: #5E120D; }
.aj-snack--warning .aj-snack__icon { background: var(--aj-gold); }
.aj-snack--info .aj-snack__icon { background: var(--aj-teal-tint); color: #fff; }
.aj-snack__text { flex: 1; min-width: 0; line-height: 1.6; }
.aj-content .aj-snack__close { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: rgba(255,255,255,.75); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.aj-content .aj-snack__close:hover { background: rgba(255,255,255,.15); color: #fff; }


/* =========================================================
   Activity execution page (/activated/)  —  ex-*
   ========================================================= */
.ex { display: flex; flex-direction: column; gap: 18px; }
.ex-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ex-step { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: #1F7073; color: #fff; font-weight: 700; font-size: 15px; flex: none; }
.ex-head h1 { margin: 0; font-size: 30px; font-weight: 700; display: flex; align-items: center; gap: 12px; }
.ex-head p { margin: 6px 0 0; font-size: 14px; color: #384545; }

.ex-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.aj-content .ex-tab { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(255,255,255,.9); background: rgba(255,255,255,.45); font-size: 14px; font-weight: 600; color: #1E2B2B; text-decoration: none; transition: all .2s; }
.aj-content .ex-tab:hover { background: rgba(255,255,255,.85); color: #142222; }
.aj-content .ex-tab.on { background: #1F7073; border-color: #1F7073; color: #fff; }
.ex-tab .dot { width: 8px; height: 8px; border-radius: 50%; }
.ex-tab .n { font-size: 12px; font-weight: 700; opacity: .75; }
.ex-tab:focus-visible { outline: 2px solid #0F4547; outline-offset: 2px; }

.ex-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ex-bar .aj-field { min-height: 44px; }
.ex-more { display: none; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px; border-radius: 18px; background: rgba(255,255,255,.45); border: 1px solid rgba(255,255,255,.9); }
.ex-more.open { display: flex; }
.ex-more .f { display: flex; flex-direction: column; gap: 6px; min-width: 170px; flex: 1 1 170px; }

.ex-table-card { padding: 0; overflow: hidden; }
.ex-scroll { overflow-x: auto; }
.ex-t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; min-width: 1180px; }
.ex-t th { position: sticky; top: 0; z-index: 1; font-size: 12px; font-weight: 600; color: #384545; text-align: right; padding: 12px; white-space: nowrap; background: rgba(255,255,255,.88); border-bottom: 1px solid rgba(15,69,71,.1); }
.ex-t th a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.ex-t th a:hover { color: #0F4547; }
.ex-t td { padding: 14px 12px; border-bottom: 1px solid rgba(15,69,71,.07); vertical-align: middle; }
.ex-t tbody tr { transition: background .2s; }
.ex-t tbody tr:hover { background: rgba(255,255,255,.6); }
.ex-name { font-weight: 600; line-height: 1.5; max-width: 300px; }
.ex-code { font-size: 12px; color: #4A5757; direction: ltr; text-align: right; margin-top: 2px; }
.ex-date { white-space: nowrap; font-size: 13px; line-height: 1.6; }
.ex-date b { font-weight: 600; }
.ex-days { font-size: 12px; color: #4A5757; }
.ex-st { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 700; margin-top: 6px; }
.ex-st::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-upcoming { background: rgba(240,187,65,.28); color: #5C430A; }
.st-running { background: rgba(31,112,115,.16); color: #0F4547; }
.st-done { background: rgba(128,131,131,.18); color: #2E3B3B; }
.ex-hours { display: inline-flex; align-items: baseline; gap: 4px; font-weight: 700; font-size: 16px; }
.ex-hours small { font-size: 12px; font-weight: 500; color: #4A5757; }
.ex-person { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.ex-person + .ex-person { margin-top: 4px; }
.ex-av { width: 30px; height: 30px; border-radius: 50%; background: rgba(31,112,115,.14); color: #0F4547; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; }
.ex-av--gold { background: rgba(240,187,65,.3); color: #5C430A; }
.ex-muted { color: #6B7676; font-size: 13px; }
.ex-sub { font-size: 12px; color: #4A5757; margin-top: 2px; }
.ex-price { font-weight: 700; white-space: nowrap; font-size: 13px; line-height: 1.7; }
.aj-content .ex-note { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border-radius: 9px; background: rgba(240,187,65,.25); color: #5C430A; border: 0; cursor: help; }
.ex-act { display: flex; align-items: center; gap: 4px; }
.aj-content .ex-ib { width: 34px; height: 34px; padding: 0; border-radius: 10px; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; color: #384545; cursor: pointer; text-decoration: none; }
.aj-content .ex-ib:hover { background: rgba(31,112,115,.1); color: #0F4547; }
.ex-ib:focus-visible { outline: 2px solid #0F4547; outline-offset: 2px; }
.ex-menu .aj-menu__item { display: flex; align-items: center; gap: 10px; }

.ex-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-top: 1px solid rgba(15,69,71,.08); }
.ex-pg { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.aj-content .ex-pg a, .ex-pg span { min-width: 38px; height: 38px; padding: 0 10px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; text-decoration: none; color: #1E2B2B; background: rgba(255,255,255,.55); border: 1px solid rgba(255,255,255,.9); }
.aj-content .ex-pg a:hover { background: #fff; }
.aj-content .ex-pg .on { background: #1F7073; color: #fff; border-color: #1F7073; }
.ex-pg .gap { background: transparent; border: 0; }
.ex-pg .dis { opacity: .4; }
.ex-empty { padding: 56px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
@media print { .ex-bar, .ex-tabs, .ex-act, .ex-pg, .ex-more { display: none !important; } }


/* =========================================================
   Plan edit page (/activated/<id>/edit/)  —  pl-*
   ========================================================= */
.pl { display: flex; flex-direction: column; gap: 20px; }
.pl-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.pl-crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #4A5757; flex-wrap: wrap; margin-bottom: 6px; }
.pl-crumbs a { color: #175659; text-decoration: none; font-weight: 500; }
.pl-head h1 { margin: 0; font-size: 28px; font-weight: 700; }
.pl-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.pl-tag { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pl-grid { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.pl-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.pl-side { flex: 1 1 290px; max-width: 350px; min-width: 0; position: sticky; top: 20px; }
.pl-card { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.pl-sec { display: flex; align-items: center; gap: 12px; }
.pl-sec h2 { margin: 0; font-size: 18px; font-weight: 700; }
.pl-sec p { margin: 2px 0 0; font-size: 13px; color: #4A5757; }
.pl-ic { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; background: rgba(31,112,115,.12); color: #175659; }
.pl-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.pl-f { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.pl-f.full { grid-column: 1 / -1; }
.pl-f .aj-field select, .pl-f .aj-field input, .pl-f .aj-field textarea { width: 100%; }
.pl-caret { position: absolute; left: 14px; pointer-events: none; color: #4A5757; }
.pl-ltr input { direction: ltr; text-align: right; }

.pl-slots { display: flex; flex-direction: column; border-radius: 18px; overflow: hidden; background: rgba(255,255,255,.5); border: 1px solid rgba(255,255,255,.95); }
.pl-slot { display: flex; align-items: center; gap: 12px; padding: 10px 14px; flex-wrap: wrap; transition: background .2s; }
.pl-slot + .pl-slot { border-top: 1px solid rgba(15,69,71,.07); }
.pl-slot.is-off { background: rgba(255,255,255,.2); }
.pl-slot.is-off .pl-tm { opacity: .4; }
.pl-sw { display: inline-flex; align-items: center; gap: 10px; min-width: 150px; cursor: pointer; padding: 6px; border-radius: 12px; font-size: 14px; font-weight: 600; position: relative; }
.pl-sw input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pl-knob { position: relative; width: 40px; height: 24px; border-radius: 999px; background: rgba(74,87,87,.35); flex: none; transition: background .2s; }
.pl-knob::after { content: ''; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .22s cubic-bezier(.3,1.4,.6,1); }
.pl-sw input:checked + .pl-knob { background: #1F7073; }
.pl-sw input:checked + .pl-knob::after { transform: translateX(-16px); }
.pl-sw input:focus-visible + .pl-knob { outline: 2px solid #0F4547; outline-offset: 2px; }
.pl-count { font-size: 11px; font-weight: 600; color: #5C430A; background: rgba(240,187,65,.3); padding: 1px 7px; border-radius: 999px; }
.pl-count[hidden] { display: none; }
.pl-tm { display: flex; align-items: center; gap: 8px; transition: opacity .2s; }
.pl-tm input { font: inherit; font-size: 14px; height: 40px; padding: 0 10px; border-radius: 12px; border: 1px solid rgba(255,255,255,.95); background: rgba(255,255,255,.8); color: #142222; direction: ltr; width: 118px; }
.pl-tm input:focus { outline: 2px solid #1F7073; outline-offset: 1px; background: #fff; }
.pl-dur { margin-inline-start: auto; font-size: 13px; font-weight: 700; color: #0F4547; min-width: 80px; text-align: left; }
.pl-dur.bad { color: #A11F18; }
.pl-slot .aj-error { flex-basis: 100%; }

.pl-pickers { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.pl-picker { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 18px; background: rgba(255,255,255,.45); border: 1px solid rgba(255,255,255,.9); }
.pl-ph { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pl-n { font-size: 12px; font-weight: 600; color: #0F4547; background: rgba(31,112,115,.12); padding: 2px 8px; border-radius: 999px; }
.pl-n.zero { color: #4A5757; background: rgba(128,131,131,.14); }
.pl-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 220px; overflow: auto; }
.pl-chip { position: relative; display: inline-flex; }
.pl-chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.pl-chip span { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.95); background: rgba(255,255,255,.55); font-size: 12px; font-weight: 500; color: #1E2B2B; transition: all .2s; cursor: pointer; }
.pl-chip:hover span { background: rgba(255,255,255,.9); }
.pl-chip input:checked + span { background: #1F7073; border-color: #1F7073; color: #fff; }
.pl-chip input:focus-visible + span { outline: 2px solid #0F4547; outline-offset: 2px; }
.pl-chip[hidden] { display: none; }
.pl-search { min-height: 38px !important; border-radius: 999px !important; }

.pl-panel { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.pl-meter { height: 10px; border-radius: 10px; background: rgba(15,69,71,.1); overflow: hidden; }
.pl-meter span { display: block; height: 100%; width: 0; border-radius: 10px; transition: width .5s cubic-bezier(.2,1,.3,1), background .3s; }
.pl-msg { font-size: 13px; line-height: 1.6; padding: 10px 12px; border-radius: 12px; }
.pl-kv { margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; padding-top: 12px; border-top: 1px solid rgba(15,69,71,.1); }
.pl-kv div { display: flex; justify-content: space-between; }
.pl-kv dt { color: #4A5757; }
.pl-kv dd { margin: 0; font-weight: 600; }
.pl-dirty { display: none; align-items: center; gap: 8px; font-size: 13px; color: #5C430A; padding: 10px 12px; border-radius: 12px; background: rgba(240,187,65,.22); }
.pl-dirty.on { display: flex; }
.pl-errors { padding: 14px 16px; border-radius: 16px; background: rgba(255,240,238,.92); border: 1px solid rgba(179,38,30,.4); color: #7A1812; font-size: 14px; line-height: 1.7; }
.pl-errors a { color: #7A1812; font-weight: 600; }
.pl-dialog { border: 0; padding: 0; border-radius: 28px; max-width: 440px; width: calc(100% - 32px); background: rgba(255,255,255,.92); backdrop-filter: blur(30px); box-shadow: 0 40px 80px -20px rgba(15,69,71,.5); }
.pl-dialog::backdrop { background: rgba(15,40,40,.3); backdrop-filter: blur(6px); }
@media (max-width: 860px) { .pl-side { position: static; max-width: none; } }

/* a name or a count in a table that opens its page (the {% link_to %} tag): it keeps the look of the text and says "link" on hover */
.aj-tlink { color: inherit; text-decoration: none; border-radius: 4px; }
.aj-tlink:hover { color: var(--aj-teal-900, #0F4547); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.aj-tlink:focus-visible { outline: 2px solid var(--aj-teal-900); outline-offset: 2px; }

/* ---------- table tools (aj-table-tools.js): the export menu above a table and the ticked rows ---------- */
.aj-tt { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; }
.aj-tt__search { flex: 1 1 280px; max-width: 420px; }
/* the tools are one cluster at the far end of the toolbar of the list (the left in Arabic) */
.aj-tools-end { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-inline-start: auto; }
.aj-tt .aj-tools-end { margin-inline-start: auto; }
.aj-tt .aj-btn, .aj-tt .aj-dropdown > .aj-btn { min-height: 42px; border-radius: 999px; padding-inline: 16px; }
#aj-cols-btn { min-width: 42px; min-height: 42px; width: 42px; height: 42px; padding: 0; border-radius: 50%; }
.aj-adv__btn { min-height: 42px; border-radius: 999px; }
.aj-tt .aj-menu { left: auto; right: 0; }
.aj-tt__menu { min-width: 230px; }
.aj-tt .aj-menu__item { justify-content: space-between; }
.aj-tt .aj-menu__item small { color: #5C6363; font-size: 12px; }
.aj-tt__sel { font-size: 13px; color: #0F4547; background: rgba(31,112,115,.12); padding: 5px 12px; border-radius: 999px; }
.aj-tt__sel[hidden] { display: none; }
.aj-tt__clear { border: 0; background: none; color: #175659; text-decoration: underline; cursor: pointer; font: inherit; padding: 0 4px; }
tr.is-picked > td { background: rgba(31,112,115,.09); }
@media print { .aj-tt { display: none !important; } }

/* ---------- advanced search (aj-advanced.js): a field for each column beside the search box ---------- */
.aj-adv { display: contents; }
form:has(> .aj-adv) { display: flex; align-items: center; gap: 8px; }
form:has(> .aj-adv) > .aj-field, form:has(> .aj-adv) > label { flex: 1 1 200px; min-width: 0; }
form:has(> .aj-adv) > .aj-adv__btn, form:has(> .aj-adv) .aj-adv__btn { flex: none; white-space: nowrap; }
.aj-adv__btn { position: relative; gap: 6px; }
.aj-adv__btn.is-on { background: #1F7073; color: #fff; }
.aj-adv__n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #F0BB41; color: #3D2D06; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }
.aj-adv__n[hidden] { display: none; }
.aj-adv__panel { flex: 1 1 100%; width: 100%; padding: 14px; border-radius: 18px; background: rgba(255,255,255,.6); border: 1px solid rgba(15,69,71,.1); display: flex; flex-direction: column; gap: 12px; }
.aj-adv__panel[hidden] { display: none; }
.aj-adv__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.aj-adv__f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: #384545; }
.aj-adv__in { height: 40px; border-radius: 12px; padding: 0 12px; width: 100%; }
.aj-adv__acts { display: flex; gap: 8px; flex-wrap: wrap; }
@media print { .aj-adv { display: none !important; } }

/* the row-expand control of DataTables Responsive: a small mark in the colours of the identity, not the blue Bootstrap circle */
body table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
body table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
  box-sizing: border-box; width: 20px; height: 20px; margin-inline-end: 8px; border: 1px solid rgba(31, 112, 115, .35); border-radius: 50%;
  background: rgba(31, 112, 115, .10); color: #1F7073; box-shadow: none; font: 700 14px/18px inherit; font-family: inherit; text-align: center;
}
body table.dataTable.dtr-inline.collapsed > tbody > tr.dtr-expanded > td.dtr-control:before,
body table.dataTable.dtr-inline.collapsed > tbody > tr.dtr-expanded > th.dtr-control:before { background: #1F7073; color: #fff; border-color: #1F7073; }

/* the sidebar is folded to its icons; the pointer opens it like the pinned one (the page makes room), the pin keeps it open */
.aj-sidebar { z-index: 40; }
.aj-sidebar.is-peek { width: 268px; }
.aj-sidebar.no-anim, .aj-sidebar.no-anim * { transition: none !important; }

/* messages are toasts (aj-toast.js): the boxes the pages draw for them stay out of the page */
[class*="-alerts"], #alert-container, .rq-alert { display: none !important; }
.aj-snack__close { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: rgba(255,255,255,.75); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.aj-snack__close:hover { background: rgba(255,255,255,.15); color: #fff; }
