/* ═══════════════════════════════════════════════════════════
   منظومة التجمع — Design System v4  (Premium Warm Light)
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&display=swap');

/* ══ CUSTOM SCROLLBAR ══════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px }
::-webkit-scrollbar-track { background: var(--bg-2) }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px }
::-webkit-scrollbar-thumb:hover { background: var(--muted) }

/* ══ CSS VARIABLES ═════════════════════════════════════════ */
:root {
  /* Brand — amber/orange gradient family */
  --brand:         #f59e0b;
  --brand-deep:    #d97706;
  --brand-darker:  #b45309;
  --brand-light:   #fef3c7;
  --brand-bg:      #fffbeb;
  --brand-glow:    rgba(245,158,11,.22);
  --brand-glow-sm: rgba(245,158,11,.12);

  /* Gradient presets */
  --grad-brand: linear-gradient(135deg, #f59e0b 0%, #d97706 55%, #b45309 100%);
  --grad-brand-h: linear-gradient(135deg, #fbbf24 0%, #f59e0b 55%, #d97706 100%);
  --grad-green: linear-gradient(135deg, #059669 0%, #10b981 100%);
  --grad-red:   linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  --grad-blue:  linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  --grad-teal:  linear-gradient(135deg, #0f766e 0%, #0d9488 100%);

  /* Backgrounds — warm cream hierarchy */
  --bg:   #faf9f6;
  --bg-2: #f3f1ec;
  --bg-3: #ede9e3;
  --bg-4: #e5e1da;

  /* Surfaces */
  --card:   #ffffff;
  --card-2: #fdfcfa;

  /* Text — warm brown scale */
  --text:   #292524;
  --text-2: #57534e;
  --text-3: #78716c;
  --muted:  #a8a29e;
  --subtle: #c4bdb8;

  /* Borders */
  --border:   #e7e5e4;
  --border-2: #d6d3d1;
  --border-3: #c5c1bc;

  /* Semantic — Status */
  --danger:      #ef4444;
  --danger-deep: #dc2626;
  --danger-bg:   #fef2f2;
  --danger-bdr:  #fecaca;
  --danger-text: #991b1b;

  --success:      #10b981;
  --success-deep: #059669;
  --success-bg:   #ecfdf5;
  --success-bdr:  #a7f3d0;
  --success-text: #065f46;

  --info:      #3b82f6;
  --info-deep: #2563eb;
  --info-bg:   #eff6ff;
  --info-bdr:  #bfdbfe;
  --info-text: #1e40af;

  --warning:      #f59e0b;
  --warning-bg:   #fffbeb;
  --warning-bdr:  #fde68a;
  --warning-text: #92400e;

  /* Shadows — warm-tinted, multi-layer */
  --sh-xs:    0 1px 3px rgba(120,100,70,.07), 0 1px 2px rgba(120,100,70,.04);
  --sh-sm:    0 4px 12px rgba(120,100,70,.10), 0 1px 4px rgba(120,100,70,.06);
  --sh-md:    0 8px 24px rgba(120,100,70,.12), 0 3px 8px rgba(120,100,70,.07);
  --sh-lg:    0 16px 48px rgba(120,100,70,.14), 0 6px 16px rgba(120,100,70,.08);
  --sh-xl:    0 24px 64px rgba(120,100,70,.16), 0 8px 24px rgba(120,100,70,.09);
  --sh-brand: 0 4px 16px rgba(245,158,11,.28), 0 2px 6px rgba(245,158,11,.16);
  --sh-brand-lg: 0 8px 28px rgba(245,158,11,.36), 0 3px 10px rgba(245,158,11,.20);
  --sh-danger: 0 4px 14px rgba(239,68,68,.28), 0 2px 6px rgba(239,68,68,.14);

  /* Radius scale */
  --r-xs: 5px;
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 28px;

  /* Transitions */
  --t-fast:   150ms ease;
  --t-base:   200ms ease;
  --t-slow:   300ms ease;
  --t-spring: 300ms cubic-bezier(.34,1.56,.64,1);

  /* Layout */
  --sidebar-w: 276px;
  --app-max:   1440px;
  --header-h:  62px;
}

/* ══ RESET ═════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0 }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; font-size: 16px }
body {
  font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: clamp(14px, 1vw + 10px, 15px);
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none }
img, svg { max-width: 100%; height: auto; vertical-align: middle }
ul, ol { list-style: none }

/* ══ HEADER ════════════════════════════════════════════════ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--header-h);
  background: var(--grad-brand);
  box-shadow:
    0 2px 0 rgba(0,0,0,.06),
    0 4px 20px rgba(180,83,9,.22),
    0 1px 6px rgba(217,119,6,.15);
}
.site-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.08) 0%, transparent 100%);
  pointer-events: none;
}
.site-header__inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  width: min(var(--app-max), 100%);
  margin-inline: auto;
  padding: 0 20px;
}
.brand {
  font-weight: 900;
  font-size: clamp(15px, 1.4vw, 19px);
  letter-spacing: -.4px;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,.18);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(46vw, 380px);
  min-width: 0;
  flex-shrink: 1;
}
.brand span { opacity: .82; font-weight: 700 }
.nav {
  margin-inline-start: auto;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}
.site-header .btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  height: 36px;
  border-radius: var(--r-sm);
  border: 1.5px solid rgba(255,255,255,.38);
  background: rgba(255,255,255,.16);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  text-decoration: none;
  white-space: nowrap;
  box-shadow: none;
}
.site-header .btn:hover {
  background: rgba(255,255,255,.26);
  border-color: rgba(255,255,255,.60);
  transform: translateY(-1px);
}
.site-header .btn:active { transform: translateY(0) }
.site-header .btn.invert {
  background: #fff;
  color: var(--brand-deep);
  border-color: #fff;
  font-weight: 800;
  box-shadow: 0 2px 10px rgba(0,0,0,.14);
}
.site-header .btn.invert:hover {
  background: var(--brand-light);
  color: var(--brand-darker);
  border-color: var(--brand-light);
}
#openSidebar { display: inline-flex }
@media (min-width: 1100px) { #openSidebar { display: none } }

/* ══ LAYOUT ════════════════════════════════════════════════ */
.layout {
  display: grid;
  grid-template-columns: minmax(0,1fr) var(--sidebar-w);
  gap: 20px;
  align-items: flex-start;
  width: min(var(--app-max), 100%);
  margin-inline: auto;
  padding: 20px 20px 36px;
  direction: ltr;
}
.layout > .content {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  width: 100%;
  direction: rtl;
}
.layout > .sidebar {
  grid-column: 2;
  grid-row: 1;
  width: var(--sidebar-w);
  min-width: 220px;
  direction: rtl;
}
.content { min-height: 60vh }
.content > h2,
.page-title {
  margin: 0 0 20px !important;
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 900;
  color: var(--text);
  letter-spacing: -.5px;
  line-height: 1.25;
}

/* ══ SIDEBAR ═══════════════════════════════════════════════ */
.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 12px);
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  height: fit-content;
  overflow: hidden;
  transition: box-shadow var(--t-base);
}
.sidebar:hover { box-shadow: var(--sh-md) }
.sidebar-head { display: none }
.sidebar-body { padding: 14px }

/* User box */
.sidebar-userbox {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r);
  background: var(--grad-brand);
  margin-bottom: 6px;
  position: relative;
  overflow: hidden;
}
.sidebar-userbox::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.10) 0%, transparent 60%);
  pointer-events: none;
}
.sidebar-userbox::after {
  content: '';
  position: absolute;
  top: -24px;
  left: -24px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(255,255,255,.09);
  pointer-events: none;
}
.sidebar-avatar {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255,255,255,.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 18px;
  color: var(--brand-deep);
  flex-shrink: 0;
  border: 2.5px solid rgba(255,255,255,.55);
  box-shadow: 0 2px 8px rgba(0,0,0,.14);
}
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover }
.sidebar-user-info { position: relative; z-index: 1; min-width: 0 }
.sidebar-hello { font-size: 11px; color: rgba(255,255,255,.72); line-height: 1.2; margin-bottom: 2px }
.sidebar-name  { font-weight: 900; color: #fff; font-size: 14px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.sidebar-role  { font-size: 11px; color: rgba(255,255,255,.88); font-weight: 700; margin-top: 2px }

/* Chips */
.chip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0 0 }
.chip {
  display: block;
  text-align: center;
  padding: 7px 8px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border-2);
  background: var(--bg-2);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.chip:hover { border-color: var(--brand-light); background: var(--brand-bg); color: var(--brand-darker) }
