/* Line icons for the sidebar menu and top bar (Tabler, MIT). @import must stay first. */
@import url("https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@3.19.0/dist/tabler-icons.min.css");
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");   /* fapilot brand font (New layout) */
/* ─────────────────────────────────────────────────────────────────
   nav.css — Shared topbar styles loaded in <head> of every CRM page.
   Uses !important to override any per-page topbar CSS variations.
   ───────────────────────────────────────────────────────────────── */

/* Version stamp: nav.js compares this to NAV_CSS_VER and, if a browser is
   holding an older cached copy of this file, loads nav.css?v=… to replace it.
   Bump BOTH this value and NAV_CSS_VER in nav.js whenever you edit this file. */
:root { --crm-nav-css-ver: 20261119f; }

/* ── Topbar container ── */
.topbar {
  background: var(--surface) !important;
  border-bottom: 1px solid var(--border) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0 20px !important;
  height: 52px !important;
  flex-shrink: 0 !important;
  /* NOTE: no position/z-index here — avoids creating a CSS stacking context
     that would trap position:fixed children (mentionDropdown) inside it */
}

/* ── Left side ── */
.topbar-left {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  min-width: 0 !important;
  flex: 1 !important;
  overflow: visible !important;
}

/* ── Logo ── */
a.logo, .logo {
  font-weight: 800 !important;
  font-size: 15px !important;
  letter-spacing: -0.4px !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  text-decoration: none !important;
  color: var(--text) !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}
.logo-icon {
  width: 28px !important;
  height: 28px !important;
  background: var(--orange) !important;
  color: #fff !important;
  border-radius: 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 14px !important;
  flex-shrink: 0 !important;
}

/* ── Nav links ── */
nav.topbar-nav {
  display: flex !important;
  align-items: center !important;
  gap: 2px !important;
  overflow: visible !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

nav.topbar-nav a {
  padding: 6px 10px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  color: var(--text3) !important;
  text-decoration: none !important;
  border-radius: 6px !important;
  transition: color 0.15s, background 0.15s !important;
  white-space: nowrap !important;
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  line-height: 1 !important;
}
nav.topbar-nav a:hover {
  color: var(--text) !important;
  background: var(--surface2) !important;
}
nav.topbar-nav a.active {
  color: var(--orange) !important;
  font-weight: 600 !important;
  background: var(--orange-dim, rgba(249,115,22,0.12)) !important;
}

/* ── Right side ── */
.topbar-right {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-shrink: 0 !important;
}

/* ── Notification bell ── */
.nav-notif-wrap { position: relative !important; }

.notif-btn {
  position: relative !important;
  background: var(--surface2) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  padding: 6px 10px !important;
  color: var(--text2) !important;
  font-size: 16px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  line-height: 1 !important;
  transition: all 0.2s !important;
  font-family: inherit !important;
}
.notif-btn:hover { background: var(--surface3) !important; color: var(--text) !important; }

.notif-badge {
  position: absolute !important;
  top: -4px !important;
  right: -4px !important;
  background: #ef4444 !important;
  color: #fff !important;
  font-size: 9px !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
  min-width: 16px !important;
  height: 16px !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 4px !important;
  line-height: 1 !important;
  border: 2px solid var(--bg, #111) !important;
}
.notif-badge.visible { display: flex !important; }

.notif-panel {
  display: none !important;
  position: absolute !important;
  top: calc(100% + 8px) !important;
  right: 0 !important;
  width: 340px !important;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4) !important;
  z-index: 500 !important;
  overflow: hidden !important;
}
.notif-panel.open { display: block !important; }

.notif-panel-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 12px 16px !important;
  border-bottom: 1px solid var(--border) !important;
}
.notif-panel-title { font-size: 13px !important; font-weight: 600 !important; }

.notif-mark-all {
  font-size: 11px !important;
  color: var(--orange) !important;
  cursor: pointer !important;
  background: none !important;
  border: none !important;
  font-family: inherit !important;
  padding: 0 !important;
}
.notif-mark-all:hover { text-decoration: underline !important; }

.notif-list { max-height: 380px !important; overflow-y: auto !important; }
.notif-empty { padding: 24px 16px !important; text-align: center !important; color: var(--text3) !important; font-size: 12px !important; }

.notif-item {
  display: flex !important;
  gap: 10px !important;
  padding: 12px 16px !important;
  border-bottom: 1px solid var(--border) !important;
  cursor: pointer !important;
  transition: background 0.15s !important;
  align-items: flex-start !important;
}
.notif-item:hover { background: var(--surface2) !important; }
.notif-item.unread { background: var(--orange-dim, rgba(249,115,22,0.10)) !important; }
.notif-item.unread:hover { background: rgba(249,115,22,0.18) !important; }

.notif-item-icon {
  width: 30px !important; height: 30px !important;
  border-radius: 50% !important; flex-shrink: 0 !important;
  background: var(--orange-dim, rgba(249,115,22,0.12)) !important;
  color: var(--orange) !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  font-size: 14px !important;
}
.notif-item-body { flex: 1 !important; min-width: 0 !important; }
.notif-item-text { font-size: 12px !important; color: var(--text) !important; line-height: 1.4 !important; }
.notif-item-text strong { color: var(--orange) !important; }
.notif-item-snippet { font-size: 11px !important; color: var(--text3) !important; margin-top: 3px !important; overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important; }
.notif-item-time { font-size: 10px !important; color: var(--text3) !important; margin-top: 3px !important; }

/* ── Settings dropdown ── */
.nav-settings-wrap { position: relative !important; }

.topbar-btn {
  background: var(--surface2) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  padding: 6px 12px !important;
  color: var(--text2) !important;
  font-size: 13px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  font-family: inherit !important;
  transition: all 0.2s !important;
}
.topbar-btn:hover { background: var(--surface3) !important; color: var(--text) !important; }

.settings-dropdown {
  display: none !important;
  position: absolute !important;
  top: calc(100% + 6px) !important;
  right: 0 !important;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  min-width: 200px !important;
  z-index: 500 !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35) !important;
  overflow: hidden !important;
}
.settings-dropdown.open { display: block !important; }

.settings-dropdown-item {
  padding: 10px 14px !important;
  font-size: 13px !important;
  color: var(--text2) !important;
  cursor: pointer !important;
  transition: background 0.15s !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}
.settings-dropdown-item:hover { background: var(--surface2) !important; color: var(--text) !important; }

