/**
 * DD Center Panel: Universal Design System & Framework Stylesheet (general.css)
 * Native CSS architecture (Zero Tailwind dependency).
 * Implements the Obsidian Sidebar + Warm Stone / White Canvas + Light Green brand aesthetic,
 * boxless underline forms, universal context menus, two-part floating bottom dock,
 * right-sidebar edge tab, and Cropper studio.
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/**
 * Root Design Tokens: Color palette, typography, geometry, elevation, and motion curves.
 */
:root {
  color-scheme: light;

  --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Light Workspace Surfaces */
  --bg-canvas: #F3F4F1;
  --bg-surface: #FFFFFF;
  --bg-app: #F8F9FB;
  --bg-subtle: #F7F8F5;
  --bg-muted: #EAECE6;
  --bg-row-hover: #F9FAFB;
  --bg-row-selected: #F3F4F6;

  /* Borders */
  --border-hairline: #E6E7E2;
  --border-subtle: #F2F4F7;
  --border-control: #D0D5DD;
  --border-strong: #D1D4CC;
  --border-input: #CBD0C6;
  --border-focus: #11161F;

  /* Typography & Brand Accents */
  --text-primary: #111315;
  --text-secondary: #4A4F55;
  --text-muted: #787F87;
  --text-faint: #98A2B3;
  --text-placeholder: #9CA3AF;

  --accent-dark: #141414;
  --accent-blue: #2563EB;
  --accent-indigo: #4F46E5;
  --accent-purple: #A855F7;
  --accent-orange: #FF6B2C;
  --accent-teal: #14B8A6;

  --onyx-950: #0B0F17;
  --onyx-900: #11161F;
  --onyx-800: #1D2432;
  --onyx-700: #2C3545;

  /* Obsidian Dark Chrome (Left Sidebar, Bottom Bar, Dark Dropdowns) */
  --sidebar-width: 248px;
  --sidebar-collapsed-width: 72px;
  --sidebar-bg: #111111;
  --sidebar-surface: #1C1C1C;
  --sidebar-hover: #252525;
  --sidebar-active-bg: #1F2633;
  --sidebar-hover-bg: rgba(255, 255, 255, 0.05);
  --sidebar-border: #262626;
  --sidebar-text: #8B95A5;
  --sidebar-text-active: #FFFFFF;
  --sidebar-muted: #8E9299;

  --right-sidebar-width: 340px;

  /* Brand DD Center - Light Green & Fresh Emerald Palette */
  --brand-green: #10B981;
  --brand-green-hover: #059669;
  --brand-green-light: #34D399;
  --brand-green-subtle: #ECFDF5;
  --brand-green-glow: rgba(16, 185, 129, 0.25);

  /* Semantic Status & Soft Badge Tokens */
  --status-success: #16A34A;
  --status-success-bg: #DCFCE7;
  --status-warning: #D97706;
  --status-warning-bg: #FEF3C7;
  --status-danger: #DC2626;
  --status-danger-bg: #FEE2E2;
  --status-info: #2563EB;
  --status-info-bg: #DBEAFE;
  --badge-purple-text: #6B21A8;
  --badge-purple-bg: #F3E8FF;
  --badge-gray-text: #374151;
  --badge-gray-bg: #F3F4F6;

  --forest-600: #10B981;
  --emerald-500: #10B981;
  --emerald-bg: #ECFDF5;
  --rose-500: #F04438;
  --rose-bg: #FEF3F2;
  --amber-500: #F79009;
  --amber-bg: #FFFAEB;
  --indigo-500: #10B981;
  --indigo-bg: #ECFDF5;
  --cyan-500: #06B6D4;
  --slate-400: #94A3B8;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.08), 0 2px 4px -2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 24px -4px rgba(16, 24, 40, 0.12), 0 4px 8px -2px rgba(16, 24, 40, 0.06);
  --shadow-floating: 0 20px 40px -8px rgba(11, 15, 23, 0.24), 0 8px 16px -4px rgba(11, 15, 23, 0.12);
  --shadow-dock: 0 16px 32px -4px rgba(11, 15, 23, 0.35), 0 4px 12px rgba(11, 15, 23, 0.2);

  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  background-color: var(--bg-canvas);
  color: var(--text-secondary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/**
 * Suppresses CSS transitions during initial page boot to prevent sidebar collapse flicker.
 */
html.no-transition,
html.no-transition * {
  transition: none !important;
}

/**
 * Universal Selection & Drag Prevention (.no-select / .select-none).
 * By default, the entire application interface (`html, body`), cards, carousels, headers,
 * and UI chrome are non-selectable (`user-select: none`).
 * Text selection is explicitly enabled only on form inputs, code blocks, and `.selectable` nodes.
 */
.no-select,
.select-none,
img,
svg,
iconify-icon,
button,
.btn,
.filter-pill,
.sidebar-item,
.ui-switch,
.ui-checkbox,
.segmented-control,
.bottom-dock-wrapper,
.dropdown-menu,
.right-sidebar-edge-tab,
.cropper-presets,
.showcase-card,
.vz-carousel {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

/**
 * Explicit Text Selection Opt-In (.selectable / .select-text / inputs / code).
 */
input,
textarea,
[contenteditable="true"],
code,
pre,
.selectable,
.select-text {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

iconify-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  outline: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/**
 * Universal Automatic Custom Scrollbars (*, html, body, tables, sidebars, modals, boards).
 * Applied globally by default across all pages and scrollable containers.
 * Note: Avoid setting `scrollbar-width: thin` alongside `::-webkit-scrollbar`, because
 * Chromium 121+ disables custom `::-webkit-scrollbar` widths whenever `scrollbar-width` is present.
 */
*::-webkit-scrollbar,
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track,
::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb,
::-webkit-scrollbar-thumb {
  background-color: rgba(152, 162, 179, 0.45);
  border-radius: var(--radius-full);
  min-height: 40px;
}

*::-webkit-scrollbar-thumb:hover,
::-webkit-scrollbar-thumb:hover {
  background-color: rgba(102, 112, 133, 0.75);
}

*::-webkit-scrollbar-corner,
::-webkit-scrollbar-corner {
  background: transparent;
}


/**
 * Core 3-Column Application Shell (.app-shell).
 * Hosts #left-sidebar, .app-workspace, and #right-sidebar across 100% of the viewport.
 */
.app-shell {
  display: flex;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-canvas);
  position: relative;
}

/**
 * Main Scrollable Workspace (.app-workspace).
 * Pure white surface without artificial topbars; headers and tables sit directly in canvas.
 */
.app-workspace {
  flex: 1;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-canvas);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  position: relative;
}

/**
 * Workspace Top Header (.workspace-header, .workspace-actions, .navbar-collapse-trigger).
 * Architectural Rule: `.workspace-header` and `.workspace-actions` enforce `flex-wrap: nowrap`
 * and a uniform `min-height: 80px` so the header bar has the exact same height across all pages.
 * On low resolutions (<= 860px), `window.navbar` (`navbar.js`) collapses `.workspace-actions`
 * into a single collapsible dropdown button (`.navbar-collapse-trigger`).
 */
.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  padding: 20px 32px 18px 32px;
  gap: 16px;
  flex-shrink: 0;
  flex-wrap: nowrap;
  min-width: 0;
}

.workspace-header > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.workspace-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.workspace-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  line-height: 1.2;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-subtitle {
  flex-basis: 100%;
  width: 100%;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  white-space: nowrap;
}

.navbar-collapse-trigger {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 13px;
  border-radius: 0;
  background-color: var(--bg-muted);
  color: var(--text-primary);
  border: none;
  font-size: 12.5px;
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.navbar-collapse-trigger:hover {
  background-color: #DFE2DC;
  color: var(--onyx-900);
}

.navbar-collapse-trigger.open {
  background-color: var(--onyx-900);
  color: #FFFFFF;
}

.navbar-collapse-chevron {
  font-size: 14px;
  transition: transform 0.2s var(--ease-spring);
}

.navbar-collapse-trigger.open .navbar-collapse-chevron {
  transform: rotate(180deg);
}

.workspace-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px 18px 32px;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.workspace-body {
  flex: 1;
  padding: 0 32px 96px 32px;
}

.workspace-body-flush {
  flex: 1;
  padding: 0 0 96px 0;
}

/**
 * Universal Left Sidebar (#left-sidebar).
 * Collapsible Obsidian Dark navigation panel with RBAC scope filtering,
 * centered /img/logo_inverted.png brand mark, and zero-flicker icon geometry.
 */
#left-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.26s var(--ease-spring), min-width 0.26s var(--ease-spring), max-width 0.26s var(--ease-spring), transform 0.26s var(--ease-spring);
  z-index: 40;
  position: relative;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.sidebar-top {
  min-height: 60px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #FFFFFF;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  min-width: 0;
}

.sidebar-brand-mark {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-logo-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 7px;
  display: block;
  flex-shrink: 0;
}

.sidebar-brand-text {
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.16s ease;
}

.sidebar-collapse-btn {
  width: 32px;
  height: 32px;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--sidebar-text);
  background-color: transparent;
  border: none;
  transition: color 0.15s ease, background-color 0.15s ease;
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
  color: #FFFFFF;
  background-color: rgba(255, 255, 255, 0.1);
}

/**
 * Scrollable Navigation List (.sidebar-nav-scroll).
 * Always keeps min-height: 0 and overflow-y: auto so large navigation lists never
 * squish vertically or overflow over the operator footer on short screens.
 */
.sidebar-nav-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav-scroll::-webkit-scrollbar {
  width: 3px;
}

.sidebar-nav-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-full);
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(139, 149, 165, 0.55);
  padding: 5px 10px 2px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.sidebar-divider {
  height: 1px;
  background-color: var(--sidebar-border);
  margin: 4px 6px;
  flex-shrink: 0;
}