.chip-full { grid-column: 1 / -1 }

/* Nav sections */
.sidebar-section { margin-top: 14px }
.sidebar-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .9px;
  text-transform: uppercase;
  color: var(--subtle);
  padding: 0 8px;
  margin: 0 0 5px;
  display: block;
}
.btn-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  text-decoration: none;
  margin: 1px 0;
  position: relative;
  min-height: 40px;
}
.btn-nav:hover {
  background: var(--bg-2);
  color: var(--text);
}
.btn-nav.active,
.btn-nav.primary {
  background: var(--brand-bg);
  color: var(--brand-darker);
  font-weight: 800;
  border: 1px solid var(--brand-light);
}
.btn-nav.active::before,
.btn-nav.primary::before {
  content: '';
  position: absolute;
  inset-inline-end: 0;
  top: 22%;
  bottom: 22%;
  width: 3.5px;
  border-radius: 99px 0 0 99px;
  background: var(--grad-brand);
  box-shadow: 0 0 6px var(--brand-glow);
}
.btn-nav.outline {
  border: 1.5px solid var(--brand-light);
  color: var(--brand-deep);
  background: var(--brand-bg);
  font-weight: 700;
}
.btn-nav.outline:hover { background: #fff7dc; border-color: var(--brand) }
.btn-nav.danger { color: var(--danger); background: var(--danger-bg) }
.btn-nav.danger:hover { background: #fee2e2; color: var(--danger-deep) }

/* Sidebar backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(41,37,36,.52);
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s ease;
  z-index: 55;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar-backdrop.show { display: block; opacity: 1; pointer-events: auto }
.sidebar-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  border: 1.5px solid rgba(255,255,255,.40);
  background: rgba(255,255,255,.20);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  transition: background var(--t-fast);
  flex-shrink: 0;
}
.sidebar-close:hover { background: rgba(255,255,255,.32) }

/* Sidebar badge */
.sb-badge {
  flex-shrink: 0;
  margin-inline-start: auto;
}

/* ══ CARD ═══════════════════════════════════════════════════ */
.card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh-xs);
  padding: 20px;
  margin: 0 0 16px;
  transition: box-shadow var(--t-base), transform var(--t-base);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.6) 0%, transparent 50%);
  pointer-events: none;
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--t-base);
}
.card:hover {
  box-shadow: var(--sh-sm);
  transform: translateY(-1px);
}
.card:hover::before { opacity: 1 }
.card > h3:first-child,
.card > h2:first-child {
  margin: 0 0 16px;
  font-size: clamp(15px, 1.2vw, 17px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.3px;
}
.card > :last-child { margin-bottom: 0 }

/* Card accent variant */
.card.accent {
  border-color: var(--brand-light);
  background: linear-gradient(180deg, var(--brand-bg) 0%, #fff 60%);
}
.card.accent > h3:first-child { color: var(--brand-darker) }

/* ══ KPI CARDS ══════════════════════════════════════════════ */
.kpi {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform var(--t-base), box-shadow var(--t-base);
  cursor: default;
}
.kpi::before {
  content: '';
  position: absolute;
  top: -30px;
  inset-inline-end: -20px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--brand-light) 0%, transparent 70%);
  opacity: .6;
  pointer-events: none;
}
.kpi::after {
  content: '';
  position: absolute;
  bottom: -20px;
  inset-inline-start: -16px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-light), transparent);
  opacity: .45;
  pointer-events: none;
}
.kpi:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-md);
  border-color: var(--brand-light);
}
.kpi .num {
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 900;
  color: var(--text);
  line-height: 1;
  letter-spacing: -1px;
  position: relative;
  z-index: 1;
}
.kpi .lbl {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-3);
  margin-top: 7px;
  text-transform: uppercase;
  letter-spacing: .5px;
  position: relative;
  z-index: 1;
}
.kpi .hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  position: relative;
  z-index: 1;
}
.kpi .bar {
  height: 5px;
  border-radius: 999px;
  background: var(--bg-3);
  margin-top: 14px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}
