/* ── Global custom scrollbars ── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-bg-surface-3) transparent;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-bg-surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-border-default); }
::-webkit-scrollbar-corner { background: transparent; }

/* user manual test styles */
.dt-table-wrap {}

/* CSS variables moved to resources/css/themes/{_palette,_ui,default-dark,default-light}.css.
   Loaded via xacss bundle. Source of truth: themes/index.css. */

/* [data-theme="light"] moved to resources/css/themes/default-light.css */

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background: var(--color-bg-app);
  overflow: hidden;
}

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

/* ============================================
   Layout Container — CSS Grid
   ============================================ */
.layout-container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) 1fr;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  transition: grid-template-columns var(--motion-base) var(--ease-standard);
}

.layout-container > .layout-header {
  grid-column: 1 / -1;
}

/* Suppress all transitions until JS adds .is-ready after first paint */
.layout-container:not(.is-ready),
.layout-container:not(.is-ready) * {
  transition: none !important;
}

/* ============================================
   Sidebar Collapse (desktop)
   ============================================ */
.layout-container.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-width) 1fr;
}

.nav-item-label,
.sidebar-child-label,
.sidebar-profile-name,
.sidebar-meta,
.nav-item .badge {
  transition: opacity var(--motion-fast) ease calc(var(--si, 0) * 20ms);
}

.sidebar-collapsed .nav-item-label,
.sidebar-collapsed .sidebar-child-label,
.sidebar-collapsed .sidebar-profile-name,
.sidebar-collapsed .sidebar-meta,
.sidebar-collapsed .nav-item .badge {
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s ease calc(var(--so, 0) * 14ms);
}

/* ============================================
   Sidebar
   ============================================ */
.layout-sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--color-bg-sidebar);
  transition: width var(--motion-base) var(--ease-standard);
  position: relative;
}

.sidebar-section {
  width: var(--sidebar-width);
  max-width: none;
  flex-shrink: 0;
  padding: 8px 8px 8px 12px;
}
.sidebar-nav {
  flex: 1;
  padding-top: 0;
  overflow-y: auto;
  min-height: 0;
  position: relative;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-default) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 12px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--color-border-default);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}
.sidebar-system { padding-top: var(--space-2); flex-shrink: 0; }
.sidebar-bottom { flex-shrink: 0; }

/* Navigation */
.nav-list { position: relative; display: flex; flex-direction: column; gap: 1px; }

.nav-item {
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1;
  gap: 8px;
  min-height: 30px;
  padding: 5px 8px;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  font-size: 14px;
  width: 100%;
  text-align: left;
}

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

.nav-item.is-section-only {
  cursor: default;
}

.nav-item.is-section-only:hover {
  color: var(--color-text-secondary);
  background: transparent;
}

.nav-item.is-active {
  background: var(--color-nav-active-bg);
  color: var(--color-text-primary);
}

.nav-item .nav-icon { width: 14px; height: 14px; flex-shrink: 0; }
.nav-item-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav-group { display: flex; flex-direction: column; min-width: 0; margin-bottom: 2px; }
.sidebar-nav-group.has-group-divider {
  margin-top: 3px;
  padding-top: 6px;
}
.sidebar-nav-group.has-group-divider::before {
  content: "";
  display: block;
  height: 1px;
  margin: -6px 8px 4px;
  background: color-mix(in srgb, var(--color-border-default) 38%, transparent);
  pointer-events: none;
}
.sidebar-child-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 0;
  padding: 0;
}

.sidebar-child-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 14px;
  line-height: 18px;
  position: relative;
}

.sidebar-child-item:hover { color: var(--color-text-primary); background: var(--color-nav-hover-bg); }
.sidebar-child-item.is-active { color: var(--color-text-primary); background: var(--color-nav-active-bg); }
.sidebar-child-item .sidebar-child-icon { width: 14px; height: 14px; flex-shrink: 0; }
.sidebar-child-label {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .layout-container,
  .layout-sidebar,
  .nav-item,
  .sidebar-child-item,
  .nav-item-label,
  .sidebar-child-label,
  .sidebar-profile-name,
  .sidebar-meta,
  .sidebar-arrow span {
    transition: none !important;
  }
}

/* ============================================
   Tooltips (JS-positioned, fixed)
   ============================================ */
.tw-tooltip {
  position: fixed;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  padding: 5px 10px;
  border-radius: 9px;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
}
.tw-tooltip.is-right {
  transform: translateX(-4px);
}
.tw-tooltip.is-bottom {
  transform: translateY(-4px);
}
.tw-tooltip.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(0, 0);
}
/* Light theme tooltip */
[data-theme="light"] .tw-tooltip {
  background: hsl(220, 15%, 18%);
  color: hsl(0, 0%, 95%);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
/* Dark theme tooltip (default) */
[data-theme="dark"] .tw-tooltip,
.tw-tooltip {
  background: hsl(220, 10%, 88%);
  color: hsl(220, 15%, 12%);
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
}

/* Header module sub-nav (icon-only buttons with title tooltip) */
.header-module-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.header-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  text-decoration: none;

  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.header-nav-btn:hover {
  background: var(--color-bg-surface-3);
  color: var(--color-text-primary);
}
.header-nav-btn.is-active {
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  color: var(--color-accent);
}
.header-nav-btn .icon { flex-shrink: 0; }
.header-page-actions .header-nav-btn .icon { width: 16px; height: 16px; }
.header-page-actions .header-nav-btn:hover {
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  color: var(--color-accent);
}

/* Divider between page-actions and module-nav */
.header-page-actions + .header-module-nav {
  padding-left: var(--space-2);
  margin-left: var(--space-1);
  border-left: 1px solid var(--color-border-default);
}

/* Sidebar profile (bottom) */
.sidebar-profile {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-2) var(--space-2) 9px;
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  text-decoration: none;

  min-height: 36px;
}
.sidebar-profile .avatar {
  width: 24px;
  height: 24px;
  font-size: 10px;
  flex-shrink: 0;
}

.sidebar-profile:hover {
  background: var(--color-bg-surface-3);
}

.sidebar-profile.is-active {
  background: var(--color-nav-active-bg);
}

.sidebar-profile-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 24px;
}

/* Sidebar team switcher */
.sidebar-team-switcher {
  position: relative;
  margin-bottom: var(--space-1);
}
.sidebar-team-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: 4px 9px;
  border: none;
  background: none;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: 12px;
  cursor: pointer;
  min-height: 28px;

}
.sidebar-team-btn:hover { background: var(--color-bg-surface-3); }
.sidebar-team-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-collapsed .sidebar-team-name { display: none; }
.sidebar-team-dropdown {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--color-bg-canvas);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 100;
  max-height: 200px;
  overflow-y: auto;
}
.sidebar-team-dropdown.is-open { display: block; }
.sidebar-team-option {
  display: block;
  width: 100%;
  padding: 6px 8px;
  border: none;
  background: none;
  text-align: left;
  font-size: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-primary);
}
.sidebar-team-option:hover { background: var(--color-bg-surface-3); }
.sidebar-team-option.is-active { font-weight: 600; color: var(--color-brand-primary); }

/* Sidebar meta (version/copyright) */
.sidebar-meta {
  font-size: 11px;
  color: var(--color-text-muted);
  padding: 0 var(--space-2);
}


/* ============================================
   Main Area
   ============================================ */
.layout-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  flex: 1;
}

/* ============================================
   Header
   ============================================ */
.layout-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: var(--header-height);
  padding: 0 var(--space-6) 0 8px;
  flex-shrink: 0;
  background: var(--color-bg-header);
}

.header-section { display: flex; align-items: center; gap: var(--space-2); }
.header-left { flex: 0 0 auto; }
.header-right { flex: 0 0 auto; margin-left: auto; gap: var(--space-1); }

.sidebar-toggle {
  display: flex;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-primary);
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  padding: 0;
}

.sidebar-toggle:hover { background: var(--color-bg-surface-3); }

/* Animated arrow (chevron left/right) */
.sidebar-arrow {
  width: 16px;
  height: 16px;
  display: inline-block;
  position: relative;
}
.sidebar-arrow span {
  position: absolute;
  left: 4px;
  width: 8px;
  height: 1.5px;
  background-color: var(--color-text-secondary);
  display: block;
  transition:
    transform var(--motion-base) var(--ease-standard),
    background-color var(--motion-fast) var(--ease-standard);

  border-radius: 1px;
}
.sidebar-arrow span:first-child {
  top: 5px;
  transform: rotate(-40deg);
}
.sidebar-arrow span:last-child {
  top: 10px;
  transform: rotate(40deg);
}
/* When collapsed: arrow points right */
.sidebar-collapsed .sidebar-arrow span:first-child {
  transform: rotate(40deg);
}
.sidebar-collapsed .sidebar-arrow span:last-child {
  transform: rotate(-40deg);
}
.sidebar-toggle:hover .sidebar-arrow span {
  background-color: var(--color-text-primary);
}

/* Breadcrumbs */
.breadcrumbs { display: flex; align-items: center; gap: var(--space-1); font-size: 13px; min-width: 0; overflow: hidden; }
.breadcrumb-item {
    color: var(--color-text-secondary);
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}
.breadcrumb-item:hover { color: var(--color-text-primary); }
.breadcrumb-item.is-current { color: var(--color-text-primary); font-weight: 500; flex-shrink: 0; }
.breadcrumb-sep { color: var(--color-text-muted); font-size: 12px; flex-shrink: 0; }

/* Search (kept for backwards compat) */
.search-box {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-bg-surface-3);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  width: 100%;
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--color-text-primary);
  font-size: 14px;
}

.search-input::placeholder { color: var(--color-text-muted); }
.search-icon { color: var(--color-text-muted); flex-shrink: 0; }
.search-kbd {
  font-size: 11px;
  padding: 2px 6px;
  background: var(--color-bg-surface-2);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-family: inherit;
}