/**
 * Fixed 44px icon slot inside 16px horizontal padding (16 + 44 + 16 = 76px = --sidebar-collapsed-width).
 * `flex-shrink: 0` guarantees items never compress vertically regardless of list length.
 */
.sidebar-item {
  height: 34px;
  padding: 0 10px 0 0;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
  position: relative;
  white-space: nowrap;
  flex-shrink: 0;
}

.sidebar-item:hover {
  background-color: var(--sidebar-hover-bg);
  color: #E2E8F0;
}

.sidebar-item.active {
  background-color: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--brand-green);
}

.sidebar-item.active .sidebar-item-icon {
  color: var(--brand-green-light);
}

.sidebar-item-icon {
  width: 44px;
  height: 34px;
  font-size: 16.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-item-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.15s ease;
}

.sidebar-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background-color: var(--rose-500);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}

/* Sidebar Collapsible Group & Sub-items */
.sidebar-group {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.sidebar-group-toggle {
  width: 100%;
  cursor: pointer;
  background: transparent !important;
  border: none;
  text-align: left;
  color: var(--sidebar-text) !important;
  font-weight: 500 !important;
}

.sidebar-group-toggle:hover {
  background-color: var(--sidebar-hover-bg) !important;
  color: #E2E8F0 !important;
}

.sidebar-group-toggle.active {
  background: transparent !important;
  color: var(--sidebar-text) !important;
  font-weight: 500 !important;
}

.sidebar-group-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--sidebar-text);
  transition: transform 0.2s ease, color 0.15s ease;
  margin-right: 6px;
}

.sidebar-group.open .sidebar-group-chevron {
  transform: rotate(180deg);
}

.sidebar-group.has-active-child > .sidebar-group-toggle {
  color: #E2E8F0 !important;
}

.sidebar-group-items {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding-left: 12px;
  margin: 2px 0 4px 22px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-group.open .sidebar-group-items {
  display: flex;
}

.sidebar-sub-item {
  height: 32px;
  font-size: 12.5px;
  padding-right: 8px;
}

.sidebar-sub-item .sidebar-item-icon {
  width: 32px;
  height: 32px;
  font-size: 15px;
}

html.sidebar-collapsed .sidebar-group-chevron,
html.sidebar-collapsed .sidebar-group-items {
  display: none !important;
}

html.sidebar-collapsed .sidebar-group-toggle {
  width: 44px;
  padding: 0;
  justify-content: center;
}

.sidebar-footer {
  padding: 8px 12px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.sidebar-footer .skeleton {
  background-color: rgba(255, 255, 255, 0.08) !important;
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.16) 45%,
    rgba(255, 255, 255, 0.04) 100%
  ) !important;
  background-size: 240% 100%;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.sidebar-user:hover,
.sidebar-user:focus-visible {
  background-color: var(--sidebar-hover-bg);
  outline: none;
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  object-fit: cover;
  background-color: var(--sidebar-active-bg);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-info {
  min-width: 0;
  flex: 1;
}

.sidebar-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/**
 * Fixed Portal Tooltip (.sidebar-floating-tooltip) for Collapsed Desktop Sidebar.
 * Mounted on `document.body` so `.sidebar-nav-scroll` can scroll vertically (`overflow-y: auto`)
 * without clipping horizontal tooltips.
 */
.sidebar-floating-tooltip {
  position: fixed;
  left: calc(var(--sidebar-collapsed-width) + 8px);
  top: 0;
  transform: translateY(-50%) translateX(-4px);
  background-color: var(--onyx-900);
  color: #FFFFFF;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.16s var(--ease-spring), visibility 0.14s;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 1000;
}

.sidebar-floating-tooltip.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

/**
 * Desktop-Only Collapsed Sidebar Rules (@media min-width: 961px).
 * Scoped strictly to desktop so the mobile/tablet off-canvas drawer (<= 960px)
 * always renders full labels and horizontal headers regardless of localStorage state.
 */
@media (min-width: 961px) {
  html.sidebar-collapsed #left-sidebar {
    width: var(--sidebar-collapsed-width);
    min-width: var(--sidebar-collapsed-width);
    max-width: var(--sidebar-collapsed-width);
  }

  html.sidebar-collapsed .sidebar-brand-text,
  html.sidebar-collapsed .sidebar-section-label,
  html.sidebar-collapsed .sidebar-item-text,
  html.sidebar-collapsed .sidebar-badge,
  html.sidebar-collapsed .sidebar-user-info {
    display: none !important;
  }

  html.sidebar-collapsed .sidebar-top {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 12px 0 10px 0;
    gap: 6px;
  }

  html.sidebar-collapsed .sidebar-brand {
    width: 100%;
    justify-content: center;
    gap: 0;
  }

  html.sidebar-collapsed .sidebar-brand-mark {
    margin: 0 auto;
  }

  html.sidebar-collapsed .sidebar-nav-scroll {
    padding: 10px 16px;
    align-items: center;
  }

  html.sidebar-collapsed .sidebar-divider {
    width: 32px;
    margin: 6px auto;
  }

  html.sidebar-collapsed .sidebar-item {
    width: 44px;
    padding: 0;
    justify-content: center;
  }

  html.sidebar-collapsed .sidebar-footer {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
    gap: 6px;
  }

  html.sidebar-collapsed .sidebar-user {
    justify-content: center;
    flex: none;
  }
}

/**
 * Universal Right Sidebar (#right-sidebar), Backdrop (.right-sidebar-backdrop) & Fixed Edge Tag (.right-sidebar-edge-tab).
 * By default operates in `override-mode` (`override: true`), overlaying the screen with a darkened backdrop
 * so the inspector stands out prominently and collapses automatically when clicking outside.
 * Can also dock inline if `override: false` is configured.
 */
#right-sidebar {
  width: 0;
  height: 100vh;
  height: 100dvh;
  background-color: var(--bg-canvas);
  border-left: 1px solid transparent;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  opacity: 0;
  transition: width 0.28s var(--ease-spring), opacity 0.2s ease, border-color 0.28s ease, transform 0.28s var(--ease-spring);
  z-index: 30;
  position: relative;
}

#right-sidebar.open {
  width: var(--right-sidebar-width);
  min-width: var(--right-sidebar-width);
  max-width: var(--right-sidebar-width);
  border-left-color: var(--border-hairline);
  opacity: 1;
}

#right-sidebar:not(.open):not(.override-mode) {
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  border-left-width: 0 !important;
  border-left-color: transparent !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/**
 * Default Override / Overlay Mode (#right-sidebar.override-mode).
 * Overlays the viewport from the right edge over a darkened backdrop (.right-sidebar-backdrop).
 */
#right-sidebar.override-mode {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(var(--right-sidebar-width), 92vw);
  min-width: min(var(--right-sidebar-width), 92vw);
  max-width: min(var(--right-sidebar-width), 92vw);
  border-left: 1px solid var(--border-hairline);
  box-shadow: -20px 0 48px -8px rgba(11, 15, 23, 0.28), -4px 0 16px rgba(11, 15, 23, 0.12);
  transform: translateX(104%);
  opacity: 1;
  pointer-events: none;
  z-index: 88;
}