.kpi .bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.kpi.soft { background: var(--brand-bg); border-color: var(--brand-light) }
.bar.orange > i { background: var(--grad-brand) }
.bar.blue   > i { background: var(--grad-blue) }
.bar.green  > i { background: var(--grad-green) }
.bar.purple > i { background: linear-gradient(90deg,#8b5cf6,#c4b5fd) }
.bar.teal   > i { background: var(--grad-teal) }
.bar.red    > i { background: var(--grad-red) }

/* ══ ALERTS ════════════════════════════════════════════════ */
.alert {
  border-radius: var(--r-sm);
  padding: 12px 16px;
  margin: 12px 0;
  border: 1.5px solid transparent;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}
.alert svg, .alert .alert-icon {
  flex-shrink: 0;
  margin-top: 1px;
  width: 18px;
  height: 18px;
}
.alert.ok,
.alert.success {
  background: var(--success-bg);
  border-color: var(--success-bdr);
  color: var(--success-text);
}
.alert.danger {
  background: var(--danger-bg);
  border-color: var(--danger-bdr);
  color: var(--danger-text);
}
.alert.info {
  background: var(--info-bg);
  border-color: var(--info-bdr);
  color: var(--info-text);
}
.alert.warning {
  background: var(--warning-bg);
  border-color: var(--warning-bdr);
  color: var(--warning-text);
}

/* ══ BUTTONS ════════════════════════════════════════════════ */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 18px;
  height: 44px;
  border-radius: var(--r-sm);
  border: 1.5px solid transparent;
  background: var(--grad-brand);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  transition:
    transform var(--t-fast),
    box-shadow var(--t-fast),
    background var(--t-fast),
    border-color var(--t-fast),
    color var(--t-fast);
  box-shadow: var(--sh-brand);
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
/* Ripple-ready shine layer */
button::after, .btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.14) 0%, transparent 60%);
  border-radius: inherit;
  pointer-events: none;
}
button:hover, .btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-brand-lg);
  background: var(--grad-brand-h);
}
button:active, .btn:active {
  transform: translateY(0);
  box-shadow: var(--sh-brand);
}
.btn.full, button.full {
  width: 100%;
  height: 46px;
  font-size: 15px;
}
.btn.sm, button.sm {
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
}
.btn.xs, button.xs {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

/* Outline */
.btn.outline {
  background: var(--card);
  color: var(--text-2);
  border-color: var(--border-2);
  box-shadow: var(--sh-xs);
}
.btn.outline::after { display: none }
.btn.outline:hover {
  background: var(--bg-2);
  border-color: var(--border-3);
  box-shadow: var(--sh-sm);
  color: var(--text);
}

/* Variants */
.btn.primary { background: var(--grad-brand); color: #fff; box-shadow: var(--sh-brand) }
.btn.secondary { background: var(--grad-teal); color: #fff; box-shadow: 0 4px 14px rgba(15,118,110,.28) }
.btn.secondary:hover { box-shadow: 0 6px 20px rgba(15,118,110,.36) }
.btn.info { background: var(--grad-blue); color: #fff; box-shadow: 0 4px 14px rgba(59,130,246,.28) }
.btn.info:hover { box-shadow: 0 6px 20px rgba(59,130,246,.36) }
.btn.danger {
  background: var(--grad-red);
  color: #fff;
  box-shadow: var(--sh-danger);
}
.btn.danger:hover { box-shadow: 0 6px 20px rgba(239,68,68,.36) }
.btn.ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
  box-shadow: none;
}
.btn.ghost::after { display: none }
.btn.ghost:hover { background: var(--bg-2); color: var(--text); box-shadow: none }

/* Disabled */
button[disabled], .btn[disabled] {
  opacity: .42;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

/* Icon button */
.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--t-fast);
  flex-shrink: 0;
}
.iconbtn:hover {
  background: var(--bg-2);
  border-color: var(--border-2);
  transform: translateY(-1px);
  box-shadow: var(--sh-xs);
}
.iconbtn[disabled] { opacity: .35; cursor: not-allowed; pointer-events: none }
.iconbtn.danger:hover { background: var(--danger-bg); border-color: var(--danger-bdr); color: var(--danger) }

/* ══ FORMS ══════════════════════════════════════════════════ */
label {
  display: block;
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}
label .req { color: var(--danger); margin-inline-start: 2px }
input, select, textarea {
  width: 100%;
  padding: 0 14px;
  height: 44px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  appearance: none;
  -webkit-appearance: none;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-2) }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
  background: #fff;
}
input::placeholder, textarea::placeholder { color: var(--subtle) }
input:read-only { background: var(--bg-2); color: var(--text-3) }
textarea {
  height: auto;
  min-height: 100px;
  resize: vertical;
  padding: 12px 14px;
  line-height: 1.6;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a8a29e' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-left: 38px;
  cursor: pointer;
}
.input-wrap { position: relative }
.input-wrap .input-icon {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  display: flex;
  align-items: center;
  padding-inline-end: 14px;
  color: var(--muted);
  pointer-events: none;
}

