/* ═══════════════════════════════════════════════════════════════════
   ELITE DESIGN SYSTEM — Political Intelligence Platform
   ═══════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  --pri:         #2454e8;
  --pri-dark:    #1a3fc4;
  --pri-light:   #eef2fd;
  --pri-glow:    rgba(36,84,232,.14);

  --sb-bg:       #05101f;
  --sb-surface:  #0b1828;
  --sb-border:   rgba(255,255,255,.07);
  --sb-text:     #6e84a0;
  --sb-text-hi:  #d8e8f8;
  --sb-active:   rgba(36,84,232,.18);

  --bg:          #eef1f8;
  --surface:     #ffffff;
  --surface-2:   #f7f9fc;
  --border:      #e2e8f0;
  --border-2:    #eef2f7;

  --text:        #0c1629;
  --text-2:      #374258;
  --text-3:      #7a8fa8;

  --shadow-xs: 0 1px 2px rgba(0,16,48,.05);
  --shadow-sm: 0 2px 8px rgba(0,16,48,.06), 0 1px 3px rgba(0,16,48,.04);
  --shadow-md: 0 4px 20px rgba(0,16,48,.09), 0 2px 8px rgba(0,16,48,.05);
  --shadow-lg: 0 8px 40px rgba(0,16,48,.11), 0 4px 14px rgba(0,16,48,.06);
  --shadow-xl: 0 20px 64px rgba(0,16,48,.13), 0 8px 24px rgba(0,16,48,.07);

  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --ease:        cubic-bezier(.4,0,.2,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --ease-out:    cubic-bezier(0,0,.2,1);

  --t-fast: .14s cubic-bezier(.4,0,.2,1);
  --t-base: .22s cubic-bezier(.4,0,.2,1);
  --t-slow: .36s cubic-bezier(.4,0,.2,1);
}

/* ── Reset + Base ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ══════════════════════════════════════════════════════════════════
   AUTH OVERLAY
   ══════════════════════════════════════════════════════════════════ */
#authOverlay {
  position: fixed; inset: 0;
  background: var(--sb-bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000;
  padding: 20px;
}
.auth-card {
  background: var(--sb-surface);
  border: 1px solid var(--sb-border);
  border-radius: 22px;
  padding: 40px 36px 36px;
  width: 100%; max-width: 380px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,.55);
  animation: authIn .35s var(--ease-spring);
}
@keyframes authIn { from { opacity:0; transform:translateY(18px) scale(.97); } }
.auth-logo {
  width: 66px; height: 66px;
  background: linear-gradient(135deg, #2454e8 0%, #6b8fff 100%);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; color: #fff;
  margin: 0 auto 20px;
  box-shadow: 0 8px 28px rgba(36,84,232,.45);
}
.auth-title {
  color: var(--sb-text-hi); font-size: 1.25rem;
  font-weight: 800; margin: 0 0 6px;
}
.auth-sub {
  color: var(--sb-text); font-size: .83rem; margin: 0 0 26px;
}
.auth-card input {
  width: 100%;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--sb-border);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--sb-text-hi);
  font-family: 'Cairo', sans-serif;
  font-size: .9rem;
  margin-bottom: 12px;
  outline: none;
  transition: border-color .2s, background .2s;
}
.auth-card input:focus {
  border-color: var(--pri);
  background: rgba(36,84,232,.08);
}
.auth-card input::placeholder { color: var(--sb-text); }
#authBtn {
  width: 100%;
  background: var(--pri);
  color: #fff;
  border: none; border-radius: 10px;
  padding: 13px;
  font-family: 'Cairo', sans-serif;
  font-size: .95rem; font-weight: 700;
  cursor: pointer; margin-top: 4px;
  transition: background .18s, transform .1s, box-shadow .18s;
  box-shadow: 0 4px 16px rgba(36,84,232,.35);
}
#authBtn:hover  { background: var(--pri-dark); box-shadow: 0 6px 22px rgba(36,84,232,.45); }
#authBtn:active { transform: scale(.98); }
#authBtn:disabled { opacity: .6; cursor: not-allowed; }
#authError {
  margin-top: 14px;
  color: #f87171;
  font-size: .82rem;
  min-height: 18px;
}

/* ══════════════════════════════════════════════════════════════════
   PREMIUM LOADING SCREEN
   ══════════════════════════════════════════════════════════════════ */
#appLoader {
  position: fixed; inset: 0;
  background: var(--sb-bg);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 22px;
  z-index: 9999;
  transition: opacity .45s var(--ease);
}
#appLoader.fade-out { opacity: 0; pointer-events: none; }
.loader-logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, #2454e8 0%, #6b8fff 100%);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.45rem;
  box-shadow: 0 8px 40px rgba(36,84,232,.55);
  animation: loaderPulse 1.6s ease-in-out infinite;
}
@keyframes loaderPulse {
  0%,100% { transform: scale(1);     box-shadow: 0 8px 40px rgba(36,84,232,.55); }
  50%     { transform: scale(1.06);  box-shadow: 0 12px 56px rgba(36,84,232,.75); }
}
.loader-bar {
  width: 160px; height: 3px;
  background: rgba(255,255,255,.08);
  border-radius: 3px; overflow: hidden;
}
.loader-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pri), #7baeff);
  border-radius: 3px;
  animation: loaderBar 1.4s var(--ease-out) infinite;
}
@keyframes loaderBar {
  0%   { transform: translateX(100%); }
  100% { transform: translateX(-200%); }
}
.loader-text {
  font-size: .78rem; color: rgba(255,255,255,.35);
  letter-spacing: .1em; text-transform: uppercase;
}