#right-sidebar.override-mode.open {
  transform: translateX(0);
  pointer-events: auto;
}

.right-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(11, 15, 23, 0.44);
  backdrop-filter: blur(2px);
  z-index: 85;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.24s var(--ease-smooth), visibility 0.24s;
}

.right-sidebar-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.right-sidebar-shell {
  width: 100%;
  min-width: min(var(--right-sidebar-width), 92vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.right-sidebar-topbar {
  height: 52px;
  padding: 0 20px 0 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  background-color: var(--bg-canvas);
}

.right-sidebar-topbar-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.right-sidebar-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 0;
  border: none;
  background-color: var(--bg-canvas);
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.right-sidebar-close-btn:hover {
  background-color: var(--bg-muted);
  color: var(--text-primary);
}

.right-sidebar-inner {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.right-sidebar-section {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.right-sidebar-section:last-child {
  border-bottom: none;
}

/**
 * Fixed Right-Edge Reopen Tag (.right-sidebar-edge-tab).
 * Appears docked on the right screen edge only when RightSidebar has content but was collapsed.
 */
.right-sidebar-edge-tab {
  position: fixed;
  right: 0;
  top: 132px;
  height: 42px;
  padding: 0 12px 0 14px;
  background-color: var(--onyx-900);
  color: #FFFFFF;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  z-index: 84;
  transform: translateX(110%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.26s var(--ease-spring), opacity 0.2s ease, padding-right 0.15s ease;
}

.right-sidebar-edge-tab.visible {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.right-sidebar-edge-tab:hover {
  padding-right: 16px;
  background-color: var(--onyx-800);
}

.right-sidebar-edge-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background-color: var(--emerald-500);
}

.sidebar-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 8px;
}

.sidebar-widget-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-primary);
}

.sidebar-widget-filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 4px 2px;
  border: none;
  border-bottom: 1.5px solid var(--border-control);
  border-radius: 0;
  background-color: transparent;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.sidebar-widget-filter:hover {
  background-color: transparent;
  border-bottom-color: var(--onyx-900);
  color: var(--text-primary);
}

/**
 * Universal Button Hierarchy (.btn).
 * Strictly borderless (`border: none`) and sharp-cornered (`border-radius: 0`),
 * relying on surface contrast and clean typography across all views.
 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: none;
  border-radius: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background-color 0.16s ease, color 0.16s ease, transform 0.18s var(--ease-spring), box-shadow 0.18s ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--brand-green);
  color: #FFFFFF;
  border: none;
  border-radius: 0;
}

.btn-primary:hover {
  background-color: var(--brand-green-hover);
  color: #FFFFFF;
}

.btn-secondary {
  background-color: var(--bg-muted);
  color: var(--text-primary);
  border: none;
  border-radius: 0;
}

.btn-secondary:hover {
  background-color: #DFE2DC;
  color: var(--onyx-900);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: 0;
}

.btn-ghost:hover {
  background-color: var(--bg-muted);
  color: var(--text-primary);
}

.btn-danger {
  background-color: var(--rose-500);
  color: #FFFFFF;
  border: none;
  border-radius: 0;
}

.btn-danger:hover {
  background-color: #D92D20;
}

.btn-danger-outline {
  background-color: var(--rose-bg);
  color: var(--rose-500);
  border: none;
  border-radius: 0;
}

.btn-danger-outline:hover {
  background-color: #FEE4E2;
  color: #D92D20;
}

/**
 * Interactive Dark-Hero Action Buttons (.btn-hero-solid, .btn-hero-outline).
 * Borderless and sharp-cornered (`border: none; border-radius: 0`) for dark carousel slides.
 */
.btn-hero-solid {
  background-color: #FFFFFF;
  color: var(--onyx-900);
  border: none;
  border-radius: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
}

.btn-hero-solid:hover {
  background-color: #F8FAFC;
  color: var(--onyx-950);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.36);
}

.btn-hero-outline {
  background-color: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  border: none;
  border-radius: 0;
  backdrop-filter: blur(6px);
}

.btn-hero-outline:hover {
  background-color: #FFFFFF;
  color: var(--onyx-900);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
}

.btn-hero-solid iconify-icon,
.btn-hero-outline iconify-icon {
  transition: transform 0.2s var(--ease-spring);
}

.btn-hero-solid:hover .btn-hero-arrow,
.btn-hero-outline:hover .btn-hero-arrow {
  transform: translateX(3px);
}

.btn-hero-solid:hover iconify-icon:first-child,
.btn-hero-outline:hover iconify-icon:first-child {
  transform: scale(1.1);
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
  border: none;
  border-radius: 0;
}

.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 0;
}

/**
 * Filter Triggers Bar (.filter-bar, .filter-pill).
 * Boxless bottom-border underline controls matching forms.html (`border: none; border-bottom: 1.5px solid ...; border-radius: 0`).
 */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 6px;
  border: none;
  border-bottom: 1.5px solid var(--border-control);
  border-radius: 0;
  font-size: 12.5px;
  font-weight: 500;
  background-color: transparent;
  color: var(--text-secondary);
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
  cursor: pointer;
}

.filter-pill:hover {
  border-bottom-color: var(--onyx-900);
  color: var(--text-primary);
}

.filter-pill.active {
  background-color: transparent;
  color: var(--text-primary);
  font-weight: 600;
  border: none;
  border-bottom: 1.5px solid var(--brand-green);
}

.filter-pill-count {
  color: var(--text-faint);
  font-weight: 500;
}

/**
 * Universal Contextual Dropdown / Popover Menu (.dropdown-menu).
 * Powers all three-dots (...) menus, filter pill popovers, and period selectors.
 */
.dropdown-menu {
  position: fixed;
  min-width: 196px;
  max-width: 260px;
  background-color: #FFFFFF;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-floating);
  padding: 5px;
  z-index: 120;
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  transition: opacity 0.15s ease, transform 0.18s var(--ease-spring);
}

.dropdown-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.dropdown-menu.dropdown-dark {
  background-color: var(--onyx-900);
  border-color: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
}

.dropdown-header {
  padding: 8px 10px 6px 10px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 4px;
}

.dropdown-dark .dropdown-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.dropdown-header-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-dark .dropdown-header-title {
  color: #FFFFFF;
}

.dropdown-header-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-dark .dropdown-header-sub {
  color: var(--sidebar-text);
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 4px 2px;
}

.dropdown-dark .dropdown-divider {
  background-color: rgba(255, 255, 255, 0.08);
}

.dropdown-item {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: left;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.dropdown-item:hover {
  background-color: var(--bg-muted);
  color: var(--text-primary);
}

.dropdown-dark .dropdown-item {
  color: #D0D5DD;
}

.dropdown-dark .dropdown-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
}

.dropdown-item.active {
  color: var(--text-primary);
  font-weight: 600;
  background-color: var(--bg-subtle);
}

.dropdown-dark .dropdown-item.active {
  color: #FFFFFF;
  background-color: rgba(255, 255, 255, 0.12);
}

.dropdown-item.danger {
  color: var(--rose-500);
}

.dropdown-item.danger:hover {
  background-color: var(--rose-bg);
  color: #D92D20;
}

.dropdown-dark .dropdown-item.danger:hover {
  background-color: rgba(240, 68, 56, 0.15);
  color: #FDA29B;
}

.dropdown-item-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.dropdown-item-meta {
  font-size: 11px;
  color: var(--text-faint);
}

/**
 * Collection Data Table (.collection-table) & Pagination Bar (.table-pagination).
 * Sentence-case muted headers, custom checkboxes, avatar cells, and inline statuses.
 */
.collection-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.collection-table thead th {
  height: 40px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-faint);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  background-color: #FFFFFF;
  white-space: nowrap;
}

.collection-table thead th:first-child,
.collection-table tbody td:first-child {
  padding-left: 32px;
}

.collection-table thead th:last-child,
.collection-table tbody td:last-child {
  padding-right: 32px;
}

.collection-table tbody tr {
  height: 54px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.12s ease;
  cursor: pointer;
}

.collection-table tbody tr:hover {
  background-color: var(--bg-row-hover);
}

.collection-table tbody tr.selected {
  background-color: var(--bg-row-selected);
}

