/* Agency CRM in the L.H Group site language (stage 1: shell + agency home).
   Active only under html.nx-app (set in crm.html, kill switch ?nx=0).
   Loaded LAST so it wins over crm.css / crm-ux-overhaul.css without touching them.
   Tokens come from lh-ds.css. */

/* ── 1. Token remap: every legacy var now speaks the site palette ───────── */
html.nx-app {
  --brand-50: #eef1ff;
  --brand-100: #dfe5ff;
  --brand-500: #3f5efb;
  --brand-600: #3f5efb;
  --brand-700: #2f4ae0;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --surface-sunken: #eef2f8;
  --ink-900: #0b0f1c;
  --ink-700: #1a2236;
  --ink-500: #66728a;
  --ink-400: #98a3b8;
  --border: #e3e9f2;
  --border-strong: #cfd9e6;
  --border-muted: #e9eef5;
  --info: #3f5efb;
  --info-bg: #eef1ff;
  --ring: 0 0 0 3px rgba(63,94,251,.22);
  --font-sans: var(--lh-font);
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-2xl: 28px;
  --ux-ink: #0b0f1c; --ux-muted: #66728a; --ux-line: #e3e9f2; --ux-soft: #f8fafd;
  --ux-teal: #3f5efb; --ux-teal-dark: #2f4ae0; --ux-teal-soft: #eef1ff;
  --crm-sidebar-w: 264px;
  --crm-sidebar-compact: 76px;
  --nx-side-bg: #0b0f1c;
}
html.nx-app[data-theme="dark"] {
  --brand-50: #171f3d; --brand-100: #1e2a55; --brand-500: #6d86ff; --brand-600: #3f5efb; --brand-700: #a9b8ff;
  --bg: #080b14; --surface: #111726; --surface-2: #151c2e; --surface-sunken: #1a2236;
  --ink-900: #f4f6fb; --ink-700: #d5dbea; --ink-500: #9aa5bd; --ink-400: #7c88a3;
  --border: #253049; --border-strong: #33405a; --border-muted: #1e273c;
}
html.nx-app body,
html.nx-app body :where(button, input, select, textarea, h1, h2, h3, h4, h5, h6, p, a, span, b, strong, small, label, td, th, li, div, summary) {
  font-family: var(--lh-font) !important;
}
html.nx-app body { background: var(--bg); color: var(--ink-900); }
html.nx-app :where(code, pre, kbd, samp) { font-family: ui-monospace, SFMono-Regular, Menlo, monospace !important; }
html.nx-app ::selection { background: rgba(63,94,251,.18); }
html.nx-app input[type="checkbox"], html.nx-app input[type="radio"] { accent-color: var(--lh-cobalt); }

/* ── 2. Side rail: the site's dark hero, as a navigation column ─────────── */
html.nx-app .topbar,
html.nx-app .sidebar-collapsed .topbar {
  width: var(--crm-sidebar-w);
  padding: 16px 12px 12px;
  gap: 10px;
  color: #fff;
  background:
    radial-gradient(120% 50% at 100% 0%, rgba(63,94,251,.30), transparent 60%),
    radial-gradient(90% 40% at 0% 100%, rgba(50,200,189,.16), transparent 65%),
    var(--nx-side-bg);
  border-inline-end: 0;
  box-shadow: none !important;
  transition: width .28s var(--lh-ease);
}
html.nx-app .topbar > .brand { display: none !important; }
html.nx-app .ux-sidebar-lock, html.nx-app #sidebarToggle { display: none !important; }
html.nx-app #app main,
html.nx-app .sidebar-collapsed #app main { margin-inline-start: var(--crm-sidebar-w); transition: margin .28s var(--lh-ease); }

.nx-brand { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 4px 10px 12px; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.08); }
.nx-brand__logo { width: 84px; height: auto; display: block; }
.nx-brand__mark { display: none; width: 38px; height: 38px; border-radius: 10px; }
.nx-brand__product { font: 800 11px var(--lh-font); letter-spacing: .18em; color: rgba(255,255,255,.55); padding-inline-start: 10px; border-inline-start: 1px solid rgba(255,255,255,.16); }