/* ══════════════════════════════════════════════════════════════════
   SIDEBAR — Premium Intelligence Panel
   ══════════════════════════════════════════════════════════════════ */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--sb-bg);
  color: var(--sb-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0; top: 0; bottom: 0;
  z-index: 1000;
  transition: transform .28s var(--ease);
  border-left: 1px solid var(--sb-border);
  background-image:
    radial-gradient(ellipse at 60% -10%, rgba(36,84,232,.1) 0%, transparent 65%);
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 14px 14px;
  border-bottom: 1px solid var(--sb-border);
}
.sidebar-brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--pri) 0%, #6b8fff 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .95rem; flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(36,84,232,.45);
}
.sidebar-brand-text { flex: 1; min-width: 0; }
.sidebar-brand-name {
  font-size: .86rem; font-weight: 800; color: var(--sb-text-hi);
  letter-spacing: -.01em; line-height: 1.2;
}
.sidebar-brand-sub {
  font-size: .6rem; color: var(--sb-text);
  letter-spacing: .05em; text-transform: uppercase; opacity: .7;
}

.sidebar-search {
  position: relative; padding: 9px 10px 5px;
}
.search-icon {
  position: absolute; right: 21px;
  top: 50%; transform: translateY(-35%);
  color: var(--sb-text); font-size: .73rem; pointer-events: none;
}
.sidebar-search input {
  width: 100%;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--sb-border);
  border-radius: var(--r-sm);
  padding: 7px 30px 7px 10px;
  color: var(--sb-text-hi);
  font-family: 'Cairo', sans-serif; font-size: .81rem;
  outline: none; transition: var(--t-base);
}
.sidebar-search input:focus {
  border-color: rgba(36,84,232,.5);
  background: rgba(36,84,232,.06);
  box-shadow: 0 0 0 3px rgba(36,84,232,.12);
}
.sidebar-search input::placeholder { color: rgba(110,132,160,.55); }

.search-dropdown {
  position: absolute; right: 10px; left: 10px;
  top: calc(100% - 5px);
  background: #0b1828;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  z-index: 2000; max-height: 300px; overflow-y: auto;
  box-shadow: var(--shadow-xl);
}
.search-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; cursor: pointer;
  transition: var(--t-fast); color: var(--sb-text-hi);
}
.search-result-item:hover { background: rgba(36,84,232,.14); }
.sr-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .74rem; flex-shrink: 0; overflow: hidden;
}
.sr-name { font-size: .81rem; font-weight: 700; }
.sr-title { font-size: .71rem; color: var(--sb-text); }
.sr-match-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.sr-match-tag {
  font-size: .62rem;
  background: rgba(36,84,232,.22); color: #93c5fd;
  border-radius: 4px; padding: 1px 5px;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sr-head-line { font-size: .66rem; color: var(--sb-text); margin-top: 2px; opacity: .8; }
.sr-org-badge { display: inline-flex; align-items: center; margin-left: 4px; opacity: .7; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 6px; }
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px;
  color: var(--sb-text); text-decoration: none;
  font-size: .83rem; font-weight: 600;
  transition: var(--t-fast);
  border-radius: var(--r-sm);
  border-right: 2px solid transparent;
  margin-bottom: 1px;
}
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.05); color: var(--sb-text-hi); }
.sidebar-nav .nav-link.active {
  background: var(--sb-active); color: #7baeff;
  border-right-color: var(--pri);
}
.sidebar-nav .nav-link .badge {
  font-size: .62rem; padding: 2px 6px;
  border-radius: 999px; flex-shrink: 0;
}
.cat-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

.sidebar-footer {
  padding: 9px 8px 12px;
  border-top: 1px solid var(--sb-border);
  display: flex; flex-direction: column; gap: 5px;
}
.btn-new-cat {
  width: 100%;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--sb-border);
  color: var(--sb-text);
  padding: 7px 10px; border-radius: var(--r-sm);
  font-family: 'Cairo', sans-serif; font-size: .79rem;
  cursor: pointer; transition: var(--t-fast); text-align: center;
}
.btn-new-cat:hover {
  background: rgba(255,255,255,.08); color: var(--sb-text-hi);
  border-color: rgba(255,255,255,.14);
}

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.65); z-index: 999;
  backdrop-filter: blur(3px);
}

/* ══════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════════════════════════ */
.main-content { margin-right: 260px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border-2);
  padding: 0 22px;
  display: flex; align-items: center; gap: 10px;
  height: 54px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 0 var(--border-2), var(--shadow-sm);
}
.topbar-title {
  font-weight: 800; font-size: .94rem; letter-spacing: -.02em; color: var(--text);
}
.page-body { padding: 22px 24px; flex: 1; }