/* ── Theme toggle ── */
.theme-toggle {
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  cursor: pointer !important;
  font-size: 12px !important;
  color: var(--text3) !important;
  user-select: none !important;
}
.theme-icon { font-size: 13px !important; line-height: 1 !important; }
.theme-toggle-track {
  width: 34px !important; height: 18px !important;
  border-radius: 9px !important;
  position: relative !important;
  background: var(--surface3) !important;
  border: 1px solid var(--border) !important;
  transition: background 0.2s !important;
  flex-shrink: 0 !important;
}
.theme-toggle-thumb {
  width: 14px !important; height: 14px !important;
  border-radius: 50% !important;
  position: absolute !important;
  top: 1px !important; left: 1px !important;
  background: var(--text3) !important;
  transition: transform 0.2s, background 0.2s !important;
}
html.light .theme-toggle-track { background: var(--orange-dim, rgba(249,115,22,0.15)) !important; border-color: var(--orange) !important; }
html.light .theme-toggle-thumb { transform: translateX(16px) !important; background: var(--orange) !important; }

/* ── Avatar ── */
.avatar {
  width: 30px !important; height: 30px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, var(--orange), #fb923c) !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  font-weight: 700 !important; font-size: 12px !important;
  color: #000 !important; overflow: hidden !important;
  cursor: pointer !important; flex-shrink: 0 !important;
  transition: opacity 0.2s !important;
}
.avatar:hover { opacity: 0.85 !important; }
.avatar img { width: 100% !important; height: 100% !important; object-fit: cover !important; }

/* ── Responsive topbar ── */
@media (max-width: 1200px) {
  nav.topbar-nav a { padding: 6px 8px !important; font-size: 11px !important; }
  .nav-dropdown-toggle { padding: 6px 8px !important; font-size: 11px !important; }
}
@media (max-width: 900px) {
  .topbar { height: 48px !important; padding: 0 10px !important; }
  .topbar-left { gap: 8px !important; }
  nav.topbar-nav { gap: 1px !important; flex-wrap: nowrap !important; }
  nav.topbar-nav a { padding: 5px 6px !important; font-size: 10px !important; gap: 2px !important; }
  .nav-dropdown-toggle { padding: 5px 6px !important; font-size: 10px !important; gap: 2px !important; }
  a.logo, .logo { font-size: 13px !important; gap: 6px !important; }
  .logo-icon { width: 24px !important; height: 24px !important; font-size: 12px !important; }
  .topbar-right { gap: 6px !important; }
  .topbar-btn { padding: 4px 8px !important; font-size: 12px !important; }
  .avatar { width: 26px !important; height: 26px !important; font-size: 10px !important; }
}
@media (max-width: 600px) {
  .topbar { height: 44px !important; padding: 0 8px !important; }
  nav.topbar-nav a { padding: 4px 5px !important; font-size: 9px !important; }
  .nav-dropdown-toggle { padding: 4px 5px !important; font-size: 9px !important; }
  a.logo, .logo { font-size: 12px !important; }
  .logo-icon { width: 22px !important; height: 22px !important; }
}

/* ── Nav Lists dropdown ── */
.nav-dropdown { position: relative !important; display: flex !important; align-items: center !important; }
.nav-dropdown-toggle {
  padding: 6px 10px !important; font-size: 12px !important; font-weight: 500 !important;
  color: var(--text3) !important; cursor: pointer !important; border-radius: 6px !important;
  transition: color 0.15s, background 0.15s !important; white-space: nowrap !important;
  display: flex !important; align-items: center !important; gap: 4px !important;
  user-select: none !important; line-height: 1 !important;
}
.nav-dropdown-toggle:hover,
.nav-dropdown.open .nav-dropdown-toggle {
  color: var(--text) !important; background: var(--surface2) !important;
}
.nav-dropdown.has-active .nav-dropdown-toggle {
  color: var(--orange) !important; font-weight: 600 !important;
  background: var(--orange-dim, rgba(249,115,22,0.12)) !important;
}
.nav-dropdown-menu {
  display: none !important; position: absolute !important; top: 100% !important; left: 0 !important;
  z-index: 9999 !important; background: var(--surface) !important;
  border: 1px solid var(--border) !important; border-radius: 10px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35) !important;
  min-width: 180px !important; padding: 4px 0 !important; margin-top: 4px !important;
  overflow: hidden !important;
}
.nav-dropdown.open .nav-dropdown-menu { display: block !important; }
.nav-dropdown-menu a {
  display: block !important; padding: 10px 16px !important; font-size: 13px !important;
  font-weight: 500 !important; color: var(--text3) !important; text-decoration: none !important;
  white-space: nowrap !important; transition: color 0.15s, background 0.15s !important;
}
.nav-dropdown-menu a:hover { color: var(--text) !important; background: var(--surface2) !important; }
.nav-dropdown-menu a.active {
  color: var(--orange) !important; font-weight: 600 !important;
  background: var(--orange-dim, rgba(249,115,22,0.12)) !important;
}

/* "More ▾" overflow dropdown — sits at the right edge of the nav, so
   anchor its menu to the right (not the left) to avoid spilling
   off-screen on narrow viewports. Slightly taller min-width since it
   often holds 5+ items at once. */
.nav-more-wrap > .nav-dropdown-menu {
  left: auto !important;
  right: 0 !important;
  min-width: 220px !important;
  max-height: calc(100vh - 80px) !important;
  overflow-y: auto !important;
}
/* Make the "More ▾" toggle visually distinct from real tabs so users
   recognize it as an overflow control rather than a top-level object. */
.nav-more-wrap > .nav-dropdown-toggle {
  color: var(--text2) !important;
  font-weight: 600 !important;
  border: 1px dashed var(--border) !important;
  padding: 5px 10px !important;
}
.nav-more-wrap.open > .nav-dropdown-toggle,
.nav-more-wrap > .nav-dropdown-toggle:hover {
  border-color: var(--orange) !important;
  color: var(--orange) !important;
  background: var(--orange-dim, rgba(249,115,22,0.12)) !important;
}