/* Form row grid */
.form-row { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0,1fr)) }
.form-row .full { grid-column: 1 / -1 }
.form-group { display: flex; flex-direction: column; gap: 4px }

/* Section label (divider inside forms) */
.section-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 0;
  border-bottom: 1.5px solid var(--border);
  margin: 6px 0 12px;
  display: block;
}

/* ══ TABLE ══════════════════════════════════════════════════ */
.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  background: var(--card);
  box-shadow: var(--sh-xs);
}
table, .table {
  width: 100%;
  border-collapse: collapse;
}
.table th, table th {
  padding: 12px 16px;
  border-bottom: 2px solid var(--bg-3);
  text-align: right;
  vertical-align: middle;
  background: linear-gradient(180deg, var(--bg-2) 0%, #f0ede7 100%);
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-3);
  letter-spacing: .4px;
  white-space: nowrap;
  text-transform: uppercase;
}
.table th:first-child, table th:first-child { border-radius: 0 var(--r-sm) 0 0 }
.table th:last-child,  table th:last-child  { border-radius: var(--r-sm) 0 0 0 }
.table td, table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--bg-2);
  text-align: right;
  vertical-align: middle;
  font-size: 14px;
  color: var(--text-2);
  transition: background var(--t-fast);
}
/* Zebra striping */
.table tbody tr:nth-child(even) td,
table tbody tr:nth-child(even) td {
  background: #fdfcf9;
}
.table tbody tr:hover td,
table tbody tr:hover td {
  background: #fffbf0;
}
.table tbody tr:last-child td,
table tbody tr:last-child td {
  border-bottom: none;
}