.collection-table tbody tr.table-row-filler {
  height: 54px;
  visibility: hidden;
}

.collection-table tbody td {
  padding: 0 14px;
  vertical-align: middle;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.collection-table tbody td.empty-state-cell {
  padding: 0;
  white-space: normal;
  text-align: center;
}

/**
 * Universal Empty State (.empty-state-box).
 * Rendered by window.shadowing.reconcileTable inside a full-width colspan cell.
 */
.empty-state-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 56px 24px;
  text-align: center;
}

.empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-app);
  color: var(--text-faint);
}

.empty-state-box .card-subtitle {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 12px;
}

.pagination-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border: none;
  border-radius: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}

.page-btn:hover:not(:disabled) {
  background-color: var(--bg-muted);
  color: var(--text-primary);
}

.page-btn.active {
  background-color: var(--brand-green);
  color: #FFFFFF;
  font-weight: 600;
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/**
 * Custom Checkbox (.ui-checkbox).
 * Supports unchecked, checked (checkmark), and indeterminate (horizontal bar) states.
 * Architectural Note: Uses `display: inline-block; vertical-align: middle; position: relative;`
 * with an out-of-flow `position: absolute` `::before` indicator so checking or unchecking
 * never alters the inline baseline or shifts the checkbox vertically.
 */
.ui-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1.5px solid var(--border-control);
  border-radius: 0;
  background-color: #FFFFFF;
  cursor: pointer;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  transition: background-color 0.12s ease, border-color 0.12s ease;
  position: relative;
}

.ui-checkbox:hover {
  border-color: var(--text-muted);
}

.ui-checkbox:checked,
.ui-checkbox:indeterminate {
  background-color: var(--brand-green);
  border-color: var(--brand-green);
}

.ui-checkbox::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  pointer-events: none;
  opacity: 0;
}

.ui-checkbox:checked::before {
  width: 9px;
  height: 5px;
  border-left: 1.8px solid #FFFFFF;
  border-bottom: 1.8px solid #FFFFFF;
  transform: translate(-50%, -62%) rotate(-45deg);
  opacity: 1;
}

.ui-checkbox:indeterminate::before {
  width: 8px;
  height: 1.8px;
  background-color: #FFFFFF;
  transform: translate(-50%, -50%);
  opacity: 1;
}

.cell-id {
  font-weight: 500;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cell-note-icon {
  color: var(--text-faint);
  font-size: 13px;
}

.entity-cell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.entity-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background-color: var(--bg-muted);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  object-fit: cover;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.entity-avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.entity-avatar:has(.entity-avatar-img) .entity-avatar-icon {
  visibility: hidden;
}

.entity-name {
  font-weight: 500;
  color: var(--text-primary);
}

/**
 * Inline Semantic Status (.status-inline).
 * Background-free status indicator combining vector icon and semantic typography.
 */
.status-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
}

.status-inline.paid,
.status-inline.success {
  color: var(--emerald-500);
}

.status-inline.cancelled,
.status-inline.danger {
  color: var(--rose-500);
}

.status-inline.refunded,
.status-inline.neutral {
  color: var(--text-secondary);
}

.status-inline.pending,
.status-inline.warning {
  color: var(--amber-500);
}

.thumb-stack {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.thumb-item {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-xs);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-secondary);
  overflow: hidden;
}

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cell-money {
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/**
 * Floating Two-Piece Bottom Action Bar (.bottom-dock-wrapper).
 * Detached [X] button on the left + dark action bar with vertical separators on the right.
 */
.bottom-dock-wrapper {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 80px);
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s var(--ease-spring), opacity 0.2s ease;
}

.bottom-dock-wrapper.active {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

.bottom-dock-close {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  background-color: var(--onyx-900);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-dock);
  transition: background-color 0.15s ease;
}

.bottom-dock-close:hover {
  background-color: var(--onyx-800);
}

.bottom-dock-bar {
  height: 40px;
  padding: 0 8px 0 16px;
  border-radius: var(--radius-lg);
  background-color: var(--onyx-900);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: var(--shadow-dock);
}

.bottom-dock-count {
  font-size: 12.5px;
  color: var(--sidebar-text);
  padding-right: 10px;
  white-space: nowrap;
}

.bottom-dock-count strong {
  color: #FFFFFF;
  font-weight: 600;
}

.bottom-dock-sep {
  width: 1px;
  height: 18px;
  background-color: rgba(255, 255, 255, 0.14);
  margin: 0 4px;
}

.bottom-dock-action {
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #FFFFFF;
  font-size: 12.5px;
  font-weight: 500;
  transition: background-color 0.15s ease;
  white-space: nowrap;
}

.bottom-dock-action:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/**
 * Boxless / Underline Form Controls (.form-field, .form-input, .form-select, .form-textarea).
 * Eliminates heavy rounded input boxes in favor of clean architectural bottom hairlines.
 */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}

.form-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  transition: color 0.15s ease;
}

.form-field:focus-within .form-label {
  color: var(--onyx-900);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  height: 36px;
  padding: 6px 0;
  background-color: transparent;
  border: none;
  border-bottom: 1.5px solid var(--border-hairline);
  border-radius: 0;
  color: var(--text-primary);
  font-size: 13.5px;
  font-weight: 500;
  transition: border-color 0.18s ease;
  outline: none;
}

.form-select {
  cursor: pointer;
}

.form-textarea {
  height: auto;
  min-height: 68px;
  padding: 8px 0;
  resize: vertical;
  line-height: 1.5;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-faint);
  font-weight: 400;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-bottom-color: var(--border-control);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-bottom-color: var(--onyx-900);
}

.input-affix-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix {
  color: var(--text-faint);
  font-size: 13px;
  font-weight: 600;
  margin-right: 8px;
  padding-bottom: 1px;
  border-bottom: 1.5px solid var(--border-hairline);
  height: 36px;
  display: inline-flex;
  align-items: center;
  transition: border-color 0.18s ease, color 0.18s ease;
}

.input-affix-wrap:focus-within .input-prefix {
  border-bottom-color: var(--onyx-900);
  color: var(--text-primary);
}

.form-hint {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 3px;
}

/**
 * Toggle Switch (.ui-switch) & Segmented Control (.segmented-control).
 */
.ui-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  gap: 8px;
}

.ui-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.ui-switch-track {
  width: 34px;
  height: 20px;
  background-color: var(--border-control);
  border-radius: var(--radius-full);
  position: relative;
  transition: background-color 0.18s ease;
  flex-shrink: 0;
}

.ui-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background-color: #FFFFFF;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-xs);
  transition: transform 0.18s var(--ease-spring);
}

.ui-switch input:checked + .ui-switch-track {
  background-color: var(--brand-green);
}

.ui-switch input:checked + .ui-switch-track::after {
  transform: translateX(14px);
}

.ui-switch input:disabled + .ui-switch-track {
  opacity: 0.5;
  cursor: not-allowed;
}

.ui-switch:has(input:disabled) {
  cursor: not-allowed;
}

.segmented-control {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background-color: var(--bg-muted);
  border: none;
  border-radius: 0;
  gap: 2px;
}

.segmented-btn {
  height: 28px;
  padding: 0 12px;
  border: none;
  border-radius: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.segmented-btn.active {
  background-color: #FFFFFF;
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

/**
 * Analytical Sidebar Widgets (.segmented-bar, .legend-list, .kpi-grid, .top-seller-row).
 */
.segmented-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 6px;
  width: 100%;
  margin-bottom: 16px;
}

.segmented-bar-piece {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.35s var(--ease-spring);
}

.legend-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
}

.legend-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 1.5px;
  flex-shrink: 0;
}

.legend-val {
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 16px;
}

.kpi-stat-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.kpi-stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.top-seller-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}

.top-seller-thumb {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
  overflow: hidden;
}