/* Header buttons */
.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  position: relative;
}
.header-btn:hover { background: var(--color-bg-surface-3); color: var(--color-text-primary); }

/* Header page actions (injected via @yield) */
.header-page-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}
/* ─── Show Page (grid overlap, like DataTable) ─── */
/* Show page CSS moved to css/admin-layout-show.css */


/* ─── Wall (team chat) ─── */
.wall { display: flex; flex-direction: column; height: 100%; }





/* ─── Audit Log ─── */



/* ─── Diff Panel ─── */
.diff-panel { padding: 12px; }
.diff-meta {
  display: flex; justify-content: space-between; margin-bottom: 12px;
  font-size: 12px; color: var(--color-text-muted);
}
.diff-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.diff-th {
  text-align: left; padding: 6px 8px; font-size: 11px; font-weight: 600;
  color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.03em;
  border-bottom: 1px solid var(--color-border-default);
}
.diff-row { border-bottom: 1px solid var(--color-border-default); }
.diff-row:last-child { border-bottom: none; }
.diff-field { padding: 6px 8px; font-weight: 500; color: var(--color-text-primary); }
.diff-old {
  padding: 6px 8px; color: var(--color-danger);
  text-decoration: line-through; opacity: 0.7;
}
.diff-new { padding: 6px 8px; color: var(--color-success); font-weight: 500; }
.diff-actions { margin-top: 16px; display: flex; justify-content: flex-end; }

/* ─── @Mentions ─── */

@media (max-width: 768px) {
  .show-layout { flex-direction: column; }
  .show-sidebar { width: 100%; }
}

/* ─── Settings Layout (uses sp-show-wrap from ShowPage) ─── */
/* Settings CSS moved to css/admin-layout-settings.css */

/* header-page-actions btn inherits standard .btn styles */

/* Header global actions (search, notifications) */
.header-global-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: var(--space-2);
  padding-left: var(--space-2);
  border-left: 1px solid var(--color-border-default);
}

/* Notification badge (red dot) */
.header-btn-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--color-danger);
  border-radius: 50%;
}

/* Offcanvas panel (notifications) */





/* Notification items in offcanvas */
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--color-border-default);

  position: relative;
}
.notif-item:hover { background: var(--color-bg-surface-3); }
.notif-item.notif-unread { background: color-mix(in srgb, var(--color-accent) 6%, transparent); }
.notif-item.notif-unread .notif-title { font-weight: 600; }
.notif-item.notif-read { opacity: 0.65; }
.notif-icon {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--color-bg-surface-3);
  flex-shrink: 0;
}
.notif-icon .icon { width: 14px; height: 14px; color: var(--color-text-secondary); }
.notif-body { flex: 1; min-width: 0; }
.notif-title {
  display: block;
  font-size: 0.8125rem;
  color: var(--color-text-primary);
  text-decoration: none;
  line-height: 1.3;
}
a.notif-title:hover { color: var(--color-accent); }
.notif-msg {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin: 1px 0 2px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-time {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
}
.notif-read-btn {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  opacity: 0;

}
.notif-item:hover .notif-read-btn { opacity: 1; }
.notif-read-btn:hover { background: var(--color-bg-surface-3); color: var(--color-success); }
.notif-view-all {
  display: block;
  text-align: center;
  padding: var(--space-4);
  font-size: 0.8125rem;
  color: var(--color-accent);
  text-decoration: none;
}
.notif-view-all:hover { text-decoration: underline; }

/* ─── Module Panel (slide-out right drawer) ─── */

.module-panel {
  position: fixed;
  top: 10px;
  right: 10px;
  bottom: 10px;
  width: 300px;
  max-width: calc(100vw - 60px);
  background: color-mix(in srgb, var(--color-bg-app) 92%, transparent);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg, 12px);
  transform: translateX(calc(100% + 20px));

  z-index: 9001;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.15), 0 0 0 1px color-mix(in srgb, var(--color-text-primary) 5%, transparent) inset;
  overflow: hidden;
}
.module-panel.is-open {
  transform: translateX(0);
}








.module-panel.is-open .module-panel-item {
  opacity: 1;
  transform: translateX(0);

}





/* Header button highlight when panel is for current module */

/* ─── PanelStack (universal nested panels) ─── */
.ps-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  pointer-events: none;
}
.ps-overlay.is-visible {
  background: rgba(0,0,0,0.12);
}
.ps-overlay.is-visible.is-top {
  pointer-events: auto;
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.ps-panel {
  position: fixed;
  background: var(--color-bg-surface-2);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg, 12px);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,0.2);
  overflow: visible;
  transform: translateX(calc(100% + 20px));

}
.ps-panel.is-open {
  transform: translateX(0);
}

/* Expand button — inside panel, overflow:visible wrapper */
.ps-expand-wrapper {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  overflow: visible;
  z-index: 2;
  pointer-events: none;
}
.ps-expand-btn {
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-bg-surface-2);
  border: 1px solid var(--color-border-default);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  pointer-events: auto;

  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.ps-expand-btn:hover {
  background: var(--color-accent);
  color: var(--color-text-inverse);
  border-color: var(--color-accent);
  transform: translateY(-50%) scale(1.1);
}

.ps-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  text-decoration: none;

}
.ps-action:hover {
  background: var(--color-bg-surface-3);
  color: var(--color-text-primary);
}

/* Body */
.ps-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 0 0 var(--radius-lg, 12px) var(--radius-lg, 12px);
}
.ps-loading {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;

}

/* Content — single or two-column */
.ps-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;

}


.ps-content.is-two-col {
  display: flex;
  overflow: hidden;
  padding: 0;
}
.ps-content.is-two-col .ps-details {
  flex: 0 0 35%;
  width: 35%;
  overflow-y: auto;
  padding: 16px;
  border-right: 1px solid var(--color-border-default);
}
.ps-content.is-two-col .ps-right {
  flex: 0 0 65%;
  width: 65%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Inline tabs */
.ps-tabs-inline {
  display: flex;
  gap: 0;
  border-bottom: 1px solid transparent;
  margin: -16px -16px 12px -16px;
  padding: 0 12px;
  background-image: linear-gradient(var(--color-border-default), var(--color-border-default));
  background-size: 0% 1px;
  background-position: left bottom;
  background-repeat: no-repeat;

}
/* Removed: .ps-tabs-inline.is-animating / ps-tab-btn stagger / ps-line-draw keyframe — no JSX toggles is-animating (2026-05-16) */
.ps-tab-btn {
  padding: 10px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);

  white-space: nowrap;
}
.ps-tab-btn:hover { color: var(--color-text-primary); }
.ps-tab-btn.is-active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}
.ps-tab-badge {
  margin-left: 4px;
  font-size: 11px;
  background: var(--color-bg-surface-3);
  color: var(--color-text-secondary);
  padding: 1px 6px;
  border-radius: 10px;
}

/* Right tabs */
.ps-right-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border-default);
  flex-shrink: 0;
  padding: 0 12px;
}
.ps-right-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
/* .ps-details-compact / .ps-fields / .ps-field / .ps-field-label / .ps-field-value / .ps-entity-link / .ps-field-edit-icon / .ps-field-editing / .ps-field-edit / .ps-field-input / .ps-field-saving — moved to xacss/components/panelstack-content.css (Фаза D1.3, 2026-04-22)
   NB:

/* Items table */
/* .ps-items-table — removed as dead CSS (0 usages in JSX/Blade, Фаза D1, 2026-04-22) */

/* .ps-relations / .ps-relation-* / .ps-detail-block / .ps-empty — moved to xacss/components/panelstack-content.css (Фаза D1.3, 2026-04-22) */

/* ─── Form Panel ─── */
/* .ps-form-* (panel/content/section/row/label/input/item/num/autocomplete) — moved to xacss/components/panelstack-content.css (Фаза D1.2, 2026-04-22) */

/* ─── RadioBlocks ─── */
/* .ps-assignees / .ps-assignee-chip / .ps-assignee-remove — moved to xacss/components/panelstack-content.css (Фаза D1.3, 2026-04-22) */

/* Loyalty block in form — moved to modules/Sales/Resources/css/sales.css (Фаза D1, 2026-04-22) */

/* .ps-form-add-btn / .ps-form-totals / .ps-form-total-row / .ps-form-total-final / .ps-form-actions — moved to xacss/components/panelstack-content.css (Фаза D1.2, 2026-04-22) */

/* ─── MiniSlide (narrow picker panel) ─── */

/* Mobile */
@media (max-width: 768px) {
  .ps-panel {
    top: 10px !important;
    right: 10px !important;
    bottom: 10px !important;
    width: calc(100vw - 20px) !important;
  }
  .ps-expand-wrapper { display: none; }
  .ps-content.is-two-col {
    flex-direction: column;
  }
  .ps-content.is-two-col .ps-details,
  .ps-content.is-two-col .ps-right {
    flex: none;
    width: 100%;
  }
  .ps-content.is-two-col .ps-details {
    border-right: none;
    border-bottom: 1px solid var(--color-border-default);
    max-height: 40vh;
  }
}

/* ─── Entity Panel v2 (slide-out entity detail) — DEPRECATED ─── */


/* Expand/collapse toggle — positioned outside panel as a sibling */







/* Two-column layout when expanded */

/* Right panel (tabs + content) */

/* Inline tabs (top of panel when not expanded) */

/* ─── Panel Fields (editable) ─── */

.panel-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);

}
.panel-field.is-editable {
  cursor: pointer;
}
.panel-field.is-editable:hover {
  background: var(--color-bg-surface-3);
}

.panel-field-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.panel-field-value {
  font-size: 14px;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  flex-wrap: wrap;
}
.panel-field-value a {
  color: var(--color-accent);
  text-decoration: none;
}
.panel-field-value a:hover {
  text-decoration: underline;
}