.nx-search-trigger {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 0 12px;
  border: 1px solid rgba(255,255,255,.12); border-radius: 999px; background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.66); font: 600 13.5px var(--lh-font); cursor: pointer; text-align: start;
  transition: background .2s, border-color .2s, color .2s;
}
.nx-search-trigger:hover, .nx-search-trigger:focus-visible { background: rgba(255,255,255,.11); border-color: rgba(255,255,255,.24); color: #fff; outline: none; }
.nx-search-trigger span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nx-search-trigger kbd, .nx-pal kbd { font: 700 11px var(--lh-font) !important; padding: 2px 7px; border-radius: 7px; border: 1px solid rgba(255,255,255,.18); color: rgba(255,255,255,.7); direction: ltr; }

html.nx-app .topbar #mainNav { gap: 2px; padding: 4px 2px 8px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.14) transparent; }
.nx-group { display: flex; flex-direction: column; gap: 2px; }
.nx-group + .nx-group { margin-top: 6px; }
.nx-group__head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 30px;
  padding: 0 12px; border: 0; background: none; cursor: pointer; border-radius: 10px;
  font: 800 11.5px var(--lh-font) !important; letter-spacing: .06em; color: rgba(255,255,255,.42);
}
.nx-group__head:hover { color: rgba(255,255,255,.8); }
.nx-group__head.is-static { cursor: default; }
.nx-group__head i { width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .3s var(--lh-ease); }
.nx-group.is-closed .nx-group__head i { transform: rotate(135deg); }
.nx-group__items { display: grid; gap: 2px; grid-template-rows: 1fr; }
.nx-group.is-closed .nx-group__items { display: none; }