.top-seller-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.top-seller-name {
  flex: 1;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.top-seller-count {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

/**
 * Additional Framework Components: Timeline, Key-Value List, Copy Snippet, Accordion, Dropzone.
 */
.timeline {
  display: flex;
  flex-direction: column;
  position: relative;
}

.timeline-item {
  display: flex;
  gap: 12px;
  padding-bottom: 18px;
  position: relative;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 24px;
  bottom: 0;
  width: 1px;
  background-color: var(--border-hairline);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-dot {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
  z-index: 1;
}

.timeline-content {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.timeline-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.kv-list {
  display: flex;
  flex-direction: column;
}

.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
  font-size: 12.5px;
}

.kv-row:last-child {
  border-bottom: none;
}

.kv-key {
  color: var(--text-muted);
  flex-shrink: 0;
}

.kv-val {
  font-weight: 500;
  color: var(--text-primary);
  text-align: right;
  min-width: 0;
  word-break: break-word;
}

.copy-snippet {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background-color: var(--bg-subtle);
  border-bottom: 1.5px solid var(--border-hairline);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-primary);
}

.copy-snippet code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/**
 * Animated Disclosure Popover (.disclosure-popover).
 * Opens technical details as a spring-animated floating card overlay so it never alters card or page height.
 */
.disclosure-popover {
  position: relative;
}

.disclosure-trigger {
  width: 100%;
  padding: 11px 14px;
  border-radius: 0;
  background-color: var(--bg-subtle);
  border: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: left;
  transition: background-color 0.15s ease;
}

.disclosure-trigger:hover {
  background-color: var(--bg-muted);
}

.disclosure-chevron {
  transition: transform 0.24s var(--ease-spring);
  color: var(--text-muted);
  flex-shrink: 0;
}

.disclosure-popover.open .disclosure-chevron,
.accordion-item.open .accordion-chevron {
  transform: rotate(180deg);
}

.disclosure-floating-panel {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  background-color: #FFFFFF;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-floating);
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  z-index: 75;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px) scale(0.98);
  transition: opacity 0.22s var(--ease-spring), transform 0.22s var(--ease-spring), visibility 0.22s;
}

.disclosure-popover.disclosure-down .disclosure-floating-panel {
  bottom: auto;
  top: calc(100% + 8px);
  transform: translateY(-8px) scale(0.98);
}

.disclosure-popover.open .disclosure-floating-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/**
 * Smooth Animated Accordion (.accordion-item).
 * Uses CSS Grid 0fr -> 1fr transition with bounded max-height scroll.
 */
.accordion-item {
  border-bottom: 1px solid var(--border-hairline);
}

.accordion-trigger {
  width: 100%;
  padding: 13px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: left;
}

.accordion-chevron {
  transition: transform 0.24s var(--ease-spring);
  color: var(--text-muted);
}

.accordion-grid-wrap {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.26s var(--ease-spring), opacity 0.2s ease;
}

.accordion-item.open .accordion-grid-wrap {
  grid-template-rows: 1fr;
  opacity: 1;
}

.accordion-body {
  overflow: hidden;
}

.accordion-body-inner {
  padding: 0 0 14px 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.55;
  max-height: 160px;
  overflow-y: auto;
}

/**
 * Formatted Form Input Models (window.FormInputs - email, phone, cpf-cnpj, currency).
 */
.input-model-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-model-wrap .form-input {
  padding-right: 76px;
}

.input-model-Wrap-icon .form-input {
  padding-left: 26px;
}

.input-model-leading-icon {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 15px;
  pointer-events: none;
  transition: color 0.15s ease;
}

.input-model-wrap:focus-within .input-model-leading-icon {
  color: var(--onyx-900);
}

.input-model-badge {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background-color: var(--bg-muted);
  color: var(--text-muted);
  pointer-events: none;
  transition: all 0.15s ease;
}

.input-model-badge.valid {
  background-color: var(--emerald-bg);
  color: var(--forest-600);
}

.input-model-badge.invalid {
  background-color: var(--rose-bg);
  color: var(--rose-500);
}

/**
 * Abstract Remote Searchable Dropdown Framework (window.AsyncSelect).
 * Boxless underline trigger + floating search popover for lazy/remote datasets.
 */
.async-select-wrap {
  position: relative;
  width: 100%;
}

.async-select-trigger {
  width: 100%;
  min-height: 38px;
  padding: 6px 0;
  background-color: transparent;
  border-bottom: 1.5px solid var(--border-control);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s ease, background-color 0.18s ease, padding 0.18s ease;
}

.async-select-trigger:hover {
  border-bottom-color: var(--text-muted);
}

.async-select-wrap.open .async-select-trigger,
.async-select-trigger:focus-visible {
  border-bottom-color: var(--onyx-900);
  background-color: rgba(16, 24, 40, 0.015);
  padding-left: 6px;
  padding-right: 6px;
}

.async-select-value {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.async-select-placeholder {
  color: var(--text-faint);
  font-size: 13px;
}

.async-select-selected-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.async-select-selected-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/**
 * Architectural Multi-Select Tag (.async-select-chip).
 * Avoids heavy black pills; uses a crisp hairline border, subtle surface, and delicate remove action.
 */
.async-select-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 4px 0 8px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.async-select-chip:hover {
  border-color: var(--border-control);
  background-color: var(--bg-muted);
}

.async-select-chip-icon {
  color: var(--text-muted);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
}

.async-select-chip button {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-xs);
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.async-select-chip button:hover {
  background-color: var(--rose-bg);
  color: var(--rose-500);
}

.async-select-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.async-select-clear {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.async-select-clear:hover {
  background-color: var(--bg-muted);
  color: var(--rose-500);
}

.async-select-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background-color: #FFFFFF;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-floating);
  z-index: 95;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px) scale(0.98);
  transition: opacity 0.2s var(--ease-spring), transform 0.2s var(--ease-spring), visibility 0.2s;
}

.async-select-wrap.open .async-select-popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.async-select-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-hairline);
  background-color: var(--bg-subtle);
}

.async-select-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 12.5px;
  color: var(--text-primary);
}

.async-select-search-input::placeholder {
  color: var(--text-faint);
}

.async-select-list {
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.async-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.async-select-option:hover,
.async-select-option.focused {
  background-color: var(--bg-muted);
}

.async-select-option.selected {
  background-color: var(--emerald-bg);
}

.async-select-opt-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.async-select-opt-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  background-color: #FFFFFF;
  border: 1px solid var(--border-hairline);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-size: 14px;
  flex-shrink: 0;
}

.async-select-opt-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.async-select-opt-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.async-select-opt-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background-color: #FFFFFF;
  border: 1px solid var(--border-hairline);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.async-select-state {
  padding: 22px 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.async-select-footer {
  padding: 6px 12px;
  border-top: 1px solid var(--border-hairline);
  background-color: #FAFBFD;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-faint);
}

@keyframes vzSpin {
  to { transform: rotate(360deg); }
}

.vz-spin {
  animation: vzSpin 0.8s linear infinite;
}

/**
 * Interactive Carousel Component (.vz-carousel - window.carousel).
 * Supports single-slide hero banners, multi-card rails, pointer drag/swipe, autoplay, and boundary disabling.
 * Architectural Note: Multi-card rails (`data-per-view="2|3"`) give `.vz-carousel-slide` vertical breathing room
 * (`padding: 6px 8px`) with negative vertical margin compensation so hover elevation (`translateY(-2px)`)
 * NEVER clips the card's top border or shadow against `.vz-carousel-viewport { overflow: hidden }`.
 */
.vz-carousel {
  position: relative;
  width: 100%;
  overflow: visible;
  border-radius: var(--radius-xl);
}

.vz-carousel-viewport {
  overflow: hidden;
  width: 100%;
  border-radius: var(--radius-xl);
}

.vz-carousel[data-per-view="2"] .vz-carousel-viewport,
.vz-carousel[data-per-view="3"] .vz-carousel-viewport {
  padding: 6px 2px;
  margin: -6px -2px;
  width: calc(100% + 4px);
}

.vz-carousel-viewport.is-draggable {
  cursor: grab;
  touch-action: pan-y;
}

.vz-carousel-viewport.is-dragging {
  cursor: grabbing;
}

.vz-carousel-track {
  display: flex;
  transition: transform 0.42s var(--ease-spring);
  will-change: transform;
}

.vz-carousel-slide {
  flex: 0 0 100%;
  min-width: 0;
}

.vz-carousel[data-per-view="2"] .vz-carousel-slide {
  flex: 0 0 50%;
  padding: 2px 8px;
}

.vz-carousel[data-per-view="3"] .vz-carousel-slide {
  flex: 0 0 33.3333%;
  padding: 2px 8px;
}

.carousel-catalog-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 20px;
  background-color: #FFFFFF;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.18s var(--ease-spring);
}

.carousel-catalog-card:hover {
  border-color: var(--onyx-900);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.vz-carousel-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.vz-carousel-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.vz-carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: var(--border-control);
  transition: width 0.24s var(--ease-spring), background-color 0.2s ease;
}