.panel-field.is-editable:hover .panel-field-edit-icon {
  opacity: 1;
}

/* Editing state */

/* ─── Panel Items Table ─── */

/* ─── Panel Relations ─── */


.text-right { text-align: right; }

/* Removed: .entity-panel mobile rules — .entity-panel has zero JSX/PHP consumers (2026-05-16) */

/* Profile (legacy — kept for compat) */
.profile-wrapper { position: relative; }
.profile-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-primary);
  padding: var(--space-1);
  border-radius: var(--radius-md);
}
.profile-toggle:hover { background: var(--color-bg-surface-3); }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.profile-name { font-size: 13px; }

/* Dropdown */
.dropdown, .notifications-wrapper { position: relative; }

.dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  background: var(--color-bg-surface-2);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  display: none;
  z-index: 100;
}

.dropdown.dropdown-right { left: auto; right: 0; }
.dropdown.is-open { display: block; }

.dropdown-header {
  padding: var(--space-2) var(--space-4);
  font-weight: 600;
  border-bottom: 1px solid var(--color-border-default);
  font-size: 13px;
}

.dropdown-body { padding: var(--space-2); }
.dropdown-empty { padding: var(--space-4); color: var(--color-text-muted); text-align: center; font-size: 13px; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 13px;
}
.dropdown-item:hover { background: var(--color-bg-surface-3); color: var(--color-text-primary); }
.dropdown-divider { height: 1px; background: var(--color-border-default); margin: var(--space-1) 0; }

/* ============================================
   Content
   ============================================ */
.layout-content {
  flex: 1;
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
  padding: 0;
  margin: 0 20px 20px 0;
  box-sizing: border-box;
  overflow: hidden;
}

.content-wrapper.has-aside { grid-template-columns: 1fr 300px; }
.content-main { min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; flex: 1; }

.content-aside {
  border-left: 1px solid var(--color-border-default);
  padding-left: var(--space-6);
  position: sticky;
  top: 0;
  height: fit-content;
  max-height: calc(100vh - var(--header-height));
  overflow-y: auto;
}

/* Aside navigation (module page nav) */
.aside-nav { display: flex; flex-direction: column; gap: 2px; }
.aside-nav-item {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius-md);
  font-size: 0.875rem; color: var(--color-text-secondary);
  text-decoration: none;
}
.aside-nav-item:hover { background: var(--color-bg-surface-3); color: var(--color-text-primary); }
.aside-nav-item.is-active { background: color-mix(in srgb, var(--color-accent) 10%, transparent); color: var(--color-accent); font-weight: 500; }

@media (max-width: 768px) {
  .content-wrapper.has-aside { grid-template-columns: 1fr; }
  .content-aside { border-left: none; padding-left: 0; border-top: 1px solid var(--color-border-default); padding-top: var(--space-6); position: static; order: -1; }
}

/* Page title (legacy) */
.page-title { font-size: 24px; font-weight: 700; margin-bottom: var(--space-6); }

/* ============================================
   Spotlight Search
   ============================================ */










/* Spotlight Filters */



/* Spotlight Groups */


/* Spotlight Results */

/* Spotlight Loading */
@keyframes spotlight-spin { to { transform: rotate(360deg); } }

/* Spotlight Empty */

/* Spotlight Recents */

/* ============================================
   Dashboard Widgets
   ============================================ */
.widgets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-6);
}

.widget {
  background: var(--color-bg-surface-2);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.widget-header { margin-bottom: var(--space-4); }
.widget-title { font-size: 16px; font-weight: 600; }

/* Skeleton */
.widget-skeleton { animation: skeleton-pulse 1.5s ease-in-out infinite; }
.skeleton-line { background: var(--color-bg-surface-3); border-radius: var(--radius-sm); margin-bottom: var(--space-2); }

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-8) 0;
  color: var(--color-text-muted);
}

/* Card */
.card {
  background: var(--color-bg-surface-2);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header { padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--color-border-default); }
.card-title { font-size: 16px; font-weight: 600; }
.card-body { padding: var(--space-6); }
.card-body--flush { padding: 0; }

/* ============================================
   Icons
   ============================================ */
.icon { width: 20px; height: 20px; display: inline-block; flex-shrink: 0; }
.icon-xs { width: 14px; height: 14px; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 48px; height: 48px; }
.icon-xl { width: 3rem; height: 3rem; }

/* ============================================
   Badge
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 20px;
  padding: 0 9px;
  font-size: 10px;
  font-weight: 500;
  border-radius: 4px;
  background: color-mix(in srgb, var(--color-accent) 18%, transparent);
  color: var(--color-accent);
  border: 1px solid color-mix(in srgb, var(--color-accent) 12%, transparent);
  line-height: 1;
  white-space: nowrap;
}

/* ============================================
   Button
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  background: color-mix(in srgb, var(--color-brand-electric) 15%, transparent);
  color: var(--color-brand-electric);
  border: 1px solid color-mix(in srgb, var(--color-brand-electric) 25%, transparent);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;

}
.btn:hover {
  background: color-mix(in srgb, var(--color-brand-electric) 25%, transparent);
  border-color: color-mix(in srgb, var(--color-brand-electric) 50%, transparent);
}
/* btn-danger — color variant */
.btn-danger { color: var(--color-danger); border-color: color-mix(in srgb, var(--color-danger) 25%, transparent); background: color-mix(in srgb, var(--color-danger) 10%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--color-danger) 20%, transparent); border-color: color-mix(in srgb, var(--color-danger) 50%, transparent); }
/* Legacy aliases (old Blade JS files) — remove when fully migrated to React */
.btn-primary, .btn-secondary, .btn-ghost, .btn-icon { }
.btn-icon { padding: var(--space-1); }

/* ── Assignees Panel (global shared partial) ── */
#assigneesPanel { overflow: visible; }
.assignee-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.375rem 0;
}
.assignee-item + .assignee-item {
    border-top: 1px solid var(--color-border-default);
}
.assignee-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.assignee-avatar img { width: 100%; height: 100%; object-fit: cover; }
.assignee-avatar span { font-size: 0.75rem; font-weight: 600; color: var(--color-text-inverse); }
.assignee-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.assignee-name {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.assignee-star { flex-shrink: 0; color: var(--color-text-muted); }
.assignee-star.is-primary { color: var(--color-warning); fill: var(--color-warning); }
button.assignee-star { opacity: 0;  }
button.assignee-star:hover { color: var(--color-warning); }
.assignee-item:hover button.assignee-star { opacity: 1; }
.assignee-actions {
    display: flex;
    gap: 0.125rem;
    flex-shrink: 0;
    opacity: 0;

}
.assignee-item:hover .assignee-actions { opacity: 1; }
.assignee-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    background: var(--color-bg-canvas);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 20;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 0.25rem;
}
#assigneeSearchWrap { position: relative; }
.assignee-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.625rem;
    cursor: pointer;
    font-size: 0.875rem;

}
.assignee-dropdown-item:hover { background: var(--color-bg-surface-3); }
.assignee-avatar-sm {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.assignee-avatar-sm img { width: 100%; height: 100%; object-fit: cover; }
.assignee-avatar-sm span { font-size: 0.625rem; font-weight: 600; color: var(--color-text-inverse); }
.assignee-dropdown-empty {
    padding: 0.75rem;
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

/* Button sizes */
.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}
.btn.btn-sm .icon { width: 14px; height: 14px; }

/* ============================================
   Sidebar Overlay (mobile)
   ============================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}
.sidebar-overlay.is-visible { display: block; }

/* ============================================
   Bottom Bar (mobile only)
   ============================================ */
.layout-bottombar { display: none; }

/* ============================================
   Responsive — Header compact (< 1200px)
   ============================================ */
@media (max-width: 1200px) {
}
@media (max-width: 1200px) {
}

/* ============================================
   Responsive — Tablet
   ============================================ */
@media (max-width: 1024px) {
  .header-module-nav { display: none; }
  .module-menu-toggle { display: flex; }
  .header-page-actions.in-module-panel { display: none; }
}

/* ============================================
   Responsive — Mobile
   ============================================ */
@media (max-width: 768px) {
  .layout-container {
    grid-template-columns: 1fr;
  }

  .layout-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    max-width: none;
    height: 100vh;
    height: 100dvh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform var(--motion-base) var(--ease-standard);
  }

  .layout-sidebar.is-open { transform: translateX(0); }

  /* Nav scrolls independently — keeps logo, system, profile always visible */
  .sidebar-nav {
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
  }

  /* Restore full sidebar on mobile (it's an overlay) */
  .nav-item-label,
  .sidebar-child-label,
  .sidebar-bottom .nav-item-label,
  .sidebar-profile-name,
  .sidebar-meta {
    opacity: 1;
    pointer-events: auto;
    transition: none;
  }
  .nav-item { justify-content: flex-start; padding: 5px 8px; }
  .nav-item .badge { display: inline-flex; }
  .sidebar-child-list,
  .sidebar-collapsed .sidebar-child-list { display: flex; align-items: stretch; padding-left: 0; }
  .sidebar-child-item,
  .sidebar-collapsed .sidebar-child-item { justify-content: flex-start; width: auto; padding: 4px 8px; }
  .sidebar-section { padding: 8px; }
  .sidebar-profile {
    justify-content: flex-start;
    padding: var(--space-2) var(--space-4);
  }

  .layout-bottombar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--color-bg-surface-2);
    border-top: 1px solid var(--color-border-default);
    z-index: 998;
    justify-content: space-around;
    align-items: center;
  }

  .bottombar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    color: var(--color-text-secondary);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    padding: var(--space-1);
  }

  .bottombar-item.is-active { color: var(--color-accent); }

  .layout-main {
    overflow: visible;
    min-width: 0;
    width: 100%;
  }
  .layout-content {
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    overflow-x: hidden;
    display: block;
  }
  .content-wrapper {
    display: block;
    min-height: auto;
    padding: 0;
    margin: 0 8px 8px 8px;
  }
  .content-main {
    min-height: auto;
    overflow: visible;
    display: block;
  }
  .dt {
    max-height: none;
    flex: none;
  }
  .dt-table-wrap {
    overflow-x: auto;
    overflow-y: visible;
  }

  .profile-name { display: none; }

  /* Offcanvas full-width on mobile */
  .offcanvas-panel { width: 100%; }
  .header-global-actions { border-left: none; gap: 0; }

  /* Spotlight fullwidth on mobile */
  .spotlight-dialog {
    max-width: none;
    margin: 0 var(--space-2);
  }

  /* Reduce content padding on mobile */
  .content-wrapper {
    padding: 0;
    margin: 0 var(--space-2) var(--space-2);
    gap: var(--space-4);
  }

  /* Reduce header padding on mobile */
  .layout-header {
    padding: 0 var(--space-4);
    gap: var(--space-2);
  }

  /* Tabs: horizontal scroll on mobile */
  .tabs-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }
  .tabs-nav::-webkit-scrollbar { display: none; }
  .tab-btn { white-space: nowrap; flex-shrink: 0; }

  /* Breadcrumbs: truncate long items */
  .breadcrumbs { min-width: 0; overflow: hidden; }
  .breadcrumb-item {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
  }
  .breadcrumb-item.is-current {
    max-width: 110px;
  }

  /* Hero: stack vertically on mobile */
  .contact-hero-row { flex-direction: column; text-align: center; }
  .contact-hero-meta { justify-content: center; flex-wrap: wrap; }
  .contact-hero-avatar { width: 56px; height: 56px; }
  .contact-hero-avatar span { font-size: 1.25rem; }

  /* Detail list: two-column but tighter on mobile */
  .detail-list {
    grid-template-columns: 100px 1fr;
    gap: 0.25rem 0.5rem;
  }

  /* Modal: near full-width on mobile */
  .modal { max-width: calc(100vw - 2 * var(--space-4)); }
  .modal-lg { max-width: calc(100vw - 2 * var(--space-2)); }

  /* Timeline controls: stack on mobile */
  .timeline-controls { gap: var(--space-2); }
  .timeline-controls-filters { flex-wrap: nowrap; width: 100%; justify-content: stretch; }
  .timeline-controls-note { width: 100%; }

  /* Timeline toggle groups: stretch to fill row */
  .timeline-controls-filters .timeline-toggle-group { flex: 1; min-width: 0; }
  .timeline-controls-filters .timeline-toggle-btn { flex: 1; justify-content: center; padding: 6px 4px; }

}

