/* Novture — shared design system. Same component structure/class names as every other
   project on this stack (kisikarti.com etc.) — only --brand/--accent/--accent2 change. */

:root {
  --brand:    #14163a;
  --accent:   #6366f1;
  --accent2:  #818cf8;
  --ink:      #1f1f1f;
  --muted:    #6b7280;
  --bg:       #f8f9fa;
  --card-bg:  #ffffff;
  --border:   #e5e7eb;
  --radius:   14px;
  --shadow:   0 4px 24px rgba(0,0,0,.08);
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 68px;
  --header-h: 60px;
}

[data-theme="dark"] {
  --ink:     #f1f5f9;
  --muted:   #94a3b8;
  --bg:      #0f172a;
  --card-bg: #1e293b;
  --border:  #334155;
  --shadow:  0 4px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: var(--accent); text-decoration: none; }
.fade-in { animation: nv-fade-in .2s ease-out; }
@keyframes nv-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Layout ---------- */

/* Full-width persistent header — sits above the sidebar and main content (both offset by
   --header-h below), holds the hamburger + logo on the start side and the icon row +
   avatar dropdown on the end side. Height/offset math lives in one variable so the sidebar
   and main content can never drift out of sync with it. */
.nv-header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  background: var(--card-bg); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; z-index: 80;
}
.nv-header-left { display: flex; align-items: center; gap: 14px; }
.nv-header-toggle {
  background: transparent; border: none; color: var(--ink); cursor: pointer;
  font-size: 18px; padding: 6px; line-height: 1; border-radius: 8px;
}
.nv-header-toggle:hover { background: var(--bg); }
.nv-header-brand {
  display: flex; align-items: center; gap: 10px; color: var(--ink);
  font-weight: 700; font-size: 18px; white-space: nowrap;
}
.nv-header-brand img { max-height: 32px; max-width: 160px; }
.nv-header-brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.nv-header-tenant-pill {
  display: flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 20px;
  background: var(--bg); font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap;
  margin-left: 6px;
}
.nv-header-tenant-pill .text-muted { font-weight: 400; }
.nv-header-tenant-pill a { font-weight: 600; text-decoration: underline; }

.kk-sidebar {
  width: var(--sidebar-w);
  background: var(--brand);
  height: calc(100vh - var(--header-h));
  padding: 16px 0;
  position: fixed;
  left: 0; top: var(--header-h);
  display: flex;
  flex-direction: column;
  transition: width .18s ease;
  z-index: 50;
  overflow-x: hidden;
  overflow-y: auto;
}
.kk-sidebar.kk-sidebar--collapsed { width: var(--sidebar-w-collapsed); }

.kk-sidebar a, .kk-sidebar .kk-sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: rgba(255,255,255,.7);
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  border-left: 3px solid transparent;
}
.kk-sidebar a:hover { color: #fff; background: rgba(255,255,255,.06); }
.kk-sidebar a.active { color: #fff; background: rgba(255,255,255,.1); border-left-color: var(--accent2); }
.kk-sidebar .kk-sidebar-icon { width: 20px; text-align: center; flex-shrink: 0; }
.kk-sidebar--collapsed .kk-sidebar-label { display: none; }
.kk-sidebar--collapsed a, .kk-sidebar--collapsed .kk-sidebar-link { justify-content: center; padding: 12px 0; }

.kk-main {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  padding: 28px;
  min-height: calc(100vh - var(--header-h));
  transition: margin-left .18s ease;
}

/* Collapse state is a class on <html> (set by an inline script in <head>, before the
   sidebar/main even exist in the DOM) so there is zero flash-of-wrong-width on load —
   same trick as the dark-mode flash-prevention script below. */
html.kk-sidebar-collapsed .kk-sidebar { width: var(--sidebar-w-collapsed); }
html.kk-sidebar-collapsed .kk-main { margin-left: var(--sidebar-w-collapsed); }
html.kk-sidebar-collapsed .kk-sidebar-label { display: none; }
html.kk-sidebar-collapsed .kk-sidebar a,
html.kk-sidebar-collapsed .kk-sidebar .kk-sidebar-link { justify-content: center; padding: 12px 0; }
html.kk-sidebar-collapsed #nvLangSwitcher { display: none; }

.kk-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

/* ---------- Cards ---------- */
.kk-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 20px;
}
.kk-card-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 24px;
  font-weight: 700;
  font-size: 18px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); }