/* ── Buttons ── */
.btn-icon {
  background: none; border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 5px 10px;
  cursor: pointer; color: var(--text-2);
  transition: var(--t-fast); text-decoration: none;
  display: inline-flex; align-items: center;
  font-family: 'Cairo', sans-serif; font-size: .82rem; gap: 4px;
}
.btn-icon:hover { background: var(--surface-2); color: var(--text); border-color: #cbd5e1; }

/* ══════════════════════════════════════════════════════════════════
   DASHBOARD — Premium Layout
   ══════════════════════════════════════════════════════════════════ */
.dash-hero {
  display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap;
  gap: 16px; margin-bottom: 26px;
  padding: 22px 26px;
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.dash-hero::before {
  content: '';
  position: absolute; top: -60px; right: -60px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(36,84,232,.07) 0%, transparent 70%);
  pointer-events: none;
}
.dash-hero::after {
  content: '';
  position: absolute; bottom: -40px; left: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(21,128,61,.05) 0%, transparent 70%);
  pointer-events: none;
}
.dash-hero-label {
  font-size: .68rem; font-weight: 800; color: var(--pri);
  text-transform: uppercase; letter-spacing: .1em; margin-bottom: 5px;
}
.dash-hero-title {
  font-size: 1.45rem; font-weight: 900; color: var(--text);
  letter-spacing: -.04em; line-height: 1;
}
.dash-hero-sub {
  font-size: .8rem; color: var(--text-3); margin-top: 5px; font-weight: 500;
}

.stats-bar { display: flex; gap: 14px; margin-bottom: 26px; flex-wrap: wrap; }
.dash-hero .stats-bar { margin-bottom: 0; }

.stat-card {
  background: var(--surface); border-radius: var(--r-lg);
  padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
  min-width: 155px; flex: 1;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border-2);
  transition: var(--t-base); position: relative; overflow: hidden;
  cursor: default;
}
.stat-card::after {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 90px; height: 90px;
  background: radial-gradient(circle at top right, var(--stat-glow, rgba(36,84,232,.06)) 0%, transparent 70%);
  pointer-events: none;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
  width: 44px; height: 44px;
  background: var(--stat-bg, var(--pri-light));
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; color: var(--stat-color, var(--pri)); flex-shrink: 0;
}
.stat-value {
  font-size: 1.65rem; font-weight: 900; line-height: 1;
  letter-spacing: -.04em; color: var(--text);
  animation: countUp .5s var(--ease) both;
}
.stat-label { font-size: .72rem; color: var(--text-3); margin-top: 3px; font-weight: 600; }

@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section-label {
  color: var(--text-3); font-size: .69rem; text-transform: uppercase;
  letter-spacing: .09em; margin-bottom: 12px; font-weight: 800;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 14px; margin-bottom: 22px;
}
.cat-card {
  background: var(--surface); border-radius: var(--r-lg);
  padding: 22px 16px 18px;
  text-decoration: none; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  box-shadow: var(--shadow-sm); transition: var(--t-slow);
  position: relative; overflow: hidden;
  border: 1.5px solid transparent; cursor: pointer;
}
.cat-card::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(160deg, var(--c, var(--pri)) 0%, transparent 75%);
  opacity: 0; transition: opacity .3s var(--ease);
}
.cat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--c, var(--pri)) 40%, transparent);
  color: var(--text);
}
.cat-card:hover::after { opacity: .05; }
.cat-card-icon {
  font-size: 2.1rem; position: relative; z-index: 1;
  transition: transform .3s var(--ease-spring);
}
.cat-card:hover .cat-card-icon { transform: scale(1.15) rotate(-4deg); }
.cat-card-name { font-weight: 800; font-size: .87rem; text-align: center; position: relative; z-index: 1; }
.cat-card-count { font-size: .73rem; color: var(--text-3); position: relative; z-index: 1; font-weight: 600; }
.cat-card-bar { position: absolute; bottom: 0; left: 0; right: 0; height: 3px; opacity: .85; }
.cat-card-add {
  border: 2px dashed var(--border); background: transparent; color: var(--text-3);
}
.cat-card-add:hover {
  border-color: #94a3b8; background: var(--surface-2);
  color: var(--text-2); transform: translateY(-2px); box-shadow: var(--shadow-sm);
}
.cat-card-add::after { display: none; }

.tip-box {
  background: linear-gradient(135deg, #fffbeb 0%, #fefce8 100%);
  border: 1px solid #fde68a; border-radius: var(--r-md);
  padding: 12px 16px; font-size: .81rem; color: #92400e;
  display: flex; align-items: center; gap: 10px;
}

/* ══════════════════════════════════════════════════════════════════
   ORG CHART
   ══════════════════════════════════════════════════════════════════ */
.chart-toolbar { display: flex; gap: 6px; padding: 0 0 8px; align-items: center; }
.chart-scroll-area {
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--r-lg);
  height: calc(100vh - 235px);
  min-height: 400px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-2);
  position: relative; cursor: grab;
  user-select: none; -webkit-user-select: none;
  background-image: radial-gradient(circle, #dde4ef 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: 11px 11px;
}
.chart-scroll-area:active { cursor: grabbing; }
#chartContainer { position: absolute; top: 0; left: 0; transform-origin: 0 0; }

/* ── Org Nodes ── */
.org-node { position: absolute; cursor: pointer; }