/* ============================================
   Profile Page
   ============================================ */
.profile-avatar-section {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
  padding: var(--space-4);
  border: 2px dashed var(--color-border-default);
  border-radius: var(--radius-lg);

}

.profile-avatar-section.drag-over {
  border-color: var(--color-accent);
  background: color-mix(in srgb, var(--color-brand-electric) 5%, transparent);
}

.profile-avatar-lg {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}

.profile-avatar-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-upload-area {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

/* ============================================
   Form Controls
   ============================================ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
.form-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.form-control {
  width: 100%;
  padding: var(--space-2) var(--space-4);
  background: var(--color-bg-surface-3);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;

}

.form-control:focus {
  border-color: var(--color-accent);
}

.form-control.form-readonly {
  opacity: 0.6;
  cursor: not-allowed;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a0a0a0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-help {
  font-size: 12px;
  color: var(--color-text-muted);
}

.form-actions {
  margin-top: var(--space-6);
  display: flex;
  justify-content: flex-end;
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  background: var(--color-bg-surface-2);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  font-size: 14px;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(100%);

}

.toast-visible {
  opacity: 1;
  transform: translateX(0);
}





/* ============================================
   Profile Responsive
   ============================================ */
@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .profile-avatar-section {
    flex-direction: column;
    text-align: center;
  }

  .toast-container {
    right: var(--space-2);
    left: var(--space-2);
  }

  .toast {
    transform: translateY(-100%);
  }

  .toast-visible {
    transform: translateY(0);
  }
}

/* Profile toggle as link */
a.profile-toggle {
  text-decoration: none;
}

a.profile-toggle.is-active {
  background: var(--color-bg-surface-3);
}

/* Profile logout section */
.profile-logout {
  display: flex;
  justify-content: center;
  padding-top: var(--space-2);
}

.profile-logout-btn {
  color: var(--color-danger);
  gap: var(--space-2);
}

.profile-logout-btn:hover {
  background: color-mix(in srgb, var(--color-danger) 10%, transparent);
  color: var(--color-danger);
}

/* ============================================
   Users Page
   ============================================ */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}
.page-header h1 { margin: 0; }

.page-actions {
  display: flex;
  gap: var(--space-2);
}



.filter-select {
  width: auto;
  min-width: 140px;
}

/* ============================================
   Data Table
   ============================================ */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: var(--space-2) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-border-default);
  font-size: 13px;
}

.data-table th {
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-bg-surface-2);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.data-table tbody tr {

}
.data-table tbody tr:hover {
  background: var(--color-bg-hover);
}
.data-table tbody tr.is-selected {
  background: var(--color-bg-selected);
  box-shadow: inset 3px 0 0 var(--color-brand-primary);
}





.avatar-sm {
  width: 32px;
  height: 32px;
}

.avatar-sm img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

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




/* Status dots */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: var(--space-1);
}

.status-active { background: var(--color-success); }

/* Badge variants */
.badge-default {
  background: var(--color-bg-surface-3);
  color: var(--color-text-secondary);
}

.badge-accent {
  background: var(--color-accent);
  color: white;
}

.badge-danger {
  background: var(--color-danger);
  color: white;
}

.badge-sm {
  font-size: 10px;
  height: 16px;
  min-width: 14px;
  padding: 0 4px;
}

/* Utility badge fallback colors — translucent style */
.badge-new { background: color-mix(in srgb, var(--color-status-new) 18%, transparent); color: var(--color-status-new); border-color: color-mix(in srgb, var(--color-status-new) 12%, transparent); }
.badge-in_progress { background: color-mix(in srgb, var(--color-status-progress) 18%, transparent); color: var(--color-status-progress); border-color: color-mix(in srgb, var(--color-status-progress) 12%, transparent); }
.badge-completed { background: color-mix(in srgb, var(--color-status-completed) 18%, transparent); color: var(--color-status-completed); border-color: color-mix(in srgb, var(--color-status-completed) 12%, transparent); }
.badge-cancelled { background: color-mix(in srgb, var(--color-bg-surface-3) 60%, transparent); color: var(--color-text-secondary); border-color: var(--color-border-default); }
.badge-active { background: color-mix(in srgb, var(--color-success) 18%, transparent); color: var(--color-success); border-color: color-mix(in srgb, var(--color-success) 12%, transparent); }
.badge-danger { background: color-mix(in srgb, var(--color-danger) 18%, transparent); color: var(--color-danger); border-color: color-mix(in srgb, var(--color-danger) 12%, transparent); }
.badge-warning { background: color-mix(in srgb, var(--color-warning) 18%, transparent); color: var(--color-warning); border-color: color-mix(in srgb, var(--color-warning) 12%, transparent); }
.badge-info { background: color-mix(in srgb, var(--color-accent) 18%, transparent); color: var(--color-accent); border-color: color-mix(in srgb, var(--color-accent) 12%, transparent); }
.badge-success { background: color-mix(in srgb, var(--color-success) 18%, transparent); color: var(--color-success); border-color: color-mix(in srgb, var(--color-success) 12%, transparent); }
.badge-priority-low { background: color-mix(in srgb, var(--color-priority-low) 18%, transparent); color: var(--color-priority-low); border-color: color-mix(in srgb, var(--color-priority-low) 12%, transparent); }
.badge-priority-normal { background: color-mix(in srgb, var(--color-priority-normal) 18%, transparent); color: var(--color-priority-normal); border-color: color-mix(in srgb, var(--color-priority-normal) 12%, transparent); }
.badge-priority-high { background: color-mix(in srgb, var(--color-priority-high) 18%, transparent); color: var(--color-priority-high); border-color: color-mix(in srgb, var(--color-priority-high) 12%, transparent); }
.badge-priority-urgent { background: color-mix(in srgb, var(--color-priority-critical) 18%, transparent); color: var(--color-priority-critical); border-color: color-mix(in srgb, var(--color-priority-critical) 12%, transparent); }

/* ============================================
   Utility Classes
   ============================================ */
.flex-row { display: flex; align-items: center; gap: 8px; }
.flex-row-between { display: flex; justify-content: space-between; align-items: center; }
.flex-col { display: flex; flex-direction: column; gap: 8px; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* Progress bar */
.progress-bar-wrap {
  height: 6px;
  background: var(--color-bg-surface-3);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--color-accent);
  border-radius: 3px;

}

/* Tab toolbar (action bar above tab table) */
.tab-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
  display: flex;
  gap: 2px;
  justify-content: center;
}

.pagination-item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--color-text-secondary);
  text-decoration: none;

}

.pagination-item:hover:not(.pagination-disabled):not(.pagination-active) {
  background: var(--color-bg-surface-3);
  color: var(--color-text-primary);
}

.pagination-active {
  background: var(--color-accent);
  color: white;
}

.pagination-disabled {
  opacity: 0.4;
  cursor: default;
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.is-open,
.modal-overlay.is-closing {
  display: flex;
}

.modal {
  background: var(--color-bg-surface-2);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,0.3);
}


.modal-sm { max-width: 400px; }
.modal-lg { max-width: 700px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border-default);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  font-size: 20px;
  line-height: 1;
  padding: var(--space-1);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;

}
.modal-close:hover {
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
}