.nx-item { position: relative; }
.nx-item[hidden] { display: none !important; }
html.nx-app .topbar .nav-btn, .nx-fav {
  position: relative; display: flex; align-items: center; gap: 11px; width: 100%; min-height: 38px;
  padding: 7px 12px; padding-inline-end: 34px; border: 0; border-radius: 12px; background: transparent;
  color: rgba(255,255,255,.74); font: 600 14px var(--lh-font) !important; text-align: start; cursor: pointer;
  box-shadow: none; transition: background .2s, color .2s;
}
html.nx-app .topbar .nav-btn svg, .nx-fav svg { width: 19px; height: 19px; flex: 0 0 19px; opacity: .85; }
html.nx-app .topbar .nav-btn:hover, .nx-fav:hover { background: rgba(255,255,255,.07); color: #fff; }
html.nx-app .topbar .nav-btn:focus-visible, .nx-fav:focus-visible { outline: 2px solid var(--lh-cyan); outline-offset: -2px; }
html.nx-app .topbar .nav-btn.active, .nx-fav.active {
  color: #fff; background: linear-gradient(100deg, rgba(50,200,189,.95), rgba(63,94,251,.95) 70%);
  box-shadow: 0 10px 24px -12px rgba(63,94,251,.9), inset 0 0 0 1px rgba(255,255,255,.14);
}
html.nx-app .topbar .nav-btn.active svg, .nx-fav.active svg { opacity: 1; }
.nx-star {
  position: absolute; top: 50%; inset-inline-end: 6px; transform: translateY(-50%); display: grid; place-items: center;
  width: 26px; height: 26px; padding: 0; border: 0; border-radius: 8px; background: none; color: rgba(255,255,255,.4);
  cursor: pointer; opacity: 0; transition: opacity .2s, color .2s, background .2s;
}
.nx-star svg path { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.nx-item:hover .nx-star, .nx-star:focus-visible { opacity: 1; }
.nx-star:hover { color: #fff; background: rgba(255,255,255,.1); }
.nx-item.is-fav .nx-star { opacity: 1; color: #ffd166; }
.nx-item.is-fav .nx-star svg path { fill: currentColor; }
.nx-group--favs { padding-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,.08); }
.nx-group--favs[hidden] { display: none !important; }

/* Footer: rail toggle + bell + account */
html.nx-app .topbar .user-info,
html.nx-app .sidebar-collapsed .topbar .user-info {
  display: flex !important; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px !important; padding: 10px 2px 0 !important; border-top: 1px solid rgba(255,255,255,.08) !important;
}
html.nx-app .sidebar-collapsed .topbar .user-info > * { display: initial !important; }
html.nx-app .topbar .user-info .notif-wrap, html.nx-app .topbar .user-info .account-menu-wrap { display: flex !important; margin: 0; grid-column: auto; order: 0; }
.nx-rail-toggle,
html.nx-app .topbar .user-info .nx-rail-toggle {
  display: inline-flex; align-items: center; gap: 8px; flex: 1 1 auto; min-height: 38px; padding: 0 10px; border: 0; border-radius: 10px;
  background: none !important; border: 0 !important; box-shadow: none !important; color: rgba(255,255,255,.55) !important; font: 600 12.5px var(--lh-font); cursor: pointer;
}
.nx-rail-toggle:hover { background: rgba(255,255,255,.07) !important; color: #fff !important; }
html.nx-app .topbar .notif-bell, html.nx-app .topbar .user-info .account-menu-button {
  width: 40px; height: 40px; min-height: 40px; border-radius: 50%; display: grid; place-items: center; padding: 0;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); color: #fff; box-shadow: none;
}
html.nx-app .topbar .notif-bell:hover, html.nx-app .topbar .user-info .account-menu-button:hover,
html.nx-app .topbar .user-info .account-menu-button[aria-expanded="true"] { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.3); color: #fff; }
html.nx-app .account-menu { color: var(--ink-900); border-radius: 20px; border-color: var(--border); box-shadow: var(--lh-shadow-pop); }
html.nx-app .account-menu :is(#docsLink, .topbar-select, .theme-toggle, #logoutBtn) { border-radius: 12px !important; }

/* Rail mode (explicit, remembered) */
html.nx-app.nx-rail { --crm-sidebar-w: 78px; }
html.nx-rail .nx-brand { justify-content: center; padding-inline: 0; }
html.nx-rail .nx-brand__logo, html.nx-rail .nx-brand__product { display: none; }
html.nx-rail .nx-brand__mark { display: block; }
html.nx-rail .nx-search-trigger { justify-content: center; padding: 0; }
html.nx-rail .nx-search-trigger :is(span, kbd) { display: none; }
html.nx-rail .nx-group__head { justify-content: center; min-height: 14px; padding: 0; pointer-events: none; }
html.nx-rail .nx-group__head > * { display: none; }
html.nx-rail .nx-group__head::before { content: ""; width: 22px; height: 1px; background: rgba(255,255,255,.14); }
html.nx-rail .nx-group.is-closed .nx-group__items { display: grid; }
html.nx-rail .topbar .nav-btn, html.nx-rail .nx-fav { justify-content: center; padding: 8px; }
html.nx-rail .topbar .nav-btn span, html.nx-rail .nx-fav span, html.nx-rail .nx-star, html.nx-rail .nx-rail-toggle span { display: none !important; }
html.nx-rail .topbar .user-info { flex-direction: column; justify-content: center; }
html.nx-rail .nx-rail-toggle { flex: 0 0 auto; justify-content: center; width: 40px; padding: 0; }

/* ── 3. Content: mist ground, white cards, pill controls ────────────────── */
html.nx-app #app main { padding: 28px clamp(18px, 3vw, 44px) 56px; }
html.nx-app .card { border-color: var(--border); border-radius: var(--lh-r-lg); box-shadow: var(--lh-shadow-1); }
html.nx-app .card:hover { box-shadow: var(--lh-shadow-2); }
html.nx-app .card > h2, html.nx-app .card > h3 { letter-spacing: -.015em; }
html.nx-app #viewRoot h1 { font-weight: 900; letter-spacing: -.03em; color: var(--ink-900); }
html.nx-app .btn { min-height: 40px; padding: 0 18px; border-radius: 999px; font-weight: 700; line-height: 1; }
html.nx-app .btn:not(.secondary):not(.ghost):not(.danger):not(.ok):not(.gold):not(.primary) { background: var(--lh-ink); border-color: var(--lh-ink); }
html.nx-app .btn:not(.secondary):not(.ghost):not(.danger):not(.ok):not(.gold):not(.primary):hover { background: var(--lh-cobalt); border-color: var(--lh-cobalt); transform: translateY(-1px); }
html.nx-app .btn.gold, html.nx-app .btn.primary { background: var(--lh-grad); background-size: 200% 100%; box-shadow: 0 10px 24px -12px rgba(63,94,251,.8); }
html.nx-app .btn.gold:hover, html.nx-app .btn.primary:hover { background: var(--lh-grad); background-size: 200% 100%; background-position: 100% 0; filter: none; box-shadow: 0 14px 28px -12px rgba(63,94,251,.9); }
html.nx-app .btn.secondary { border-color: var(--border-strong); }
html.nx-app .btn.secondary:hover { border-color: var(--lh-cobalt); color: var(--lh-cobalt); background: #fff; }
html.nx-app :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea) { border-radius: 12px; border-color: var(--border); }
html.nx-app :is(input, select, textarea):focus { border-color: var(--lh-cobalt) !important; box-shadow: var(--lh-ring) !important; outline: none; }
html.nx-app :is(button, a, input, select, textarea, summary):focus-visible { outline-color: var(--lh-cobalt); }
html.nx-app .modal { border-radius: 28px; box-shadow: var(--lh-shadow-pop); }
html.nx-app .modal-back { background: rgba(8,11,22,.42); backdrop-filter: blur(3px); }
html.nx-app .data-grid thead th { color: var(--lh-muted); font-weight: 800; letter-spacing: .02em; }
html.nx-app #viewRoot a:not([class]) { color: var(--lh-cobalt); }
html.nx-app .topbar a, html.nx-app .nx-brand { color: inherit; }

/* Legacy page intros from crm-ux-overhaul become site-style headings */
html.nx-app .ux-page-intro h1 { font-size: clamp(28px, 3vw, 42px); font-weight: 900; letter-spacing: -.035em; }
html.nx-app .ux-dashboard-search { border-radius: 26px; background: linear-gradient(125deg, #fff 0%, #f4f6ff 55%, #ecfbf9 100%); border-color: var(--border); }
html.nx-app .ux-dashboard-search__eyebrow { color: var(--lh-cobalt); }
html.nx-app .ux-dashboard-search__input { border-color: #c9d4ff; border-radius: 999px; padding-inline: 22px; }
html.nx-app .ux-dashboard-search__input:focus { border-color: var(--lh-cobalt); outline-color: rgba(63,94,251,.15); }

/* ── 4. Agency home: site hero + floating chat card ─────────────────────── */
html.nx-app .agency-home { --ah-ink: #0b0f1c; --ah-muted: #66728a; --ah-line: #e3e9f2; max-width: 1180px; color: var(--ah-ink); }
html.nx-app .agency-home .ah-top {
  position: relative; isolation: isolate; overflow: hidden; margin: 0 0 -46px; padding: clamp(28px, 4vw, 48px) clamp(22px, 4vw, 48px) 86px;
  border-radius: 30px; color: #fff; align-items: flex-end;
  background:
    radial-gradient(60% 120% at 100% 0%, rgba(63,94,251,.55), transparent 60%),
    radial-gradient(50% 120% at 0% 100%, rgba(50,200,189,.35), transparent 60%),
    radial-gradient(40% 80% at 40% 120%, rgba(116,87,219,.45), transparent 70%),
    #0b0f1c;
}
html.nx-app .agency-home .ah-top::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 44px 44px; -webkit-mask: radial-gradient(80% 90% at 70% 10%, #000, transparent); mask: radial-gradient(80% 90% at 70% 10%, #000, transparent);
}
html.nx-app .agency-home .ah-eyebrow { display: inline-flex; align-items: center; gap: 10px; color: rgba(255,255,255,.7); font-size: 13px; font-weight: 700; letter-spacing: .04em; }
html.nx-app .agency-home .ah-eyebrow::before { content: ""; width: 26px; height: 2px; border-radius: 2px; background: var(--lh-grad-2); }
html.nx-app #viewRoot .agency-home .ah-top h1 { margin: 12px 0 0; color: #fff; font-size: clamp(34px, 4.6vw, 64px); line-height: 1.02; font-weight: 900; letter-spacing: -.04em; }
html.nx-app .agency-home .ah-top p { margin: 12px 0 0; color: rgba(255,255,255,.72); font-size: clamp(15px, 1.3vw, 18px); max-width: 44ch; }
html.nx-app .agency-home .ah-client {
  flex-wrap: nowrap; flex: 0 1 auto; width: auto; max-width: 100%; gap: 6px; padding: 6px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
html.nx-app .agency-home .ah-client label { padding-inline: 10px 2px; color: rgba(255,255,255,.7); font-size: 13px; font-weight: 700; }
html.nx-app .agency-home .ah-client select { min-height: 42px; min-width: 220px; border-radius: 999px; border: 0; background-color: #fff; color: var(--lh-ink); font-weight: 700; padding-inline: 16px 34px; }
html.nx-app .agency-home .ah-client .ah-quiet { white-space: nowrap; min-height: 42px; padding: 0 16px; border-radius: 999px; border: 0; background: transparent; color: #fff; font-weight: 700; }
html.nx-app .agency-home .ah-client .ah-quiet:hover { background: rgba(255,255,255,.12); }

html.nx-app .agency-home .ah-chat { position: relative; z-index: 1; margin-inline: clamp(10px, 2vw, 24px); border: 1px solid var(--lh-line); border-radius: 26px; box-shadow: var(--lh-shadow-2); }
html.nx-app .agency-home .ah-chat-heading { padding: 14px 20px; border-bottom-color: var(--lh-line); }
html.nx-app .agency-home .ah-chat-heading b { font-size: 16px; font-weight: 800; }
html.nx-app .agency-home .ah-chat-heading .ah-quiet,
html.nx-app .agency-home .ah-sessions .ah-quiet { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--lh-line-2); background: #fff; color: var(--lh-ink); font-size: 13px; font-weight: 700; }
html.nx-app .agency-home .ah-chat-heading .ah-quiet:hover,
html.nx-app .agency-home .ah-sessions .ah-quiet:hover { border-color: var(--lh-cobalt); color: var(--lh-cobalt); }
html.nx-app .agency-home .ah-sessions { background: var(--lh-mist); border-bottom-color: var(--lh-line); padding: 8px 20px; }
html.nx-app .agency-home .ah-sessions select { border-radius: 999px; }
html.nx-app .agency-home .ah-conversation { background: linear-gradient(180deg, #fff, #fbfcff); }
html.nx-app .agency-home .ah-chat .ah-composer { padding: 12px 16px 14px; border-top: 1px solid var(--lh-line); background: #fff; }
html.nx-app .agency-home .ah-input-row { padding: 6px; border: 1px solid var(--lh-line-2); border-radius: 22px; background: #fff; transition: border-color .2s, box-shadow .2s; }
html.nx-app .agency-home .ah-input-row:focus-within { border-color: var(--lh-cobalt); box-shadow: var(--lh-ring); }
html.nx-app .agency-home .ah-input-row #ahRequest { border: 0 !important; box-shadow: none !important; background: transparent; padding-inline: 8px; }
html.nx-app .agency-home .ah-input-row #ahAttach { border-radius: 50%; border: 1px solid var(--lh-line-2); color: var(--lh-ink); background: var(--lh-mist); }
html.nx-app .agency-home .ah-primary { border: 0; border-radius: 999px; padding: 0 22px; color: #fff; font-weight: 800; background: var(--lh-grad); background-size: 200% 100%; box-shadow: 0 10px 24px -12px rgba(63,94,251,.8); transition: background-position .5s var(--lh-ease), transform .2s; }
html.nx-app .agency-home .ah-primary:hover:not(:disabled) { background-position: 100% 0; transform: translateY(-1px); }
html.nx-app .agency-home .ah-primary:disabled { background: #c9d2e3; box-shadow: none; color: #fff; opacity: 1; }
html.nx-app .agency-home .ah-examples button { border-radius: 999px; border: 1px solid var(--lh-line-2); background: var(--lh-mist); color: var(--lh-ink-3); font-weight: 600; }
html.nx-app .agency-home .ah-examples button:hover { border-color: var(--lh-cobalt); color: var(--lh-cobalt); background: #fff; }
html.nx-app .agency-home .ah-bubble { border-radius: 20px; }
html.nx-app .agency-home .ah-message { border-radius: 16px; }
html.nx-app .agency-home :is(.ah-setup, .ah-work) {
  margin: 14px clamp(10px, 2vw, 24px) 0; padding: 0 18px; border: 1px solid var(--lh-line); border-radius: 20px; background: #fff; box-shadow: var(--lh-shadow-1);
}
html.nx-app .agency-home :is(.ah-setup, .ah-work) > summary { min-height: 54px; display: flex; align-items: center; font-weight: 800; }
html.nx-app .agency-home .ah-filters button[aria-selected="true"] { background: var(--lh-ink); color: #fff; border-color: var(--lh-ink); }
html.nx-app .agency-home .ah-filters button { border-radius: 999px; }
html.nx-app .agency-home.ah-focused .ah-chat { margin: 0; border-radius: 0; }

/* ── 5. Quick search palette ────────────────────────────────────────────── */
.nx-pal { position: fixed; inset: 0; z-index: 9990; display: grid; justify-items: center; align-items: start; padding: 12vh 16px 16px; font-family: var(--lh-font); }
.nx-pal[hidden] { display: none; }
.nx-pal__scrim { position: absolute; inset: 0; background: rgba(8,11,22,.48); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: nxPalFade .2s ease; }
.nx-pal__box { position: relative; width: min(640px, 100%); max-height: min(560px, 76vh); display: flex; flex-direction: column; border-radius: 26px; background: #fff; box-shadow: var(--lh-shadow-pop); overflow: hidden; animation: nxPalIn .32s var(--lh-ease); }
.nx-pal__box::before { content: ""; height: 3px; background: var(--lh-grad-line); flex: none; }
.nx-pal__field { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--lh-line); color: var(--lh-muted); }
.nx-pal__field input { flex: 1; min-width: 0; border: 0 !important; box-shadow: none !important; outline: none; background: none; font: 600 18px var(--lh-font) !important; color: var(--lh-ink); padding: 6px 0; }
.nx-pal kbd { border-color: var(--lh-line-2); color: var(--lh-muted); background: var(--lh-mist); }
.nx-pal__list { overflow: auto; padding: 8px; }
.nx-pal__sec { padding: 10px 12px 6px; font: 800 11.5px var(--lh-font); letter-spacing: .06em; color: var(--lh-faint); }
.nx-pal__row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 12px; border: 0; border-radius: 14px; background: none; color: var(--lh-ink); text-align: start; cursor: pointer; }
.nx-pal__row.is-on { background: var(--lh-cobalt-soft); }
.nx-pal__ic { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 11px; background: var(--lh-mist); color: var(--lh-ink-3); }
.nx-pal__ic svg { width: 18px; height: 18px; }
.nx-pal__row.is-on .nx-pal__ic { background: var(--lh-grad-2); color: #fff; }
.nx-pal__avatar { font: 800 15px var(--lh-font); }
.nx-pal__txt { flex: 1; min-width: 0; display: grid; gap: 1px; }
.nx-pal__txt strong { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nx-pal__txt small { font-size: 12.5px; color: var(--lh-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nx-pal__go { color: var(--lh-cobalt); font-weight: 800; opacity: 0; transform: translateX(6px); transition: opacity .2s, transform .2s; }
.nx-pal__row.is-on .nx-pal__go { opacity: 1; transform: none; }
.nx-pal__empty { margin: 0; padding: 28px 16px; text-align: center; color: var(--lh-muted); }
.nx-pal__foot { display: flex; gap: 18px; flex-wrap: wrap; padding: 10px 18px; border-top: 1px solid var(--lh-line); background: var(--lh-mist); color: var(--lh-muted); font-size: 12px; }
.nx-pal__foot kbd { margin-inline-end: 3px; }
html.nx-pal-open body { overflow: hidden; }
@keyframes nxPalFade { from { opacity: 0; } }
@keyframes nxPalIn { from { opacity: 0; transform: translateY(-10px) scale(.985); } }
@media (prefers-reduced-motion: reduce) { .nx-pal__scrim, .nx-pal__box { animation: none; } }

/* ── 6. Tablet + phone: white top bar like the site header, dark drawer ── */
@media (max-width: 1024px) {
  html.nx-app { --crm-sidebar-w: 0px; }
  /* no width/margin animation when the layout switches (rotate, resize) */
  html.nx-app .topbar, html.nx-app #app main { transition: none !important; }
  html.nx-app .topbar, html.nx-app .sidebar-collapsed .topbar, html.nx-app.nx-rail .topbar {
    width: 100%; height: 64px; flex-direction: row; align-items: center; padding: 8px 12px; gap: 8px;
    background: rgba(255,255,255,.94); backdrop-filter: saturate(170%) blur(16px); -webkit-backdrop-filter: saturate(170%) blur(16px);
    border-bottom: 1px solid var(--lh-line); color: var(--lh-ink);
  }
  html.nx-app .topbar .hamburger { border-radius: 999px !important; border-color: var(--lh-line-2) !important; color: var(--lh-ink) !important; }
  .nx-brand { flex: 1 1 auto; min-height: 0; padding: 0; border: 0; }
  .nx-brand__logo { display: none; }
  .nx-brand__mark { display: block !important; width: 36px; height: 36px; }
  .nx-brand__product { color: var(--lh-muted); border-color: var(--lh-line-2); }
  html.nx-rail .nx-brand__product { display: inline; }
  .nx-search-trigger { flex: 0 0 auto; width: 44px; height: 44px; min-height: 44px; padding: 0; justify-content: center; border-color: var(--lh-line-2); background: #fff; color: var(--lh-ink); }
  .nx-search-trigger:hover { background: var(--lh-mist); color: var(--lh-ink); border-color: var(--lh-line-2); }
  .nx-search-trigger :is(span, kbd) { display: none; }
  html.nx-app .topbar .user-info, html.nx-app .sidebar-collapsed .topbar .user-info { flex-wrap: nowrap; padding: 0 !important; border: 0 !important; }
  .nx-rail-toggle { display: none !important; }
  html.nx-app .topbar .notif-bell, html.nx-app .topbar .user-info .account-menu-button { background: #fff; border-color: var(--lh-line-2); color: var(--lh-ink); }
  html.nx-app .topbar .notif-bell:hover, html.nx-app .topbar .user-info .account-menu-button:hover { background: var(--lh-mist); color: var(--lh-ink); }
  html.nx-app .topbar #mainNav, html.nx-app .topbar #mainNav.open {
    width: min(320px, 86vw); background: var(--nx-side-bg); border: 0; border-radius: 0 0 0 0;
    padding: 14px 12px max(18px, env(safe-area-inset-bottom));
  }
  html.nx-app .topbar #mainNav .nav-btn, html.nx-app .nx-fav { min-height: 46px; font-size: 15px !important; }
  html.nx-app .topbar #mainNav .nav-btn span { display: inline !important; }
  html.nx-app .nx-star { opacity: 1; }
  html.nx-app #app main, html.nx-app .sidebar-collapsed #app main { margin-inline-start: 0; padding: 82px 14px 42px; }
  html.nx-rail .nx-group__head > * { display: revert; }
  html.nx-rail .nx-group__head { justify-content: space-between; padding: 0 12px; min-height: 30px; pointer-events: auto; }
  html.nx-rail .nx-group__head::before { content: none; }
  html.nx-rail .topbar .nav-btn, html.nx-rail .nx-fav { justify-content: flex-start; padding: 8px 12px; }
  html.nx-rail .nx-group.is-closed .nx-group__items { display: none; }
}
@media (max-width: 760px) {
  html.nx-app .agency-home .ah-top { margin-bottom: -34px; padding: 22px 18px 62px; border-radius: 24px; }
  html.nx-app #viewRoot .agency-home .ah-top h1 { font-size: 32px; }
  html.nx-app .agency-home .ah-top p, html.nx-app .agency-home .ah-eyebrow { display: block; }
  html.nx-app .agency-home .ah-top p { font-size: 14px; }
  html.nx-app .agency-home .ah-client { width: 100%; flex-wrap: nowrap; }
  html.nx-app .agency-home .ah-client label { display: none; }
  html.nx-app .agency-home .ah-client select { min-width: 0; flex: 1; }
  html.nx-app .agency-home .ah-chat { margin-inline: 6px; border-radius: 22px; }
  html.nx-app .agency-home :is(.ah-setup, .ah-work) { margin-inline: 6px; }
  .nx-pal { padding-top: 10px; }
  .nx-pal__box { max-height: calc(100dvh - 20px); border-radius: 22px; }
  .nx-pal__foot { display: none; }
}
html.nx-app .nx-pal__field input, html.nx-app .nx-pal__field input:focus { border: 0 !important; box-shadow: none !important; outline: none !important; }
html.nx-app .nx-pal__field input::-webkit-search-cancel-button { display: none; }

/* ── 7. Inline teal left in crm.js templates (style="…") ────────────────── */
html.nx-app :is([style*=";color:#115e59"], [style^="color:#115e59"], [style*="; color:#115e59"], [style*=";color:#0f766e"], [style^="color:#0f766e"], [style*="; color:#0f766e"]) { color: #24308f !important; }
html.nx-app :is([style*="solid #ccfbf1"], [style*="solid #5eead4"]) { border-color: #dfe5ff !important; }
html.nx-app :is([style*="background:#5eead4"], [style*="background:#ccfbf1"], [style*="background:#f0fdfa"]) { background: #eef1ff !important; }
html.nx-app [style*="background:#0d9488"] { background: #3f5efb !important; }
html.nx-app [style*="color:#14b8a6"]:not([style*="-color:#14b8a6"]) { color: #2f4ae0 !important; }

/* ── 8. Stage 2: clients list + client card ─────────────────────────────── */
/* Page intro = the site's section header: kicker line, heavy title, no box */
html.nx-app .ux-page-intro { background: transparent; border: 0; box-shadow: none; padding: 6px 0 18px; }
html.nx-app .ux-page-intro__copy h1 { margin: 0; font-size: clamp(30px, 3.4vw, 48px) !important; line-height: 1.04; }
html.nx-app .ux-page-intro__copy p { color: var(--lh-muted); font-size: 15.5px; margin-top: 8px; }
html.nx-app .ux-page-intro__copy::before { content: ""; display: block; width: 34px; height: 3px; margin-bottom: 14px; border-radius: 3px; background: var(--lh-grad-2); }
html.nx-app .ux-view-switch { padding: 4px; border-radius: 999px; background: #fff; border: 1px solid var(--lh-line); box-shadow: var(--lh-shadow-1); }
html.nx-app .ux-view-switch__button { border-radius: 999px !important; border: 0 !important; font-weight: 700; color: var(--lh-muted); background: transparent; min-height: 36px; padding: 0 16px; }
html.nx-app .ux-view-switch__button.is-active { background: var(--lh-ink) !important; color: #fff !important; box-shadow: none; }
/* Search fields: pill, like the site */
html.nx-app #viewRoot :is(input[type="search"], #quickJumpInput, .toolbar input[type="search"]) { border-radius: 999px !important; padding-inline: 20px !important; min-height: 46px; background: #fff; }
/* Client tiles */
html.nx-app #activeCards > .card, html.nx-app .active-card { border-radius: 20px !important; }
html.nx-app #activeCards > .card:hover, html.nx-app .active-card:hover { border-color: #c9d3ff !important; transform: translateY(-2px); box-shadow: 0 1px 2px rgba(15,23,42,.05), 0 22px 44px -30px rgba(63,94,251,.55) !important; }
html.nx-app [data-sec-head] h2 { font-weight: 900; letter-spacing: -.02em; }
/* Client card header + tabs */
html.nx-app body.ux-lead-detail #viewRoot h1 { font-size: clamp(26px, 2.6vw, 36px); }
html.nx-app .ux-command-button { border-radius: 999px !important; font-weight: 700 !important; }
html.nx-app .ux-command-button.is-primary { background: var(--lh-ink) !important; border-color: var(--lh-ink) !important; color: #fff !important; }
html.nx-app .ux-command-button.is-primary:hover { background: var(--lh-cobalt) !important; border-color: var(--lh-cobalt) !important; }

/* ── 9. Stage 3: leads (agency sales board) + tasks ─────────────────────── */
html.nx-app .as-metrics > * { border-radius: 22px; border: 1px solid var(--lh-line); box-shadow: var(--lh-shadow-sm, 0 1px 2px rgba(11,15,28,.04)); transition: transform .2s var(--lh-ease), box-shadow .2s var(--lh-ease); }
html.nx-app .as-metrics > *:hover { transform: translateY(-2px); box-shadow: 0 14px 34px -18px rgba(63,94,251,.35); }
html.nx-app .as-column { background: #fff; border: 1px solid var(--lh-line); border-radius: 24px; padding: 14px; }
html.nx-app .as-column h2 { font-weight: 800; color: var(--lh-ink); align-items: center; }
html.nx-app .as-column h2 span { min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; background: var(--lh-mist); color: var(--lh-cobalt); font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
html.nx-app .as-card { border-radius: 18px; border-color: var(--lh-line); background: var(--lh-mist); transition: transform .2s var(--lh-ease), box-shadow .2s var(--lh-ease), background .2s; }
html.nx-app .as-card:hover { background: #fff; transform: translateY(-2px); box-shadow: 0 14px 30px -18px rgba(11,15,28,.3); }
html.nx-app .as-card h3 { font-weight: 800; }
html.nx-app .as-table table { border-radius: 18px; overflow: hidden; }
html.nx-app .as-table th { background: var(--lh-mist); color: var(--lh-muted); font-weight: 700; font-size: 13px; }
html.nx-app .as-dialog { border-color: var(--lh-line); border-radius: 26px; }
html.nx-app .as-dialog::backdrop { background: rgba(11,15,28,.45); backdrop-filter: blur(4px); }
/* tasks: ghost buttons in page toolbars as pills, "now" card as site hero card */
html.nx-app #viewRoot > .toolbar .btn.ghost { border: 1px solid var(--lh-line); background: #fff; border-radius: 999px; padding: 8px 14px; }
html.nx-app #viewRoot > .toolbar .btn.ghost:hover { border-color: var(--lh-cobalt); color: var(--lh-cobalt); }
html.nx-app #dayPlan .card[style*="solid var(--accent"] { border: 0 !important; background: linear-gradient(#fff, #fff) padding-box, var(--lh-grad, linear-gradient(120deg,#32c8bd,#3f5efb,#7457db)) border-box; border: 2px solid transparent !important; border-radius: 22px; box-shadow: 0 18px 40px -24px rgba(63,94,251,.45); }

/* ── 10. Stage 4: finance + quotes ─────────────────────────────────────── */
html.nx-app #finMonthPick { width: auto !important; flex: 0 0 auto; border-radius: 999px !important; padding: 7px 14px !important; }
html.nx-app #finPrev, html.nx-app #finNext, html.nx-app #finThis { border: 1px solid var(--lh-line); border-radius: 999px; background: #fff; }
html.nx-app #finPrev:hover, html.nx-app #finNext:hover, html.nx-app #finThis:hover { border-color: var(--lh-cobalt); color: var(--lh-cobalt); }
html.nx-app #finBody .kpi { border-radius: 22px; }
html.nx-app #finBody .kpi[data-fin-filter] { transition: transform .2s var(--lh-ease), box-shadow .2s var(--lh-ease); }
html.nx-app #finBody .kpi[data-fin-filter]:hover { transform: translateY(-2px); box-shadow: 0 14px 34px -18px rgba(63,94,251,.35); }
html.nx-app #finBody .lead-table-inner th { color: var(--lh-muted); font-weight: 700; }
html.nx-app #finBody tr[style*="border-top:2px solid var(--ink"] { background: var(--lh-mist) !important; border-top: 2px solid var(--lh-cobalt) !important; }
html.nx-app #finBody tr[style*="border-top:2px solid var(--ink"] td:first-child { border-radius: 0 12px 12px 0; }
html.nx-app #finLeadDrop { border-radius: 16px !important; border-color: var(--lh-line) !important; box-shadow: 0 18px 40px -20px rgba(11,15,28,.35) !important; }

/* ── 11. Stage 6: settings + platform ──────────────────────────────────── */
html.nx-app .settings-workspace { border-radius: 26px; overflow: hidden; }
html.nx-app .settings-workspace .settings-section { border-radius: 0 14px 14px 0; transition: background .15s, color .15s; }
html.nx-app .settings-workspace .settings-section:hover { background: var(--lh-mist); color: var(--lh-ink); }
html.nx-app .settings-workspace .settings-section.is-active { background: #eef1ff; color: var(--lh-cobalt); font-weight: 700; }
html.nx-app .settings-sections__search input { border-radius: 999px; }

/* ── 12. Clients: one search box (quick jump + card filter) ────────────── */
html.nx-app #quickJumpBox { background: var(--lh-mist) !important; border-bottom: 0 !important; padding: 12px 0 !important; }
html.nx-app #quickJumpInput { min-height: 52px; padding: 0 22px !important; border-radius: 999px !important; border: 1px solid var(--lh-line) !important; font-size: 15px !important; box-shadow: 0 14px 34px -26px rgba(11,15,28,.35); }
html.nx-app #quickJumpInput:focus { border-color: var(--lh-cobalt) !important; box-shadow: var(--lh-ring) !important; outline: 0; }
html.nx-app #quickJumpList { top: calc(100% + 6px) !important; border: 1px solid var(--lh-line) !important; border-radius: 18px !important; padding: 6px; box-shadow: 0 24px 50px -24px rgba(11,15,28,.35) !important; }
html.nx-app #quickJumpList .qj-row { border-bottom: 0 !important; border-radius: 12px; }
html.nx-app #quickJumpList .qj-row:hover { background: #eef1ff; }
html.nx-app #quickJumpCount { font-size: 13px !important; white-space: nowrap; }