.vz-carousel-dot.active {
  width: 24px;
  background-color: var(--onyx-900);
}

.vz-carousel-nav-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.vz-carousel-btn {
  width: 32px;
  height: 32px;
  border-radius: 0;
  border: none;
  background-color: var(--bg-muted);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.vz-carousel-btn:hover:not(:disabled) {
  background-color: var(--onyx-900);
  color: #FFFFFF;
}

.vz-carousel-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background-color: var(--bg-subtle);
  color: var(--text-faint);
}

@media (max-width: 960px) {
  .vz-carousel[data-per-view="3"] .vz-carousel-slide {
    flex: 0 0 50%;
  }
}

@media (max-width: 640px) {
  .vz-carousel[data-per-view="2"] .vz-carousel-slide,
  .vz-carousel[data-per-view="3"] .vz-carousel-slide {
    flex: 0 0 100%;
    padding: 2px 0;
  }
}

.upload-dropzone {
  border: 1.5px dashed var(--border-control);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  text-align: center;
  background-color: var(--bg-subtle);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--onyx-900);
  background-color: #F2F4F7;
}

/**
 * Unified Image Cropper Modal (.cropper-modal-box, .cropper-stage).
 * Styled to match the DD Center Onyx / Pure-Canvas design system.
 */
.cropper-modal-box {
  max-width: 680px !important;
  overflow: hidden !important;
}

.cropper-stage {
  width: 100%;
  height: 360px;
  background-color: #0B0F17;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cropper-stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.cropper-toolbar {
  padding: 14px 24px;
  background-color: #FFFFFF;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.cropper-view-box {
  outline: 2px solid #FFFFFF !important;
  outline-color: rgba(255, 255, 255, 0.9) !important;
}

.cropper-point {
  background-color: #FFFFFF !important;
  width: 8px !important;
  height: 8px !important;
  border-radius: 9999px !important;
  opacity: 1 !important;
}

.cropper-line {
  background-color: rgba(255, 255, 255, 0.5) !important;
}

/**
 * Universal Pop-Up & Modal Framework (window.popup - /js/pop-up.js).
 * Supports both `.popup-*` and `.modal-*` class conventions so declarative and dynamic pop-ups
 * share identical responsive geometry, scroll behavior, and unclipped inner dropdown popovers.
 */
.popup-overlay,
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(11, 15, 23, 0.48);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 105;
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s var(--ease-smooth), visibility 0.2s;
}

.popup-overlay.active,
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.popup-box,
.modal-box {
  background-color: #FFFFFF;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-floating);
  width: 100%;
  max-width: 520px;
  margin: auto;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: visible;
  transform: scale(0.97) translateY(8px);
  transition: transform 0.22s var(--ease-spring);
}

.popup-box.popup-sm,
.modal-box.popup-sm {
  max-width: 420px;
}

.popup-box.popup-md,
.modal-box.popup-md {
  max-width: 540px;
}

.popup-box.popup-lg,
.modal-box.popup-lg {
  max-width: 680px;
}

.popup-overlay.active .popup-box,
.modal-overlay.active .modal-box {
  transform: scale(1) translateY(0);
}

.popup-header,
.modal-header {
  padding: 18px 24px 15px 24px;
  border-bottom: 1px solid var(--border-hairline);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  background-color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.popup-title,
.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.015em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.popup-subtitle,
.modal-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.popup-close-btn {
  width: 30px;
  height: 30px;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.popup-close-btn:hover {
  background-color: var(--bg-muted);
  color: var(--text-primary);
}

.popup-body,
.modal-body {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: visible;
}

.popup-footer,
.modal-footer {
  padding: 14px 24px;
  background-color: var(--bg-subtle);
  border-top: 1px solid var(--border-hairline);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
  min-width: 0;
}

.form-row-2,
.popup-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

/**
 * Toast Notifications (#notification-container, .notification-toast).
 * Smoothly reduces opacity to 30% on hover so content behind the toast remains legible.
 */
#notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 130;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  width: 100%;
  pointer-events: none;
}

.notification-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 15px;
  background-color: var(--onyx-900);
  color: #FFFFFF;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-floating);
  opacity: 1;
  transition: opacity 0.25s var(--ease-smooth), transform 0.25s var(--ease-spring);
  animation: toastSlideIn 0.22s var(--ease-spring);
  user-select: text;
  -webkit-user-select: text;
}

.notification-toast:hover {
  opacity: 1;
  box-shadow: var(--shadow-lifted);
}

@keyframes toastSlideIn {
  from {
    transform: translateY(-10px) scale(0.97);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/**
 * Skeleton Shimmer Primitives (.skeleton, [data-skeleton]).
 * Architectural Note: Never use `!important` on the `background` shorthand property when animating
 * `background-position` via `@keyframes`, because `!important` on `background` locks `background-position: 0% 0% !important`
 * in the CSS Cascade and blocks `@keyframes` movement. Instead, set `background-color` and `background-image`
 * separately so `background-position` animates smoothly from right to left.
 */
.skeleton,
[data-skeleton]:not(.showcase-card):not(.kanban-column):not(.kanban-card):not(tbody):not(.app-workspace):not(.workspace-content):not(#leads-telemetry-container):not(.workspace-body-flush):not(.m-section):not(.m-service-card-vertical):not(.m-product-card):not(.m-active-order-widget):not(.m-order-card):not(.m-chat-item):not(.m-metric-card):not(.package-card):not(.m-pin-box):not([data-skeleton-group]),
.showcase-card[data-skeleton] .chart-kpi-val,
.showcase-card[data-skeleton] .chart-kpi-sub,
.showcase-card[data-skeleton] .showcase-card-subtitle,
.showcase-card[data-skeleton] .kpi-stat-value,
.showcase-card[data-skeleton] .kpi-stat-sub,
.showcase-card[data-skeleton] .legend-val,
.showcase-card[data-skeleton] .gauge-stat-top,
.showcase-card[data-skeleton] .timeline-content,
.showcase-card[data-skeleton] .top-member-item,
.showcase-card[data-skeleton] [id^="chart-"],
.showcase-card[data-skeleton] [id*="gauge"],
.chart-kpi-item [data-skeleton],
.chart-kpi-val[data-skeleton],
.chart-kpi-sub[data-skeleton] {
  background-color: #E4E9F0 !important;
  background-image: linear-gradient(
    90deg,
    rgba(228, 233, 240, 0) 0%,
    rgba(255, 255, 255, 0.78) 45%,
    rgba(203, 213, 225, 0.55) 55%,
    rgba(228, 233, 240, 0) 100%
  ) !important;
  background-size: 240% 100%;
  background-repeat: no-repeat;
  animation: skeletonShimmer 1.35s linear infinite;
  border-radius: var(--radius-sm);
  color: transparent !important;
  border-color: transparent !important;
  pointer-events: none;
  user-select: none;
}

img.skeleton,
img[data-skeleton] {
  content: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7") !important;
  object-position: -9999px -9999px !important;
}

span.skeleton,
strong.skeleton,
small.skeleton,
b.skeleton,
em.skeleton {
  display: inline-block;
  min-width: 42px;
}

.skeleton *,
.skeleton svg,
.skeleton .apexcharts-canvas,
[data-skeleton]:not(.showcase-card):not(.kanban-column):not(.kanban-card):not(tbody):not(.app-workspace):not(.workspace-content):not(#leads-telemetry-container):not(.workspace-body-flush):not(.m-section):not(.m-service-card-vertical):not(.m-product-card):not(.m-active-order-widget):not(.m-order-card):not(.m-chat-item):not(.m-metric-card):not(.package-card):not(.m-pin-box):not([data-skeleton-group]) *,
.showcase-card[data-skeleton] .chart-kpi-val *,
.showcase-card[data-skeleton] .chart-kpi-sub *,
.showcase-card[data-skeleton] .showcase-card-subtitle *,
.showcase-card[data-skeleton] .kpi-stat-value *,
.showcase-card[data-skeleton] .kpi-stat-sub *,
.showcase-card[data-skeleton] .legend-val *,
.showcase-card[data-skeleton] [id^="chart-"] *,
.showcase-card[data-skeleton] [id*="gauge"] *,
.chart-kpi-item [data-skeleton] *,
.chart-kpi-val[data-skeleton] *,
.chart-kpi-sub[data-skeleton] * {
  visibility: hidden !important;
  opacity: 0 !important;
}

@keyframes skeletonShimmer {
  0% { background-position: 180% 0; }
  100% { background-position: -180% 0; }
}

/**
 * Responsive Navigation & Viewport Breakpoints.
 */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(11, 15, 23, 0.5);
  backdrop-filter: blur(2px);
  z-index: 35;
}

.mobile-menu-fab {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background-color: var(--onyx-900);
  color: #FFFFFF;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-dock);
  z-index: 39;
}

@media (max-width: 1280px) {
  #right-sidebar.open {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    box-shadow: var(--shadow-floating);
    z-index: 88;
  }
}

@media (max-width: 1120px) {
  .workspace-actions .btn {
    padding: 0 11px;
    font-size: 12px;
  }
}

@media (max-width: 960px) {
  #left-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
    z-index: 50;
  }

  #left-sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-floating);
  }

  .sidebar-overlay.active {
    display: block;
  }

  .mobile-menu-fab {
    display: inline-flex;
  }

  .sidebar-floating-tooltip {
    display: none !important;
  }

  .workspace-header,
  .workspace-toolbar,
  .workspace-body,
  .table-pagination {
    padding-left: 20px;
    padding-right: 20px;
  }

  .collection-table thead th:first-child,
  .collection-table tbody td:first-child {
    padding-left: 20px;
  }

  .collection-table thead th:last-child,
  .collection-table tbody td:last-child {
    padding-right: 20px;
  }
}