.modal-body {
  padding: var(--space-6);
}
.modal-body-scroll {
  max-height: calc(90vh - 60px);
  overflow-y: auto;
}

.modal-body .form-group {
  margin-bottom: var(--space-4);
}

.modal-body .form-actions {
  margin-top: var(--space-6);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border-default);
}

/* ── Quick Preview Modal ── */
.modal-footer.qp-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border-default);
}

/* ── QP Task-specific styles ── */

/* ── QP Inline dropdown ── */

/* ── DaData Suggest Dropdown ── */
.dadata-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--color-bg-surface-2);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  max-height: 320px;
  overflow-y: auto;
  margin-top: 4px;
}
.dadata-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border-default);

}
.dadata-item:last-child { border-bottom: none; }
.dadata-item:hover { background: var(--color-bg-surface-3); }
.dadata-item-name {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.dadata-item-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-top: 2px;
}
.dadata-item-address {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}
.dadata-item-mgmt {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  margin-top: 2px;
  font-style: italic;
}
.dadata-status {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.dadata-status-active {
  background: color-mix(in srgb, var(--color-success) 15%, transparent);
  color: var(--color-success);
}
.dadata-status-liquidated {
  background: color-mix(in srgb, var(--color-danger) 15%, transparent);
  color: var(--color-danger);
}

/* ── Toggle Switch (settings) ── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--color-bg-surface-3);
  border-radius: 22px;

}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: var(--color-text-secondary);
  border-radius: 50%;

}
.toggle-switch input:checked + .toggle-slider {
  background: var(--color-accent);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: var(--color-bg-elevated);
}

/* ============================================
   Form page extras
   ============================================ */
.users-form-page {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.users-form-page form {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.form-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-4);
}

.form-actions-right {
  display: flex;
  gap: var(--space-2);
}

.form-error {
  font-size: 12px;
  color: var(--color-danger);
  margin-top: var(--space-1);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* ============================================
   Users Responsive
   ============================================ */
@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-actions {
    justify-content: flex-end;
  }

  .users-filters {
    flex-direction: column;
  }

  .filter-select {
    width: 100%;
  }

  .data-table th:nth-child(n+4),
  .data-table td:nth-child(n+4) {
    display: none;
  }

  .form-actions-bar {
    flex-direction: column;
    gap: var(--space-4);
  }
}

/* ============================================
   Utilities
   ============================================ */

/* Display */
.d-none { display: none; }
.d-flex { display: flex; }
.d-grid { display: grid; }

/* Flex */
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

/* Text */
.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-primary { color: var(--color-accent); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-xs { font-size: 0.6875rem; }
.text-sm { font-size: 0.75rem; }
.text-base { font-size: 0.8125rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.5rem; }
.text-2xl { font-size: 2rem; }
.text-3xl { font-size: 2.5rem; }

/* Font weight */
.fw-600 { font-weight: 600; }

/* Sizing */
.w-full { width: 100%; }
.max-w-md { max-width: 480px; }
.max-w-xl { max-width: 720px; }

/* Spacing resets */
.p-0 { padding: 0; }
.m-0 { margin: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }

/* Background */
.bg-muted { background: var(--color-bg-surface); }
.bg-secondary { background: var(--color-bg-surface-2); }
.bg-tertiary { background: var(--color-bg-surface-3); }

/* Position */

/* Overflow */
.overflow-hidden { overflow: hidden; }

/* Text truncation */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Border */
.border-0 { border: none; }
.border-top { border-top: 1px solid var(--color-border-default); }

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* Compound utility patterns — analytics/stats */
.stat-label { font-size: 0.6875rem; color: var(--color-text-muted); margin-bottom: 4px; }
.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-value-xl { font-size: 2.5rem; font-weight: 700; }
.stat-hint { font-size: 0.75rem; color: var(--color-text-muted); margin-top: 4px; }
.card-section-header { display: flex; justify-content: space-between; align-items: center; }
.icon-xs { width: 14px; height: 14px; }
.icon-sm { width: 20px; height: 20px; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-4); }
.metric-grid-sm { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-2); }
.metric-row { display: flex; align-items: center; gap: 8px; }
.progress-bar-bg { background: var(--color-bg-surface-2); border-radius: 4px; overflow: hidden; }
.progress-bar-bg-sm { height: 24px; }
.progress-bar-bg-md { height: 28px; }
.progress-bar-fill { height: 100%; border-radius: 4px; display: flex; align-items: center; padding-left: 8px; font-size: 0.6875rem; color: var(--color-text-inverse); font-weight: 600;  }
.form-select-compact { max-width: 220px; }
.overflow-x-auto { overflow-x: auto; }
.metric-row-label { width: 120px; flex-shrink: 0; }
.metric-row-label-sm { width: 60px; flex-shrink: 0; }
.metric-row-label-lg { width: 160px; flex-shrink: 0; }
.table-section-divider { border-top: 2px solid var(--color-border-default); }
.skeleton-block { background: var(--color-bg-surface-2); border-radius: 4px; }
.metric-info-content { font-size: 0.875rem; line-height: 1.6; }

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ── Avatar Upload Section ── */
.avatar-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}


/* ── Code Editor (reusable syntax-highlighted textarea) ── */
.code-editor {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  tab-size: 4;
  white-space: pre;
  resize: vertical;
  background: var(--color-bg-canvas);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  color: var(--color-text-primary);
}
.code-editor:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 15%, transparent);
}

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border-default);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: tw-spin 0.6s linear infinite;
}
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
@keyframes tw-spin { to { transform: rotate(360deg); } }
.btn.is-loading { opacity: 0.7; pointer-events: none; }

/* ── Avatar Picker Modal ── */
.avatar-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: var(--space-2);
  max-height: 320px;
  overflow-y: auto;
}

.avatar-picker-item {
  cursor: pointer;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  overflow: hidden;

  text-align: center;
}

.avatar-picker-item:hover {
  border-color: var(--color-accent);
}

.avatar-picker-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.avatar-picker-name {
  display: block;
  font-size: .6875rem;
  padding: .25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: .5;
}

.avatar-picker-loading,
.avatar-picker-empty {
  text-align: center;
  padding: 2rem;
  opacity: .4;
  font-size: .875rem;
}

/* ============================================
   Show Page — Shared Detail Layout
   Used by: tasks, projects, contacts, companies, users, files
   ============================================ */

/* .contact-detail-layout / .contact-detail-sidebar / .contact-detail-content / .contact-sidebar-panels — moved to modules/Contacts/Resources/css/contacts.css (Фаза D3, 2026-04-22) */

/* Sidebar panel */
.sidebar-panel .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* Collapsible sidebar panels */
.sidebar-panel .card-header {  }
.sidebar-panel.is-collapsed .sidebar-panel-chevron { transform: rotate(-90deg); }
.sidebar-panel.is-collapsed .card-header { border-bottom-color: transparent; }
.sidebar-panel > .card-body {
    opacity: 1;
}
.sidebar-panel.is-collapsible > .card-body {
    overflow: hidden;

    max-height: 2000px;
}
.sidebar-panel.is-collapsed > .card-body {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
}

/* .contact-hero-* — moved to modules/Contacts/Resources/css/contacts.css (Фаза D3, 2026-04-22) */