@keyframes nodeIn {
  from { opacity: 0; transform: translateY(12px) scale(.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.org-node { animation: nodeIn .32s var(--ease) both; --node-scale: 1; }
.org-node[data-depth="2"] { --node-scale: .88; }
.org-node[data-depth="3"] { --node-scale: .74; }
.org-node[data-depth="4"] { --node-scale: .60; }
.org-node[data-depth="5"] { --node-scale: .48; }
.org-node[data-depth="6"],
.org-node[data-depth="7"],
.org-node[data-depth="8"] { --node-scale: .38; }
.org-node .node-card { transform: scale(var(--node-scale)); transform-origin: top center; }

.node-card {
  background: var(--surface);
  border: 1.5px solid var(--nc, var(--pri));
  border-radius: var(--r-md);
  padding: 9px 9px 7px;
  text-align: center;
  transition: box-shadow .22s var(--ease), transform .22s var(--ease-spring);
  box-shadow: var(--shadow-sm);
  position: relative; min-height: 96px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
}
.org-node:hover .node-card {
  box-shadow: 0 6px 22px rgba(0,16,48,.13),
              0 0 0 3px color-mix(in srgb, var(--nc, var(--pri)) 18%, transparent);
  transform: scale(var(--node-scale)) translateY(-3px);
  z-index: 10;
}

/* Vacant node — same appearance as normal cards, no faded/dashed treatment */
.node-card.vacant {}
.node-vacant-icon {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--nc, var(--pri)) 30%, transparent);
  display: flex; align-items: center; justify-content: center;
  color: var(--nc, var(--pri)); font-size: .85rem;
  margin: 0 auto 5px; opacity: .45;
}
.node-vacant-label { display: none; }

/* Filled node */
.node-role-badge {
  font-size: .59rem; background: var(--nc, var(--pri)); color: #fff;
  border-radius: 999px; padding: 1px 8px; margin-bottom: 5px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: block; letter-spacing: .01em; font-weight: 700;
}
.node-photo-wrap {
  width: 46px; height: 46px; border-radius: 50%;
  overflow: hidden; background: var(--nc, var(--pri));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin: 0 auto 4px;
  box-shadow: 0 3px 10px color-mix(in srgb, var(--nc, var(--pri)) 35%, transparent);
}
.node-photo-wrap img { width: 100%; height: 100%; object-fit: cover; }
.node-initials { color: #fff; font-weight: 800; font-size: .88rem; }
.node-name {
  font-size: .73rem; font-weight: 800; color: var(--text);
  line-height: 1.3; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  letter-spacing: -.01em;
}
.node-title-text {
  font-size: .63rem; color: var(--text-3); margin-top: 1px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Node action bar */
.node-bar {
  display: flex; gap: 1px; justify-content: center;
  margin-top: 6px; border-top: 1px solid rgba(0,0,0,.06);
  padding-top: 4px; width: 100%;
}
.nbar-btn {
  background: none; border: none; border-radius: 5px;
  padding: 2px 6px; cursor: pointer;
  color: var(--text-3); font-size: .67rem;
  transition: var(--t-fast); font-family: 'Cairo', sans-serif;
}
.nbar-btn:hover { background: var(--surface-2); color: var(--text-2); }
.nbar-btn.danger:hover { background: #fee2e2; color: #ef4444; }


/* ── List View ── */
.list-card {
  background: var(--surface); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-2);
}
.list-person-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--border-2);
  transition: var(--t-fast); cursor: pointer;
}
.list-person-item:hover { background: var(--surface-2); }
.list-person-item:last-child { border-bottom: none; }
.list-person-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .8rem;
  flex-shrink: 0; overflow: hidden;
}
.list-person-avatar img { width: 100%; height: 100%; object-fit: cover; }
.list-person-name { font-weight: 700; font-size: .84rem; }
.list-person-title { font-size: .73rem; color: var(--text-3); }
.list-vacant-badge { font-size: .63rem; color: var(--text-3); font-style: italic; }