/* ══ BADGE ══════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--brand-light);
  border: 1px solid #fde68a;
  font-size: 12px;
  font-weight: 700;
  color: var(--warning-text);
  white-space: nowrap;
  line-height: 1.4;
}
.badge-success {
  background: var(--success-bg);
  border-color: var(--success-bdr);
  color: var(--success-text);
}
.badge-danger {
  background: var(--danger-bg);
  border-color: var(--danger-bdr);
  color: var(--danger-text);
}
.badge-info {
  background: var(--info-bg);
  border-color: var(--info-bdr);
  color: var(--info-text);
}
.badge-warning {
  background: var(--warning-bg);
  border-color: var(--warning-bdr);
  color: var(--warning-text);
}
.badge-neutral {
  background: var(--bg-2);
  border-color: var(--border-2);
  color: var(--text-3);
}
.badge-dark {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

/* ══ ACTIONS ROW ════════════════════════════════════════════ */
.actions, .act-row, .row-actions {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
}
.actions .btn, .actions button, .actions a,
.act-row .btn, .act-row button, .act-row a {
  white-space: nowrap;
  flex-shrink: 0;
}

/* ══ UTILITIES ══════════════════════════════════════════════ */
.muted { color: var(--muted); font-size: 13px }
.text-sm { font-size: 13px }
.text-xs { font-size: 12px }
.text-muted { color: var(--muted) }
.text-danger { color: var(--danger) }
.text-success { color: var(--success) }
.text-brand { color: var(--brand-deep) }
.font-bold { font-weight: 700 }
.font-black { font-weight: 900 }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px }

.header-actions,
.smart-search,
.links {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.header-actions { margin-bottom: 14px }
.smart-search input { min-width: 220px }
.search-hint { font-size: 12px; color: var(--muted); margin-top: 6px }

/* Pager */
.pager {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 16px;
  flex-wrap: wrap;
}
.pager .btn {
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
  border: none;
}

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px }

/* Summary strip */
.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 10px;
}

/* Progress */
.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-3);
  overflow: hidden;
  min-width: 80px;
}
.progress > .bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--grad-brand);
  transition: width .4s ease;
}