/* Table Hero (compact entity header with dot + title + meta) */
.table-hero .card-body { padding: var(--space-4) var(--space-6); }
.table-hero-title { display: flex; align-items: center; gap: 0.5rem; font-size: 1.25rem; font-weight: 600; margin: 0; }
.table-hero-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.375rem; font-size: 0.875rem; }
.table-hero-meta-left { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* Tabs */
.tabs-nav { display: flex; gap: 0; overflow: hidden; }
.tab-btn {
  background: none; border: none; padding: 0.75rem 1rem;
  color: var(--color-text-secondary); cursor: pointer;
  border-bottom: 2px solid transparent;

  text-decoration: none; font-family: inherit;
  overflow: hidden; white-space: nowrap;
}
.tab-btn:hover { color: var(--color-text-primary); }
.tab-btn.is-active { color: var(--color-accent); border-bottom-color: var(--color-accent); }
.tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.25rem; height: 1.25rem; padding: 0 0.375rem;
  border-radius: 0.625rem; font-size: 0.6875rem; font-weight: 600; line-height: 1;
  background: var(--color-bg-surface-3); color: var(--color-text-secondary);
  margin-left: 0.375rem; vertical-align: middle;
}
.tab-btn.is-active .tab-badge { background: color-mix(in srgb, var(--color-accent) 15%, transparent); color: var(--color-accent); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* Detail list */
dt.detail-list-full { margin-top: 0.25rem; }
dd.detail-list-full { margin: 0; }

/* Detail Fields v2 — vertical stacked layout */

/* Phone field with timezone */

/* Collapsible "Дополнительно" */

/* Timeline block (lines 3983-4335) moved to xacss/components/timeline.css (Фаза E2, 2026-04-22) */


@media (max-width: 768px), (min-width: 769px) and (max-width: 1024px) and (max-aspect-ratio: 4/3) {
  .contact-detail-layout { flex-direction: column; width: 100%; }
  .contact-detail-sidebar { position: static; width: 100% !important; min-width: 0; max-width: none; }
  .contact-detail-content { margin-left: 0; margin-top: var(--space-4); width: 100%; min-width: 0; }
  .detail-resize-handle { display: none; }
  .contact-sidebar-panels { position: static; }


  /* Tab toolbar buttons: full width */
  .tab-toolbar { flex-direction: column; }
  .tab-toolbar .btn { width: 100%; justify-content: center; }

  /* Tab content: full width */
  .tab-panel { width: 100%; overflow: hidden; }
  .tab-panel .tt { width: 100%; }
  .tab-panel .tt-table-view { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ============================================
   Import / Export Pages
   ============================================ */





/* Steps indicator */






/* Dropzone */


/* Mapping table */


/* Preview table */



/* Result */







@media (max-width: 768px) {
  .ie-fields-grid { grid-template-columns: 1fr; }
  .ie-steps { gap: var(--space-1); }
  .ie-step-label { display: none; }
  .ie-step-line { flex: 0 0 20px; }
}

/* ============================================
   Flash Messages
   ============================================ */
.flash-message {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  margin: var(--space-4) var(--space-4) 0;
  border-radius: var(--radius-md);
  font-size: 0.875rem;

}
.flash-message .icon { width: 18px; height: 18px; flex-shrink: 0; }
.flash-message span { flex: 1; }
.flash-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.25rem; line-height: 1; padding: 0 4px;
  opacity: 0.6;
}
.flash-close:hover { opacity: 1; }
.flash-success {
  background: color-mix(in srgb, var(--color-success) 15%, transparent);
  color: var(--color-success);
  border: 1px solid color-mix(in srgb, var(--color-success) 30%, transparent);
}
.flash-error {
  background: color-mix(in srgb, var(--color-danger) 15%, transparent);
  color: var(--color-danger);
  border: 1px solid color-mix(in srgb, var(--color-danger) 30%, transparent);
}
.flash-warning {
  background: color-mix(in srgb, var(--color-warning) 15%, transparent);
  color: var(--color-warning);
  border: 1px solid color-mix(in srgb, var(--color-warning) 30%, transparent);
}


/* Toast container — fixed top-right, above everything */
.toast-container {
  position: fixed;
  top: var(--spacing-md, 1rem);
  right: var(--spacing-md, 1rem);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm, 0.5rem);
  max-width: 420px;
  pointer-events: none;
}
.toast-container .flash-message {
  margin: 0;
  pointer-events: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ═══════════════════════════════════════════════════════════
   Spacing & Layout Utilities
   ═══════════════════════════════════════════════════════════ */
.mt-sm { margin-top: var(--space-2); }
.mt-md { margin-top: var(--space-4); }
.mt-lg { margin-top: var(--space-6); }
.mb-sm { margin-bottom: var(--space-2); }
.mb-md { margin-bottom: var(--space-4); }
.mb-lg { margin-bottom: var(--space-6); }

.form-group-narrow { max-width: 400px; }


.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  cursor: pointer;
}

.action-buttons {
  display: flex;
  gap: 4px;
}


.text-secondary {
  color: var(--color-text-secondary);
}

.text-xs {
  font-size: 12px;
}

/* ============================================
   Sales Page Layout with Nav Sidebar
   ============================================ */
.sp-page-layout {
  display: flex;
  gap: 0;
  align-items: flex-start;
}
.sp-page-content {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.sp-page-sidebar {
  width: 245px;
  min-width: 200px;
  flex-shrink: 0;
  margin-left: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.sp-page-sidebar--scrollable {
  align-self: flex-start;
}
.sp-nav-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sp-nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.sp-nav-link:hover {
  background: var(--color-bg-surface-3);
  color: var(--color-text-primary);
}
.sp-nav-link .icon {
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.sp-nav-link:hover .icon {
  color: var(--color-accent);
}
.sp-nav-link-active {
  background: var(--color-bg-surface-3);
  color: var(--color-text-primary);
  font-weight: 500;
}
.sp-nav-link-active .icon {
  color: var(--color-accent);
}
.sp-nav-heading {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  padding: 8px 12px 2px;
  margin-top: 2px;
}
.sp-nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sp-nav-divider {
  height: 1px;
  background: var(--color-border-default);
  margin: 6px 0;
}

/* Nav children (tree-line style) */
.sp-nav-children {
  position: relative;
  margin-left: 20px;
  padding-left: 12px;
}
.sp-nav-children::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--color-border-default);
}
.sp-nav-child {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  opacity: 0.6;
  color: var(--color-text-secondary);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.sp-nav-child::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  width: 10px;
  height: 1px;
  background: var(--color-border-default);
}
.sp-nav-child:last-child::after {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  bottom: -1px;
  width: 1px;
  background: var(--color-bg-app);
}
.sp-nav-child:hover {
  opacity: 1;
}
.sp-nav-child.sp-nav-link-active {
  opacity: 1;
  color: var(--color-text-primary);
  font-weight: 500;
}
.sp-nav-child .sp-nav-dot {
  width: 6px;
  height: 6px;
}
.sp-page-sidebar-wide {
  width: 300px;
  min-width: 260px;
}
.sp-page-sidebar-wide .contact-sidebar-panels {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
@media (max-width: 768px), (min-width: 769px) and (max-width: 1024px) and (max-aspect-ratio: 4/3) {
  .sp-page-layout { flex-direction: column; }
  .sp-page-sidebar { width: 100%; margin-left: 0; margin-top: var(--space-4); }
  .sp-page-sidebar-wide { width: 100%; min-width: 0; }
}

/* Analytics @media rules moved to modules/Analytics/Resources/css/analytics.css (Фаза E3, 2026-04-22) */

/* ============================================
   Documents Module — Shared Components
   ============================================ */

/* Tab section header (title + actions inline) */

/* Brief / form data grid */

/* Revision timeline items */

/* File list items */
.file-list-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.file-list-item + .file-list-item { border-top: 1px solid var(--color-border-default); }

/* Code preview block */

/* Monospace form textareas */
.form-control-mono { font-family: var(--font-mono); font-size: 0.85rem; }

/* Narrow form card (centered, max 900px) */
.form-card-narrow { max-width: 900px; margin: 0 auto; }

/* Signature preview in forms */

/* ============================================
   Relations Tab — grouped entity cards
   ============================================ */
.relations-tab { display: flex; flex-direction: column; gap: 0.75rem; }
.relations-tab { display: flex; flex-direction: column; gap: 8px; }
.relations-group { border: 1px solid var(--color-border-default); border-radius: var(--radius-md); overflow: hidden; }
.relations-group.is-empty { display: none; }
.relations-group-header {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer; user-select: none;

}
.relations-group-header:hover { background: var(--color-bg-surface-3); }
.relations-group-label { font-weight: 500; font-size: 12px; color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.03em; }
.relations-group-count {
  font-size: 11px; color: var(--color-text-muted);
  background: var(--color-bg-surface-3); border-radius: 10px;
  padding: 0 6px; min-width: 18px; text-align: center; line-height: 1.5;
}
.relations-group-chevron {  color: var(--color-text-secondary); margin-left: auto; }
.relations-group.is-expanded .relations-group-chevron { transform: rotate(180deg); }

/* Body hidden by default, shown only when JS adds .is-expanded */
.relations-group-body { display: none; }
.relations-group.is-expanded .relations-group-body { display: block; }

.relations-cards-list { display: flex; flex-direction: column; }
.rc-empty { padding: 8px 12px; font-size: 12px; color: var(--color-text-muted); }

/* Relation card */
.relation-card {
  display: block; position: relative;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border-default);
  cursor: pointer;
  text-decoration: none; color: inherit;
}
.relation-card:last-child { border-bottom: none; }
.relation-card:hover { background: var(--color-bg-surface-3); }

.rc-stripe {
  position: absolute; left: 0; top: 4px; bottom: 4px; width: 2px; border-radius: 1px;
}
.rc-title {
  font-size: 13px; font-weight: 500; color: var(--color-text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.relation-card:hover .rc-title { color: var(--color-accent); }

/* Field rows */
.rc-rows { margin-top: 4px; }
.rc-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1px 0; gap: 8px;
}
.rc-row-label {
  font-size: 11px; color: var(--color-text-muted); flex-shrink: 0;
}
.rc-row-value {
  font-size: 11px; color: var(--color-text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: right; min-width: 0;
}
.rc-row-value.is-bold { font-weight: 600; color: var(--color-text-primary); }
.rc-row-value .rc-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  margin-right: 4px; vertical-align: middle;
}

/* Status tags */
.rc-tag {
  font-size: 10px; font-weight: 500; padding: 0 5px; border-radius: 3px;
  line-height: 1.6; white-space: nowrap;
}
.rc-tag--new { background: color-mix(in srgb, var(--color-brand-electric) 10%, transparent); color: var(--color-brand-electric); }
.rc-tag--in_progress { background: color-mix(in srgb, var(--color-warning) 10%, transparent); color: var(--color-warning); }
.rc-tag--active { background: color-mix(in srgb, var(--color-success) 10%, transparent); color: var(--color-success); }
.rc-tag--danger { background: color-mix(in srgb, var(--color-danger) 10%, transparent); color: var(--color-danger); }

/* Relations tab header */
.relations-tab-header { padding: 0 0 8px; }

/* Add relation panel */
.arp-body { padding: 12px; }
.arp-types { display: flex; flex-direction: column; gap: 4px; }
.arp-type-btn {
  display: block; width: 100%; text-align: left;
  padding: 10px 12px; font-size: 13px; font-weight: 500;
  background: none; border: 1px solid var(--color-border-default); border-radius: var(--radius-sm);
  color: var(--color-text-primary); cursor: pointer;

}
.arp-type-btn:hover { background: var(--color-bg-surface-3); border-color: var(--color-accent); }

.arp-search { display: flex; gap: 8px; margin-bottom: 8px; }
.arp-search-input {
  flex: 1; padding: 8px 10px; font-size: 13px;
  background: var(--color-bg-surface-3); border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm); color: var(--color-text-primary);
  outline: none; font-family: inherit;
}
.arp-search-input:focus { border-color: var(--color-accent); }
.arp-back {
  padding: 8px 10px; font-size: 11px; font-weight: 500;
  background: none; border: 1px solid var(--color-border-default); border-radius: var(--radius-sm);
  color: var(--color-text-muted); cursor: pointer; white-space: nowrap;

}
.arp-back:hover { border-color: var(--color-accent); color: var(--color-text-primary); }

.arp-create-btn {
  display: block; width: 100%; text-align: center;
  padding: 8px 12px; margin-bottom: 8px; font-size: 13px; font-weight: 500;
  background: none; border: 1px dashed var(--color-border-default); border-radius: var(--radius-sm);
  color: var(--color-accent); cursor: pointer;

}
.arp-create-btn:hover { background: color-mix(in srgb, var(--color-brand-electric) 5%, transparent); border-color: var(--color-accent); }
.arp-results { display: flex; flex-direction: column; gap: 2px; }
.arp-result-btn {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; font-size: 13px;
  background: none; border: 1px solid var(--color-border-default); border-radius: var(--radius-sm);
  color: var(--color-text-primary); cursor: pointer;

  text-align: left; width: 100%;
}
.arp-result-btn:hover { background: var(--color-bg-surface-3); border-color: var(--color-accent); }
.arp-result-btn:disabled { opacity: 0.5; cursor: wait; }
.arp-result-name { font-weight: 500; }
.arp-result-id { font-size: 11px; color: var(--color-text-muted); }
.arp-hint { padding: 12px; font-size: 12px; color: var(--color-text-muted); text-align: center; }

.relation-card-add {
  display: flex; align-items: center; justify-content: center;
  border-style: dashed; border-color: var(--color-border-default);
  cursor: pointer;
  min-height: 60px; color: var(--color-text-secondary);
  background: transparent;
}
.relation-card-add:hover {
  border-color: var(--color-accent); background: var(--color-bg-surface-2);
  color: var(--color-accent);
}

.relations-tab-footer {
  display: flex; justify-content: center; padding-top: 0.25rem;
}

/* Project card + task tree */
.project-card-progress { height: 4px; margin-top: 0.25rem; }
.project-task-tree { display: flex; flex-direction: column; gap: 1px; margin-top: 0.5rem; }
.project-task-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.75rem; padding-left: calc(0.75rem + var(--depth, 0) * 1.25rem);
  border-radius: var(--radius-sm);
  text-decoration: none; color: inherit;
}
.project-task-item:hover { background: var(--color-bg-surface-2); }
.project-task-status {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--color-border-default);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.project-task-status .icon { width: 12px; height: 12px; }
.project-task-status--completed { border-color: var(--color-success); background: var(--color-success); color: var(--color-text-inverse); }
.project-task-status--in_progress { border-color: var(--color-accent); }
.project-task-status--cancelled { border-color: var(--color-text-muted); }
.project-task-title { flex: 1; min-width: 0; font-size: 0.875rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-task-title--done { text-decoration: line-through; color: var(--color-text-muted); }
.project-task-badges { display: flex; align-items: center; gap: 0.375rem; flex-shrink: 0; }

.relation-wizard-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.5rem;
}
.relation-wizard-option {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1rem; border: 1px solid var(--color-border-default); border-radius: var(--radius-md);
  background: var(--color-bg-app); cursor: pointer;
  font-size: 0.85rem; color: var(--color-text-primary); text-align: left;
}
.relation-wizard-option:hover {
  border-color: var(--color-accent); background: var(--color-bg-surface-2);
}
.relation-wizard-option .icon { flex-shrink: 0; color: var(--color-accent); }

@media (max-width: 768px) {
  .relations-cards-list { /* already column layout */ }
  .relation-wizard-grid { grid-template-columns: 1fr; }
}

/* ── Template editor (3-column layout) ── */
.tpl-editor {
  --tpl-gap: var(--space-2);
  --tpl-sidebar: 300px;
  display: grid;
  grid-template-columns: 300px 1fr 300px;
  gap: var(--space-2);
  min-height: calc(100vh - 120px);
  align-items: start;
}
.tpl-editor .card { max-width: none; }

/* Uniform spacing between stacked cards in all 3 columns */
.tpl-editor-settings,
.tpl-editor-center,
.tpl-editor .sp-page-sidebar-tags {
  display: flex; flex-direction: column; gap: var(--space-2);
}

/* Override default sp-page-sidebar gap inside tpl-editor */
.tpl-editor .sp-page-sidebar {
  gap: var(--space-2); margin-left: 0; width: auto; min-width: 0;
}

/* Compact card padding inside editor */
.tpl-editor .card-header { padding: var(--space-2) var(--space-4); }
.tpl-editor .card-body { padding: var(--space-4); }

.tpl-editor-settings .card-body {
  display: flex; flex-direction: column; gap: var(--space-2);
}
.tpl-editor-settings .form-group { margin-bottom: 0; }

.tpl-editor-center { min-width: 0; }
.tpl-editor-body { flex: 1; display: flex; flex-direction: column; }
.tpl-content-textarea {
  flex: 1; min-height: 400px; resize: vertical;
  font-family: var(--font-mono); font-size: 0.8rem;
  line-height: 1.5; tab-size: 2;
}
/* CodeMirror inside template editor */
.tpl-editor .CodeMirror {
  height: 100%; min-height: 400px;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}
.tpl-editor-body .CodeMirror { height: 100%; }
.tpl-editor .CodeMirror-gutters { background: transparent; border-right: 1px solid var(--color-border-default); }
.tpl-editor .CodeMirror-linenumber { color: var(--color-text-muted); }

/* Upload zone */
.tpl-upload-zone {
  display: flex; flex-direction: column; align-items: center;
  gap: var(--space-4); padding: var(--space-6);
}
.tpl-upload-placeholder {
  display: flex; flex-direction: column; align-items: center;
  gap: var(--space-2); padding: var(--space-6);
  color: var(--color-text-muted); text-align: center;
}
.tpl-upload-placeholder p { margin: 0; font-size: 0.85rem; }
.tpl-file-info {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: var(--color-bg-surface-2);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  width: 100%;
}
.tpl-file-name { flex: 1; font-weight: 500; font-size: 0.85rem; }

.btn-block { width: 100%; }

@media (max-width: 1100px) {
  .tpl-editor { grid-template-columns: 1fr; }
  .tpl-content-textarea { min-height: 300px; }
}

/* Collapsible toggle (clickable card-header) */


.tags-group {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
}
.tags-hint {
  font-size: 0.8rem; color: var(--color-text-muted); margin: 0;
}

.tag-copy-btn {
  display: inline-block; padding: 0.2rem 0.5rem;
  font-size: 0.75rem; font-family: var(--font-mono);
  background: var(--color-bg-surface-2); border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm); cursor: pointer;
  color: var(--color-text-primary);
  line-height: 1.4; white-space: nowrap;
}
.tag-copy-btn:hover {
  background: var(--color-accent-bg, color-mix(in srgb, var(--color-brand-electric) 8%, transparent));
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.tag-copy-btn.tag-copied {
  background: var(--color-success-bg, color-mix(in srgb, var(--color-success) 10%, transparent));
  border-color: var(--color-success);
  color: var(--color-success);
}





/* ============================================
   DataTable — Filter Presets
   ============================================ */
.dt-filter-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-bottom: var(--spacing-md, 16px);
  margin-bottom: var(--spacing-md, 16px);
  border-bottom: 1px solid var(--color-border-default);
}