/* ── Global customer search bar (injected by nav.js under .topbar) ── */
.crm-gsearch-bar {
  background: var(--surface) !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 8px 20px !important;
  display: flex !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  min-width: 0 !important;
}
.crm-gsearch-bar.crm-gsearch-fixed { position: fixed !important; left: 0; right: 0; z-index: 99; }
.crm-gsearch-form {
  display: flex !important; align-items: center !important; gap: 8px !important;
  width: 100% !important; max-width: 720px !important; margin: 0 !important;
  background: var(--surface2, var(--bg)) !important;
  border: 1px solid var(--border) !important; border-radius: 10px !important;
  padding: 0 4px 0 12px !important; height: 36px !important; box-sizing: border-box !important;
  transition: border-color .15s, box-shadow .15s;
}
.crm-gsearch-form:focus-within {
  border-color: var(--orange) !important;
  box-shadow: 0 0 0 3px var(--orange-dim, rgba(249,115,22,0.12)) !important;
}
.crm-gsearch-icon { font-size: 13px; opacity: .7; }
.crm-gsearch-form input {
  flex: 1 !important; min-width: 0 !important; border: none !important; outline: none !important;
  background: transparent !important; color: var(--text) !important;
  font-size: 13px !important; font-family: var(--font, inherit) !important; padding: 0 !important; height: 100% !important;
}
.crm-gsearch-form input::placeholder { color: var(--text3) !important; }
.crm-gsearch-kbd {
  font-family: var(--mono, monospace); font-size: 11px; color: var(--text3);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; line-height: 1.4;
}
.crm-gsearch-form:focus-within .crm-gsearch-kbd { display: none; }
.crm-gsearch-btn {
  background: var(--orange) !important; color: #fff !important; border: none !important;
  border-radius: 7px !important; padding: 0 14px !important; height: 28px !important;
  font-size: 12px !important; font-weight: 600 !important; cursor: pointer !important;
  font-family: var(--font, inherit) !important;
}
.crm-gsearch-btn:hover { filter: brightness(1.08); }
.crm-gsearch-bar { position: relative; z-index: 98; }
.crm-gsearch-form { position: relative !important; }
.crm-gsearch-dd {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 10000;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 14px 40px rgba(0,0,0,.28); max-height: 70vh; overflow-y: auto; padding: 4px;
  font-family: var(--font, inherit); text-align: left;
}
.crm-gsearch-opt {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px;
  text-decoration: none !important; color: var(--text) !important; cursor: pointer;
}
.crm-gsearch-opt:hover, .crm-gsearch-opt.active { background: var(--orange-dim, rgba(249,115,22,0.12)); }
.crm-gsearch-opt-ico { font-size: 16px; flex-shrink: 0; }
.crm-gsearch-opt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.crm-gsearch-opt-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-gsearch-opt-sub { font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-gsearch-opt-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 10px; color: var(--text3); flex-shrink: 0; max-width: 40%; text-align: right; }
.crm-gsearch-opt-tag { font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 10px; white-space: nowrap; }
.crm-gsearch-opt-tag.acc { background: var(--cyan-dim, rgba(34,211,238,0.12)); color: var(--cyan, #0891b2); }
.crm-gsearch-opt-tag.lead { background: var(--purple-dim, rgba(167,139,250,0.12)); color: var(--purple, #7c3aed); }
.crm-gsearch-none { padding: 10px 12px; font-size: 12px; color: var(--text3); }
.crm-gsearch-all {
  display: block; padding: 8px 10px; margin-top: 2px; border-top: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--orange) !important; text-decoration: none !important; border-radius: 0 0 7px 7px;
}
.crm-gsearch-all:hover { background: var(--surface2, var(--bg)); }
@media (max-width: 600px) {
  .crm-gsearch-bar { padding: 6px 12px !important; }
  .crm-gsearch-kbd { display: none; }
}


/* ═══════════════════════════════════════════════════════════════════
   Sidebar menu (nav.js › 1a). Its 56px column is reserved from the first paint
   (html:not(.crm-no-rail)), not when nav.js runs at the end of the page, so pages
   no longer jump sideways while loading. nav.js sets crm-no-rail if it builds no menu. Collapsed rail of department icons on the
   left; hover/click a department → flyout of its pages; ☰ expands the full
   menu over the page. The old horizontal #topbarNav is hidden.
   ═══════════════════════════════════════════════════════════════════ */
html:not(.crm-no-rail) nav.topbar-nav { display: none !important; }
html:not(.crm-no-rail) body { padding-left: 56px !important; }
html:not(.crm-no-rail) .topbar { left: 56px !important; }               /* Housing page: fixed top bar */
html:not(.crm-no-rail) .v2-left { left: 56px !important; }               /* SEVIS v2 three-pane layout */
html:not(.crm-no-rail) .v2-main { left: 316px !important; }
html:not(.crm-no-rail) body.v2-left-collapsed .v2-main { left: 80px !important; }

.crm-rail {
  position: fixed; top: 0; left: 0; bottom: 0; width: 56px; z-index: 900;
  background: var(--surface, #fff); border-right: 1px solid var(--border, #e5e7eb);
  display: flex; flex-direction: column; box-sizing: border-box; padding: 0 8px 8px;
  font-family: inherit; transition: width .15s ease;
}
.crm-rail * { box-sizing: border-box; }
.crm-rail .ti { line-height: 1; }
.crm-rail-toggle, .crm-rg-head {
  display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none;
  color: var(--text3, #6b7280); cursor: pointer; font: inherit; text-align: left; white-space: nowrap; overflow: hidden;
}
.crm-rail-toggle {
  height: 52px; margin: 0 -8px 8px; width: calc(100% + 16px); padding: 0 18px;
  border-bottom: 1px solid var(--border, #e5e7eb); font-size: 13px; font-weight: 600;
}
.crm-rail-toggle .ti { font-size: 20px; }
.crm-rail-toggle:hover { color: var(--text, #111); }
.crm-rail-groups { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; }
.crm-rg { position: relative; }
.crm-rg-head { height: 40px; padding: 0 10px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.crm-rg-head > .ti:first-child { font-size: 20px; flex-shrink: 0; }
.crm-rg-head:hover, .crm-rg.fly > .crm-rg-head { background: var(--surface2, #f3f4f6); color: var(--text, #111); }
.crm-rg.has-active > .crm-rg-head { color: var(--orange, #f97316); background: var(--orange-dim, rgba(249,115,22,.12)); }
.crm-rg-label, .crm-rail-toggle-label, .crm-rg-chev { display: none; }
.crm-rg-chev { margin-left: auto; font-size: 14px; transition: transform .15s; }

/* pages */
.crm-rg-items { display: none; }
.crm-rg-flytitle { font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--text3, #6b7280); padding: 6px 10px 4px; }
a.crm-ri {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--text, #111); text-decoration: none; white-space: nowrap;
}
a.crm-ri .ti { font-size: 18px; color: var(--text3, #6b7280); flex-shrink: 0; }
a.crm-ri:hover { background: var(--surface2, #f3f4f6); }
a.crm-ri.active { color: var(--orange, #f97316); background: var(--orange-dim, rgba(249,115,22,.12)); font-weight: 600; }
a.crm-ri.active .ti { color: var(--orange, #f97316); }

/* collapsed: flyout to the right of the department icon */
html:not(.crm-rail-open) .crm-rg.fly > .crm-rg-items {
  display: block; position: absolute; left: 46px; top: -6px; min-width: 210px; padding: 6px; z-index: 901;
  background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
html:not(.crm-rail-open) .crm-rg.fly > .crm-rg-items::before {      /* hover bridge */
  content: ''; position: absolute; left: -12px; top: 0; bottom: 0; width: 12px;
}

/* expanded: full menu over the page */
html.crm-rail-open .crm-rail { width: 248px; box-shadow: 8px 0 30px rgba(0,0,0,.18); }
html.crm-rail-open .crm-rail-groups { overflow-y: auto; }
html.crm-rail-open .crm-rg-label, html.crm-rail-open .crm-rail-toggle-label { display: inline; }
html.crm-rail-open .crm-rg-chev { display: inline-block; }
html.crm-rail-open .crm-rg:not(.open) .crm-rg-chev { transform: rotate(-90deg); }
html.crm-rail-open .crm-rg.open > .crm-rg-items { display: block; padding: 2px 0 6px 14px; }
html.crm-rail-open .crm-rg-flytitle { display: none; }

/* ☰ in the top bar — phones only */
.crm-menu-btn { display: none; }
@media (max-width: 700px) {
  html:not(.crm-no-rail) body { padding-left: 0 !important; }
  html:not(.crm-no-rail) .topbar { left: 0 !important; }
  html:not(.crm-no-rail) .v2-left { left: 0 !important; }
  html:not(.crm-no-rail) .v2-main { left: 260px !important; }
  .crm-rail { width: 260px; transform: translateX(-100%); transition: transform .2s ease; }
  html.crm-rail-open .crm-rail { transform: none; width: 260px; }
  .crm-menu-btn {
    display: inline-flex !important; align-items: center; justify-content: center; width: 34px; height: 34px;
    border: 0; background: none; color: var(--text, #111); font-size: 22px; cursor: pointer; padding: 0; flex-shrink: 0;
  }
}
.notif-btn .ti, .topbar-btn .ti { font-size: 18px; vertical-align: -3px; }
.theme-icon .ti { font-size: 14px; }
.logo-icon .ti { font-size: 17px; }
@media print { .crm-rail, .crm-menu-btn { display: none !important; } html:not(.crm-no-rail) body { padding-left: 0 !important; } }

/* Search box inside the top bar (nav.js › 1c), between the logo and the bell/profile */
.topbar .crm-gsearch-bar.crm-gsearch-in-topbar {
  flex: 1 1 auto !important; align-self: stretch !important; align-items: center !important;
  background: transparent !important; border: 0 !important; padding: 0 16px !important; min-width: 0 !important;
}
.crm-gsearch-in-topbar .crm-gsearch-form { max-width: 560px !important; height: 34px !important; }
.crm-gsearch-icon .ti { font-size: 15px; vertical-align: -2px; }
html:not(.crm-no-rail) .topbar-left { flex: 0 0 auto !important; }
@media (max-width: 700px) {
  .topbar .crm-gsearch-bar.crm-gsearch-in-topbar { padding: 0 6px !important; }
  .crm-gsearch-in-topbar .crm-gsearch-btn, .crm-gsearch-in-topbar .crm-gsearch-kbd { display: none !important; }
}

/* ── Settings link at the bottom of the sidebar; the top-right gear is retired ── */
html:not(.crm-no-rail) .nav-settings-wrap { display: none !important; }
.crm-rail-foot { margin-top: auto; padding-top: 6px; border-top: 1px solid var(--border, #e5e7eb); }
a.crm-rail-link {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 10px; border-radius: 8px;
  color: var(--text3, #6b7280); text-decoration: none; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden;
}
a.crm-rail-link .ti { font-size: 20px; flex-shrink: 0; }
a.crm-rail-link:hover { background: var(--surface2, #f3f4f6); color: var(--text, #111); }
a.crm-rail-link.active { color: var(--orange, #f97316); background: var(--orange-dim, rgba(249,115,22,.12)); }
html:not(.crm-rail-open) a.crm-rail-link .crm-rg-label { display: none; }
html.crm-rail-open a.crm-rail-link .crm-rg-label { display: inline; }

/* ── New / Classic layout switch (top bar) ── */
.crm-layout-switch { display: inline-flex; border: 1px solid var(--border, #d1d5db); border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.crm-layout-switch button { border: 0; background: var(--surface, #fff); color: var(--text3, #6b7280); font: inherit; font-size: 12px; font-weight: 600; padding: 5px 10px; cursor: pointer; }
.crm-layout-switch button.on { background: var(--orange-dim, rgba(249,115,22,.12)); color: var(--orange, #f97316); }
@media (max-width: 700px) { .crm-layout-switch { display: none; } }

/* ── What's new popup ── */
.crm-wn-overlay { position: fixed; inset: 0; z-index: 3000; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.crm-wn { position: relative; width: 100%; max-width: 600px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface, #fff); color: var(--text, #111);
  border: 1px solid var(--border, #e5e7eb); border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.25); padding: 24px; font-family: inherit; }
.crm-wn-x { position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border: 0; background: none; font-size: 24px; color: var(--text3, #6b7280); cursor: pointer; border-radius: 8px; }
.crm-wn-x:hover { background: var(--surface2, #f3f4f6); }
.crm-wn-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--orange, #f97316); background: var(--orange-dim, rgba(249,115,22,.12)); padding: 4px 10px; border-radius: 999px; }
.crm-wn-head h2 { font-size: 21px; font-weight: 700; margin: 10px 0 6px; letter-spacing: -.3px; }
.crm-wn-head p { font-size: 14px; line-height: 1.5; color: var(--text2, #374151); margin: 0; }
.crm-wn-list { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.crm-wn-list li { display: flex; gap: 12px; }
.crm-wn-list .ti { font-size: 22px; color: var(--orange, #f97316); flex-shrink: 0; margin-top: 1px; }
.crm-wn-list b { display: block; font-size: 14px; }
.crm-wn-list span { display: block; font-size: 13px; line-height: 1.5; color: var(--text2, #374151); margin-top: 2px; }
.crm-wn-fb { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border, #e5e7eb); }
.crm-wn-fb[hidden] { display: none; }
.crm-wn-kind { display: inline-flex; border: 1px solid var(--border, #d1d5db); border-radius: 8px; overflow: hidden; margin-bottom: 10px; }
.crm-wn-kind button { border: 0; background: var(--surface, #fff); color: var(--text2, #374151); font: inherit; font-size: 13px; padding: 7px 12px; cursor: pointer; }
.crm-wn-kind button.on { background: var(--orange-dim, rgba(249,115,22,.12)); color: var(--orange, #f97316); font-weight: 600; }
.crm-wn-fb textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--border, #d1d5db); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14px; background: var(--bg2, #fff); color: var(--text, #111); resize: vertical; }
.crm-wn-sr { position: absolute; left: -9999px; }
.crm-wn-msg { font-size: 13px; min-height: 18px; margin-top: 6px; color: var(--text3, #6b7280); }
.crm-wn-msg.ok { color: #059669; } .crm-wn-msg.err { color: #dc2626; }
.crm-wn-fbrow { display: flex; justify-content: flex-end; margin-top: 6px; }
.crm-wn-foot { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border, #e5e7eb); }
.crm-wn-sp { flex: 1; }
.crm-wn-btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border, #d1d5db);
  background: var(--surface, #fff); color: var(--text, #111); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; }
.crm-wn-btn:hover { background: var(--surface2, #f3f4f6); }
.crm-wn-btn.primary { background: var(--orange, #f97316); border-color: var(--orange, #f97316); color: #fff; }
.crm-wn-btn.primary:hover { filter: brightness(1.05); background: var(--orange, #f97316); }
.crm-wn-btn[disabled] { opacity: .6; cursor: wait; }

/* ═══════════════════════════════════════════════════════════════════
   fapilot.com brand on the NEW layout (2026-11-19). Source of the tokens:
   LMS app2/dashboard/assets/css/theme.css — navy #1F3550, amber #F4C842,
   pink #E6457C, slate neutrals, Inter. Everything is scoped to
   html:not(.crm-classic): the Classic layout keeps the old orange until the transition ends.
   The CRM accent variable is still called --orange; on New it holds navy.
   ═══════════════════════════════════════════════════════════════════ */
html.light:not(.crm-classic) {
  --orange: #1f3550 !important; --orange-dim: rgba(31,53,80,.09) !important; --orange-glow: rgba(31,53,80,.18) !important;
  --bg: #f7f8fa !important; --bg2: #ffffff !important;
  --surface: #ffffff !important; --surface2: #f0f2f6 !important; --surface3: #e6e9ef !important;
  --border: #e6e9ef !important; --border-light: #d5dbe4 !important;
  --text: #1d2535 !important; --text2: #3d4658 !important; --text3: #646c7d !important;
  --cyan: #2e6da0 !important; --cyan-dim: rgba(46,109,160,.10) !important;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif !important;
}
html:not(.light):not(.crm-classic) {            /* dark: fapilot night base (already the CRM's), brand blue accent */
  --orange: #4277bd !important; --orange-dim: rgba(66,119,189,.16) !important; --orange-glow: rgba(66,119,189,.28) !important;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif !important;
}
html:not(.crm-classic) body { font-family: var(--font) !important; }

/* top bar = fapilot appbar */
html:not(.crm-classic) .topbar { background: #1f3550 !important; border-bottom: 1px solid #3d5474 !important; box-shadow: inset 0 3px 0 #e6457c !important; }
html:not(.light):not(.crm-classic) .topbar { background: #15263c !important; }
html:not(.crm-classic) .topbar a.logo, html:not(.crm-classic) .topbar .logo { color: #ffffff !important; }
html:not(.crm-classic) .topbar .logo-icon { background: transparent !important; border: 1.5px solid #ffffff !important; border-radius: 4px !important; color: #ffffff !important; }
html:not(.crm-classic) .topbar .notif-btn { background: transparent !important; border: 1px solid #3d5474 !important; border-radius: 4px !important; color: #cfd6e1 !important; }
html:not(.crm-classic) .topbar .topbar-btn, html:not(.crm-classic) .topbar .theme-icon, html:not(.crm-classic) .topbar .crm-menu-btn { color: #cfd6e1 !important; }
html:not(.crm-classic) .topbar .theme-toggle-track, html.light:not(.crm-classic) .topbar .theme-toggle-track { background: #243651 !important; border: 1px solid #5a7090 !important; }
html:not(.crm-classic) .topbar .theme-toggle-thumb, html.light:not(.crm-classic) .topbar .theme-toggle-thumb { background: #f4c842 !important; }
html:not(.crm-classic) .topbar .avatar { background: #f4c842 !important; color: #1f3550 !important; border-radius: 4px !important; font-weight: 800 !important; }
/* A photo fills the tile itself: no amber corners around it (2026-11-19) */
html:not(.crm-classic) .topbar .avatar:has(img) { background: transparent !important; overflow: hidden !important; }
html:not(.crm-classic) .topbar .avatar img { border-radius: 4px !important; }
html:not(.crm-classic) .topbar .crm-gsearch-form { background: #243651 !important; border-color: #3d5474 !important; border-radius: 6px !important; }
html:not(.crm-classic) .topbar .crm-gsearch-form:focus-within { border-color: #f4c842 !important; box-shadow: 0 0 0 3px rgba(244,200,66,.18) !important; }
html:not(.crm-classic) .topbar .crm-gsearch-form input { color: #ffffff !important; }
html:not(.crm-classic) .topbar .crm-gsearch-form input::placeholder { color: #8a9bb4 !important; }
html:not(.crm-classic) .topbar .crm-gsearch-icon { color: #8a9bb4 !important; opacity: 1 !important; }
html:not(.crm-classic) .topbar .crm-gsearch-kbd { color: #8a9bb4 !important; border-color: #3d5474 !important; }
html:not(.crm-classic) .topbar .crm-gsearch-btn { background: #f4c842 !important; color: #1f3550 !important; border-radius: 4px !important; }
html:not(.crm-classic) .topbar .crm-layout-switch { border-color: #3d5474 !important; border-radius: 4px !important; background: #243651 !important; }
html:not(.crm-classic) .topbar .crm-layout-switch button { background: transparent !important; color: #8a9bb4 !important; }
html:not(.crm-classic) .topbar .crm-layout-switch button.on { background: #f4c842 !important; color: #1f3550 !important; }

/* side menu */
html:not(.crm-classic) .crm-rail-toggle { background: #1f3550 !important; color: #cfd6e1 !important; border-bottom-color: #3d5474 !important; box-shadow: inset 0 3px 0 #e6457c !important; }
html:not(.light):not(.crm-classic) .crm-rail-toggle { background: #15263c !important; }
html:not(.crm-classic) .crm-rail-toggle:hover { color: #ffffff !important; }
html:not(.crm-classic) .crm-rg.has-active > .crm-rg-head, html:not(.crm-classic) a.crm-rail-link.active, html:not(.crm-classic) a.crm-ri.active {
  color: var(--orange) !important; background: var(--orange-dim) !important; box-shadow: inset 2px 0 0 var(--orange) !important; border-radius: 0 8px 8px 0 !important;
}
html:not(.crm-classic) a.crm-ri.active .ti { color: var(--orange) !important; }
html:not(.light):not(.crm-classic) .crm-rg.has-active > .crm-rg-head, html:not(.light):not(.crm-classic) a.crm-rail-link.active,
html:not(.light):not(.crm-classic) a.crm-ri.active, html:not(.light):not(.crm-classic) a.crm-ri.active .ti { color: #f4c842 !important; box-shadow: inset 2px 0 0 #f4c842 !important; }
html:not(.crm-classic) .crm-rg-flytitle { font-family: var(--mono, 'JetBrains Mono', monospace) !important; letter-spacing: .14em !important; font-size: 10px !important; }

/* What's new popup */
html:not(.crm-classic) .crm-wn-badge { color: #1f3550 !important; background: #fef4d3 !important; }
html:not(.light):not(.crm-classic) .crm-wn-badge { color: #f4c842 !important; background: rgba(244,200,66,.12) !important; }

/* ═══════════════════════════════════════════════════════════════════
   Flying Academy logo in the top bar (nav.js writes the two <img>s).
   White logo on the navy bar (New) and on dark mode; dark logo on
   Classic's white bar.
   ═══════════════════════════════════════════════════════════════════ */
.topbar a.logo { gap: 9px !important; }
.crm-logo-img { height: 24px; width: auto; display: block; flex-shrink: 0; }
.crm-logo-on-light { display: none; }
html.light.crm-classic .crm-logo-on-dark { display: none; }
html.light.crm-classic .crm-logo-on-light { display: block; }
.crm-logo-tag {
  font-family: var(--mono, 'JetBrains Mono', monospace); font-size: 10px; font-weight: 600; letter-spacing: .22em;
  color: #8a9bb4; padding-left: 9px; border-left: 1px solid #3d5474; line-height: 16px;
}
html.light.crm-classic .crm-logo-tag { color: var(--text3); border-left-color: var(--border); }

/* ═══════════════════════════════════════════════════════════════════
   MOBILE FOUNDATION (2026-11-19) — phones and small tablets.
   Breakpoints used across the CRM: 768px (phone / portrait tablet) and
   480px (small phone). Desktop is untouched: every rule below is inside
   a max-width media query. Page-specific mobile rules live at the end of
   each page's own <style>, in a block marked "Mobile (≤768px)".
   Helpers for pages: .crm-m-hide, .crm-m-only, .crm-m-xscroll,
   .crm-m-stack, .crm-m-full, .crm-m-sheet; JS: window.CRM_IS_MOBILE().
   ═══════════════════════════════════════════════════════════════════ */
.crm-m-only { display: none !important; }
@media (max-width: 768px) {
  .crm-m-only { display: revert !important; }
  .crm-m-hide { display: none !important; }
  .crm-m-xscroll { overflow-x: auto !important; -webkit-overflow-scrolling: touch; max-width: 100% !important; }
  .crm-m-stack { flex-direction: column !important; align-items: stretch !important; }
  .crm-m-full { width: 100% !important; max-width: 100% !important; min-width: 0 !important; }
  .crm-m-sheet {                                  /* a dialog box → full-screen sheet */
    width: 100% !important; max-width: 100% !important; min-width: 0 !important;
    height: 100% !important; max-height: 100% !important; margin: 0 !important; border-radius: 0 !important;
    overflow-y: auto !important;
  }

  /* 16px text in fields stops iPhone Safari zooming in on every tap */
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), select, textarea { font-size: 16px !important; }
  img, video { max-width: 100%; }
  .page-body { padding-left: 12px !important; padding-right: 12px !important; }

  /* notifications panel: full width under the bar */
  .notif-panel { position: fixed !important; left: 8px !important; right: 8px !important; top: 52px !important; width: auto !important; max-width: none !important; }

  /* What's new popup */
  .crm-wn { padding: 18px !important; border-radius: 14px !important; }
}
@media (max-width: 700px) {
  .topbar { gap: 6px !important; padding: 0 8px !important; position: relative; }
  .topbar-right { gap: 6px !important; flex-shrink: 0 !important; }
  .theme-toggle { display: none !important; }         /* Light/Dark is in Settings › Appearance */
  .crm-logo-tag { display: none; }
  .crm-logo-img { height: 20px; }
  .topbar .crm-gsearch-bar.crm-gsearch-in-topbar { padding: 0 4px !important; }
  .topbar .notif-btn { width: 34px !important; height: 34px !important; padding: 0 !important; display: inline-flex !important; align-items: center !important; justify-content: center !important; }
}
@media (max-width: 480px) {
  /* search becomes an icon; tapping it expands the box across the bar */
  .topbar .crm-gsearch-bar.crm-gsearch-in-topbar { position: static !important; flex: 1 1 auto !important; display: flex !important; justify-content: flex-end !important; }
  .crm-gsearch-in-topbar .crm-gsearch-form { width: 36px !important; min-width: 36px !important; padding: 0 !important; justify-content: center !important; }
  .crm-gsearch-in-topbar .crm-gsearch-form input { position: absolute !important; inset: 0 !important; opacity: 0 !important; width: 100% !important; }
  .crm-gsearch-in-topbar.crm-gs-open .crm-gsearch-form {
    position: absolute !important; left: 8px !important; right: 8px !important; top: 5px !important; width: auto !important;
    z-index: 30 !important; padding: 0 6px 0 12px !important; justify-content: flex-start !important;
  }
  .crm-gsearch-in-topbar.crm-gs-open .crm-gsearch-form input { position: static !important; opacity: 1 !important; }
  .crm-gsearch-dd { position: fixed !important; left: 8px !important; right: 8px !important; top: 50px !important; }
}
@media (max-width: 700px) {
  /* dim the page behind the open menu; tapping it closes the menu (nav.js document click) */
  html.crm-rail-open body::after { content: ''; position: fixed; inset: 0; background: rgba(15,25,40,.45); z-index: 899; }
}

/* ═══════════════════════════════════════════════════════════════════
   Accent helpers (2026-11-19). Page CSS that used to hard-code orange now
   reads these, with the old orange as the fallback, so Classic is unchanged
   and the New layout follows the fapilot brand.
     rgba(var(--orange-rgb, 249,115,22), a)   tints
     var(--orange-deep, #ea580c)               hover of solid buttons
     var(--avatar-bg, linear-gradient(...))    initials avatars
   ═══════════════════════════════════════════════════════════════════ */
html.light:not(.crm-classic) { --orange-rgb: 31,53,80; --orange-deep: #15263c; --avatar-bg: #f4c842; }
html:not(.light):not(.crm-classic) { --orange-rgb: 66,119,189; --orange-deep: #35649f; --avatar-bg: #f4c842; }

/* ═══════════════════════════════════════════════════════════════════
   Menu search (2026-11-19): a box at the top of the side menu that finds a module by name or by
   related words ("visa" → SEVIS, "rent" → Housing). Collapsed rail: a search icon that opens it.
   ═══════════════════════════════════════════════════════════════════ */
.crm-rail-search { position: relative; margin: 0 0 6px; }
.crm-rail-find { display: flex; align-items: center; justify-content: center; width: 40px; height: 36px; border: 0; border-radius: 8px; background: none; color: var(--text3, #6b7280); cursor: pointer; }
.crm-rail-find .ti { font-size: 19px; }
.crm-rail-find:hover { background: var(--surface2, #f3f4f6); color: var(--text, #111); }
.crm-rail-search input { display: none; }
html.crm-rail-open .crm-rail-find { position: absolute; left: 2px; top: 0; width: 32px; pointer-events: none; }
html.crm-rail-open .crm-rail-search input {
  display: block; width: 100%; height: 36px; padding: 0 10px 0 34px; border: 1px solid var(--border, #e5e7eb); border-radius: 8px;
  background: var(--surface2, #f9fafb); color: var(--text, #111); font: inherit; font-size: 13px; outline: none;
}
html.crm-rail-open .crm-rail-search input:focus { border-color: var(--orange, #f97316); background: var(--surface, #fff); }
.crm-rail-results { display: none; }
html.crm-rail-open .crm-rail.crm-searching .crm-rail-results { display: flex; flex-direction: column; gap: 1px; flex: 1; min-height: 0; overflow-y: auto; }
html.crm-rail-open .crm-rail.crm-searching .crm-rail-groups { display: none; }
.crm-rail-results a.crm-sr { white-space: normal; }
.crm-rail-results a.crm-sr.hi { background: var(--surface2, #f3f4f6); box-shadow: inset 2px 0 0 var(--orange, #f97316); }
.crm-sr-t { display: flex; flex-direction: column; min-width: 0; }
.crm-sr-t small { font-size: 11px; font-weight: 400; color: var(--text3, #6b7280); }
.crm-sr-none { padding: 10px; font-size: 12.5px; color: var(--text3, #6b7280); }
@media (max-width: 768px) { html.crm-rail-open .crm-rail-search input { height: 42px; font-size: 16px; } }

/* ═══════════════════════════════════════════════════════════════════
   MOTION STANDARD (2026-11-19). One set of durations and one easing for the
   whole CRM, New layout only (html:not(.crm-classic)); Classic is unchanged.
     --crm-dur-fast 120ms   hovers, dropdowns, menus
     --crm-dur-base 180ms   tab content, overlays fading in, page cross-fade
     --crm-dur-slow 260ms   side panels / drawers / dialogs
     --crm-ease-out         cubic-bezier(.2,.8,.2,1) (fast start, soft landing)
   Rules: animate transform + opacity only (never width/height/top/left);
   things that appear (display:none → shown) get a short keyframe, so no page
   JS is needed; list rows never animate; prefers-reduced-motion turns it all off.
   ═══════════════════════════════════════════════════════════════════ */
:root {
  --crm-dur-fast: 120ms; --crm-dur-base: 180ms; --crm-dur-slow: 260ms;
  --crm-ease-out: cubic-bezier(.2,.8,.2,1); --crm-ease-in: cubic-bezier(.4,0,1,1);
}
@keyframes crm-fade-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes crm-pop-in   { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes crm-drop-in  { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes crm-fly-in   { from { opacity: 0; transform: translateX(-4px); } to { opacity: 1; transform: none; } }
@keyframes crm-slide-in-right { from { opacity: .3; transform: translateX(32px); } to { opacity: 1; transform: none; } }
@keyframes crm-shimmer  { from { background-position: 150% 0; } to { background-position: -50% 0; } }

/* Placeholder for the side menu until nav.js draws it (same width as the menu; navy band on New) */
html:not(.crm-no-rail):not(.crm-has-rail) body::before {
  content: ''; position: fixed; top: 0; left: 0; bottom: 0; width: 56px; z-index: 899;
  background: var(--surface, #fff); border-right: 1px solid var(--border, #e5e7eb);
}
html:not(.crm-no-rail):not(.crm-has-rail):not(.crm-classic) body::before {
  background: linear-gradient(#1f3550 0 52px, var(--surface, #fff) 52px);
}
html:not(.light):not(.crm-no-rail):not(.crm-has-rail):not(.crm-classic) body::before { background: linear-gradient(#15263c 0 52px, var(--surface, #111827) 52px); }
@media (max-width: 700px) { html:not(.crm-has-rail) body::before { display: none !important; } }
@media print { html body::before { display: none !important; } }

/* Theme switch: swap colours in one frame (nav.js adds this class for two frames) */
html.crm-no-motion *, html.crm-no-motion *::before, html.crm-no-motion *::after { transition: none !important; }

/* Page-to-page: short cross-fade instead of a white flash (Chrome/Edge 126+, Safari 18.2+; others ignore it) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 120ms var(--crm-ease-in, ease-in) both crm-vt-out; }
::view-transition-new(root) { animation: 180ms cubic-bezier(.2,.8,.2,1) both crm-vt-in; }
@keyframes crm-vt-out { to { opacity: 0; } }
@keyframes crm-vt-in  { from { opacity: 0; } }
html.crm-classic { view-transition-name: none; }

/* Side menu: expand / flyout / phone drawer */
html:not(.crm-classic) .crm-rail { transition: width var(--crm-dur-base) var(--crm-ease-out), box-shadow var(--crm-dur-base) var(--crm-ease-out); }
html:not(.crm-classic).crm-rail-open .crm-rg-label,
html:not(.crm-classic).crm-rail-open .crm-rail-toggle-label,
html:not(.crm-classic).crm-rail-open .crm-rail-search input,
html:not(.crm-classic).crm-rail-open .crm-rg.open > .crm-rg-items { animation: crm-fade-in var(--crm-dur-base) var(--crm-ease-out); }
html:not(.crm-classic):not(.crm-rail-open) .crm-rg.fly > .crm-rg-items { animation: crm-fly-in var(--crm-dur-fast) var(--crm-ease-out); }
html:not(.crm-classic) .crm-rg-chev { transition: transform var(--crm-dur-fast) var(--crm-ease-out); }
@media (max-width: 700px) {
  html:not(.crm-classic) .crm-rail { transition: transform var(--crm-dur-slow) var(--crm-ease-out); }
  html:not(.crm-classic).crm-rail-open body::after { animation: crm-fade-in var(--crm-dur-base) var(--crm-ease-out); }
}

/* Top-bar buttons: colours only (was 'transition: all') */
html:not(.crm-classic) .notif-btn, html:not(.crm-classic) .topbar-btn {
  transition: background-color var(--crm-dur-fast) var(--crm-ease-out), color var(--crm-dur-fast) var(--crm-ease-out), border-color var(--crm-dur-fast) var(--crm-ease-out) !important;
}
/* Busy list rows and tabs: animate colours only (they had 'transition: all', so layout changes slid around) */
html:not(.crm-classic) :is(.record-item, .tab, .action-btn, .chip, .v2-chip, .filter-chip, .view-btn) {
  transition-property: background-color, border-color, color, box-shadow, opacity;
  transition-timing-function: var(--crm-ease-out);
}

/* Dropdowns and menus: fade + 4px drop */
html:not(.crm-classic) :is(.settings-dropdown.open, .notif-panel.open, .nav-dropdown.open, .mention-dropdown.open,
  .ctx-menu.open, .cal-base-dropdown.open, #v2TabsDropdown.open, .crm-gsearch-dd, .sv-qmenu, .em-vmenu) {
  animation: crm-drop-in var(--crm-dur-fast) var(--crm-ease-out);
}

/* Dialogs: the dark backdrop fades in, the box rises 8px and settles. No blur behind dialogs:
   backdrop-filter repainted the whole page every frame (8 fps instead of 60 while a dialog opened). */
html:not(.crm-classic) :is(.modal-overlay, .modal-backdrop, .modal-bg, .k-modal-bg, .mb-backdrop, .macro-modal-overlay,
  .upload-modal-bg, .md-modal-bg, .dr-modal-backdrop, .docpv-backdrop, .cm-overlay, .i20-overlay, .prompt-overlay,
  .rh-overlay, .v2-tpl-overlay, .v2-print-overlay, .mass-modal-overlay, .mass-overlay, .crm-wn-overlay) {
  animation: crm-fade-in var(--crm-dur-base) var(--crm-ease-out);
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
}
html:not(.crm-classic) :is(.modal-overlay, .modal-backdrop, .modal-bg, .k-modal-bg, .macro-modal-overlay, .mass-modal-overlay, .crm-wn-overlay)
  > :is(.modal, .macro-modal, .mass-modal, .k-modal, .crm-wn) {
  animation: crm-pop-in var(--crm-dur-slow) var(--crm-ease-out);
}

/* Side panels (quick looks, task Details bar, drawers): slide in from the right; slide out too
   (visibility now waits for the slide instead of hiding the panel at once) */
html:not(.crm-classic) :is(.ol-ql, .cl-ql, .ac-ql) {
  transition: transform var(--crm-dur-slow) var(--crm-ease-out), visibility 0s linear var(--crm-dur-slow);
}
html:not(.crm-classic) :is(.ol-ql, .cl-ql, .ac-ql).open { transition: transform var(--crm-dur-slow) var(--crm-ease-out), visibility 0s; }
html:not(.crm-classic) :is(.ol-ql-bg, .cl-ql-bg, .ac-ql-bg, .bkd-backdrop) { animation: crm-fade-in var(--crm-dur-base) var(--crm-ease-out); }
html:not(.crm-classic) .tl-peek { animation: crm-slide-in-right var(--crm-dur-slow) var(--crm-ease-out); }
@media (max-width: 768px) { html:not(.crm-classic) .tl-peek { animation-name: crm-fade-in; } }

/* Record tabs: the new tab's content fades in (opacity only, so nothing inside moves) */
html:not(.crm-classic) :is(.tab-content.active, .tab-panel.active) { animation: crm-fade-in var(--crm-dur-base) var(--crm-ease-out); }

/* Loading placeholder pages can use: <div class="crm-skel" style="height:14px;width:60%"></div> */
.crm-skel {
  display: block; border-radius: 6px; min-height: 12px;
  background: linear-gradient(90deg, var(--surface2, #eef1f6) 0%, var(--surface3, #e6e9ef) 40%, var(--surface2, #eef1f6) 80%);
  background-size: 300% 100%; animation: crm-shimmer 1.4s linear infinite;
}

/* Reduced motion: no slides, fades or cross-fades anywhere (New layout) */
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  html:not(.crm-classic) *, html:not(.crm-classic) *::before, html:not(.crm-classic) *::after {
    animation-duration: 1ms !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important; transition-delay: 0s !important; scroll-behavior: auto !important;
  }
}