/**
 * Responsive Navigation Bar Collapse (`window.navbar` - `<= 860px`).
 * Hides `.workspace-actions` inline buttons and reveals `.navbar-collapse-trigger` dropdown button.
 */
@media (max-width: 860px) {
  .workspace-header.navbar-ready .workspace-actions {
    display: none !important;
  }

  .workspace-header.navbar-ready .navbar-collapse-trigger {
    display: inline-flex;
  }
}

@media (max-width: 640px) {
  .workspace-title {
    font-size: 19px;
  }

  #right-sidebar.open {
    width: min(340px, 92vw);
  }

  .right-sidebar-shell {
    min-width: 100%;
  }

  .bottom-dock-bar {
    padding: 0 6px 0 12px;
    max-width: calc(100vw - 72px);
    overflow-x: auto;
  }

  .popup-overlay,
  .modal-overlay {
    padding: 12px;
    align-items: flex-start;
  }

  .popup-header,
  .modal-header {
    padding: 15px 18px 13px 18px;
  }

  .popup-body,
  .modal-body {
    padding: 16px 18px;
    gap: 14px;
  }

  .popup-footer,
  .modal-footer {
    padding: 12px 18px;
  }

  .popup-footer .btn,
  .modal-footer .btn {
    flex: 1 1 auto;
  }

  .form-row-2,
  .popup-grid-2,
  .form-grid-2 {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/**
 * Shared Demo & Dashboard Showcase Layouts (.showcase-grid, .showcase-card).
 * Architectural Rule: `.showcase-card-header` uses `flex-wrap: nowrap` on desktop and gives
 * its first child `flex: 1 1 0%; min-width: 0;` with an ellipsis subtitle so dynamic subtitle updates
 * (e.g., switching between `24h` and `7d` in charts) NEVER push the right-hand controls onto a second line.
 */
.showcase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 20px;
  padding: 0 32px 96px 32px;
}

#charts-showcase-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 0 32px 96px 32px;
}

@media (max-width: 960px) {
  #charts-showcase-grid {
    grid-template-columns: 1fr;
  }
}

.showcase-card.span-full,
.showcase-card[data-span="full"],
.showcase-card-full {
  grid-column: 1 / -1 !important;
  width: 100% !important;
}

/**
 * Interactive Workflow Step Cards (.workflow-step-card) in Carousels & Steppers.
 * Provides micro-interaction elevation and emerald highlight on hover.
 */
.workflow-step-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  background: var(--bg-app);
  height: 100%;
  transition: transform 0.22s var(--ease-spring), border-color 0.2s ease, box-shadow 0.22s ease, background-color 0.2s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.workflow-step-card:hover {
  transform: translateY(-4px);
  border-color: var(--brand-green);
  background: #FFFFFF;
  box-shadow: 0 10px 24px -4px rgba(16, 185, 129, 0.18), 0 4px 10px -2px rgba(16, 185, 129, 0.08);
}

.workflow-step-card:hover .step-card-icon {
  color: var(--brand-green) !important;
  transform: scale(1.12);
  transition: transform 0.2s ease, color 0.2s ease;
}

.showcase-card {
  background-color: #FFFFFF;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-xl);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.showcase-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
  min-width: 0;
}

.showcase-card-header > div:first-child {
  flex: 1 1 0%;
  min-width: 0;
}

.showcase-card-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.showcase-card-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  min-width: 0;
}

.showcase-card-title > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.showcase-card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 860px) {
  .showcase-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .showcase-card-header > div:first-child {
    width: 100%;
  }

  .showcase-card-controls {
    width: 100%;
    flex-wrap: wrap;
  }
}

.chart-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  padding: 12px 14px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
}

.chart-kpi-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chart-kpi-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chart-kpi-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.scope-pill-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scope-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
}

.scope-row:last-child {
  border-bottom: none;
}

.scope-code {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  background-color: var(--bg-subtle);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-hairline);
}

.crop-preview-box {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  background-color: var(--bg-subtle);
}

.crop-preview-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1px solid var(--border-control);
  background-color: #FFFFFF;
  flex-shrink: 0;
}

.gauge-split-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  margin-top: 4px;
}

.gauge-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.gauge-stat-top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.gauge-stat-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/**
 * Universal DatePicker & DateRangePicker Component (window.datePicker).
 * Supports both `mode: 'single'` (specific day) and `mode: 'range'` (start -> end interval)
 * with identical `min(468px, calc(100vw - 24px))` popover geometry and mobile/tablet stacking.
 * Architectural Note: `.variant-input` maintains a resting bottom hairline (`var(--border-control)`)
 * even when `.has-value` is active, turning black (`var(--onyx-900)`) ONLY while `.open` or `:focus-visible`.
 */
.vz-datepicker-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 8px;
  border-radius: 0;
  font-size: 12.5px;
  font-weight: 500;
  background-color: transparent;
  color: var(--text-secondary);
  border: none;
  border-bottom: 1.5px solid var(--border-control);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.vz-datepicker-trigger:hover {
  border-bottom-color: var(--text-muted);
  color: var(--text-primary);
}

.vz-datepicker-trigger.has-value,
.vz-datepicker-trigger.open {
  background-color: rgba(16, 24, 40, 0.03);
  color: var(--onyx-900);
  border: none;
  border-bottom: 1.5px solid var(--onyx-900);
}

.vz-datepicker-trigger.variant-input,
.vz-datepicker-trigger.variant-input.has-value {
  width: 100%;
  height: 38px;
  padding: 6px 0;
  border: none;
  border-bottom: 1.5px solid var(--border-control);
  border-radius: 0;
  background-color: transparent;
  color: var(--text-primary);
  justify-content: space-between;
}

.vz-datepicker-trigger.variant-input:hover {
  border-bottom-color: var(--text-muted);
}

.vz-datepicker-trigger.variant-input.open,
.vz-datepicker-trigger.variant-input:focus-visible {
  background-color: rgba(16, 24, 40, 0.015);
  color: var(--text-primary);
  border: none;
  border-bottom: 1.5px solid var(--onyx-900);
}

.vz-datepicker-clear {
  width: 18px;
  height: 18px;
  border-radius: 0;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.vz-datepicker-clear:hover {
  opacity: 1;
  background-color: var(--bg-muted);
  color: var(--rose-500);
}

.vz-datepicker-trigger.variant-input .vz-datepicker-clear:hover {
  background-color: var(--bg-muted);
  color: var(--rose-500);
}

.vz-datepicker-popover {
  position: fixed;
  background-color: #FFFFFF;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-floating);
  z-index: 125;
  display: flex;
  flex-direction: column;
  width: min(468px, calc(100vw - 24px));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px) scale(0.98);
  transition: opacity 0.18s var(--ease-spring), transform 0.18s var(--ease-spring), visibility 0.18s;
  overflow: hidden;
}

.vz-datepicker-popover.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.vz-dp-body {
  display: flex;
  min-width: 0;
}

.vz-dp-presets {
  width: 148px;
  background-color: var(--bg-subtle);
  border-right: 1px solid var(--border-hairline);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
}