.dt-preset-btn {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border: 1px solid var(--color-border-default);
  border-radius: 16px;
  background: var(--color-bg-canvas);
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
  white-space: nowrap;
  cursor: pointer;

  line-height: 1.4;
}
.dt-preset-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-text-primary);
}
.dt-preset-btn.is-active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-text-inverse);
}
.dt-preset-btn.is-default:not(.is-active) {
  border-color: var(--color-accent);
}
.dt-preset-add {
  font-size: 1rem;
  padding: 4px 10px;
  color: var(--color-text-muted);
}
.dt-preset-add:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* ═══════════ Label Editor ═══════════ */
.label-editor-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(100vh - 64px);
  overflow: hidden;
}
.label-editor-panel {
  overflow-y: auto;
  padding: 0;
  scrollbar-width: thin;
}
.form-control-sm {
  padding: 4px 8px;
  font-size: 13px;
  height: 30px;
}
select.form-control-sm {
  padding-right: 24px;
}
.label-editor-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: var(--space-6);
  scrollbar-width: thin;
}
.label-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;

}
.label-thumb:hover {
  border-color: var(--color-border-default);
}
.label-thumb.active {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-brand-electric) 15%, transparent);
}
.label-preview {
  border-radius: 6px;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.25));
}
@media (max-width: 900px) {
  .label-editor-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .label-editor-panel {
    max-height: 50vh;
    border-bottom: 1px solid var(--color-border-default);
  }
}

/* ─── Label Editor v2 (le-*) ─── */

/* Compact inputs inside editor */

/* Field cards */

/* Preview stage */
.label-editor-stage {
  background: color-mix(in srgb, var(--color-bg-surface-3) 70%, var(--color-bg-app));
  display: flex; flex-direction: column;
  border-left: 1px solid var(--color-border-default);
}

/* Preview wrap */
.label-preview-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow: auto;
}
.label-preview {
  background: var(--color-bg-elevated); color: var(--color-text-primary); box-shadow: 0 2px 16px rgba(0,0,0,0.3);
  border-radius: 2px; overflow: hidden;
}

/* Drag states for field cards */
.label-field-card.is-dragging { opacity: 0.4; transform: scale(0.97); }
.label-field-card.is-over { margin-top: 4px; border-top: 2px solid var(--color-accent); }

/* Label editor panel cards — legacy */
.label-editor-panel .card {
  margin-bottom: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
}
.label-editor-panel .card-body {
  padding: var(--space-4);
}
.label-editor-panel .card-body .form-group {
  margin-bottom: var(--space-2);
}
.label-editor-panel .card-body .form-grid {
  margin-bottom: var(--space-2);
}

/* Empty state card */
.empty-state-text {
  margin-bottom: var(--space-2);
}

/* Form hint text */
.form-hint {
  color: var(--color-text-muted);
  font-weight: 400;
}

.modal-scroll-area {
  max-height: 400px;
  overflow-y: auto;
  scrollbar-width: thin;
}