/* ── Person Modal ── */
.person-header {
  background: linear-gradient(135deg, #060f20 0%, #0c1e3c 100%);
  color: #fff; padding: 20px 22px;
  border-radius: var(--r-md) var(--r-md) 0 0;
  display: flex; align-items: center; gap: 16px;
  position: relative; overflow: hidden;
}
.person-header::before {
  content: '';
  position: absolute; top: -50px; right: -50px;
  width: 170px; height: 170px;
  background: radial-gradient(circle, rgba(36,84,232,.28) 0%, transparent 70%);
  pointer-events: none;
}
.person-header-photo { position: relative; flex-shrink: 0; z-index: 1; }
.avatar-lg {
  width: 66px; height: 66px; border-radius: 50%;
  background: rgba(255,255,255,.14);
  border: 2.5px solid rgba(255,255,255,.22);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 900; color: #fff; overflow: hidden;
}
.avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.avatar-upload-btn {
  position: absolute; bottom: 0; left: 0;
  width: 22px; height: 22px; background: var(--pri);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: .55rem; color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.person-header-info h5 { font-size: 1.05rem; font-weight: 800; letter-spacing: -.02em; }

/* Contact chips */
.contact-row { margin-bottom: 7px; }
.contact-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: 999px;
  text-decoration: none; font-size: .81rem; font-weight: 700;
  transition: var(--t-fast);
}
.contact-chip:hover { filter: brightness(.95); transform: translateY(-1px); }
.contact-chip.phone    { background: #dcfce7; color: #15803d; }
.contact-chip.email    { background: #dbeafe; color: #1d4ed8; }
.contact-chip.website  { background: #f0fdf4; color: #16a34a; }
.contact-chip.twitter  { background: #e0f2fe; color: #0284c7; }
.contact-chip.facebook { background: #eff6ff; color: #2563eb; }
.contact-chip.linkedin { background: #f0f9ff; color: #0369a1; }
.social-links-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* Info blocks */
.info-block {
  background: var(--surface-2); border-radius: var(--r-md);
  padding: 11px 14px; margin-bottom: 8px;
  border-right: 3px solid var(--border); transition: var(--t-fast);
}
.info-block.highlight { background: #fffbeb; border-right-color: #f59e0b; }
.info-block:hover { box-shadow: var(--shadow-xs); }
.info-block-label {
  font-size: .74rem; font-weight: 800; color: var(--text-2);
  margin-bottom: 6px; display: flex; align-items: center; gap: 6px;
  letter-spacing: -.01em;
}
.info-block-body { font-size: .84rem; color: var(--text); white-space: pre-wrap; line-height: 1.75; }

/* Empty state */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 65px 20px; gap: 12px;
}
.empty-icon { font-size: 3.5rem; }

/* ── Responsive ── */
@media (max-width: 991px) {
  .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main-content { margin-right: 0; }
  .page-body { padding: 16px; }
}

/* ── Custom Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ══════════════════════════════════════════════════════════════════
   ORG UNIT NODE
   ══════════════════════════════════════════════════════════════════ */
.node-card.org-unit {
  background: color-mix(in srgb, var(--nc, var(--pri)) 7%, #fff);
  border-style: solid; border-width: 1.5px;
  min-height: 80px; padding: 10px 8px 6px;
}
.node-org-icon { font-size: 1.3rem; line-height: 1; margin-bottom: 5px; }
.node-org-title {
  font-size: .76rem; font-weight: 800; line-height: 1.35;
  text-align: center; word-break: break-word; max-width: 100%;
  letter-spacing: -.01em;
}

.node-role-badge.vacant-badge {
  background: transparent; border: 1.5px dashed currentColor;
  font-weight: 700; opacity: .68;
}

.node-collapsed-count {
  font-size: .6rem; color: var(--nc, var(--pri));
  background: color-mix(in srgb, var(--nc, var(--pri)) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--nc, var(--pri)) 24%, #fff);
  border-radius: 999px; padding: 1px 8px;
  margin-top: 4px; font-weight: 700;
}

.nbar-btn.nbar-toggle { color: var(--nc, var(--pri)); }
.nbar-btn.nbar-toggle:hover {
  background: color-mix(in srgb, var(--nc, var(--pri)) 10%, #fff);
  color: var(--nc, var(--pri));
}
.nbar-btn.nbar-ministry { color: #7c3aed; }
.nbar-btn.nbar-ministry:hover { background: #f5f3ff; color: #6d28d9; }

/* ── Chart toolbar extras ── */
.zoom-label {
  font-size: .75rem; font-weight: 800; color: var(--text-2);
  min-width: 42px; text-align: center;
}
.chart-hint { font-size: .71rem; color: var(--text-3); margin-right: 4px; }

/* ── Bootstrap overrides ── */
.modal-content { border-radius: var(--r-lg); border: none; box-shadow: var(--shadow-xl); }
/* Smooth bottom-sheet slide-up on mobile */
@media (max-width: 768px) {
  .modal.fade .modal-dialog { transform: translateY(100%); transition: transform .3s var(--ease); }
  .modal.show .modal-dialog { transform: translateY(0); }
}
.form-control, .form-select {
  font-family: 'Cairo', sans-serif; border-radius: var(--r-sm);
  font-size: .84rem; border-color: var(--border); transition: var(--t-fast);
}
.form-control:focus, .form-select:focus {
  border-color: var(--pri);
  box-shadow: 0 0 0 3px var(--pri-glow);
}
.btn { font-family: 'Cairo', sans-serif; border-radius: var(--r-sm); }
.form-label { font-weight: 700; font-size: .81rem; margin-bottom: 4px; color: var(--text-2); }

/* ── Political affiliation badge ── */
.pa-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: .71rem; font-weight: 700;
}
.pa-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.node-pa-dot {
  width: 6px; height: 6px; border-radius: 50%;
  display: inline-block; margin-left: 3px; vertical-align: middle; flex-shrink: 0;
}

/* ── Governorate chip ── */
.contact-chip.gov { background: var(--surface-2); color: var(--text-2); border: 1.5px solid var(--border); }

/* ── Ministry info section ── */
.ministry-section { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.ministry-section-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; background: #f0f9ff;
  cursor: pointer; font-weight: 700; font-size: .82rem;
  color: #0369a1; user-select: none; border: none;
  width: 100%; text-align: right; transition: var(--t-fast);
}
.ministry-section-header:hover { background: #e0f2fe; }
.ministry-section-body {
  padding: 12px 14px; font-size: .79rem; color: var(--text-2);
  max-height: 340px; overflow-y: auto;
  line-height: 1.8; white-space: pre-wrap; background: var(--surface);
}

/* ── Node highlight animation ── */
@keyframes nodeHighlight {
  0%,100% { box-shadow: var(--shadow-sm); }
  30%      { box-shadow: 0 0 0 7px rgba(96,165,250,.45), var(--shadow-md); }
  60%      { box-shadow: 0 0 0 3px rgba(96,165,250,.25), var(--shadow-sm); }
}
.node-card.highlighted { animation: nodeHighlight 1s ease 3; }


/* ── Isolate / Focus banner ────────────────────────────────────── */
.isolate-banner {
  align-items: center; gap: 8px; flex-shrink: 0;
  padding: 6px 14px;
  background: linear-gradient(90deg, #fffbeb, #fef3c7);
  border-bottom: 1.5px solid #f59e0b;
  font-size: .74rem; font-weight: 700; color: #92400e;
}
.isolate-banner i { color: #d97706; }
.isolate-banner span { flex: 1; }
.isolate-exit-btn {
  margin-right: auto; border: none;
  background: #f59e0b; color: #fff;
  padding: 4px 12px; border-radius: var(--r-sm);
  font-size: .7rem; cursor: pointer; font-weight: 700;
  font-family: inherit; transition: var(--t-fast);
  display: flex; align-items: center; gap: 5px;
}
.isolate-exit-btn:hover { background: #d97706; }

/* ── Person modal tabs ─────────────────────────────────────────── */
.p-in-chart-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-sm);
  border: 1.5px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.9); cursor: pointer; font-size: .72rem; font-weight: 700;
  font-family: inherit; transition: var(--t-fast);
}
.p-in-chart-btn:hover { background: rgba(255,255,255,.25); border-color: rgba(255,255,255,.6); }
.p-modal-tabs-bar {
  display: flex;
  border-bottom: 1.5px solid var(--border);
  margin: 8px -1rem 0;
  padding: 0 1rem;
}
.p-modal-tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px 4px; border: none; background: none; cursor: pointer;
  font-size: .73rem; font-weight: 700; color: var(--text-3);
  font-family: inherit; border-bottom: 2.5px solid transparent;
  margin-bottom: -1.5px; transition: var(--t-fast);
}
.p-modal-tab:hover { color: var(--pri); background: rgba(36,84,232,.04); }
.p-modal-tab.active { color: var(--pri); border-bottom-color: var(--pri); }
.p-modal-tab i { font-size: .65rem; }
.p-modal-pane { padding-top: 10px; }
.p-modal-news-content { display: flex; flex-direction: column; gap: 0; }
/* Institution panel tab active state */
#mpTabD.mp-tab-active, #mpTabG.mp-tab-active { color:#fff !important; border-bottom-color:#fff !important; }
#mpTabD, #mpTabG { border-bottom-width:2px; border-bottom-style:solid; }

/* ── Filter bar ────────────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
  padding: 5px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.filter-bar-label {
  font-size: .67rem; font-weight: 800; color: var(--text-3);
  letter-spacing: .04em; flex-shrink: 0;
}
.filter-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 11px; border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--surface); cursor: pointer;
  font-size: .7rem; font-weight: 700; color: var(--text-2);
  font-family: inherit; transition: var(--t-fast);
}
.filter-btn:hover { border-color: var(--pri); color: var(--pri); }
.filter-btn.active { border-color: var(--pri); background: var(--pri); color: #fff; }
.filter-badge {
  background: rgba(255,255,255,.25); color: #fff;
  border-radius: 999px; font-size: .59rem; font-weight: 800;
  padding: 0 5px; min-width: 16px; text-align: center; line-height: 1.5;
}
.filter-btn:not(.active) .filter-badge { background: var(--pri); color: #fff; }
.filter-reset {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--r-sm);
  border: 1.5px solid #fca5a5; background: #fff1f2;
  color: #dc2626; cursor: pointer; font-size: .7rem;
  font-weight: 700; font-family: inherit; transition: var(--t-fast);
}
.filter-reset:hover { background: #fee2e2; }

/* ── Filter dropdown ───────────────────────────────────────────── */
.filter-dropdown {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  min-width: 210px; max-height: 280px; overflow-y: auto;
  animation: fadeIn .12s var(--ease);
}
.filter-dd-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; font-weight: 800; font-size: .72rem;
  color: var(--text-3); border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: .06em; gap: 8px; position: sticky; top: 0;
  background: var(--surface);
}
.filter-dd-close {
  border: none; background: none; cursor: pointer;
  color: var(--text-3); font-size: .75rem; line-height: 1;
  padding: 2px 4px; border-radius: 4px;
}
.filter-dd-close:hover { background: var(--bg); color: #dc2626; }
.filter-dd-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 14px; cursor: pointer; transition: background .1s;
  font-size: .78rem; color: var(--text);
}
.filter-dd-item:hover { background: var(--bg); }
.filter-dd-item input { cursor: pointer; accent-color: var(--pri); }
.filter-dd-empty { padding: 12px 14px; font-size: .75rem; color: var(--text-3); }

/* ── Filtered node (dim non-matching) ──────────────────────────── */
.org-node.node-filtered { opacity: .14; filter: grayscale(.9); pointer-events: none; transition: opacity .2s; }

/* ══════════════════════════════════════════════════════════════════
   NODE CARD — PA Ring + Gov + Social
   ══════════════════════════════════════════════════════════════════ */
.node-card.has-pa { border-top: 2.5px solid var(--pa-color); }
.node-pa-tag {
  display: inline-block; margin: 2px auto 2px;
  padding: 1px 8px; border-radius: 999px;
  font-size: .57rem; font-weight: 800;
  text-align: center; letter-spacing: .01em;
}
.node-gov {
  font-size: .56rem; color: var(--text-3);
  line-height: 1.3; text-align: center; margin: 1px 0;
}
.node-gov .fa-map-marker-alt { font-size: .5rem; }
.node-soc-row { display: flex; justify-content: center; gap: 4px; margin: 2px 0; }
.node-soc {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; font-size: .62rem;
  text-decoration: none; transition: transform .15s var(--ease-spring);
}
.node-soc:hover { transform: scale(1.28); }
.node-soc.tw { background: #1da1f2; color: #fff; }
.node-soc.fb { background: #1877f2; color: #fff; }

/* ══════════════════════════════════════════════════════════════════
   SIDEBAR DRILL-DOWN TREE
   ══════════════════════════════════════════════════════════════════ */
.sb-cat-section { border-bottom: 1px solid var(--sb-border); }
.sb-cat-head {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 10px; color: var(--sb-text);
  text-decoration: none; font-size: .82rem; font-weight: 700;
  transition: var(--t-fast); border-radius: var(--r-sm);
  border-right: 2px solid transparent; margin: 2px 4px;
}
.sb-cat-head:hover { background: rgba(255,255,255,.05); color: var(--sb-text-hi); }
.sb-cat-head.active {
  background: var(--sb-active); color: #7baeff;
  border-right-color: var(--cat, var(--pri));
}
.sb-cat-head .badge { font-size: .61rem; padding: 2px 6px; border-radius: 999px; flex-shrink: 0; }
.sb-caret { font-size: .57rem; flex-shrink: 0; transition: transform .2s; }
.sb-cat-tree { background: rgba(0,0,0,.18); padding: 3px 0; }
.sb-node-row {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 12px; cursor: pointer;
  font-size: .75rem; color: var(--sb-text);
  transition: var(--t-fast); user-select: none;
  border-right: 2px solid transparent;
}
.sb-node-row:hover { background: rgba(255,255,255,.05); color: var(--sb-text-hi); }
.sb-node-caret { font-size: .52rem; color: rgba(110,132,160,.55); flex-shrink: 0; transition: transform .15s; }
.sb-node-dot  { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.sb-node-spacer { width: 10px; flex-shrink: 0; }
.sb-icon { flex-shrink: 0; }
.sb-node-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }

/* ══════════════════════════════════════════════════════════════════
   MOBILE FLOATING ZOOM BAR
   ══════════════════════════════════════════════════════════════════ */
.mobile-zoom-bar {
  display: none;
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 50%; transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  padding: 5px 8px;
  gap: 2px;
  z-index: 500;
  align-items: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.mzb-btn {
  width: 42px; height: 42px;
  border: none; background: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: .95rem; color: var(--text-2);
  transition: background .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.mzb-btn:active { background: var(--bg); color: var(--pri); }
.mzb-divider { width: 1px; height: 22px; background: var(--border); flex-shrink: 0; margin: 0 2px; }
.mzb-label {
  font-size: .72rem; font-weight: 800; color: var(--text-3);
  padding: 0 4px; min-width: 42px; text-align: center;
}

/* ══════════════════════════════════════════════════════════════════
   MOBILE — max-width 768px
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* ── Base ── */
  body { padding-bottom: env(safe-area-inset-bottom, 0px); }

  /* ── Layout ── */
  .page-body { padding: 10px 10px 80px; }
  .topbar { height: 50px; padding: 0 10px; gap: 5px; }
  .topbar-title { font-size: .85rem; }

  /* Hide verbose text in topbar buttons; keep icons */
  .topbar .btn-text-hide { display: none !important; }

  /* ── Sidebar ── */
  .sidebar { width: min(82vw, 288px); }
  .sidebar-brand { padding: 14px 12px 12px; }
  .sidebar-nav .nav-link { padding: 10px 12px; font-size: .86rem; }
  .sb-cat-head { padding: 10px 10px; }
  .sb-node-row { padding: 7px 12px; }
  .btn-new-cat { padding: 9px 10px; font-size: .82rem; }

  /* ── Dashboard ── */
  .dash-hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 14px;
    gap: 14px;
  }
  .dash-hero .stats-bar {
    width: 100%; display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px; margin-bottom: 0;
  }
  .stat-card { min-width: unset; padding: 13px 12px; gap: 10px; }
  .stat-value { font-size: 1.35rem; }
  .stat-icon { width: 38px; height: 38px; font-size: 1rem; }
  .dash-hero-title { font-size: 1.15rem; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cat-card { padding: 16px 10px 14px; }
  .cat-card-icon { font-size: 1.8rem; }
  .cat-card-name { font-size: .82rem; }

  /* ── Chart ── */
  .chart-scroll-area {
    height: calc(100dvh - 205px);
    min-height: 340px;
    border-radius: var(--r-md);
    touch-action: none;
  }
  .chart-toolbar { gap: 4px; padding-bottom: 6px; }
  .chart-hint { display: none; }          /* "Ctrl+Scroll" irrelevant on mobile */
  .btn-icon { min-height: 36px; min-width: 36px; }

  /* ── Filter bar ── */
  .filter-bar {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; flex-wrap: nowrap; gap: 8px; padding: 6px 12px;
  }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-btn, .filter-reset { flex-shrink: 0; padding: 5px 13px; font-size: .73rem; }
  .filter-bar-label { flex-shrink: 0; }

  /* ── Node cards — bigger touch targets ── */
  .nbar-btn { padding: 5px 9px; font-size: .75rem; min-height: 30px; }
  .node-name { font-size: .76rem; }

  /* ── Depth scaling — less aggressive on mobile ── */
  .org-node[data-depth="2"] { --node-scale: .94; }
  .org-node[data-depth="3"] { --node-scale: .82; }
  .org-node[data-depth="4"] { --node-scale: .70; }
  .org-node[data-depth="5"] { --node-scale: .58; }
  .org-node[data-depth="6"],
  .org-node[data-depth="7"],
  .org-node[data-depth="8"] { --node-scale: .48; }

  /* ── Show floating zoom bar ── */
  .mobile-zoom-bar { display: flex; }

  /* ── Modals — bottom sheet style ── */
  .modal-dialog {
    margin: 0; max-width: 100%;
    min-height: 100%; align-items: flex-end;
  }
  .modal-dialog .modal-content {
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    max-height: 92dvh; display: flex; flex-direction: column;
  }
  .modal-dialog .modal-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .modal.show .modal-dialog { align-items: flex-end; }

  /* Drag handle on modals */
  .modal-content::before {
    content: ''; display: block;
    width: 40px; height: 4px;
    background: var(--border);
    border-radius: 4px;
    margin: 10px auto -4px;
    flex-shrink: 0;
  }

  /* ── Larger photo upload button ── */
  .avatar-upload-btn { width: 28px; height: 28px; font-size: .65rem; }

  /* ── List view ── */
  .list-person-item { padding: 12px 14px; }
  .list-person-avatar { width: 40px; height: 40px; font-size: .85rem; }
  .list-person-name { font-size: .88rem; }

  /* ── Filter dropdown ── */
  .filter-dropdown { min-width: min(90vw, 280px); max-height: 50dvh; }
  .filter-dd-item { padding: 10px 14px; }

  /* ── Auth card ── */
  .auth-card { padding: 30px 22px 28px; }
  .auth-logo { width: 56px; height: 56px; font-size: 1.4rem; }

  /* ── Isolate banner ── */
  .isolate-banner { font-size: .72rem; padding: 7px 12px; }

  /* ── Contact chips ── */
  .contact-chip { font-size: .84rem; }

  /* ── p-in-chart button larger ── */
  .p-in-chart-btn { padding: 5px 12px; font-size: .75rem; }

  /* ── QR modal full centered ── */
  #phoneQRModal .modal-dialog {
    align-items: center; margin: auto;
    max-width: min(360px, 95vw);
  }
  #phoneQRModal .modal-content { border-radius: var(--r-xl); max-height: unset; }
  #phoneQRModal .modal-content::before { display: none; }
}

/* Prevent iOS auto-zoom on input focus (requires font-size >= 16px) */
@media (max-width: 768px) {
  .form-control, .form-select, .sidebar-search input,
  .auth-card input, #globalSearch {
    font-size: 16px !important;
  }
}

/* ── Extra small phones ── */
@media (max-width: 390px) {
  .topbar { padding: 0 8px; gap: 4px; }
  .topbar-title span:last-child { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
  .cat-card-name { font-size: .78rem; }
  .dash-hero-title { font-size: 1rem; }
}

/* ══════════════════════════════════════════════════════════════════
   MOBILE PERFORMANCE + UX OVERHAUL
   ══════════════════════════════════════════════════════════════════ */

/* ── Instant taps: removes the 300ms delay on iOS/Android ── */
button, a, label,
.node-card, .nbar-btn, .mzb-btn,
.sb-cat-head, .sb-node-row, .nav-link,
.cat-card, .list-person-item, .p-modal-tab,
.filter-btn, .filter-reset, .btn-icon {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
  /* ── Kill staggered entry animations on mobile ────────────────────
     With 300+ nodes, each running a CSS animation, the GPU is
     overwhelmed on phones. Removing it shaves 1-2 seconds off
     chart render time with zero visual downside.               ── */
  .org-node {
    animation: none !important;
    opacity: 1 !important;
    transform: none;
  }
  /* Keep hover effect but make it instant */
  .org-node:hover .node-card {
    transition: box-shadow .1s, transform .1s;
  }

  /* ── Prevent accidental swipe-back while panning chart ── */
  .chart-scroll-area {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Mobile bottom bar: wider to fit nav + zoom buttons ── */
  .mobile-zoom-bar {
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    padding: 4px 6px;
    gap: 0;
    border-radius: 22px;
    box-shadow: 0 4px 24px rgba(0,16,48,.18), 0 1px 4px rgba(0,16,48,.1);
  }
  .mzb-btn {
    width: 38px; height: 38px;
    font-size: .88rem;
    border-radius: 50%;
    transition: background .1s, transform .1s;
  }
  /* Pressed state feedback */
  .mzb-btn:active {
    background: var(--pri-light);
    color: var(--pri);
    transform: scale(.88);
  }
  .mzb-label { min-width: 36px; font-size: .7rem; }

  /* ── Better tap feedback on node cards ── */
  .node-card:active {
    transform: scale(calc(var(--node-scale, 1) * .96));
    transition: transform .08s;
  }

  /* ── Sidebar footer: bigger tap targets ── */
  .btn-new-cat {
    padding: 12px 10px;
    font-size: .84rem;
    min-height: 44px;
  }

  /* ── Topbar: hide hamburger from topbar when bottom bar is visible ──
     The bottom bar already has a ☰ button, no need for two          ── */
  .topbar .btn-icon.d-lg-none:first-child { display: none !important; }

  /* ── Modals: bigger drag handle, easier to close ── */
  .modal-content::before {
    width: 48px; height: 5px;
    margin: 12px auto -6px;
    background: #cbd5e1;
  }

  /* ── Chart height: fill more screen ── */
  .chart-scroll-area {
    height: calc(100dvh - 160px);
  }

  /* ── Dashboard cards: full width on very small screens ── */
  .dash-actions { flex-direction: column; }
}

/* ── Landscape phone: taller chart ── */
@media (max-width: 768px) and (orientation: landscape) {
  .chart-scroll-area { height: calc(100dvh - 120px); }
  .mobile-zoom-bar { bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
}