.btn-brand { background: var(--brand); color: #fff; }
.btn-secondary { background: var(--card-bg); color: var(--ink); border-color: var(--border); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 16px; }
.btn-block { display: block; width: 100%; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 6px; color: var(--muted); }
.req-star { color: #dc2626; }
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--card-bg);
  color: var(--ink);
}
.form-control:focus { outline: none; border-color: var(--accent); }
.invalid-feedback { color: #dc2626; font-size: 12px; margin-top: 4px; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 8px; border: 1px solid transparent; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-danger  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-muted   { background: #f1f5f9; color: #475569; }

/* ---------- Utility ---------- */
.text-muted { color: var(--muted); }
.fw-bold { font-weight: 700; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 16px; } .mb-4 { margin-bottom: 24px; }
.mt-1 { margin-top: 4px; }  .mt-2 { margin-top: 8px; }  .mt-3 { margin-top: 16px; }  .mt-4 { margin-top: 24px; }

/* ---------- Header icon row + avatar dropdown ---------- */
.nv-topbar {
  display: flex; align-items: center; gap: 8px;
}

.nv-topbar-icon {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card-bg); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--ink);
  flex-shrink: 0;
}
.nv-topbar-icon:hover { border-color: var(--accent); }
.nv-topbar-icon--disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.nv-topbar-icon--disabled:hover { border-color: var(--border); }
.nv-topbar-icon--create { font-size: 22px; font-weight: 700; background: var(--accent); color: #fff; border-color: transparent; }
.nv-topbar-icon--create:hover { background: var(--accent2); border-color: transparent; }

.nv-topbar-dropdown { position: relative; }
.nv-topbar-menu {
  display: none;
  position: absolute; top: 48px; right: 0; min-width: 220px;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); padding: 6px; z-index: 70;
}
.nv-topbar-menu--open { display: block; }
html[dir="rtl"] .nv-topbar-menu { right: auto; left: 0; }
.nv-topbar-menu a, .nv-topbar-menu-btn, .nv-topbar-menu-soon, .nv-topbar-menu-link-danger {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 6px;
  border: none; background: transparent; font-size: 13px; font-family: inherit;
  color: var(--ink); cursor: pointer; white-space: nowrap;
}
html[dir="rtl"] .nv-topbar-menu a, html[dir="rtl"] .nv-topbar-menu-btn,
html[dir="rtl"] .nv-topbar-menu-soon, html[dir="rtl"] .nv-topbar-menu-link-danger { text-align: right; }
.nv-topbar-menu a:hover, .nv-topbar-menu-btn:hover { background: var(--bg); }
.nv-topbar-menu-soon { cursor: default; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nv-topbar-menu-link-danger { color: #dc2626; }
.nv-topbar-menu-link-danger:hover { background: #fef2f2; }
.nv-topbar-menu-divider { height: 1px; background: var(--border); margin: 6px 4px; }
.nv-avatar-menu-header { padding: 6px 12px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }

.nv-avatar {
  width: 38px; height: 38px; border-radius: 10px; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.nv-avatar:hover { background: var(--accent2); }
.nv-admin-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.nv-admin-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px;
}
.nv-admin-card-header {
  font-weight: 700; font-size: 15px; color: var(--accent); display: flex; align-items: center;
  gap: 8px; padding-bottom: 12px; margin-bottom: 8px; border-bottom: 1px solid var(--border);
}
.nv-admin-card a { display: block; padding: 6px 0; font-size: 14px; color: var(--ink); }
.nv-admin-card a:hover { color: var(--accent); }
.nv-admin-item-soon { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; font-size: 14px; color: var(--muted); }
.nv-admin-search-row { margin-bottom: 20px; }
.nv-admin-search { max-width: 480px; }
.nv-admin-search-empty { grid-column: 1 / -1; text-align: center; padding: 24px 0; }
mark.nv-search-hit { background: #fbbf24; color: #1f1f1f; border-radius: 3px; padding: 0 1px; }

/* ---------- Branding > Theme ---------- */
.nv-theme-subnav { width: 220px; flex-shrink: 0; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.nv-theme-subnav-item { padding: 12px 16px; font-size: 14px; font-weight: 500; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nv-theme-subnav-item:last-child { border-bottom: none; }
.nv-theme-subnav-item.active { background: var(--accent); color: #fff; }
.nv-theme-subnav-item.disabled { color: var(--muted); cursor: not-allowed; }
.nv-color-field {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 8px;
  padding: 4px 10px; background: var(--card-bg);
}
.nv-color-swatch { width: 28px; height: 28px; padding: 0; border: none; border-radius: 6px; background: none; cursor: pointer; flex-shrink: 0; }
.nv-color-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.nv-color-swatch::-webkit-color-swatch { border: none; border-radius: 6px; }
.nv-color-hex { flex: 1; min-width: 0; border: none; background: transparent; color: var(--ink); font-size: 13px; font-family: monospace; padding: 6px 0; outline: none; }

/* ---------- Phone widget (country code + number) ---------- */
.phone-input-wrap { display: flex; gap: 6px; align-items: center; }
.phone-flag-btn { flex-shrink: 0; height: 38px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--card-bg); color: var(--ink); font-size: 13px; cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.phone-flag-btn:hover { border-color: var(--accent); }
.phone-num-input { flex: 1; min-width: 0; }
#countryPickerOverlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 9999; align-items: center; justify-content: center; }
#countryPickerOverlay.open { display: flex; }
#countryPickerBox { background: var(--card-bg); border-radius: 12px; width: 340px; max-height: 480px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 80px rgba(0,0,0,.45); }
#countryPickerBox input { border: none; border-bottom: 1px solid var(--border); padding: 12px 16px; font-size: 14px; background: transparent; color: var(--ink); outline: none; }
#countryList { overflow-y: auto; flex: 1; }
.cp-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; cursor: pointer; font-size: 13px; color: var(--ink); }
.cp-item:hover { background: rgba(99,102,241,.08); }
.cp-item .cp-flag { font-size: 20px; line-height: 1; }
.cp-item .cp-name { flex: 1; }
.cp-item .cp-code { color: var(--muted); font-weight: 600; }

/* ---------- Permission tree (Role editor) ---------- */
.nv-perm-tree ul { list-style: none; margin: 0; padding-left: 22px; }
.nv-perm-tree > ul { padding-left: 0; }
.nv-perm-tree label { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; }
.nv-perm-module-list { display: flex; flex-direction: column; gap: 2px; min-width: 180px; }
.nv-perm-module-list button { text-align: left; background: transparent; border: none; padding: 10px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--ink); }
.nv-perm-module-list button.active { background: var(--accent); color: #fff; }

/* ---------- Dark mode overrides ---------- */
[data-theme="dark"] body            { background: var(--bg); color: var(--ink); }
[data-theme="dark"] .kk-card        { background: var(--card-bg); border-color: var(--border); }
[data-theme="dark"] .kk-main        { background: var(--bg); }
[data-theme="dark"] .alert-success  { background: #052e16; border-color: #166534; color: #86efac; }
[data-theme="dark"] .alert-danger   { background: #2d1010; border-color: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .alert-info     { background: #0c1a3a; border-color: #1e40af; color: #93c5fd; }
[data-theme="dark"] .alert-warning  { background: #2c1a03; border-color: #92400e; color: #fcd34d; }
[data-theme="dark"] .badge-muted    { background: #1e293b; color: #94a3b8; }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: #1e293b; border-color: #334155; color: #f1f5f9; }
[data-theme="dark"] .form-control   { background: #1e293b; border-color: #334155; color: #f1f5f9; }
[data-theme="dark"] .nv-perm-module-list button { color: var(--ink); }

/* ---------- Right-side slide-in drawer (Add Category, field config panels) ----------
   Phase 2C.1 §30-33 — canonical, responsive drawer sizing. Two size classes only (plain =
   standard CRUD forms, --wide = richer multi-section forms/engine drawers) — this split was
   already how the app's ~30 drawer instances were consistently using the two pre-existing
   widths (confirmed by audit: zero inline width overrides, zero scattered ad-hoc values), so it
   is kept rather than collapsed into one size. What was actually missing was viewport scaling:
   both classes used a bare fixed px width with only `max-width:100vw` as a clipping guard (no
   reflow, so a 760px drawer on a 375px phone was clipped, not resized). clamp() keeps the exact
   same width on desktop (>~1000px, where the vw term is already larger than the px ceiling) and
   scales down smoothly on medium screens; the @media block below switches to a full-width sheet
   on narrow viewports, matching how .nv-modal-family panels already behave via `max-width:
   calc(100vw - 32px)`. */
.nv-drawer-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 900;
}
.nv-drawer-overlay.open { display: block; }
.nv-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: clamp(320px, 90vw, 460px); max-width: 100vw;
  background: var(--card-bg); box-shadow: -8px 0 32px rgba(0,0,0,.25); z-index: 901;
  border-top-left-radius: var(--radius); border-bottom-left-radius: var(--radius);
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform .25s ease;
}
.nv-drawer.nv-drawer--wide { width: clamp(320px, 92vw, 760px); }
.nv-drawer.open { transform: translateX(0); }
@media (max-width: 640px) {
  .nv-drawer, .nv-drawer.nv-drawer--wide { width: 100vw; border-top-left-radius: 0; border-bottom-left-radius: 0; }
}
.nv-drawer-header {
  display: flex; align-items: center; justify-content: space-between; padding: 18px 20px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.nv-drawer-header h2 { font-size: 17px; margin: 0; font-weight: 700; }
.nv-drawer-close { background: transparent; border: none; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; padding: 4px; }
.nv-drawer-close:hover { color: var(--ink); }
/* Every drawer wraps its body+footer in a plain <form> (save_category/save_field), which sits
   between .nv-drawer (the flex column) and .nv-drawer-body/-footer as a non-flex <form> —
   without making that form a flex column itself, .nv-drawer-body's flex:1 has no flex container
   to size against, so the form (and drawer) just grow to fit all the content instead of the
   body scrolling internally, pushing the footer buttons out of reach on any long form. */
.nv-drawer > form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
/* min-height:0 overrides the flex item's content-based auto min-height — without it, this
   panel grows to fit all its content instead of clipping to the drawer's fixed height, so
   overflow-y:auto never actually engages and the footer (Add/Cancel) scrolls off-screen with
   nothing to bring it back — a long Options list on Dropdown/Multi-Select/Radio fields hits
   this every time. */
.nv-drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; }
.nv-drawer-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; flex-shrink: 0; justify-content: flex-end; }

/* ---------- Toggle switch (pill), replaces plain checkboxes for on/off settings ---------- */
.nv-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 14px; }
.nv-toggle input { display: none; }
.nv-toggle-track { width: 38px; height: 21px; border-radius: 999px; background: var(--border); position: relative; transition: background .15s; flex-shrink: 0; }
.nv-toggle-track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%;
  background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.nv-toggle input:checked + .nv-toggle-track { background: var(--accent); }
.nv-toggle input:checked + .nv-toggle-track::after { transform: translateX(17px); }

/* ---------- Options list editor (Dropdown/Radio/Checkbox/Dependent config drawers) ---------- */
.nv-opt-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.nv-opt-row.dragging { opacity: .4; }
.nv-opt-row input { flex: 1; }
.nv-opt-row select { flex: 1; min-width: 0; }
.nv-opt-drag { cursor: grab; color: var(--muted); flex-shrink: 0; font-size: 14px; padding: 0 2px; }
.nv-opt-move { background: transparent; border: 1px solid var(--border); border-radius: 6px; width: 26px; height: 26px; cursor: pointer; color: var(--ink); flex-shrink: 0; }
.nv-opt-move:hover { border-color: var(--accent); }
.nv-opt-remove { background: transparent; border: none; color: #dc2626; cursor: pointer; font-size: 17px; padding: 0 4px; flex-shrink: 0; }

/* ---------- Categories browser (two-panel) ---------- */
.nv-cat-browser { display: flex; gap: 20px; align-items: flex-start; }
.nv-cat-panel { width: 260px; flex-shrink: 0; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.nv-cat-list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 9px 10px;
  border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--ink);
}
.nv-cat-list-item:hover { background: var(--bg); }
.nv-cat-list-item.active { background: var(--accent); color: #fff; }
.nv-cat-list-item .nv-cat-edit-btn { opacity: 0; background: transparent; border: none; cursor: pointer; color: inherit; flex-shrink: 0; }
.nv-cat-list-item:hover .nv-cat-edit-btn { opacity: .7; }
.nv-cat-list-item .nv-cat-edit-btn:hover { opacity: 1; }
.nv-svc-panel { flex: 1; min-width: 0; }
.nv-svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.nv-svc-card {
  display: flex; gap: 12px; align-items: center; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; cursor: pointer; text-decoration: none; color: inherit;
}
.nv-svc-card:hover { border-color: var(--accent); }
.nv-svc-card-icon {
  width: 44px; height: 44px; border-radius: 10px; background: var(--bg); display: flex; align-items: center;
  justify-content: center; font-size: 20px; flex-shrink: 0; overflow: hidden;
}
.nv-svc-card-icon img { width: 100%; height: 100%; object-fit: cover; }
.nv-svc-card-name { font-weight: 600; font-size: 14px; color: var(--ink); }
.nv-svc-card-cat { font-size: 12px; color: var(--muted); }

/* ---------- Large square image uploader (category/service icon) ---------- */
.nv-icon-upload { width: 110px; height: 110px; border-radius: 12px; overflow: hidden; background: var(--bg); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nv-icon-upload img { width: 100%; height: 100%; object-fit: cover; }
.nv-icon-upload-placeholder { color: var(--muted); font-size: 32px; }
.nv-icon-upload-actions { display: flex; gap: 10px; margin-top: 8px; font-size: 13px; }
.nv-icon-upload-actions button { background: transparent; border: none; color: var(--accent); cursor: pointer; padding: 0; font-size: 13px; }
.nv-icon-upload-actions button.nv-icon-remove { color: #dc2626; }

/* ---------- Service Catalog Form builder (drag-drop palette + canvas) ---------- */
.nv-fb-layout { display: flex; gap: 20px; align-items: flex-start; }
.nv-fb-palette { width: 240px; flex-shrink: 0; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; max-height: calc(100vh - 220px); overflow-y: auto; position: sticky; top: 90px; }
.nv-fb-group-title { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 0 6px; font-weight: 700; }
.nv-fb-group-title:first-child { margin-top: 0; }
.nv-fb-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: grab; font-size: 13px; color: var(--ink); }
.nv-fb-chip:hover { background: var(--bg); }
.nv-fb-chip-icon { width: 20px; text-align: center; color: var(--accent); flex-shrink: 0; }
.nv-fb-canvas { flex: 1; min-width: 0; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; min-height: 400px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 12px; }
.nv-fb-canvas.nv-fb-drop-active { outline: 2px dashed var(--accent); outline-offset: -4px; }
.nv-fb-empty { width: 100%; }
.nv-fb-field { position: relative; width: 100%; border: 1px dashed var(--border); border-radius: 8px; padding: 12px 14px; background: var(--bg); }
.nv-fb-field.dragging { opacity: .4; }
.nv-fb-field-body { cursor: pointer; }
.nv-fb-field-label { font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.nv-fb-field-preview { font-size: 13px; color: var(--muted); }
.nv-fb-field-preview textarea { width: 100%; resize: vertical; min-height: 64px; }
.nv-fb-field.collapsed { width: calc(50% - 6px); }
/* Same row-wrapping layout as .nv-fb-canvas (not flex-direction:column) — a .collapsed field's
   width:50% only pairs up side-by-side with a sibling when the parent wraps items in a row, and
   that must hold true inside a Section's body too, not just at the top level of the form. */
.nv-fb-section-body { width: 100%; margin-left: 24px; padding: 12px; border-left: 2px solid var(--border); border-radius: 0 8px 8px 0; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 12px; min-height: 44px; }
.nv-fb-section-body.nv-fb-drop-active { outline: 2px dashed var(--accent); outline-offset: -4px; }
.nv-fb-section-empty { width: 100%; text-align: center; color: var(--muted); font-size: 12px; padding: 10px 0; margin: 0; }
/* Section rows read as a collapsible header bar (border-style solid, tinted background) instead
   of the plain dashed field row every other type uses — the Collapse toolbar button hides/shows
   the .nv-fb-section-body that immediately follows it, rather than shrinking the row's width. */
.nv-fb-field--section { border-style: solid; background: var(--bg); }
.nv-fb-field--section.nv-fb-section-collapsed + .nv-fb-section-body { display: none; }
.nv-fb-richtext-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 5px; border: 1px solid var(--border); border-bottom: none; border-radius: 8px 8px 0 0; background: var(--card-bg); }
.nv-fb-richtext-toolbar span { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); border-radius: 5px; }
.nv-fb-field-preview textarea.nv-fb-richtext-area { border-radius: 0 0 8px 8px; }
.nv-fb-label-preview { border: 1px dashed var(--border); border-radius: 8px; padding: 10px 12px; font-size: 14px; color: var(--ink); min-height: 40px; }
.nv-fb-label-preview :first-child { margin-top: 0; }
.nv-fb-label-preview :last-child { margin-bottom: 0; }
.nv-fb-image-preview { display: block; max-width: 100%; max-height: 160px; border-radius: 8px; border: 1px solid var(--border); object-fit: contain; background: var(--card-bg); }
.nv-fb-image-preview--empty { width: 100%; height: 80px; display: flex; align-items: center; justify-content: center; font-size: 26px; color: var(--muted); }

/* ---------- Workflow visual designer (Phase 2C.1) — vertical flow canvas built on the SAME
   .nv-fb-palette/.nv-fb-chip drag-source classes the Form Builder already uses (reused as-is,
   not duplicated); only the node/connector shapes below are new, since a linear flow of cards
   needs a different visual language than the form-builder's wrapping field grid. ---------- */
.nv-wf-canvas { display: flex; flex-direction: column; align-items: stretch; }
.nv-wf-node {
  position: relative; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px;
}
.nv-wf-node.nv-wf-node--action { cursor: grab; }
.nv-wf-node.nv-wf-node--action.dragging { opacity: .4; }
.nv-wf-node.nv-wf-node--dropzone { border-style: dashed; text-align: center; color: var(--muted); font-size: 13px; cursor: default; }
.nv-wf-node.nv-wf-node--dropzone.nv-fb-drop-active { outline: 2px dashed var(--accent); outline-offset: -4px; border-color: var(--accent); }
.nv-wf-node-head { display: flex; align-items: center; gap: 10px; }
.nv-wf-node-icon { width: 28px; height: 28px; border-radius: 8px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; color: var(--accent); }
.nv-wf-node-title { font-weight: 700; font-size: 13px; color: var(--ink); flex: 1; }
.nv-wf-node-actions { display: flex; gap: 4px; }
.nv-wf-node-actions button { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 3px 6px; border-radius: 5px; }
.nv-wf-node-actions button:hover { background: var(--bg); color: var(--ink); }
.nv-wf-node-summary { font-size: 12px; color: var(--muted); margin-top: 4px; font-family: monospace; word-break: break-word; }
.nv-wf-connector { width: 2px; height: 20px; background: var(--border); margin: 0 auto; position: relative; }
.nv-wf-connector::after {
  content: ''; position: absolute; left: 50%; bottom: -1px; transform: translateX(-50%);
  border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--border);
}

/* ---------- Real rich-text editor (Label field's Default Value) ---------- */
.nv-rte-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 5px; border: 1px solid var(--border); border-bottom: none; border-radius: 8px 8px 0 0; background: var(--card-bg); align-items: center; }
.nv-rte-toolbar button { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--ink); border-radius: 5px; background: transparent; border: none; cursor: pointer; }
.nv-rte-toolbar button:hover { background: var(--bg); }
.nv-rte-toolbar select { height: 26px; border: 1px solid var(--border); border-radius: 5px; background: var(--card-bg); color: var(--ink); font-size: 12px; max-width: 90px; }
.nv-rte-toolbar input[type="color"] { width: 26px; height: 26px; border: 1px solid var(--border); border-radius: 5px; background: var(--card-bg); padding: 2px; cursor: pointer; }
.nv-rte-toolbar .nv-rte-sep { width: 1px; height: 20px; background: var(--border); margin: 0 3px; flex-shrink: 0; }
.nv-rte-body { min-height: 120px; max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: 0 0 8px 8px; padding: 10px 12px; font-size: 14px; color: var(--ink); background: var(--card-bg); }
.nv-rte-body:focus { outline: none; border-color: var(--accent); }
.nv-rte-body table { border-collapse: collapse; }
.nv-rte-body table td { border: 1px solid var(--border); padding: 4px 8px; }
.nv-rte-body code { background: var(--bg); border-radius: 4px; padding: 1px 5px; font-family: monospace; }

/* ---------- API field: Test Connection response body preview ---------- */
.nv-api-test-body { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; max-height: 260px; overflow: auto; font-family: monospace; font-size: 12px; color: var(--ink); white-space: pre-wrap; word-break: break-word; }

/* ---------- Dependent field's nested tree editor (up to 10 levels) ---------- */
.nv-dep-node { margin-bottom: 2px; }
.nv-dep-node-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.nv-dep-node-row input { flex: 1; }
.nv-dep-add-btn { background: transparent; border: 1px solid var(--border); color: var(--accent); cursor: pointer; font-size: 14px; line-height: 1; width: 26px; height: 26px; border-radius: 5px; flex-shrink: 0; }
.nv-dep-add-btn:hover { background: var(--bg); }
.nv-fb-field-toolbar {
  position: absolute; top: -14px; right: 8px; display: none; align-items: center; gap: 2px;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 3px;
}
.nv-fb-field:hover .nv-fb-field-toolbar, .nv-fb-field-toolbar.pinned { display: flex; }
/* Shifted further left on Section rows so it never overlaps .nv-fb-section-toggle, which is
   pinned at the same corner (right: 8px) but always visible instead of hover-only. */
.nv-fb-field--section .nv-fb-field-toolbar { right: 42px; }
.nv-fb-field-toolbar button { width: 26px; height: 26px; border: none; background: transparent; border-radius: 6px; cursor: pointer; color: var(--ink); display: flex; align-items: center; justify-content: center; font-size: 13px; }
.nv-fb-field-toolbar button:hover { background: var(--bg); color: var(--accent); }
/* A Section's collapse toggle is primary functionality (it hides/shows everything nested inside
   it), not a secondary hover action like the rest of the toolbar — so it lives outside the
   hover-only toolbar entirely, pinned to the row's own top-right corner, always visible. */
.nv-fb-section-toggle {
  position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border: 1px solid var(--border);
  background: var(--card-bg); border-radius: 6px; cursor: pointer; color: var(--ink); font-size: 13px;
  display: flex; align-items: center; justify-content: center; z-index: 1;
}
.nv-fb-section-toggle:hover { background: var(--bg); color: var(--accent); }
.nv-fb-move-handle { cursor: grab; }
.nv-fb-empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: 14px; }
/* Real create/edit form rendering of a unified core+custom field list (v1.00057) — mirrors the
   canvas's own row/collapsed-half-width pairing (.nv-fb-canvas/.nv-fb-field.collapsed above) but
   for the actual submitted form instead of the builder preview. */
/* Read-only record detail view (modules/crm/account-view.php, contact-view.php) — a two-column
   layout (field groups + a related-records sidebar), matching the reference product's record
   page shape rather than reusing the edit drawer for viewing. */
.nv-view-layout { display: flex; gap: 20px; align-items: flex-start; }
.nv-view-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 0 20px; }
.nv-view-main > h3 { width: 100%; }
.nv-view-side { width: 300px; flex-shrink: 0; }
.nv-view-fields { width: 100%; display: flex; flex-wrap: wrap; gap: 0 20px; }
.nv-view-field { width: 50%; padding: 10px 0; border-bottom: 1px solid var(--border); }
.nv-view-field-label { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.nv-view-field-value { font-size: 14px; color: var(--ink); word-break: break-word; }
.nv-view-field-value a { color: var(--accent); }
.nv-view-field-label { display: flex; align-items: center; gap: 6px; }
.nv-view-field-icon { opacity: .7; font-size: 12px; }
@media (max-width: 900px) {
  .nv-view-layout { flex-direction: column; }
  .nv-view-side { width: 100%; }
  .nv-view-field { width: 100%; }
}

/* Record detail header (account-view.php/contact-view.php/opportunity-view.php) — avatar +
   name + a meta chip row, replacing a bare <h1> so the "who/what am I looking at" summary that
   used to require reading every field row is visible at a glance, matching the reference
   product's own record-header pattern. */
.nv-record-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.nv-record-avatar {
  width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font-size: 20px; font-weight: 700;
  letter-spacing: .02em;
}
.nv-record-title-block { flex: 1; min-width: 0; }
.nv-record-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nv-record-title-row h1 { font-size: 22px; margin: 0; }
.nv-record-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-size: 13px; color: var(--muted); }
.nv-record-meta a { color: var(--accent); }
.nv-record-meta-sep { opacity: .5; }
.nv-record-actions { display: flex; gap: 8px; flex-shrink: 0; }
.nv-stage-chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.nv-stage-chip--open { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.nv-stage-chip--won { background: color-mix(in srgb, #16a34a 18%, transparent); color: #16a34a; }
.nv-stage-chip--lost { background: color-mix(in srgb, #dc2626 16%, transparent); color: #dc2626; }
:root[data-theme="dark"] .nv-stage-chip--won { color: #4ade80; }
:root[data-theme="dark"] .nv-stage-chip--lost { color: #f87171; }

/* Opportunity Pipeline/Kanban (Phase 6B) — columns are 100% data-driven from the tenant's own
   Stage field metadata, never hardcoded in count/width, so this must scroll horizontally rather
   than assume any fixed number of columns. */
.nv-pipeline { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.nv-pipeline-col { flex: 0 0 260px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.nv-pipeline-col-header { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.nv-pipeline-col-body { min-height: 60px; display: flex; flex-direction: column; gap: 8px; }
.nv-pipeline-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px; cursor: pointer; }
.nv-pipeline-card:hover { border-color: var(--accent); }
.nv-pipeline-card.dragging { opacity: .4; }
.nv-pipeline-card-title { font-weight: 600; font-size: 13px; }
.nv-pipeline-col-header-right { display: flex; align-items: center; gap: 6px; }
.nv-pipeline-quick-add { width: 20px; height: 20px; line-height: 18px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--card-bg); color: var(--ink); cursor: pointer; font-size: 14px; }
.nv-pipeline-quick-add:hover { border-color: var(--accent); color: var(--accent); }
.nv-pipeline-card-move { width: 100%; margin-top: 8px; font-size: 11px; padding: 3px 4px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--ink); }
.nv-pipeline-filters .form-control { font-size: 13px; padding: 5px 8px; }

/* Related-list rows inside .nv-view-side cards — small avatar + name + secondary line, instead
   of bare text, so Account's related Contacts/Opportunities read as real record rows. */
.nv-related-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.nv-related-row:last-child { border-bottom: none; }
.nv-related-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--card-bg-alt, var(--border)); color: var(--ink); font-size: 12px; font-weight: 700;
}
.nv-related-body { flex: 1; min-width: 0; }
.nv-related-body-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.nv-related-body-top a { font-weight: 600; }
@media (max-width: 900px) {
  .nv-record-header { flex-wrap: wrap; }
}

/* Simple underline tab strip (modules/crm/picklists.php's Account Type / Salutation / Stage /
   Forecast Category tabs) — plain link-per-tab, no JS state, active tab decided by ?type=. */
.nv-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.nv-tab { padding: 10px 16px; font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.nv-tab:hover { color: var(--ink); }
.nv-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.nv-plv-handle { cursor: grab; color: var(--muted); text-align: center; }
#nvPicklistBody tr.dragging { opacity: .4; }

.nv-form-fields { display: flex; flex-wrap: wrap; gap: 0 20px; }
.nv-form-field { width: 100%; }
.nv-form-field .form-group:last-child { margin-bottom: 0; }
.nv-form-field--half { width: calc(50% - 10px); }

.nv-fb-tabbar { display: flex; gap: 4px; flex-wrap: wrap; background: var(--bg); border-radius: 10px; padding: 6px; margin-bottom: 20px; }
.nv-fb-tab { padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; text-decoration: none; }
.nv-fb-tab:hover { color: var(--ink); }
.nv-fb-tab.active { background: var(--accent); color: #fff; }

/* ---------- Import Options wizard (inside the field-config drawer) ---------- */
.nv-import-steps { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.nv-import-step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.nv-import-step-num { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 11px; flex-shrink: 0; }
.nv-import-step.active { color: var(--ink); font-weight: 700; }
.nv-import-step.active .nv-import-step-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.nv-import-step-sep { flex: 1; height: 1px; background: var(--border); }
.nv-import-file-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; margin-top: 10px; }
.nv-import-file-chip button { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0; }
.nv-import-file-chip button:hover { color: #dc2626; }
.nv-import-actions { display: flex; gap: 8px; margin-top: 24px; justify-content: flex-end; }

/* ---------- Generic confirm modal (destructive actions) ---------- */
.nv-confirm-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 950; }
.nv-confirm-overlay.open { display: block; }
.nv-confirm-modal {
  display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 420px; max-width: calc(100vw - 32px); background: var(--card-bg); border-radius: var(--radius);
  padding: 24px; z-index: 951; box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.nv-confirm-modal.open { display: block; }
.nv-confirm-icon { font-size: 26px; color: #dc2626; margin-bottom: 10px; }
.nv-confirm-text { font-size: 14px; color: var(--ink); line-height: 1.5; margin: 0 0 20px; }
.nv-confirm-actions { display: flex; gap: 10px; }

/* ---------- Generic centered modal (e.g. Add API Credential) — sits above .nv-drawer ---------- */
.nv-modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 950; }
.nv-modal-overlay.open { display: block; }
.nv-modal {
  display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 480px; max-width: calc(100vw - 32px); max-height: calc(100vh - 64px); background: var(--card-bg);
  border-radius: var(--radius); z-index: 951; box-shadow: 0 20px 50px rgba(0,0,0,.3);
  flex-direction: column;
}
.nv-modal.open { display: flex; }
.nv-modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.nv-modal-header h3 { font-size: 16px; margin: 0; font-weight: 700; }
.nv-modal-body { padding: 20px; overflow-y: auto; flex: 1; min-height: 0; }
.nv-modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0; }

/* ---------- Form Preview (real inputs, as a requester would see them) ---------- */
.nv-preview-modal { width: 640px; max-height: calc(100vh - 48px); }
.nv-preview-section-heading { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
.nv-preview-section-body { border-left: 2px solid var(--border); padding-left: 14px; margin-top: 8px; display: flex; flex-direction: column; gap: 14px; }
.nv-preview-api-status { font-size: 13px; padding: 8px 12px; border-radius: 8px; background: var(--bg); margin-bottom: 14px; }

/* ---------- Multi-select tag picker (Multi-Select Dropdown's Default Value) ---------- */
.nv-mselect { position: relative; }
.nv-mselect-box {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 42px;
  padding: 7px 34px 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card-bg); cursor: pointer; position: relative;
}
.nv-mselect-box:focus { outline: none; border-color: var(--accent); }
.nv-mselect-placeholder { color: var(--muted); font-size: 14px; }
.nv-mselect-caret { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 11px; pointer-events: none; }
.nv-mselect-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 6px 3px 10px; border-radius: 20px;
  background: var(--bg); font-size: 13px; color: var(--ink);
}
.nv-mselect-chip button { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0 2px; line-height: 1; }
.nv-mselect-chip button:hover { color: #dc2626; }
.nv-mselect-panel {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; width: 100%; max-height: 280px;
  overflow-y: auto; background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow); z-index: 20; padding: 12px;
}
.nv-mselect-panel.open { display: block; }
.nv-mselect-panel-title { font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.nv-mselect-panel-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.nv-mselect-panel-chips:empty { display: none; margin-bottom: 0; }
.nv-mselect-panel-options { border-top: 1px solid var(--border); padding-top: 8px; }
.nv-mselect-option { padding: 8px 6px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.nv-mselect-option:hover { background: var(--bg); }
.nv-mselect-option.selected { background: var(--bg); font-weight: 600; }
.nv-mselect-option.selected::before { content: "✓ "; color: var(--accent); }
.nv-fb-multiselect-preview { display: flex; flex-wrap: wrap; gap: 6px; }
.nv-fb-checkbox-preview { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.nv-fb-checkbox-preview.nv-fb-checkbox-preview--vertical { flex-direction: column; gap: 8px; }
.nv-fb-checkbox-preview-item { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); }

/* ---------- RTL (Arabic) — basic mirroring, not yet a full RTL audit ---------- */
html[dir="rtl"] .kk-sidebar { left: auto; right: 0; }
html[dir="rtl"] .kk-sidebar a.active { border-left-color: transparent; border-right: 3px solid var(--accent2); }
html[dir="rtl"] .kk-main { margin-left: 0; margin-right: var(--sidebar-w); }
html[dir="rtl"].kk-sidebar-collapsed .kk-main { margin-right: var(--sidebar-w-collapsed); margin-left: 0; }
html[dir="rtl"] .nv-drawer { right: auto; left: 0; transform: translateX(-100%); border-top-left-radius: 0; border-bottom-left-radius: 0; border-top-right-radius: var(--radius); border-bottom-right-radius: var(--radius); }
html[dir="rtl"] .nv-drawer.open { transform: translateX(0); }
html[dir="rtl"] .nv-drawer-close { transform: scaleX(-1); }

@media (max-width: 768px) {
  .kk-sidebar { width: var(--sidebar-w-collapsed); }
  .kk-sidebar .kk-sidebar-label { display: none; }
  .kk-main { margin-left: var(--sidebar-w-collapsed); padding: 16px; }
}

/* ---------- Generic CRM lookup/typeahead widget (assets/js/crm-lookup.js) ---------- */
.nv-lookup { position: relative; }
.nv-lookup-input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card-bg); color: var(--ink); font-size: 14px;
}
.nv-lookup-input:focus { outline: none; border-color: var(--accent); }
.nv-lookup-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 240px; overflow-y: auto;
}
.nv-lookup-result-item {
  padding: 9px 12px; font-size: 14px; color: var(--ink); cursor: pointer;
}
.nv-lookup-result-item:hover { background: var(--bg); }
.nv-lookup-create-row {
  padding: 9px 12px; font-size: 14px; color: var(--accent); font-weight: 600; cursor: pointer;
  border-top: 1px solid var(--border);
}
.nv-lookup-create-row:hover { background: var(--bg); }