/* ═══════ Number spinner [- val +] ═══════ */
.num-spinner {
  display: flex;
  align-items: center;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  height: 30px;
  width: 100%;
}
.num-spinner-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 100%;
  border: none;
  background: var(--color-bg-surface-3);
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;

  padding: 0;
  line-height: 1;
  user-select: none;
}
.num-spinner-btn:hover {
  background: var(--color-accent);
  color: var(--color-text-inverse);
}
.num-spinner-btn:active {
  opacity: 0.8;
}
.num-spinner input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  border-left: 1px solid var(--color-border-default);
  border-right: 1px solid var(--color-border-default);
  background: var(--color-bg-canvas);
  color: var(--color-text-primary);
  text-align: center;
  font-size: 12px;
  padding: 0;
  -moz-appearance: textfield;
  outline: none;
}
.num-spinner input::-webkit-outer-spin-button,
.num-spinner input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
/* Light theme overrides */
[data-theme="light"] .num-spinner-btn {
  background: var(--color-bg-surface-2);
}
[data-theme="light"] .num-spinner input {
  background: var(--color-bg-elevated);
}

/* ═══════ Label field card (template constructor) ═══════ */
.label-field-card {
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  margin-bottom: var(--space-2);
  background: var(--color-bg-surface-2);
}
.lfc-header {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-bottom: var(--space-1);
}
.lfc-drag {
  cursor: grab;
  color: var(--color-text-muted);
  font-size: 1rem;
  user-select: none;
  flex-shrink: 0;
}
.lfc-header select {
  flex: 1;
}
.lfc-collapse {

}
.label-field-card.is-collapsed .lfc-collapse {
  transform: rotate(-90deg);
}
.lfc-body {
  border-top: 1px solid var(--color-border-default);
  padding-top: var(--space-2);
  overflow: hidden;
  max-height: 600px;
  opacity: 1;

}
.label-field-card.is-collapsed .lfc-body {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  border-top-color: transparent;
}
.label-field-card.is-collapsed .lfc-header {
  margin-bottom: 0;
}
.lfc-body .form-group {
  margin-bottom: var(--space-1);
}
.lfc-body .form-label {
  font-size: 0.6875rem;
  margin-bottom: 2px;
  color: var(--color-text-muted);
}
.lfc-row {
  display: grid;
  gap: var(--space-1);
  margin-bottom: var(--space-1);
}
.lfc-row-2 { grid-template-columns: 1fr 1fr; }
.lfc-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.lfc-row-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* Label print items list */
.lp-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lp-item-row {
  display: flex;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  background: var(--color-bg-surface-2);
}
.lp-item-fields {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 4px 8px;
}
.lp-item-actions {
  display: flex;
  align-items: flex-end;
  gap: 4px;
}

/* Divider */
hr.divider {
  border: none;
  border-top: 1px solid var(--color-border-default);
  margin: var(--space-4) 0;
}

/* Tags info list */

/* ── Autocomplete Component (shared across Sales forms) ── */
.autocomplete-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-default);
  border-radius: 6px;
  font-size: 0.875rem;
}
.autocomplete-pill-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 1.125rem;
  padding: 0 2px;
  line-height: 1;
}
.autocomplete-pill-clear:hover { color: var(--color-text-primary); }
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--color-bg-app);
  border: 1px solid var(--color-border-default);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-height: 240px;
  overflow-y: auto;
  margin-top: 2px;
}
.autocomplete-dropdown-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border-default);
}
.autocomplete-dropdown-item:last-child { border-bottom: none; }
.autocomplete-dropdown-item:hover { background: var(--color-bg-surface); }
.autocomplete-dropdown-item .ac-name { font-weight: 500; }
.autocomplete-dropdown-item .ac-sub { font-size: 0.75rem; color: var(--color-text-muted); }

/* ── Checkbox Pills (taxonomy multi-select) ── */

/* ── Channels Grid (2-col responsive) ── */
@media (max-width: 768px) {
  .channels-grid { grid-template-columns: 1fr; }
}

/* ── Channel Card ── */

/* ── Status Badge (verified/not-verified) ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
}
.status-badge.verified { background: color-mix(in srgb, var(--color-success) 15%, transparent); color: var(--color-success); }
.status-badge.not-verified { background: color-mix(in srgb, var(--color-danger) 15%, transparent); color: var(--color-danger); }

/* ── Push Status Card ── */

/* ── Preference Matrix Table ── */


/* Chain settings */
.toggle-slider {
  position: absolute; inset: 0; background: var(--color-bg-surface-3);
  border-radius: 9px; cursor: pointer;
}
.toggle-slider::before {
  content: ''; position: absolute; width: 14px; height: 14px;
  left: 2px; top: 2px; background: var(--color-bg-elevated); border-radius: 50%;

}


/* ========== Module utilities (shared across Deals/Tasks/Contacts/Companies) ========== */
.file-upload-toolbar { padding: 8px 12px; display: flex; gap: 8px; align-items: center; }
.stage-indicator { display: inline-flex; align-items: center; gap: 4px; }
.stage-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dt-cell-completed { text-decoration: line-through; opacity: 0.6; }
.subtask-row { display: flex; align-items: center; gap: 8px; padding: 6px 12px; text-decoration: none; color: inherit; }
.subtask-row:hover { background: var(--color-bg-hover); }
.subtask-meta { font-size: 11px; color: var(--color-text-muted); }
.subtask-toolbar { display: flex; justify-content: flex-end; margin-bottom: 8px; padding: 0 12px; }
.subtask-form { display: flex; gap: 8px; padding: 8px 12px; align-items: center; }


/* ═══════════════════════════════════════════════════════════════
   Chat Inbox — 3-column layout using dt-* system
   ═══════════════════════════════════════════════════════════════ */

.content-main:has(.chat-inbox) { overflow: hidden; }

/* ─── Analytics Module ─── */
.text-center { text-align: center; }
.span-full { grid-column: 1 / -1; }
/* Analytics responsive @media moved to modules/Analytics/Resources/css/analytics.css (Фаза E3, 2026-04-22) */

/* Chats block (.chat-*, .inbox-*, .msg-*) moved to modules/Chats/Resources/css/chats.css (Фаза E2, 2026-04-22) */


/* ── Public Form (brief-*) ──────────────────────────────────────────── */
.public-layout { min-height: 100vh; }
.signature-canvas { border: 1px solid var(--color-border-default); border-radius: 8px; cursor: crosshair; touch-action: none; width: 100%; max-width: 500px; height: 150px; }
.signature-actions { margin-top: 6px; }
.thankyou-page { max-width: 520px; margin: 0 auto; padding: 80px 16px; text-align: center; }
.thankyou-icon { width: 80px; height: 80px; margin: 0 auto 24px; background: var(--color-success-soft); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.thankyou-icon svg { width: 40px; height: 40px; stroke: var(--color-success); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.thankyou-page h1 { font-size: 1.75rem; margin: 0 0 12px; }
.thankyou-page p { color: var(--color-text-secondary); font-size: 1.0625rem; margin: 0; }

/* ── Documents: reusable patterns ───────────────────────────────────── */
.field-item {
    padding: 6px 10px;
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-sm);
}
.field-item-grid { display: grid; gap: 6px; }
.field-item-grid-lg { display: grid; gap: 8px; }
.code-textarea { font-family: var(--font-mono); font-size: 0.85rem; }
.code-textarea-sm { font-family: var(--font-mono); font-size: 0.8rem; }
.micro-label { display: block; font-size: 0.65rem; color: var(--color-text-muted); margin-bottom: 2px; }
.ml-auto { margin-left: auto; }
.text-pre-wrap { white-space: pre-wrap; }
.text-accent { color: var(--color-accent); text-decoration: none; }
.doc-preview-iframe { width: 100%; height: 600px; border: 1px solid var(--color-border-default); border-radius: 8px; background: var(--color-bg-elevated); }
.card-body-border-top { border-top: 1px solid var(--color-border-default); }
.ml-2 { margin-left: 8px; }

/* ── Form Field Constructor ─────────────────────────────────────────── */

@media (max-width: 768px) {
    .ffc-field-row {
        grid-template-columns: 24px 1fr auto;
    }
    .ffc-field-input--type,
    .ffc-field-input--key { grid-column: 2 / -1; }
}

/* ── Pipeline Form + Show ──────────────────────────────────────────── */

.ps-page { max-width: 800px; margin: 0 auto; padding: var(--space-4); }

/* Pipeline type selector cards */

/* Color swatches */
.color-swatches { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.color-swatch {
    width: 30px; height: 30px; border-radius: 50%;
    border: 2px solid transparent; cursor: pointer;

    padding: 0; outline: none; flex-shrink: 0;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.is-active {
    box-shadow: 0 0 0 2px var(--color-bg-app), 0 0 0 4px currentColor;
    transform: scale(1.1);
}

/* .ps-hero-dot / .ps-hero-stat — moved to modules/Deals/Resources/css/deals.css (Фаза D2, 2026-04-22) */

/* Pipeline preview — visual funnel of colored stage blocks */

/* Color picker */

/* Stage editor list */

/* .ps-stages-* / .ps-stage-dot / .ps-prob-* / .ps-stages-summary* — moved to modules/Deals/Resources/css/deals.css (Фаза D2, 2026-04-22) */
/* .ps-form-error Pipeline override с margin-top: 2px — унифицирован в xacss/components/panelstack-content.css */

@media (max-width: 640px) {
    .pf-stage-field--type { width: 90px; }
    .pf-stage-field--prob { width: 60px; }
    .pf-stages-header { display: none; }
    .pf-stage-row { flex-wrap: wrap; }
    .pf-stage-field--name { min-width: 140px; }
    /* .ps-stages-col--prob / --type responsive rules — moved to modules/Deals/Resources/css/deals.css (Фаза D2) */
}