/* Info / member grids */
.inf-grid,
.type-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.inf-card, .ts-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--sh-xs);
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.inf-card:hover, .ts-card:hover { box-shadow: var(--sh-sm); transform: translateY(-1px) }
.inf-card h4, .ts-card h4 {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.inf-big, .ts-big {
  font-size: clamp(28px, 3vw, 36px);
  font-weight: 900;
  color: var(--text);
  line-height: 1;
  letter-spacing: -1px;
}
.inf-row, .ts-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 7px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--bg-2);
}
.inf-row:last-child, .ts-row:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0 }
.inf-label, .ts-lbl {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 110px;
  color: var(--text-3);
  font-weight: 600;
}
.inf-val, .ts-val { font-weight: 800; color: var(--text); flex-shrink: 0 }

/* Member grid */
.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.member-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  box-shadow: var(--sh-xs);
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.member-card:hover { box-shadow: var(--sh-sm); transform: translateY(-2px) }

/* Avatar */
.av {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--brand-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 15px;
  color: var(--brand-darker);
  flex-shrink: 0;
  border: 2px solid var(--brand-light);
}
.av img { width: 100%; height: 100%; object-fit: cover }
.av.lg { width: 56px; height: 56px; font-size: 20px }
.av.xl { width: 72px; height: 72px; font-size: 26px }

/* Name info (table cell) */
.name-info { display: flex; flex-direction: column; gap: 2px }
.name-info .nm { font-weight: 700; font-size: 14px; color: var(--text) }
.name-info .sub { font-size: 12px; color: var(--muted) }

/* Quick links */
.quick-links { display: flex; flex-wrap: wrap; gap: 8px }
.ql-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: all var(--t-fast);
  cursor: pointer;
  font-family: inherit;
  height: 40px;
}
.ql-btn:hover {
  border-color: var(--brand-light);
  background: var(--brand-bg);
  color: var(--brand-darker);
  transform: translateY(-1px);
  box-shadow: var(--sh-xs);
}

/* mem-table */
.mem-table th,
.mem-table td { padding: 11px 14px }

/* Approval cards */
.approval-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--sh-xs);
}
.approval-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px }
.approval-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center }
.approval-actions .notes-input { max-width: 320px; flex: 1 1 200px }

/* Profile / entity hero */
.profile-hero,
.entity-head,
.mv-hero,
.pp-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.profile-badges,
.mv-actions { display: flex; gap: 8px; flex-wrap: wrap }

/* Specific grids used in app pages */
.mv-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 16px }
.mv-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px;
}
.mv-card h3 {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.pp-hero-meta { display: flex; gap: 8px; flex-wrap: wrap }
.pp-knesset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px }
.pp-tables-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 14px }
.pp-two-col     { display: grid; grid-template-columns: 1fr 1fr; gap: 14px }
.pp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch }
.pp-table { min-width: 500px; border-collapse: collapse }

/* Stats table */
.stats-table { width: 100%; border-collapse: collapse }
.stats-table th, .stats-table td { padding: 10px 14px; text-align: right; vertical-align: middle }
.stats-table thead th {
  background: var(--bg-2);
  border-bottom: 2px solid var(--border);
  font-size: 12px;
  font-weight: 800;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.stats-table tbody td { border-bottom: 1px solid var(--bg-2); font-size: 14px; color: var(--text-2) }
.stats-table tbody tr:hover td { background: #fffbf0 }
.stats-table tbody tr:last-child td { border-bottom: none }

/* ══ FOOTER ═════════════════════════════════════════════════ */
.footer {
  margin-top: 32px;
  padding: 20px 0 28px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  border-top: 1px solid var(--border);
}

/* ══ MODALS ═════════════════════════════════════════════════ */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(41,37,36,.52);
  z-index: 460;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 470;
}
.modal .card {
  width: min(100%, 580px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  margin: 0;
  box-shadow: var(--sh-xl);
  border-color: var(--border-2);
  animation: modal-in .2s var(--t-spring) both;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(.97) }
  to   { opacity: 1; transform: translateY(0) scale(1) }
}
.modal.show,
.modal-backdrop.show { display: flex }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1.5px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 900 }

/* ══ TYPE PAGE HEADER ═══════════════════════════════════════ */
.type-page-header,
.members-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