.vz-dp-preset-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 4px 8px 6px 8px;
}

.vz-dp-preset-btn {
  width: 100%;
  height: 29px;
  padding: 0 9px;
  border: none;
  border-radius: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.vz-dp-preset-btn:hover {
  background-color: var(--bg-muted);
  color: var(--text-primary);
}

.vz-dp-preset-btn.active {
  background-color: var(--brand-green);
  color: #FFFFFF;
  font-weight: 600;
}

.vz-dp-calendar {
  flex: 1;
  padding: 14px 16px;
  min-width: 0;
}

.vz-dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.vz-dp-month-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.vz-dp-nav-btn {
  width: 28px;
  height: 28px;
  border-radius: 0;
  border: none;
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}

.vz-dp-nav-btn:hover {
  background-color: var(--bg-muted);
  color: var(--text-primary);
}

.vz-dp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 6px;
  text-align: center;
}

.vz-dp-Weekday {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  padding: 4px 0;
}

.vz-dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 3px;
}

.vz-dp-day {
  height: 34px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  position: relative;
  transition: background-color 0.12s ease, color 0.12s ease;
  font-variant-numeric: tabular-nums;
}

.vz-dp-day:hover:not(.is-outside):not(.is-selected):not(.is-range-start):not(.is-range-end) {
  background-color: var(--bg-muted);
}

.vz-dp-day.is-outside {
  color: var(--text-faint);
  opacity: 0.4;
}

.vz-dp-day.is-today::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: var(--radius-full);
  background-color: var(--emerald-500);
}

.vz-dp-day.is-in-range {
  background-color: var(--brand-green-subtle);
  color: var(--brand-green-hover);
  border-radius: 0;
}

.vz-dp-day.is-selected,
.vz-dp-day.is-range-start,
.vz-dp-day.is-range-end {
  background-color: var(--brand-green) !important;
  color: #FFFFFF !important;
  font-weight: 700;
}

.vz-dp-day.is-range-start {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.vz-dp-day.is-range-end {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.vz-dp-day.is-range-start.is-range-end {
  border-radius: var(--radius-sm);
}

.vz-dp-footer {
  padding: 10px 14px;
  background-color: var(--bg-subtle);
  border-top: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.vz-dp-footer-info {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kbd-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-xs);
  background-color: var(--bg-muted);
  border: 1px solid var(--border-control);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

/**
 * Interactive Kanban Board & Pipeline Engine (window.Kanban - /js/kanban.js).
 * Responsive 4 -> 2 -> 1 column layout that fits cleanly inside `.app-workspace` without horizontal overflow.
 */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 0 32px 96px 32px;
  align-items: start;
  width: 100%;
}

.kanban-column {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 480px;
  max-height: calc(100dvh - 190px);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.kanban-column.drag-over {
  background-color: #EEF2F6;
  border-color: var(--onyx-900);
}

.kanban-column-header {
  padding: 14px 16px 12px 16px;
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.kanban-column-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.kanban-column-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kanban-column-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.kanban-column-count {
  height: 20px;
  padding: 0 7px;
  border-radius: var(--radius-full);
  background-color: #FFFFFF;
  border: 1px solid var(--border-hairline);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kanban-column-total {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.kanban-column-body {
  flex: 1;
  min-height: 160px;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kanban-card {
  background-color: #FFFFFF;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: grab;
  transition: transform 0.16s var(--ease-spring), box-shadow 0.16s ease, border-color 0.16s ease;
  position: relative;
  min-width: 0;
}

.kanban-card:hover {
  border-color: var(--border-control);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.kanban-card.is-dragging-source {
  opacity: 0.3;
  border-style: dashed;
}

.kanban-drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 200;
  background-color: #FFFFFF;
  border: 1.5px solid var(--onyx-900);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-floating);
  transform: rotate(2deg) scale(1.02);
  opacity: 0.96;
}

.kanban-drop-slot,
.kanban-sortable-ghost {
  height: 86px;
  border: 1.5px dashed var(--onyx-900) !important;
  border-radius: var(--radius-lg) !important;
  background-color: rgba(17, 22, 31, 0.04) !important;
  opacity: 0.45 !important;
  flex-shrink: 0;
  transition: height 0.15s ease;
}

.kanban-sortable-drag {
  background-color: #FFFFFF !important;
  border: 1.5px solid var(--onyx-900) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-floating) !important;
  transform: rotate(2deg) scale(1.02);
  opacity: 0.98 !important;
}

.kanban-thermal-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.kanban-thermal-badge.hot {
  background-color: var(--rose-bg);
  color: var(--rose-500);
}

.kanban-thermal-badge.warm {
  background-color: var(--amber-bg);
  color: var(--amber-500);
}

.kanban-thermal-badge.cold {
  background-color: var(--indigo-bg);
  color: var(--indigo-500);
}

@media (max-width: 1320px) {
  .kanban-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kanban-column {
    max-height: none;
    min-height: 320px;
  }
}

@media (max-width: 960px) {
  .showcase-grid,
  .kanban-board {
    padding-left: 20px;
    padding-right: 20px;
  }

  .showcase-grid > .showcase-card[style*="span 2"],
  #charts-showcase-grid > .showcase-card {
    grid-column: span 1 !important;
  }

  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .kanban-board {
    grid-template-columns: 1fr;
  }

  .vz-datepicker-popover .vz-dp-body {
    flex-direction: column;
  }

  .vz-datepicker-popover .vz-dp-presets {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-hairline);
    flex-direction: row;
    flex-wrap: wrap;
  }

  .vz-datepicker-popover .vz-dp-preset-btn {
    width: auto;
  }
}

/**
 * Domain-Agnostic Detail Helpers: Two-Line Cell, Score Meter, Callout, Notes Composer.
 * Used by `/lead/leads.html` and `/lead/lead.html` so production pages avoid heavy inline styles.
 * `.cell-stack` keeps primary + secondary text inside ONE leaf wrapper so skeleton masking covers both lines.
 * `.meter` is a 6px progress track whose fill width is set inline (`style="width: 72%"`) and tinted by `.hot|.warm|.cold`.
 */
.cell-stack {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  max-width: 100%;
  line-height: 1.3;
}

.cell-stack > span:first-child {
  font-size: 13px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meter {
  height: 6px;
  width: 100%;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.meter-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-full);
  background-color: var(--text-muted);
  transition: width 0.25s ease;
}

.meter-fill.hot {
  background-color: var(--rose-500);
}

.meter-fill.warm {
  background-color: var(--amber-500);
}

.meter-fill.cold {
  background-color: var(--indigo-500);
}

.callout {
  background-color: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.callout-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* Universal 5-Star Yellow Rating Component (Strictly forbids raw numeric badges) */
.star-rating {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  user-select: none;
  line-height: 1;
  vertical-align: middle;
}

.star-rating-stars {
  display: inline-flex;
  align-items: center;
  gap: 1.5px;
}

.star-rating .star-icon {
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #D1D5DB;
  transition: transform 0.15s ease;
}

.star-rating .star-icon.is-filled {
  color: #F59E0B;
}

.star-rating .star-icon.is-half {
  color: #FBBF24;
}

.star-rating-count {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted, #6B7280);
  opacity: 0.72;
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

/* Universal Contextual Tooltip Box ([data-tooltip]) */
[data-tooltip] {
  position: relative;
  cursor: pointer;
}

.ui-tooltip-portal {
  position: fixed;
  z-index: 98;
  max-width: 250px;
  padding: 7px 11px;
  background-color: #141414;
  color: #F9FAFB;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.45;
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  user-select: none;
}

.ui-tooltip-portal.visible {
  opacity: 0.96;
  transform: translateY(0);
}

/* Visual De-cluttering & Opacity Hierarchy Utilities */
.opacity-soft {
  opacity: 0.78;
}

.opacity-muted {
  opacity: 0.58;
}

.opacity-faint {
  opacity: 0.42;
}

/* Pull-to-Refresh Indicator */
.m-ptr-indicator {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #FFFFFF;
  border: 1px solid var(--border-hairline);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
  transition: top 0.22s ease, opacity 0.22s ease;
  opacity: 0;
  pointer-events: none;
}

.m-ptr-spinner {
  font-size: 16px;
  color: var(--brand-green);
  animation: nh-spin 0.8s linear infinite;
}

@keyframes nh-spin {
  to {
    transform: rotate(360deg);
  }
}


