/* core/fonts.css */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../../assets/fonts/InterVariable.woff2') format('woff2');
}



@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('../../assets/fonts/Sora-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
                 U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
                 U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('../../assets/fonts/Sora-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* core/tokens.css */
html { scrollbar-gutter: stable; }

:root {

  
  --color-brand-500: #3B82F6;   
  --color-brand-600: #2563EB;   
  --color-brand-100: #DBEAFE;   

  
  
  --color-success-500: #10B981;
  --color-warning-500: #F59E0B;
  --color-error-500:   #EF4444;
  --color-info-500:    #06B6D4;

  
  
  --surface-page:     #16161A;   
  --surface-elevated: #1A1A1F;   
  --surface-card:     #1F1F24;   
  --surface-input:    #1A1A1F;   
  --surface-hover:    #26262C;   
  --surface-active:   #2A2A30;   

  
  --text-primary:   #E6E7EB;   
  --text-secondary: #9CA3AF;   
  
  --text-muted:     #8B929D;   
  
  --text-disabled:  #4B5563;   
  
  --text-on-saturated: #FFFFFF;
  --text-on-brand:  var(--text-on-saturated);   

  
  --border-subtle:  rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.10);
  --border-strong:  rgba(255, 255, 255, 0.16);

  
  --border-control: rgba(255, 255, 255, 0.35);

  
  --border-on-saturated: rgba(255, 255, 255, 0.75);

  
  --border-pressed: var(--text-on-saturated);

  
  --border-control-hover: rgba(255, 255, 255, 0.40);

  
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.40);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.55);

  
  --radius-xs:   4px;    
  --radius-sm:   6px;    
  --radius-base: 8px;    
  --radius-md:   10px;   
  --radius-lg:   14px;   
  --radius-xl:   20px;   
  --radius-full: 9999px; 

  
  --focus-ring-color: var(--color-brand-500);

  
  --layout-icon-rail-width:  56px;    
  --layout-sidebar-width:    264px;   
  --layout-container-max:    1440px;
  --layout-header-height:    52px;   
  --layout-page-padding-x:   32px;

  
  
  --primary-color:    var(--color-brand-500);
  --bg-primary:       var(--surface-page);
  --bg-secondary:     var(--surface-elevated);
  --bg-tertiary:      var(--surface-elevated);
  --bg-card:          var(--surface-card);
  --bg-input:         var(--surface-input);
  --bg-hover:         var(--surface-hover);
  --bg-sidebar:       var(--surface-elevated);
  --border-color:     var(--border-default);
  --border-light:     var(--border-subtle);
  --border-dark:      var(--border-strong);
  --border-radius:    var(--radius-base);
  --border-radius-sm: var(--radius-sm);
  --border-radius-lg: var(--radius-lg);
  --text-accent:      var(--color-brand-500);
  --success-color:    var(--color-success-500);
  --warning-color:    var(--color-warning-500);
  --error-color:      var(--color-error-500);
  --shadow-lg:        var(--shadow-md);
  --container-max-width: var(--layout-container-max);

  
  --shadow:           0 6px 12px rgba(0, 0, 0, 0.4);
  --footer-height:    40px;
  --transition:       all 0.2s ease-in-out;
  --transition-fast:  all 0.1s ease-in-out;
}




:root {
  
  --surface-sunken: #121216;
  --surface-raised: #26262C;   

  
  --surface-selected: #33415C;

  
  --color-brand-400: #60A5FA;

  
  --edge-top:        inset 0 1px 0 rgba(255, 255, 255, 0.055);
  --edge-top-strong: inset 0 1px 0 rgba(255, 255, 255, 0.09);

  
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.45), 0 8px 24px -12px rgba(0, 0, 0, 0.70);
  --shadow-hero: 0 2px 4px rgba(0, 0, 0, 0.50), 0 24px 60px -24px rgba(0, 0, 0, 0.85);

  
  --film-card: linear-gradient(180deg, rgba(255, 255, 255, 0.028) 0%, rgba(255, 255, 255, 0) 42%);
  --film-hero: radial-gradient(130% 100% at 0% 0%, rgba(59, 130, 246, 0.10) 0%, rgba(59, 130, 246, 0) 58%);

  
  --glow-brand:   0 0 12px rgba(59, 130, 246, 0.35);
  --glow-success: 0 0 0 1px rgba(16, 185, 129, 0.28), 0 0 20px -6px rgba(16, 185, 129, 0.42);

  
  --data-line:    var(--color-brand-400);
  
  --data-line-dim: rgba(96, 165, 250, 0.60);
  --data-fill-hi: #3D3D46;
  --data-fill-lo: #2C2C33;
  
  --data-bar: #666670;
  
  
  --data-base-hi: #64748B;
  --data-base-lo: #475569;
  --data-grid:    rgba(255, 255, 255, 0.04);
  --data-axis:    rgba(255, 255, 255, 0.10);

  
  --tracking-numeric: -0.03em;
}


:root {
  
  --control-h-sm:  28px;  
  --control-h-md:  36px;  
  --control-h-lg:  44px;  

  
  --control-px-sm: var(--space-3);   
  --control-px-md: var(--space-4);   
  --control-px-lg: var(--space-5);   

  
  --control-font-sm: var(--font-xs);    
  --control-font-md: var(--font-sm);    
  --control-font-lg: var(--font-base);  

  
  --control-icon-sm: 14px;
  --control-icon-md: 16px;

  
  --control-gap: var(--space-2);  
}


:root {
  
  --leads-tags-share: 0.2;
  --leads-tree-w: 272px;   
  
  --filter-select-w: 168px;
  
  --lead-fs-text: var(--font-md-plus);    
  --lead-fs-mid: var(--font-base);        
  --lead-fs-small: var(--font-xs);        
  
  --lead-stub-w: 116px;
  --lead-stub-w-narrow: 120px;   
  
  --lead-act-sell-rgb: 103, 232, 249;     
  --lead-act-offer-rgb: 167, 139, 250;    
  --lead-act-seek-rgb: 253, 224, 71;      
  --lead-act-other-rgb: 156, 163, 175;    
  
  --lead-tags-max-w: 520px;
  --lead-tag-gap: 6px;
  --lead-nick-max-w: 240px;
  
  --lead-chip-h: 22px;
  --lead-flag-size: var(--lead-fs-text);   
  --lead-chip-name-max-w: 160px;   
  
  --lead-tree-row-h: 34px;
  --lead-tree-row-gap: 8px;
  --lead-row-selected-bg: rgba(var(--color-brand-500-rgb), 0.07);
}

@media (max-width: 1279px) {
  :root {
    --leads-tags-share: 0.35;
  }
}



:root {
  
  --font-md-plus: 15px;   
  
  --font-xl-sm:   20px;   

  

  
  --font-hero: 56px;
}


:root {
  
  --color-brand-text:   var(--color-brand-400);    
  --color-error-text:   #F87171;                   
  --color-success-text: var(--color-success-500);  
  --color-warning-text: var(--color-warning-500);  
  --color-info-text:    var(--color-info-500);     

  
  
  --color-brand-bg: #2563EB;   
  
  --color-brand-bg-hover: #1D4ED8;
  --color-error-bg: #DC2626;   

  
  --text-on-warning: var(--surface-page);   
  --text-on-success: var(--surface-page);   
  --text-on-info:    var(--surface-page);   

  
  --text-on-error:   var(--text-on-saturated);   

  
  --surface-tag-neutral: #6B7280;
}


:root {
  --tag-cat-green:  #34D399;   
  --tag-cat-teal:   #5EEAD4;   
  --tag-cat-amber:  #FBBF24;   
  --tag-cat-orange: #FB923C;   
  --tag-cat-violet: #C4B5FD;   
  --tag-cat-indigo: #A5B4FC;   
  --tag-cat-pink:   #F9A8D4;   
  --tag-cat-red:    #FCA5A5;   
  
  --tag-cat-neutral: var(--text-secondary);

  --tag-cat-green-rgb:   52, 211, 153;
  
  --tag-cat-teal-rgb:    94, 234, 212;
  --tag-cat-amber-rgb:   251, 191, 36;
  --tag-cat-orange-rgb:  251, 146, 60;
  --tag-cat-violet-rgb:  196, 181, 253;
  --tag-cat-indigo-rgb:  165, 180, 252;
  --tag-cat-pink-rgb:    249, 168, 212;
  --tag-cat-red-rgb:     252, 165, 165;
  --tag-cat-neutral-rgb: 156, 163, 175;

  
  --tag-pill-max-w: 240px;
}


:root {
  --accent-color:  var(--color-brand-500);
  --accent-rgb:    59, 130, 246;          
  --card-bg:       var(--surface-card);
  --info-color:    var(--color-info-500);
  --light-text:    var(--text-secondary);
  --lighter-text:  var(--text-muted);
  --primary-hover: var(--color-brand-600);
  --primary-text:  var(--text-primary);
  --secondary-bg:  var(--surface-elevated);
  --text-tertiary: var(--text-muted);

  
  --surface-1: var(--surface-page);   
  --surface-2: #1C1C22;               
  
}


:root {
  --color-brand-500-rgb:      59, 130, 246;
  --color-brand-400-rgb:      96, 165, 250;
  --color-success-500-rgb:    16, 185, 129;
  --color-warning-500-rgb:   245, 158, 11;
  --color-error-500-rgb:     239, 68, 68;
  --color-info-500-rgb:        6, 182, 212;
  --surface-card-rgb:         31, 31, 36;
  --surface-tag-neutral-rgb: 107, 114, 128;
  --data-base-hi-rgb:        100, 116, 139;

  --tag-cat-teal-rgb:    94, 234, 212;
  --tag-cat-amber-rgb:  251, 191, 36;
  --tag-cat-orange-rgb: 251, 146, 60;
  --tag-cat-violet-rgb: 196, 181, 253;
  --tag-cat-indigo-rgb: 165, 180, 252;
  --tag-cat-pink-rgb:   249, 168, 212;
  --tag-cat-red-rgb:    252, 165, 165;
  --tag-cat-neutral-rgb: 156, 163, 175;

  
  --accent-rgb: var(--color-brand-500-rgb);
}


:root {
  
  --legacy-sky:        #38BDF8;   --legacy-sky-rgb:         56, 189, 248;
  --legacy-azure:      #4A90E2;   --legacy-azure-rgb:       74, 144, 226;
  --legacy-light-blue: #4FC3F7;   --legacy-light-blue-rgb:  79, 195, 247;
  --legacy-cyan:       #00E5FF;   --legacy-cyan-rgb:         0, 229, 255;
  --legacy-purple:     #7B61FF;
  --legacy-blue-100:   #BCD6FB;   
  --legacy-amber-100:  #FCD9A0;   

  
  --legacy-material-blue:         #2196F3;  --legacy-material-blue-rgb:          33, 150, 243;
  --legacy-material-green:        #4CAF50;  --legacy-material-green-rgb:         76, 175, 80;
  --legacy-material-red:          #F44336;  --legacy-material-red-rgb:          244, 67, 54;
  --legacy-material-amber:        #FFC107;  --legacy-material-amber-rgb:        255, 193, 7;
  --legacy-material-orange:       #FF9800;  --legacy-material-orange-rgb:       255, 152, 0;
  --legacy-material-deep-orange:  #FF5722;  --legacy-material-deep-orange-rgb:  255, 87, 34;
  --legacy-material-purple:       #9C27B0;  --legacy-material-purple-rgb:       156, 39, 176;
  --legacy-material-pink:         #E91E63;  --legacy-material-pink-rgb:         233, 30, 99;
  --legacy-material-blue-grey:    #607D8B;  --legacy-material-blue-grey-rgb:     96, 125, 139;
  --legacy-material-grey:         #757575;  --legacy-material-grey-rgb:         117, 117, 117;
  --legacy-material-yellow:       #FFEB3B;

  
  --legacy-bootstrap-green: #28A745;  --legacy-bootstrap-green-rgb:  40, 167, 69;
  --legacy-bootstrap-teal:  #17A2B8;  --legacy-bootstrap-teal-rgb:   23, 162, 184;
  --legacy-bootstrap-red:   #DC3545;  --legacy-bootstrap-red-rgb:   220, 53, 69;

  
  --legacy-mint:        #48BB78;  --legacy-mint-rgb:        72, 187, 120;
  --legacy-tangerine:   #ED8936;  --legacy-tangerine-rgb:  237, 137, 54;
  
  --legacy-chakra-blue-300: #63B3ED;  --legacy-chakra-blue-300-rgb: 99, 179, 237;
  --legacy-periwinkle:  #667EEA;  --legacy-periwinkle-rgb: 102, 126, 234;
  --legacy-gold:        #FFD700;  --legacy-gold-rgb:       255, 215, 0;
  --legacy-yellow-500:  #EAB308;  --legacy-yellow-500-rgb: 234, 179, 8;
  --legacy-green-400:   #4ADE80;
  --legacy-green-500:   #22C55E;  --legacy-green-500-rgb:   34, 197, 94;
  --legacy-emerald-300: #6EE7B7;
  --legacy-orange-300:  #FDBA74;

  
  --legacy-blue-900: #1E3A8A;
  --legacy-blue-300: #93C5FD;

  
  --legacy-emerald-900: #064E3B;

  
  --legacy-amber-900: #78350F;
  --legacy-amber-300: #FCD34D;

  
  --legacy-red-900: #7F1D1D;

  
  --legacy-badge-red-300: #FCA5A5;  

  
  --legacy-badge-owner-gold: #FFCC02;
  --legacy-badge-owner-gold-rgb: 255, 204, 2;

  
  --legacy-badge-viewer-slate: #ADBAC7;
  --legacy-badge-viewer-slate-rgb: 173, 186, 199;

  --legacy-slate-400:   #94A3B8;  --legacy-slate-400-rgb:  148, 163, 184;
  --legacy-indigo-600:  #4F46E5;
  --legacy-indigo-500:  #6366F1;  --legacy-indigo-500-rgb:  99, 102, 241;
  --legacy-indigo-400:  #818CF8;  --legacy-indigo-400-rgb: 129, 140, 248;

  
  --legacy-indigo-300: #A5B4FC;  

  --legacy-violet-700:  #6D28D9;

  
  --legacy-violet-400:  #A78BFA;

  
  --legacy-paper: #F9FAFB;  --legacy-paper-rgb: 249, 250, 251;
  --legacy-cream: #FFFAF0;  --legacy-cream-rgb: 255, 250, 240;
}

/* core/typography.css */
:root {
  
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  
  --font-mono:   'SF Mono', 'Monaco', monospace;

  
  --font-2xs:  11px;   
  --font-xs:   12px;   
  --font-sm:   13px;   
  --font-base: 14px;   
  --font-md:   16px;   
  --font-lg:   18px;   
  --font-xl:   22px;   
  --font-2xl:  28px;   
  --font-3xl:  36px;   
  --font-4xl:  48px;   

  
  --weight-regular: 400;
  --weight-medium:  500;
  --weight-semi:    600;
  --weight-bold:    700;

  
  --line-tight:   1.15;
  --line-snug:    1.3;
  --line-base:    1.5;
  --line-relaxed: 1.65;

  
  --tracking-eyebrow: 0.08em;
  --tracking-caps:    0.06em;
  --tracking-tight:   -0.02em;
}


body {
  font-family: var(--font-family);
}




.eyebrow {
  font-size: var(--font-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}


.eyebrow-sm {
  font-size: var(--font-2xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
}


.page-title {
  font-size: var(--font-2xl);
  font-weight: var(--weight-semi);
  line-height: var(--line-tight);
  color: var(--text-primary);
  margin: 0;
}


.page-title--lg {
  font-size: var(--font-3xl);
}


.page-title--hero {
  font-size: var(--font-4xl);
  letter-spacing: var(--tracking-tight);
}


.page-subtitle {
  font-size: var(--font-base);
  color: var(--text-secondary);
  line-height: var(--line-base);
  margin: 8px 0 0 0;
}



.section-title {
  font-size: var(--font-sm);
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  line-height: var(--line-snug);
  color: var(--text-muted);
  margin: 0;
}


.card-title {
  font-size: var(--font-md);
  font-weight: var(--weight-semi);
  color: var(--text-primary);
  line-height: var(--line-snug);
  margin: 0;
}


.card-description {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  line-height: var(--line-base);
}


.body    { font-size: var(--font-base); color: var(--text-primary);   line-height: var(--line-base); }
.body-sm { font-size: var(--font-sm);   color: var(--text-secondary); line-height: var(--line-base); }
.body-xs { font-size: var(--font-xs);   color: var(--text-muted);     line-height: var(--line-base); }



.field-hint,
.meta {
  font-size: var(--font-xs);          
  font-weight: var(--weight-regular); 
  line-height: 1.4;                   
  color: var(--text-muted);
}



.data-value {
  font-size: var(--font-sm);          
  font-weight: var(--weight-semi);    
  line-height: var(--line-snug);      
  color: var(--text-primary);
}


.data-value--mono {
  font-family: var(--font-mono);
  font-weight: var(--weight-regular); 
}


input::placeholder,
textarea::placeholder {
  color:   var(--text-muted);
  opacity: 1;
}

/* core/spacing.css */
:root {
  --space-1:   4px;
  --space-2:   8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-32: 128px;
}

/* components/icon.css */
.icon {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  vertical-align: -0.125em;
  
  color: inherit;
  
  pointer-events: none;
}


.icon-sm { font-size: 14px; }
.icon-md { font-size: 18px; }
.icon-lg { font-size: 24px; }
.icon-xl { font-size: 32px; }


.icon-thin {
  stroke-width: 1.25;
}


.icon-bold {
  stroke-width: 2.25;
}

/* components/button.css */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--control-gap);               
  height: var(--control-h-md);           
  padding: 0 var(--control-px-md);       
  font-size: var(--control-font-md);     
  font-weight: var(--weight-medium);     
  font-family: inherit;
  line-height: 1;
  border-radius: var(--radius-base);     
  
  border: 1px solid var(--border-control);
  background: var(--surface-card);
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  box-sizing: border-box;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  user-select: none;
}

.btn:hover:not(:disabled) {
  background: var(--surface-hover);
}

.btn:focus-visible {
  outline: 2px solid var(--focus-ring-color, var(--color-brand-500));
  outline-offset: 2px;
}


.btn:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}




.btn--sm {
  height: var(--control-h-sm);           
  padding: 0 var(--control-px-sm);       
  font-size: var(--control-font-sm);     
}


.btn--lg {
  height: var(--control-h-lg);           
  padding: 0 var(--control-px-lg);       
  font-size: var(--control-font-lg);     
}


.btn--icon {
  width: var(--control-h-sm);            
  height: var(--control-h-sm);
  padding: 0;
  flex-shrink: 0;
}





.btn--primary {
  background: var(--color-brand-bg);
  border-color: var(--color-brand-bg);
  color: var(--text-on-brand);
}

.btn--primary:hover:not(:disabled) {
  background: var(--color-brand-bg-hover);
  border-color: var(--color-brand-bg-hover);
}


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

.btn--ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-control);
}


.btn--ghost:focus-visible {
  border-color: var(--border-control);
}


.btn--ghost.btn--outline-rest {
  border-color: var(--border-control);
}



.btn--danger {
  background: transparent;
  border-color: var(--color-error-500);
  color: var(--color-error-text);
}

.btn--danger:hover:not(:disabled) {
  background: rgba(var(--color-error-500-rgb), 0.08);
}


.btn .icon {
  width: var(--control-icon-md);    
  height: var(--control-icon-md);
  flex-shrink: 0;
}

.btn--sm .icon {
  width: var(--control-icon-sm);   
  height: var(--control-icon-sm);
}


.btn-full-width {
  width: 100%;
}





.btn-mini:not(.btn) {
    height: var(--control-h-sm);
    padding: 0 var(--control-px-sm);
    font-size: var(--font-sm);            
    border-width: 1px;
    border-style: solid;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
}


.btn-mini {
    background: var(--bg-primary);
    border-color: var(--border-control); 
    color: var(--text-primary);
}


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


.btn-primary  { background: var(--color-brand-bg); border-color: var(--color-brand-bg); color: var(--text-on-brand); }
.btn-primary:hover:not(:disabled) { background: var(--color-brand-bg-hover); border-color: var(--color-brand-bg-hover); }



.btn-toggle {
    min-width: var(--control-h-sm);
    height: var(--control-h-sm);
    padding: 0;
    font-size: var(--font-sm);
    border: 1px solid var(--border-control); 
    border-radius: var(--border-radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}


.btn-toggle:hover:not(.active) {
    background: var(--surface-hover);
    border-color: var(--border-control);
}


.btn-toggle.active {
    background: var(--color-brand-bg);
    color: var(--text-on-brand);
    border-color: var(--color-brand-bg);
}


.btn-toggle:disabled,
.btn-toggle.active:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}



.view-toggle {
    display: flex;
    gap: 0.2rem;
    flex-shrink: 0;
}


.btn--refresh .icon {
  transition: transform 0.2s ease;
}

.btn--refresh.is-loading .icon {
  animation: spin 0.8s linear infinite;
}

.btn--refresh.is-loading {
  cursor: progress;
  pointer-events: none;
}

/* components/badge-v2.css */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);           
  border-radius: var(--radius-full);
  font-size: var(--font-2xs);            
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  line-height: 1.4;
  white-space: nowrap;
  vertical-align: middle;
}


.badge::before {
  content: "●";
  font-size: 6px;
  line-height: 1;
  flex-shrink: 0;
}


.badge--success {
  background: rgba(var(--color-success-500-rgb), 0.12);
  color: var(--color-success-500);
}

.badge--warning {
  background: rgba(var(--color-warning-500-rgb), 0.12);
  color: var(--color-warning-500);
}

.badge--error {
  background: rgba(var(--color-error-500-rgb), 0.12);
  color: var(--color-error-text);
}

.badge--neutral {
  background: var(--surface-hover);
  color: var(--text-secondary);
}

.badge--info {
  background: rgba(var(--color-info-500-rgb), 0.12);
  color: var(--color-info-500);
}




.badge--no-dot::before {
  content: none;
}


.badge-success {
  background-color: rgba(var(--legacy-material-green-rgb), 0.2);
  color: var(--success-color);
}

.badge-warning {
  background-color: rgba(var(--legacy-material-orange-rgb), 0.2);
  color: var(--warning-color);
}


.badge-auto {
  font-size: var(--font-2xs);
  padding: 3px 8px;
  
  background: linear-gradient(135deg, var(--legacy-indigo-600), var(--legacy-violet-700));
  color: white;
  border-radius: 10px;
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  animation: pulse-badge 2s ease-in-out infinite;
  box-shadow: 0 2px 8px rgba(var(--legacy-periwinkle-rgb), 0.4);
}


.badge.badge-auto {
  font-size: var(--font-2xs);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-caps);
  
  animation: none;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1);    opacity: 1;   }
  50%      { transform: scale(1.05); opacity: 0.9; }
}

/* components/tag-pill-v2.css */
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px var(--space-2);            
  border-radius: var(--radius-full);
  font-size: var(--font-xs);             
  font-weight: var(--weight-regular);
  line-height: 1.3;
  background: var(--surface-hover);
  border: 1px solid var(--border-control);
  color: var(--text-secondary);
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
  cursor: default;
}

.tag-pill:hover {
  background: rgba(var(--color-brand-500-rgb), 0.10);
  border-color: var(--border-control);
  color: var(--color-brand-text);
}


.tag-pill.is-active {
  background: var(--color-brand-bg);
  border-color: var(--border-on-saturated);
  color: var(--text-on-brand);
  font-weight: var(--weight-medium);
}


.tag-pill--removable {
  cursor: pointer;
  border: none;
  padding: 4px var(--space-2);
}

.tag-pill--removable:hover .tag-pill__remove {
  color: var(--color-error-text);
}


.tag-pill__remove {
  color: var(--text-muted);
  flex-shrink: 0;
  font-size: 10px;
  transition: color 0.12s ease;
  width: 10px;
  height: 10px;
}

/* components/filter-chips.css */
:root {
  --filter-border:       rgba(255, 255, 255, 0.36);  
  --filter-border-hover: rgba(255, 255, 255, 0.48);
  
  --filter-border-quiet: var(--border-default);
}





.filters-summary-row {
  display:     flex;
  align-items: center;
  gap:         var(--space-4);      
  flex-wrap:   wrap;
  padding-top: var(--space-2);      
  border-top:  1px solid var(--border-subtle);
}

.filters-summary-row[hidden] {
  display: none;
}


.filters-chips-row {
  flex:        1 1 auto;
  min-width:   0;
  display:     flex;
  flex-wrap:   wrap;
  align-items: center;
  gap:         var(--space-2);      
  
  min-height:  var(--control-h-sm); 
  max-height:  64px;
  overflow:    hidden;
}


.filters-chips-row:has(.filters-chips-collapse) {
  max-height: none;
  overflow:   visible;
}


.filters-chips-empty {
  font-size: var(--font-sm);        
  color:     var(--text-secondary); 
  line-height: 1.3;
}




.filters-chips-row .filter-chip {
  display:       inline-flex;
  align-items:   center;
  gap:           var(--space-1);                  
  height:        var(--control-h-sm);             
  padding:       0 var(--space-1) 0 var(--space-2);
  
  border:        1px solid var(--filter-border-quiet);
  border-radius: var(--radius-full);
  background:    var(--surface-raised);
  color:         var(--text-primary);
  font-size:     var(--font-sm);                  
  font-weight:   var(--weight-regular);
  line-height:   1;
  white-space:   nowrap;
  max-width:     100%;
  cursor:        default;
  
  transition:    opacity 0.12s ease, border-color 0.12s ease;
}


.filters-chips-row .filter-chip:hover {
  background:   var(--surface-raised);
  border-color: var(--border-strong);
  color:        var(--text-primary);
}


.filters-chips-row .filter-chip__icon {
  width:       14px;
  height:      14px;
  flex-shrink: 0;
  color:       var(--text-secondary);
}

.filters-chips-row .filter-chip__label {
  overflow:      hidden;
  text-overflow: ellipsis;
  white-space:   nowrap;
  min-width:     0;
}

.filters-chips-row .filter-chip__count {
  font-size:            var(--font-xs);   
  font-variant-numeric: tabular-nums;
  color:                var(--text-secondary);
  flex-shrink:          0;
}


.filters-chips-row .filter-chip__x {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  width:           24px;              
  height:          24px;
  flex-shrink:     0;
  padding:         0;
  border:          none;
  border-radius:   var(--radius-full);
  background:      transparent;
  color:           var(--text-secondary);
  cursor:          pointer;
  transition:      background 0.12s ease, color 0.12s ease;
}

.filters-chips-row .filter-chip__x .icon {
  width:  14px;                       
  height: 14px;
}


.filters-chips-row .filter-chip__x:hover {
  background: color-mix(in srgb, var(--color-error-500) 16%, transparent);
  color:      var(--color-error-text);
}






.filters-chips-row .filter-chip--hunter,
.filters-chips-row .filter-chip--group,
.filters-chips-row .filter-chip--query,
.filters-chips-row .filter-chip--status,
.filters-chips-row .filter-chip--show-with-tags,
.filters-chips-row .filter-chip--show-without-tags,
.filters-chips-row .filter-chip--show-unclassified,
.filters-chips-row .filter-chip--flag {
  border-color: var(--filter-border-quiet);
  background:   var(--surface-raised);
}

.filters-chips-row .filter-chip--flag .filter-chip__icon { color: var(--text-secondary); }


.filters-chips-row .filter-chip__dot {
  width:         12px;
  height:        12px;
  border-radius: 50%;
  flex-shrink:   0;
  background:    var(--text-secondary);
}


.filters-chips-row .filter-chip[data-orphan="1"]:not(.tag-chip) {
  border-style: dashed;
}




.filters-chips-row .filters-chips-more,
.filters-chips-row .filters-chips-collapse {
  display:         inline-flex;
  align-items:     center;
  height:          var(--control-h-sm);       
  padding:         0 var(--space-2);
  border:          1px dashed var(--filter-border);
  border-radius:   var(--radius-full);
  background:      transparent;
  color:           var(--text-secondary);
  font-family:     inherit;
  font-size:       var(--font-sm);            
  line-height:     1;
  white-space:     nowrap;
  cursor:          pointer;
  flex-shrink:     0;
  transition:      border-color 0.12s ease, color 0.12s ease;
}

.filters-chips-row .filters-chips-more:hover,
.filters-chips-row .filters-chips-collapse:hover {
  border-color: var(--filter-border-hover);
  color:        var(--text-primary);
}


.filters-chips-row .filters-chips-mode {
  display:       inline-flex;
  align-items:   center;
  height:        var(--control-h-sm);        
  padding:       0;
  border:        1px solid var(--filter-border);
  border-radius: var(--radius-full);
  overflow:      hidden;
  flex-shrink:   0;
}

.filters-chips-row .filters-chips-mode__btn {
  display:       inline-flex;
  align-items:   center;
  height:        100%;
  padding:       0 var(--space-3);           
  border:        none;
  background:    transparent;
  color:         var(--text-secondary);
  font-family:   inherit;
  font-size:     var(--font-sm);             
  line-height:   1;
  white-space:   nowrap;
  cursor:        pointer;
  transition:    background 0.12s ease, color 0.12s ease;
}

.filters-chips-row .filters-chips-mode__btn:hover {
  background: var(--surface-hover);
  color:      var(--text-primary);
}


.filters-chips-row .filters-chips-mode__btn.active {
  background:  var(--surface-active);
  color:       var(--text-primary);
  font-weight: var(--weight-medium);
}

.filters-chips-row .filters-chips-clear {
  display:       inline-flex;
  align-items:   center;
  height:        var(--control-h-sm);         
  padding:       0 var(--space-2);
  border:        none;
  border-radius: var(--radius-sm);
  background:    transparent;
  color:         var(--text-secondary);
  font-family:   inherit;
  font-size:     var(--font-sm);              
  font-weight:   var(--weight-medium);
  line-height:   1;
  white-space:   nowrap;
  cursor:        pointer;
  flex-shrink:   0;
  
  transition:    background 0.12s ease, color 0.12s ease;
}

.filters-chips-row .filters-chips-clear:hover {
  background: var(--surface-hover);
  color:      var(--text-primary);
}



.filters-chips-row .filters-chips-tail {
  display:     inline-flex;
  align-items: center;
  gap:         var(--space-2);      
  flex-shrink: 0;
  white-space: nowrap;
}

.filters-chips-row .filters-chips-tail .btn {
  gap: var(--space-1);              
}


.filters-chips-row:has(.filters-chips-tail) {
  max-height: calc(3 * var(--control-h-sm) + 2 * var(--space-2));
}


@media (max-width: 480px) {
  .filters-chips-row .filters-chips-tail {
    flex-wrap: wrap;
    white-space: normal;
    max-width: 100%;
    row-gap:   var(--space-2);
  }
  .filters-chips-row:has(.filters-chips-tail) {
    max-height: none;
    overflow:   visible;
  }
}




.filter-toggles {
  display:     flex;
  align-items: center;
  flex-wrap:   wrap;
  gap:         var(--space-2);       
  min-width:   0;
}


.filter-toggles__contact[hidden] {
  display: none;
}

.filter-toggles__contact {
  display:     inline-flex;
  align-items: center;
  gap:         var(--space-2);
}

.filter-toggle {
  --toggle-accent: var(--text-secondary);

  display:       inline-flex;
  align-items:   center;
  gap:           var(--space-2);            
  height:        var(--control-h-md);       
  padding:       0 var(--space-3);          
  
  border:        1px solid var(--filter-border);   
  border-radius: var(--radius-base);
  background:    var(--surface-sunken);            
  color:         var(--text-secondary);
  font-family:   inherit;
  font-size:     var(--control-font-md);    
  font-weight:   var(--weight-regular);
  line-height:   1;
  white-space:   nowrap;
  cursor:        pointer;
  transition:    background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}


.filter-toggle:hover:not(:disabled) {
  border-color: var(--filter-border-hover);
  color:        var(--text-primary);
}


.filter-toggle[aria-pressed="true"]:not(:disabled) {
  --toggle-accent: var(--color-brand-500);

  background:   var(--surface-active);
  
  border-color: var(--border-pressed);
  color:        var(--text-primary);
  font-weight:  var(--weight-medium);
}


.filter-toggle:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}


.filter-toggle__label {
  line-height: 1;
}


.results-header .filter-toggle {
  height:  var(--control-h-sm);      
  padding: 0 var(--control-px-sm);   
  gap:     var(--space-1);           
}


.results-header .filter-toggle .icon {
  width:  var(--control-icon-sm);    
  height: var(--control-icon-sm);
}


.filter-toggle__dot {
  width:         12px;
  height:        12px;
  border-radius: 50%;
  border:        2px solid var(--toggle-accent);
  background:    transparent;
  flex-shrink:   0;
  box-sizing:    border-box;
}

.filter-toggle[aria-pressed="true"] .filter-toggle__dot {
  background: var(--toggle-accent);
}


.filter-toggle .icon {
  width:       16px;                 
  height:      16px;
  flex-shrink: 0;
  color:       var(--text-secondary);
}




.filter-group-label {
  font-size:      var(--font-xs);          
  font-weight:    var(--weight-medium);
  letter-spacing: var(--tracking-eyebrow); 
  text-transform: uppercase;
  color:          var(--text-muted);
  line-height:    1.3;
  white-space:    nowrap;
  flex-shrink:    0;
}


.filters-chips-row .filters-mode-group {
  display:      inline-flex;
  align-items:  center;
  flex-shrink:  0;                    
  gap:          var(--space-2);       
  margin-left:  var(--space-2);       
}


.filters-chips-row .filters-mode-group:first-child {
  margin-left: 0;
}





.kpi-inline {
  display:       flex;
  align-items:   center;
  gap:           var(--space-4);       
  flex-shrink:   0;
  flex-wrap:     wrap;
  margin-left:   auto;                 
  padding:       var(--space-1) var(--space-3);   
  background:    var(--surface-sunken);
  border-radius: var(--radius-sm);
}

.kpi-inline__item {
  display:     inline-flex;
  align-items: center;
  gap:         var(--space-1);       
  min-width:   0;
}

.kpi-inline__icon {
  width:       16px;                 
  height:      16px;
  flex-shrink: 0;
  color:       var(--text-secondary);
}

.kpi-inline__icon--brand   { color: var(--color-brand-text); }
.kpi-inline__icon--success { color: var(--color-success-500); }

.kpi-inline__icon--warning { color: var(--color-warning-text); }
.kpi-inline__icon--error   { color: var(--color-error-text); }

.kpi-inline__value {
  font-size:            var(--font-xl-sm);    
  font-weight:          var(--weight-semi);   
  font-variant-numeric: tabular-nums;         
  line-height:          1.15;
  color:                var(--text-primary);
}

.kpi-inline__label {
  
  font-size:   var(--font-sm);       
  font-weight: var(--weight-regular);
  color:       var(--text-secondary); 
  line-height: 1.3;
  white-space: nowrap;
}


.kpi-inline__item.is-unmeasured .kpi-inline__value {
  color:         var(--text-muted);
  font-weight:   var(--weight-regular);
  border-bottom: 1px dotted var(--text-muted);
  cursor:        help;
}

.kpi-inline__item.is-unmeasured .kpi-inline__label { color: var(--text-muted); }


.kpi-inline__item.is-unmeasured .kpi-inline__icon,
.kpi-inline__item.is-unmeasured .kpi-inline__icon--brand,
.kpi-inline__item.is-unmeasured .kpi-inline__icon--success,
.kpi-inline__item.is-unmeasured .kpi-inline__icon--warning,
.kpi-inline__item.is-unmeasured .kpi-inline__icon--error {
  color: var(--text-muted);
}


.kpi-inline__item--door {
  display:       inline-flex;
  align-items:   center;
  min-height:    24px;
  background:    none;
  border:        none;
  padding:       0;
  margin:        0;
  font:          inherit;
  color:         inherit;
  cursor:        pointer;
  border-radius: var(--radius-sm);
}

.kpi-inline__item--door:hover {
  background: var(--surface-hover);
}

.kpi-inline__item--door:hover .kpi-inline__label {
  text-decoration: underline;
}

.kpi-inline__item--door:focus-visible {
  outline:        2px solid var(--focus-ring-color);
  outline-offset: 2px;
}


.kpi-inline__item--aside {
  margin-left:  var(--space-3);       
  padding-left: var(--space-4);       
  border-left:  1px solid var(--border-default);
}




.filters-note {
  display:       none;               
  align-items:   center;
  gap:           var(--space-2);     
  padding:       var(--space-2) var(--space-3);
  background:    var(--surface-sunken);
  border-left:   2px solid var(--color-warning-500);
  border-radius: var(--radius-sm);
  font-size:     var(--font-xs);     
  line-height:   1.3;
  color:         var(--text-muted);
}

.filters-note.is-visible { display: flex; }

.filters-note__icon {
  flex:   none;
  width:  14px;
  height: 14px;
  color:  var(--color-warning-500);
}


.filters-note .btn { margin-left: auto; }


.filters-note--error {
  border-left-color: var(--color-error-500);
  color:             var(--color-error-text);
}

.filters-note--error .filters-note__icon { display: none; }




.page-filters-card--merged .form-input-v2:focus-visible,
.filter-toggle:focus-visible,
.page-filters-card--merged .group-filter-dropdown button:focus-visible,
.filters-chips-row .filter-chip__x:focus-visible,
.filters-chips-row .filters-chips-more:focus-visible,
.filters-chips-row .filters-chips-collapse:focus-visible,
.filters-chips-row .filters-chips-clear:focus-visible,
.filters-chips-row .filters-chips-mode__btn:focus-visible {
  outline:        2px solid var(--focus-ring-color);
  outline-offset: 2px;
}


.filters-chips-row .filters-chips-mode__btn:focus-visible {
  outline-offset: -2px;
}




@keyframes filter-chip-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}


.filters-chips-row .filter-chip--enter {
  animation: filter-chip-in 0.12s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .filters-chips-row .filter-chip--enter {
    animation: none;
  }
  .filters-chips-row .filter-chip,
  .filter-toggle,
  .filters-chips-row .filter-chip__x,
  .filters-chips-row .filters-chips-more,
  .filters-chips-row .filters-chips-collapse,
  .filters-chips-row .filters-chips-clear,
  .filters-chips-row .filters-chips-mode__btn {
    transition: none;
  }
}




.tag-chip {
  --tag-fg: var(--text-secondary);
  --tag-bg: var(--surface-hover);
  --tag-bd: var(--border-control);
  display:        inline-flex;
  align-items:    center;
  box-sizing:     border-box;
  min-height:     var(--control-h-sm);          
  padding:        0 var(--space-2);             
  border:         1px solid var(--tag-bd);
  border-radius:  var(--radius-full);           
  background:     var(--tag-bg);
  color:          var(--tag-fg);
  font-family:    inherit;
  font-size:      var(--font-xs);               
  font-weight:    var(--weight-regular);
  line-height:    1.3;
  white-space:    nowrap;
  max-width:      min(100%, var(--tag-pill-max-w));   
  transition:     background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
button.tag-chip { cursor: pointer; }


.tag-pill--cat-green  { --tag-fg: var(--tag-cat-green);  --tag-bg: rgba(var(--tag-cat-green-rgb),  .15); --tag-bd: rgba(var(--tag-cat-green-rgb),  .7); }
.tag-pill--cat-teal   { --tag-fg: var(--tag-cat-teal);   --tag-bg: rgba(var(--tag-cat-teal-rgb),   .15); --tag-bd: rgba(var(--tag-cat-teal-rgb),   .7); }
.tag-pill--cat-amber  { --tag-fg: var(--tag-cat-amber);  --tag-bg: rgba(var(--tag-cat-amber-rgb),  .15); --tag-bd: rgba(var(--tag-cat-amber-rgb),  .7); }
.tag-pill--cat-orange { --tag-fg: var(--tag-cat-orange); --tag-bg: rgba(var(--tag-cat-orange-rgb), .15); --tag-bd: rgba(var(--tag-cat-orange-rgb), .7); }
.tag-pill--cat-violet { --tag-fg: var(--tag-cat-violet); --tag-bg: rgba(var(--tag-cat-violet-rgb), .15); --tag-bd: rgba(var(--tag-cat-violet-rgb), .7); }
.tag-pill--cat-indigo { --tag-fg: var(--tag-cat-indigo); --tag-bg: rgba(var(--tag-cat-indigo-rgb), .15); --tag-bd: rgba(var(--tag-cat-indigo-rgb), .7); }
.tag-pill--cat-pink   { --tag-fg: var(--tag-cat-pink);   --tag-bg: rgba(var(--tag-cat-pink-rgb),   .15); --tag-bd: rgba(var(--tag-cat-pink-rgb),   .7); }
.tag-pill--cat-red    { --tag-fg: var(--tag-cat-red);    --tag-bg: rgba(var(--tag-cat-red-rgb),    .15); --tag-bd: rgba(var(--tag-cat-red-rgb),    .7); }


.tag-chip:hover:not(.is-active) { border-color: currentColor; }


.tag-chip.is-active {
  background:   var(--color-brand-bg);
  border-color: var(--border-on-saturated);      
  color:        var(--text-on-brand);
  font-weight:  var(--weight-medium);
}
.tag-chip.is-active:hover { border-color: var(--border-on-saturated); }


.filters-chips-row .filter-chip.tag-chip {
  height:      var(--control-h-sm);
  padding:     0 var(--space-2);
  border:      1px solid var(--tag-bd);
  background:  var(--tag-bg);
  color:       var(--tag-fg);
  font-size:   var(--font-xs);
  font-weight: var(--weight-regular);
  line-height: 1.3;
}
.filters-chips-row .filter-chip.tag-chip.is-active,
.filters-chips-row .filter-chip.tag-chip.is-active:hover {
  background:   var(--color-brand-bg);
  border-color: var(--border-on-saturated);
  color:        var(--text-on-brand);
  font-weight:  var(--weight-medium);
}

.tag-chip__label {
  overflow:      hidden;
  text-overflow: ellipsis;
  white-space:   nowrap;
  min-width:     0;
}


.tag-chip__count {
  font-variant-numeric: tabular-nums;
  color:       var(--text-secondary);
  flex-shrink: 0;
}
.tag-chip.is-active .tag-chip__count { color: var(--text-on-brand); }


.tag-chip .tag-chip__x {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  width:           24px;
  height:          24px;
  margin-right:    -6px;
  flex-shrink:     0;
  padding:         0;
  border:          0;
  border-radius:   var(--radius-full);
  background:      transparent;
  color:           inherit;
  cursor:          pointer;
}
.tag-chip .tag-chip__x .icon { width: 14px; height: 14px; }
.tag-chip .tag-chip__x:hover {
  background: color-mix(in srgb, var(--color-error-500) 16%, transparent);
}

button.tag-chip:focus-visible,
.tag-chip__x:focus-visible {
  outline:        2px solid var(--focus-ring-color);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .tag-chip { transition: none; }
}


.m5-tags {
  display:     flex;
  flex-wrap:   wrap;
  align-items: center;
  gap:         var(--space-1);
}

/* components/status-indicator.css */
.status-indicator--compact {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  white-space: nowrap;
  line-height: 1;
}


.status-indicator[hidden],
.status-indicator--compact[hidden] { display: none !important; }

.status-indicator--compact .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
  background: var(--text-muted); 
  transition: background-color 0.15s ease;
}

.status-indicator--compact.ok        .dot,
.status-indicator--compact.connected .dot { background: var(--color-success-500); }
.status-indicator--compact.error     .dot { background: var(--color-error-500);   }
.status-indicator--compact.warning   .dot { background: var(--color-warning-500); }

.status-indicator__label {
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
}


.status-indicator--freshness .status-indicator__label,
.status-indicator--freshness {
  text-transform: none;
  letter-spacing: normal;
}
.status-indicator--freshness.fresh      .dot { background: var(--color-success-500); }
.status-indicator--freshness.stale      .dot { background: var(--color-warning-500); }
.status-indicator--freshness.very-stale .dot { background: var(--color-error-500);   }
.status-indicator--freshness.no-data    .dot { background: var(--text-muted);         }


.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--text-muted);
  vertical-align: middle;
  margin-right: 4px;
  flex-shrink: 0;
}
.status-dot--success { background: var(--color-success-500); }
.status-dot--warning { background: var(--color-warning-500); }
.status-dot--error   { background: var(--color-error-500);   }


@media (max-width: 768px) {
  .status-indicator #api-status-text {
    display: none;
  }
}

/* components/form-v2.css */
.form-group-v2 {
  display: flex;
  flex-direction: column;
  margin-bottom: var(--space-4);   
}


.form-group {
  margin-bottom: 20px;
}


.form-label-v2 {
  display: block;
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  line-height: 1;
}


.form-label-v2__hint {
  font-size: var(--font-xs);
  color: var(--text-muted);
  font-weight: var(--weight-regular);
  margin-left: var(--space-2);
}


.form-input-v2 {
  width: 100%;
  height: var(--control-h-md);          
  padding: 0 var(--control-px-md);      
  background: var(--surface-input);
  
  border: 1px solid var(--border-control);
  border-radius: var(--radius-base);
  font-size: var(--control-font-md);    
  font-family: inherit;
  color: var(--text-primary);
  line-height: normal;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
  box-sizing: border-box;
}


.filter-search-input {
  width: 100%;
  height: var(--control-h-md);                              
  padding: 0 var(--control-px-md);                          
  background: var(--surface-sunken);
  border: 1px solid var(--filter-border, var(--border-control));
  border-radius: var(--radius-base);                        
  font-size: var(--font-md-plus);                           
  font-family: inherit;
  color: var(--text-primary);
  line-height: normal;
  box-sizing: border-box;
}

.filter-search-input::placeholder {
  color: var(--text-secondary);         
}


.form-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.form-select-wrap > select.form-input-v2 {
  padding-right: calc(var(--control-px-md) + var(--control-icon-md) + var(--space-2));  
}

.form-select-wrap > select.form-input-v2:not(:disabled) {
  cursor: pointer;
}

.form-select-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: var(--control-px-md);
  width: var(--control-icon-md);
  height: var(--control-icon-md);
  transform: translateY(-50%);
  background-color: var(--text-secondary);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") center / contain no-repeat;
  pointer-events: none;
}

.form-select-wrap:hover::after,
.form-select-wrap:focus-within::after {
  background-color: var(--text-primary);
}


textarea.form-input-v2 {
  height: auto;
  min-height: var(--control-h-lg);
  padding: var(--space-2) var(--control-px-md);
  line-height: var(--line-base);
}


.form-input-v2[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 18px;            
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.form-input-v2[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong, rgba(255, 255, 255, 0.20));
}
.form-input-v2[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong, rgba(255, 255, 255, 0.20));
}
.form-input-v2[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--color-brand-500, var(--color-brand-500));
}
.form-input-v2[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;        
  border-radius: 50%;
  background: var(--color-brand-500, var(--color-brand-500));
  cursor: pointer;
}
.form-input-v2[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: var(--color-brand-500, var(--color-brand-500));
  cursor: pointer;
}

.form-input-v2::placeholder {
  color: var(--text-muted);
}



.form-input-v2:focus,
.form-input-v2:focus-visible {
  outline: none;
  border-color: var(--color-brand-500);
  box-shadow: 0 0 0 3px rgba(var(--color-brand-500-rgb), 0.15);
}


.filter-search-input:focus-visible {
  outline: 2px solid var(--focus-ring-color);
  outline-offset: 2px;
}

.form-input-v2:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--surface-page);
}


.form-input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}


.form-input-icon {
  position: absolute;
  left: var(--space-3);
  color: var(--text-muted);
  pointer-events: none;
  font-size: var(--font-base);
  flex-shrink: 0;
}


.form-input-with-icon .form-input-v2 {
  padding-left: 36px;
}


.form-helper-v2 {
  font-size: var(--font-xs);        
  color: var(--text-muted);
  margin-top: var(--space-1);
  line-height: var(--line-base);
}


.form-error-v2 {
  font-size: var(--font-xs);
  color: var(--color-error-text);
  margin-top: var(--space-1);
  line-height: var(--line-base);
}


textarea.form-input-v2 {
  resize: vertical;
  min-height: 80px;
  line-height: var(--line-base);
}



.form-checkbox-v2 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0;         
  cursor: pointer;
  font-size: var(--font-sm);
  color: var(--text-primary);
  user-select: none;
}

.form-checkbox-v2 input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  
  border: 1px solid var(--border-control);
  border-radius: var(--radius-xs);
  background: var(--surface-input);
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  position: relative;
}

.form-checkbox-v2 input[type="checkbox"]:checked {
  background: var(--color-brand-500);
  border-color: var(--color-brand-500);
}

.form-checkbox-v2 input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  inset: 3px 3px 4px 3px;
  border: 2px solid var(--text-on-brand);
  border-top: none;
  border-right: none;
  transform: rotate(-45deg);
}


.form-checkbox-v2 input[type="checkbox"]:indeterminate {
  background: var(--color-brand-500);
  border-color: var(--color-brand-500);
}
.form-checkbox-v2 input[type="checkbox"]:indeterminate::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 6px;
  height: 2px;
  background: var(--text-on-brand);
}


.form-checkbox-v2 input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--focus-ring-color);
  outline-offset: 2px;
  box-shadow: none;
}


.form-checkbox-v2 input[type="checkbox"]:disabled {
  cursor: not-allowed;
}
.form-checkbox-v2:has(input[type="checkbox"]:disabled) {
  cursor: not-allowed;
}


.form-radio-v2 {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1px solid var(--border-control);
  border-radius: 50%;
  background: var(--surface-input);
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  position: relative;
}
.form-radio-v2:checked {
  border-color: var(--color-brand-500);
  background: var(--color-brand-500);
  box-shadow: inset 0 0 0 3px var(--surface-input);
}
.form-radio-v2:focus-visible {
  outline: 2px solid var(--focus-ring-color);
  outline-offset: 2px;
}
.form-radio-v2:disabled { cursor: not-allowed; }







.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: var(--weight-medium);
    color: var(--text-primary);
}



.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-control);
    border-radius: var(--border-radius);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--legacy-light-blue-rgb), 0.2);
}

.form-input:focus-visible {
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

.form-input::placeholder {
    color: var(--text-muted);
}


.form-input-v2--error {
  border-color: var(--color-error-500);
}

.form-input-v2--error:focus,
.form-input-v2--error:focus-visible {
  border-color: var(--color-error-500);
  box-shadow: 0 0 0 3px rgba(var(--color-error-500-rgb), 0.15);
}


.form-input--sm {
    height: 28px;
    padding: 0 var(--space-2);
    font-size: var(--font-xs);
}

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



.form-control-mini {
    height: var(--control-h-sm);          
    padding: 0 8px;
    font-size: var(--font-sm);            
    background: var(--bg-primary);
    border: 1px solid var(--border-control);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    min-width: 100px;
}

.form-control-mini:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--legacy-sky-rgb), 0.2);
}

/* components/data-table-v2.css */
.data-table-v2-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
}


.data-table-v2 {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-sm);           
  table-layout: auto;
}



.data-table-v2 th {
  padding: var(--space-2) var(--space-3);   
  font-size: var(--font-sm);               
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  background: var(--surface-card);
  position: sticky;
  top: 0;
  z-index: 1;
}


.data-table-v2 td {
  padding: var(--space-2) var(--space-3);   
  font-size: var(--font-sm);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  line-height: var(--line-snug);
}


.data-table-v2 td.col-truncate,
.data-table-v2 th.col-truncate {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.data-table-v2 td.col-name,
.data-table-v2 th.col-name {
  white-space: nowrap;
  min-width: 120px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: var(--weight-medium);
}


.data-table-v2 td.col-numeric,
.data-table-v2 th.col-numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.data-table-v2 td.col-center,
.data-table-v2 th.col-center {
  text-align: center;
}


.data-table-v2 td.col-date,
.data-table-v2 th.col-date {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}


.data-table-v2 td.col-actions,
.data-table-v2 th.col-actions {
  position: sticky;
  right: 0;
  background: var(--surface-card);
  text-align: right;
  white-space: nowrap;
  z-index: 2;
  width: 1%;     
  padding-right: var(--space-3);
  box-shadow: -8px 0 8px -8px rgba(0,0,0,0.4); 
}
.data-table-v2 tbody tr:hover td.col-actions {
  background: var(--surface-hover);
}


.data-table-v2 tbody tr {
  transition: background 0.1s ease;
}

.data-table-v2 tbody tr:hover td {
  background: var(--surface-hover);
}


.data-table-v2 tbody tr:last-child td {
  border-bottom: none;
}


.data-table-v2 th.is-sortable {
  cursor: pointer;
  user-select: none;
  padding-right: var(--space-6);  
  position: relative;
}

.data-table-v2 th.is-sortable:hover {
  color: var(--text-secondary);
}


.data-table-v2 th.is-sortable::after {
  content: "↕";
  position: absolute;
  right: var(--space-3);
  opacity: 0.3;
  font-size: 10px;
}

.data-table-v2 th.is-sortable[aria-sort="ascending"]::after  { content: "↑"; opacity: 0.8; }
.data-table-v2 th.is-sortable[aria-sort="descending"]::after { content: "↓"; opacity: 0.8; }





.data-table-v2 tbody tr[data-expanded] td {
  background: var(--surface-elevated);
}


.data-table-v2 tbody tr.expand-content td {
  background: var(--surface-elevated);
  border-left: none;
  border-right: none;
  padding: var(--space-3) var(--space-4);
  
  border-bottom: 1px solid var(--border-subtle);
}


.data-table-v2 tbody tr.expand-content:hover td {
  background: var(--surface-elevated);
}





.data-table-v2 tbody tr.channel-analytics-row td {
  height: 44px;
  padding-top: 0;
  padding-bottom: 0;
  vertical-align: middle;
  transition: background 150ms ease-out;
}

.data-table-v2 tbody tr.channel-analytics-row:hover td {
  background: var(--surface-hover);
  transition: background 150ms ease-out;
}



.count-rate-cell {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: var(--space-2);
  white-space: nowrap;
}

.count-rate-cell__value {
  font-variant-numeric: tabular-nums;
}


.count-rate-cell__value--clean  { color: var(--color-success-text); }
.count-rate-cell__value--warn   { color: var(--color-warning-text); }
.count-rate-cell__value--danger { color: var(--color-error-text); }

.count-rate-cell__rate {
  
  font-size: var(--font-sm);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  
  min-width: 2.5em;
  text-align: right;
}



.avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);       
  background: var(--surface-hover);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  overflow: hidden;
  flex-shrink: 0;
  vertical-align: middle;
}


.avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}


.data-table-v2 th.col-avatar,
.data-table-v2 td.col-avatar {
  width: 40px;
  min-width: 40px;
  padding-right: 0;
  text-align: center;
}



.channel-name-cell {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

.channel-name-cell__primary {
  font-size: var(--font-sm);             
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
}

.channel-name-cell__sep {
  color: var(--text-muted);
  flex-shrink: 0;
  font-size: var(--font-sm);
}

.channel-name-cell__secondary {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}






.col-link {
  width: 1%;            
  white-space: nowrap;
  text-align: center;
}

.col-link a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 150ms ease-out;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-xs);
}

.col-link a:hover {
  color: var(--text-secondary);
  background: var(--surface-hover);
}

.col-link .icon {
  width: 14px;
  height: 14px;
  pointer-events: none;
}



.quality-cell {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}


.quality-cell__score {
  font-size: var(--font-sm);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  min-width: 20px;
  text-align: right;
}


@media (max-width: 768px) {
  .data-table-v2-wrapper {
    display: block;
    overflow-x: auto;
  }

  .data-table-v2 th,
  .data-table-v2 td {
    padding: var(--space-2) var(--space-3);
  }
}



.leads-table-container {
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-base);
  padding: 1rem;
  margin-bottom: 1rem;
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.leads-table th {
  background: var(--bg-secondary);
  padding: 0.75rem 0.5rem;
  text-align: left;
  border-bottom: 2px solid var(--border-color);
  font-weight: var(--weight-semi);
  color: var(--text-primary);
}

.leads-table td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

.leads-table tr:hover {
  background: var(--bg-hover);
}


.leads-table .copies-col, .leads-table .copies-cell { white-space: nowrap; }                    
.leads-table .copies-cell .lead-copies__toggle { margin-block: calc(-1 * var(--space-1)); }   
.leads-table tr.is-copies-open > td { border-bottom-color: transparent; }                       
.leads-table tr.lead-copies-row > td { padding: 0; }
.leads-table tr.lead-copies-row:hover,
.leads-table .lead-copies__table tr:hover { background: transparent; }                          
.leads-table .lead-copies__table th { background: transparent; }                                
.lead-copies-row__body {
  box-sizing: border-box; padding: 0 var(--space-2) var(--space-2);                             
  position: sticky; left: 0; max-width: 100cqi;                                                 
}
.leads-table-container { container-type: inline-size; }


.username-cell {
    font-weight: var(--weight-semi);
    min-width: 120px;
}


.username-profile-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
}

.message-cell {
    max-width: 300px;
    word-wrap: break-word;
    white-space: normal;   
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.group-cell {
    max-width: 150px;
    word-wrap: break-word;
    white-space: normal;   
}

.hunter-cell {
    min-width: 100px;
    font-size: 0.85rem;
}

.tags-cell {
    max-width: 200px;
}



.message-text {
    background: var(--surface-sunken);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: var(--border-radius);
    line-height: 1.6;
    
    white-space: pre-line;
    
    max-height: 150px;
    overflow-y: auto;
}


@media (max-width: 1024px) {
    .table-wrapper,
    .analytics-table-wrapper,
    [class*='table-container'] {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
    }
    
    th, td {
        white-space: nowrap;
        padding: 8px 10px;
    }
}


@media (max-width: 640px) {
  .data-table-v2--cards { min-width: 0; }   
  .data-table-v2.data-table-v2--cards,
  .data-table-v2.data-table-v2--cards tbody { display: block; }
  
  .data-table-v2.data-table-v2--cards thead {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .data-table-v2.data-table-v2--cards tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: var(--space-3);
    row-gap: var(--space-1);
    align-items: start;
    padding: var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
  }
  .data-table-v2.data-table-v2--cards td[data-cell] {
    display: block;
    position: static;
    width: auto; min-width: 0; max-width: none; height: auto;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    text-align: left;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
  }
  .data-table-v2.data-table-v2--cards tbody tr:hover td[data-cell] { background: transparent; }
  .data-table-v2.data-table-v2--cards td[data-cell="name"]    { grid-column: 1 / -1; grid-row: 1; }
  .data-table-v2.data-table-v2--cards td[data-cell="status"]  { grid-column: 1 / -1; grid-row: 2; }
  .data-table-v2.data-table-v2--cards td[data-cell="actions"] { grid-column: 1 / -1; grid-row: 3; }
  .data-table-v2.data-table-v2--cards td[data-cell="account"] { grid-column: 1 / -1; grid-row: 4; }
  .data-table-v2.data-table-v2--cards td[data-cell="scheme"]  { grid-column: 1; grid-row: 5; color: var(--text-secondary); }
  .data-table-v2.data-table-v2--cards td[data-cell="country"] { grid-column: 2; grid-row: 5; color: var(--text-secondary); }
  .data-table-v2.data-table-v2--cards td[data-cell="health"]  { grid-column: 1 / -1; grid-row: 6; }
  
  .data-table-v2.data-table-v2--cards td[data-cell="actions"] .proxy-actions { justify-content: flex-start; flex-wrap: wrap; }
}
}

/* components/toggle.css */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  
  padding: var(--space-1) 0;         
}

.toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle__slider {
  display: block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--surface-active);
  
  border: 1px solid var(--border-control);
  transition: background 0.18s, border-color 0.18s;
  position: relative;
}

.toggle__slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  background: var(--text-muted);
  transition: transform 0.18s, background 0.18s;
}

.toggle input[type="checkbox"]:checked + .toggle__slider {
  background: var(--color-brand-500);
  border-color: var(--color-brand-500);
}

.toggle input[type="checkbox"]:checked + .toggle__slider::after {
  transform: translateX(16px);
  background: var(--text-on-brand);
}

.toggle input[type="checkbox"]:focus-visible + .toggle__slider {
  outline: 2px solid var(--focus-ring-color);
  outline-offset: 2px;
}


.toggle input[type="checkbox"]:disabled + .toggle__slider {
  opacity: 0.45;
}

.toggle:has(input[type="checkbox"]:disabled) {
  cursor: not-allowed;
}



.toggle--lg {
  
  padding: var(--space-2) 0;
}

.toggle--lg .toggle__slider {
  width: 52px;
  height: 28px;
}

.toggle--lg .toggle__slider::after {
  width: 22px;
  height: 22px;
}


.toggle--lg input[type="checkbox"]:checked + .toggle__slider::after {
  transform: translateX(24px);
}




.toggle--field {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  width: fit-content;
  max-width: 100%;
}

.toggle-field__label {
  font-size: var(--font-base);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  line-height: var(--line-snug);
}



.toggle-state {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.toggle-state__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.toggle-state__word {
  font-size: var(--font-sm);
  font-weight: var(--weight-semi);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}


.toggle-state--on  { color: var(--color-success-500); }
.toggle-state--off { color: var(--color-error-text); }



@media (max-width: 768px) {
  .toggle--field {
    gap: var(--space-2);
  }
}

/* components/panel.css */
.panel,
.dash-panel,
.dash-pulse-bar,
#all-hunters-list,
.leads-results-section,
.tags-tree-card,
.page-filters-card {
  background-color: var(--surface-elevated);
  background-image: var(--film-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--edge-top), var(--shadow-card);
}

.panel,
.dash-panel {
  padding: var(--space-5);
}


@media (max-width: 768px) {
  .panel,
  .dash-panel { padding: var(--space-4); }
}


.panel--flush {
  padding: 0;
}





.panel-title,
.dash-panel-title,
.modal-section__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  font-size: var(--font-sm);
  font-weight: var(--weight-semi);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.panel-title a,
.dash-panel-title a,
.modal-section__title a {
  font-size: var(--font-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-brand-text);
  text-decoration: none;
}

.panel-title a:hover,
.dash-panel-title a:hover { text-decoration: underline; }

/* components/leads-results.css */
.results-count {
    font-size: var(--font-base);
    color: var(--text-secondary);
    font-weight: var(--weight-regular);
    white-space: nowrap;
}

.results-count strong {
    font-weight: var(--weight-bold);
    color: var(--color-brand-text);
    font-size: 15px;
}



.results-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    padding: var(--space-2) var(--space-4);
    gap: var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.results-header--info {
    border-bottom: 0;
    padding-bottom: 0;
}


.results-info-compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.results-header--info .results-info-compact {
    flex: 1 1 100%;
    min-width: 0;
    gap: var(--space-2);
    flex-wrap: wrap;
}


.results-header--info .filters-note {
    flex: 1 1 100%;
}


.count-compact {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--font-sm);            
    font-weight: var(--weight-regular);
    
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    white-space: nowrap;
}

.count-compact b {
    font-weight: var(--weight-semi);
    color: var(--text-primary);
}

.count-compact .results-sep {
    margin: 0 var(--space-1);
    color: var(--text-muted);
}


.count-compact__item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    white-space: nowrap;
}


.results-aside {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    height: var(--control-h-sm);          
    font-size: var(--font-sm);
    color: var(--text-secondary);
    white-space: nowrap;
    margin-left: var(--space-2);
    padding-left: var(--space-3);
    border-left: 1px solid var(--border-default);
}

.results-aside b {
    font-weight: var(--weight-semi);
    color: var(--text-primary);
}


.count-compact.is-unmeasured b,
.results-aside.is-unmeasured b {
    color: var(--text-muted);
}


.leads-results-section {
    container-type: inline-size;
    container-name: leads-results;
}



.results-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);   
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}


.sort-icon {
    font-size: 0.9rem;
    cursor: help;
    flex-shrink: 0;
}

.results-content {
    padding: var(--space-4);   
}


.results-content:has(> .leads-grid) {
    padding: 0;
}


.results-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: nowrap; 
    
    margin-left: auto;
}


#copy-all-usernames,
#leads-export {
    white-space: nowrap;
    flex-shrink: 0;
}


@media (max-width: 480px) {
    #copy-all-usernames {
        font-size: 0.75rem;
        padding: 0.3rem 0.5rem;
        
    }

    
    #copy-all-usernames::before {
        content: "Копировать";
        display: block;
    }

    #copy-all-usernames {
        text-indent: -9999px; 
        position: relative;
    }

    #copy-all-usernames::before {
        text-indent: 0;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 100%;
        text-align: center;
    }
}


@media (min-width: 768px) and (max-width: 1024px) {
    #copy-all-usernames {
        max-width: 180px;
        font-size: 0.8rem;
    }
    
    .results-controls {
        flex-wrap: wrap;
    }
}


.table-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    justify-content: flex-start;
}



.tags-toggle-mobile {
    display: none;
}


@media (max-width: 768px) {
    
    .results-content {
        padding: 4px 0;
    }
    .results-header {
        padding: 6px 8px;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        align-items: center;
    }
    .results-footer {
        padding: 4px 0;
    }
    .results-controls {
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
    }
    .results-info-compact {
        flex-shrink: 0;
    }
    .count-compact {
        font-size: 0.75rem;
        padding: 2px 6px;
    }
    .results-controls {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
    }
    .results-controls select {
        font-size: 0.7rem;
        padding: 2px 4px;
        max-width: 80px;
    }
    #copy-all-usernames {
        display: none !important;
    }
    
    .tags-toggle-mobile {
        display: block;
        width: 100%;
        padding: 8px 0;
        background: var(--bg-secondary);
        border: 1px solid var(--border-control);
        border-radius: 4px;
        color: var(--text-primary);
        font-size: 0.85rem;
        font-weight: var(--weight-medium);
        cursor: pointer;
        text-align: left;
        text-indent: 8px;
        margin-bottom: 4px;
        box-sizing: border-box;
    }
    .tags-toggle-mobile:active {
        background: var(--bg-hover);
    }
}






@media (min-width: 769px) {
    .container:has(> #leads-page.active) {
        max-width: none;
        padding-inline: 0;
    }

    
    .main-content:has(#leads-page.active) {
        padding-block: 0;
    }

    #leads-page .leads-screen {
        display: grid;
        grid-template-columns: var(--leads-tree-w) minmax(0, 1fr);
        grid-template-rows: auto 1fr;
        align-items: start;
    }

    
    #leads-page .leads-main-layout {
        display: contents;
    }

    #leads-page .leads-screen > .page-filters-card {
        grid-column: 2;
        grid-row: 1;
    }

    #leads-page .tags-tree-section {
        grid-column: 1;
        grid-row: 1 / span 2;
    }

    #leads-page .leads-results-section {
        grid-column: 2;
        grid-row: 2;
    }
}


#leads-page .page-filters-card {
    margin: 0;
    padding: var(--space-3) var(--space-6);
    background: none;
    border: 0;
    border-bottom: 1px solid var(--border-subtle);
    border-radius: 0;
    box-shadow: none;
}


#leads-page .leads-results-section {
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}


.results-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-3) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
}

.results-bar > .results-header {
    display: contents;
}

.results-bar .results-info-compact {
    order: 1;
    flex: 0 1 auto;
}

.results-bar .results-controls {
    order: 2;
    margin-left: auto;
    gap: var(--space-2);
}

.results-bar .pagination-controls {
    order: 3;
}

.results-bar .filters-note {
    order: 4;
    flex: 1 1 100%;
}


.results-bar .count-compact,
.results-bar .results-aside {
    font-size: var(--lead-fs-small);
    height: auto;
}

.results-bar .kpi-inline__icon {
    display: none;
}

.results-bar .results-aside {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
}

.results-bar .results-info-compact {
    gap: var(--space-4);
}


.results-bar .page-info {
    padding: 0 var(--space-1);
    font-family: inherit;
    font-size: var(--lead-fs-small);
    font-weight: var(--weight-regular);
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    white-space: nowrap;
    background: none;
    border-radius: 0;
}

.results-bar .page-info.is-unmeasured {
    color: var(--text-muted);
}


.results-bar .btn-page {
    background: none;
    border: 0;
    color: var(--text-muted);
}

.results-bar .btn-page:hover:not(:disabled) {
    background: var(--surface-hover);
    color: var(--text-primary);
    transform: none;
    box-shadow: none;
}

.results-bar .btn-page:disabled {
    background: none;
}


.results-bar .results-info-compact {
    flex-wrap: wrap;
    row-gap: var(--space-1);
}

.results-bar .count-compact {
    flex-wrap: wrap;
    white-space: normal;
}


#leads-page .results-footer {
    padding: var(--space-3) var(--space-6);
}


.filters-sort {
    margin-left: auto;
    display: flex;
    align-items: center;
}


#leads-page .filter-toggles__contact > .filter-group-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}


@media (min-width: 769px) {
    #leads-page .page-filters-card--merged .filter-search-wrap {
        flex: 0 0 300px;
        width: 300px;
        margin-right: 0;
    }

    #leads-page .page-filters-card--merged .filters-tier {
        column-gap: var(--space-2);
    }
}


@media (max-width: 768px) {
    .container:has(> #leads-page.active) {
        padding-inline: 0 !important;
    }

    #leads-page .page-filters-card,
    .results-bar,
    #leads-page .results-footer {
        padding-inline: var(--space-4);
    }

    #leads-page .tags-toggle-mobile {
        width: calc(100% - 2 * var(--space-4));
        margin-inline: var(--space-4);
    }
}


@container leads-results (max-width: 1250px) {
    .results-bar #show-message-text .filter-toggle__label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .results-bar {
        column-gap: var(--space-3);
    }

    .results-bar .results-info-compact {
        gap: var(--space-2);
    }

    .results-bar .results-controls {
        gap: var(--space-1);
    }

    .results-bar .page-info {
        padding: 0;
    }
}


#leads-page .page-filters-card .form-input-v2,
#leads-page .page-filters-card .group-filter-trigger,
#leads-page .page-filters-card .gf-selected-text,
#leads-page .page-filters-card .filter-toggle,
#leads-page .page-filters-card .hint-btn,
#leads-page .results-bar .btn,
#leads-page .results-bar .filter-toggle,
#leads-page .results-bar .btn-toggle,
#leads-page .results-bar .btn-page,
#leads-page .tree-controls-compact .btn,
#leads-page .results-footer,
#leads-page .results-footer select,
#leads-page .results-footer label {
    font-size: var(--lead-fs-mid);
}


@media (min-width: 769px) {
    #leads-page .page-filters-card--merged .filter-search-wrap {
        flex: 0 0 300px;
        min-width: 160px;
    }
}

#leads-page .page-filters-card--merged .filters-tier {
    row-gap: var(--space-2);
}


.results-bar__actions {
    order: 2;
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2) var(--space-4);
}

.results-bar__actions > .results-controls,
.results-bar__actions > .pagination-controls {
    order: 0;
    margin-left: 0;
}

#leads-page .results-footer .items-per-page-control,
#leads-page .results-footer .items-per-page-control span {
    font-size: var(--lead-fs-mid);
}

#leads-page .results-footer .page-info {
    font-family: inherit;
    font-size: var(--lead-fs-small);
    background: none;
}


#leads-page .tags-toggle-mobile,
#leads-page .tags-toggle-mobile span {
    font-size: var(--lead-fs-mid);
}


@media (min-width: 769px) {
    body:has(#leads-page.active) .header.app-header .container {
        max-width: none;
        padding-inline: var(--space-6);
    }
}

/* components/lead-card.css */
.leads-main-layout {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}


.leads-results-section {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}


.leads-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}


#leads-page .leads-main-layout {
  gap: var(--space-6);     
  margin-top: var(--space-4);
}


@media (max-width: 768px) {
    .leads-grid {
        display: flex;
        flex-direction: column;
    }
    .leads-results-section {
        padding: 0 !important;
        min-width: 0;
        width: 100%;
    }
    .leads-results-section, .leads-main-layout {
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
    }
    .leads-main-layout {
        flex-direction: column !important;
        gap: 8px !important;
    }
}




.lead-card-compact {
    display: grid;
    
    grid-template-columns:
        calc(var(--lead-stub-w) + var(--space-4)) minmax(0, 1fr) auto var(--control-h-sm) var(--control-h-sm);
    align-items: start;
    column-gap: 0;
    row-gap: var(--space-1);
    padding: var(--space-3) var(--space-6);
    margin: 0;
    border: 0;
    border-bottom: 1px solid var(--border-subtle);
    border-radius: 0;
    background: transparent;
    position: relative;
}


.lead-card-compact:hover {
    background: color-mix(in srgb, var(--text-primary) 3%, transparent);
}


.lead-card-compact.is-selected {
    background: var(--lead-row-selected-bg);
    box-shadow: inset 0 0 0 1px rgba(var(--color-brand-500-rgb), 0.45);
}


.lead-header-horizontal,
.lead-message-wide,
.lead-footer-inline {
    display: contents;
}


.lead-stub {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    margin: 0 var(--space-4) 0 calc(-1 * var(--space-2));
}

.lead-stub__item {
    --ac: var(--lead-act-other-rgb);
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    align-items: center;
    gap: var(--space-1);
    min-width: 0;
    padding: 0 0 0 calc(var(--space-2) + 2px);
    border: 0;
    border-left: 3px solid rgb(var(--ac));
    border-radius: 2px;
    background: linear-gradient(90deg, rgba(var(--ac), 0.10), rgba(var(--ac), 0) 90%);
    color: rgb(var(--ac));
    font-family: inherit;
    font-size: var(--lead-fs-mid);
    font-weight: var(--weight-semi);
    line-height: 1.2;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
}

.lead-stub__item[data-group="sell"]  { --ac: var(--lead-act-sell-rgb); }
.lead-stub__item[data-group="offer"] { --ac: var(--lead-act-offer-rgb); }
.lead-stub__item[data-group="seek"]  { --ac: var(--lead-act-seek-rgb); }
.lead-stub__item[data-group="other"] { --ac: var(--lead-act-other-rgb); }

.lead-stub__icon {
    width: 14px;
    height: 14px;
    flex: none;
}

.lead-stub__label {
    min-width: 0;
    overflow: hidden;
    text-overflow: clip;
}

.lead-stub__item:hover {
    background: linear-gradient(90deg, rgba(var(--ac), 0.18), rgba(var(--ac), 0) 90%);
}

.lead-stub__item:focus-visible {
    outline: 2px solid var(--focus-ring-color);
    outline-offset: -2px;
}


.lead-stub__item[aria-pressed="true"] {
    background: linear-gradient(90deg, rgba(var(--ac), 0.24), rgba(var(--ac), 0.06) 90%);
    box-shadow: inset 0 0 0 1px rgba(var(--ac), 0.6);
}


.lead-stub--none {
    pointer-events: auto;
}


.leads-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-4);
    padding: var(--space-2) var(--space-6);
    font-size: var(--lead-fs-small);
    line-height: var(--line-base);
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
}

.leads-legend__item {
    --ac: var(--lead-act-other-rgb);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.leads-legend__item[data-group="sell"]  { --ac: var(--lead-act-sell-rgb); }
.leads-legend__item[data-group="offer"] { --ac: var(--lead-act-offer-rgb); }
.leads-legend__item[data-group="seek"]  { --ac: var(--lead-act-seek-rgb); }

.leads-legend__item i {
    width: 3px;
    height: 14px;
    border-radius: 2px;
    background: rgb(var(--ac));
}

.leads-legend__item--none i {
    background: none;
    border: 1px dashed var(--border-strong);
}

.leads-legend em {
    font-style: normal;
    color: var(--text-secondary);
}


@container leads-results (max-width: 1300px) {
    .leads-legend__item span[lang="en"] {
        display: none;
    }
}

@container leads-results (max-width: 760px) {
    .leads-legend {
        padding-inline: var(--space-4);
    }
}


.lead-who {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    overflow: hidden;
    font-size: var(--lead-fs-mid);
    line-height: var(--line-base);
    color: var(--text-muted);
}

.lead-username-clickable {
    flex: 0 1 auto;
    min-width: 6ch;
    max-width: var(--lead-nick-max-w);
    font-size: var(--lead-fs-mid);
    font-weight: var(--weight-semi);
    line-height: var(--line-base);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lead-username-clickable:hover {
    color: var(--color-brand-text);
}


.lead-geo {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    overflow: hidden;
    white-space: nowrap;
    color: var(--text-primary);   
}


.lead-geo,
.lead-geo > .lead-pstl {
    flex: none;
}

.lead-geo > .is-fit-hidden {
    display: none;
}

.lead-pstl {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    height: var(--lead-chip-h);
    padding: 0 var(--space-2) 0 var(--space-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--text-primary) 5%, transparent);
    font: inherit;
    font-size: var(--lead-fs-mid);
    line-height: 1;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}


.lead-pstl--place,
.lead-pstl--lang {
    color: var(--text-primary);
}

.lead-pstl--city {
    padding-inline: var(--space-2);
    color: var(--text-secondary);
}

.lead-pstl__icon {
    width: 13px;
    height: 13px;
    flex: none;
    color: var(--text-muted);
}


.lead-pstl__flag {
    font-size: var(--lead-flag-size);
    line-height: 1;
}

.lead-pstl__name {
    max-width: var(--lead-chip-name-max-w);
    overflow: hidden;
    text-overflow: ellipsis;
}

.lead-pstl:hover {
    border-color: var(--border-control);
    background: color-mix(in srgb, var(--text-primary) 9%, transparent);
}

.lead-pstl:hover .lead-pstl__icon {
    color: var(--text-secondary);
}

.lead-pstl:focus-visible {
    outline: 2px solid var(--focus-ring-color);
    outline-offset: 1px;
}


.lead-pstl[aria-pressed="true"] {
    border-color: rgba(var(--color-brand-500-rgb), 0.6);
    background: rgba(var(--color-brand-500-rgb), 0.18);
    color: var(--color-brand-text);
}

.lead-pstl[aria-pressed="true"] .lead-pstl__icon {
    color: var(--color-brand-text);
}

.lead-date-sub {
    flex: none;
    font-size: var(--lead-fs-small);
    line-height: var(--line-base);
    color: var(--text-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}


.lead-meta-inline {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    gap: var(--space-2);
    overflow: hidden;
    font-size: var(--lead-fs-small);
    line-height: var(--line-base);
    color: var(--text-muted);
}

.lead-meta-inline > * {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lead-meta__hunter {
    flex: 0 1 auto;
    max-width: 50%;
}

.lead-meta__channel {
    flex: 1 1 0;
}


.lead-meta__icon {
    width: 12px;
    height: 12px;
    flex: none;
    vertical-align: -2px;
    margin-right: 3px;
    color: var(--text-muted);
}


.lead-flags::before {
    content: "·";
    content: "·" / "";
    margin-right: var(--space-2);
    opacity: 0.5;
}


.lead-flags {
    flex: none;
    display: flex;
    gap: var(--space-2);
    font-size: var(--lead-fs-small);
}

.icon-mini {
    display: inline-flex;
    align-items: center;
    font-size: var(--lead-fs-small);
    color: var(--text-muted);
}


.lead-who .profile-chip {
    flex: none;
    width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-muted);
    font-size: 0;
    line-height: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    position: relative;
    box-shadow: none;
    transform: none;
    text-decoration: none;
    box-sizing: border-box;
}

.lead-who .profile-chip .status-dot,
.lead-who .profile-chip .profile-chip__icon {
    display: none;
}

.lead-who .profile-chip .profile-chip__tg {
    display: block;
    width: 14px;
    height: 14px;
    margin: 0;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 1.5;
}


.lead-who .profile-chip[role="button"]::after {
    content: "";
    position: absolute;
    inset: -4px;
}

.lead-who .profile-chip--trusted {
    color: var(--success-color);
}


.lead-who .profile-chip--profiled {
    color: var(--color-brand-text);
}

.lead-who .profile-chip--forming {
    color: var(--text-muted);
}


.lead-who .profile-chip--trust-unmeasured .profile-chip__tg {
    fill: transparent;
    stroke-dasharray: 2 2;   
}

.lead-who .profile-chip--trust-unmeasured {
    color: var(--color-brand-text);
    background: transparent;
    border: 0;
}


.lead-who .profile-chip--locked {
    color: var(--text-muted);
    background: transparent;
    border: 0;
}

.lead-who .profile-chip--locked .profile-chip__tg {
    fill: transparent;
}

.lead-who .profile-chip[role="button"]:hover {
    text-decoration: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent);
}

.lead-who .profile-chip[role="button"]:focus-visible {
    outline: 2px solid var(--focus-ring-color);
    outline-offset: 2px;
}


.lead-tags-chips {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: start;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: var(--lead-tag-gap);
    min-width: 0;
    min-height: var(--control-h-sm);
    max-width: min(var(--lead-tags-max-w), 40cqi);
    margin: 0 var(--space-1) 0 var(--space-4);
    overflow: hidden;
}

.lead-tags-chips .tag-chip {
    flex: none;
    min-height: 0;
    padding: 2px var(--space-2);
    font-size: var(--lead-fs-mid);
    line-height: 1.3;
}


.lead-tags-chips:has(.lead-tags-more:not(.is-empty)) .tag-chip {
    max-width: calc(100% - 2.5rem);
}

.lead-tags-chips .tag-chip:not(.is-active) {
    background: color-mix(in srgb, var(--tag-fg) 10%, transparent);
    border-color: color-mix(in srgb, var(--tag-fg) 22%, transparent);
}

.lead-tags-chips .tag-chip:not(.is-active):hover {
    border-color: var(--tag-fg);
}


.lead-tags-chips .tag-chip.is-overflow,
.lead-tags-chips .tag-chip.is-fit-hidden {
    display: none;
}

.lead-card-compact.is-selected .lead-tags-chips {
    flex-wrap: wrap;
    overflow: visible;
}

.lead-card-compact.is-selected .lead-tags-chips .tag-chip.is-overflow,
.lead-card-compact.is-selected .lead-tags-chips .tag-chip.is-fit-hidden {
    display: inline-flex;
}

.lead-tags-more {
    flex: none;
    padding: 0 var(--space-1);
    font-size: var(--lead-fs-small);
    line-height: var(--control-h-sm);
    color: var(--text-muted);
    cursor: help;
}

.lead-tags-more.is-empty,
.lead-card-compact.is-selected .lead-tags-more {
    display: none;
}


.tag-empty-mini {
    font-size: var(--lead-fs-small);
    color: var(--text-muted);
  
    line-height: 1.3;
}


.lead-actions-inline {
    grid-column: 4;
    grid-row: 1 / span 2;
    align-self: start;
    display: flex;
    align-items: center;
}

.btn-expand-mini,
.btn-icon-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--control-h-sm);
    height: var(--control-h-sm);
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: var(--font-md);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-expand-mini .icon,
.btn-icon-mini .icon {
    width: 16px;
    height: 16px;
}

.btn-icon-mini:hover,
.btn-expand-mini:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}


.btn-icon-mini:focus-visible,
.btn-expand-mini:focus-visible {
    outline: 2px solid var(--focus-ring-color);
    outline-offset: 2px;
}

.btn-icon-mini.btn-block-user:hover {
    color: var(--color-error-text);
}


.btn-expand-mini {
    width: var(--control-h-sm);
    height: var(--control-h-sm);
    padding: 0;
    grid-column: 5;
    grid-row: 1 / span 2;
    justify-self: end;
    align-self: start;
}


.message-text-horizontal {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    font-size: var(--lead-fs-text);
    line-height: 1.5;
    color: var(--text-primary);
    text-align: left;
    
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    max-height: 3em;
    overflow: hidden;
    word-break: break-word;
    white-space: pre-wrap;
    transition: max-height 0.3s ease;
}

.message-text-horizontal.expanded {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: none;
    max-height: none;
}


@container leads-results (max-width: 760px) {
    .lead-card-compact {
        
        grid-template-columns:
            calc(var(--lead-stub-w-narrow) + var(--space-1) + 2px) minmax(0, 1fr) var(--control-h-sm) var(--control-h-sm);
        padding-inline: var(--space-4);
    }
    .lead-stub {
        grid-row: 1 / span 3;
        margin: 0 calc(var(--space-2) + 2px) 0 calc(-1 * var(--space-1));
    }
    .lead-actions-inline {
        grid-column: 3;
        grid-row: 1;
    }
    .btn-expand-mini {
        grid-column: 4;
        grid-row: 1;
    }
    .message-text-horizontal {
        grid-column: 2 / -1;
    }
    .lead-tags-chips {
        grid-column: 2 / -1;
        grid-row: 3;
        max-width: none;
        margin: var(--space-2) 0 0;
    }
    .lead-card-compact .lead-copies {
        grid-column: 2 / -1;
        grid-row: 4;
    }
    
    .lead-stub__item {
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 2px;
        white-space: normal;
        padding-left: var(--space-2);
    }
    
    .lead-stub--multi .lead-stub__item {
        flex-direction: row;
        align-items: center;
    }
    .lead-stub--multi .lead-stub__label {
        display: none;
    }
}


@container leads-results (max-width: 516px) {
    .lead-meta-inline {
        display: none;
    }
    
    .lead-who {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        column-gap: var(--space-2);
        row-gap: 0;
    }
    .lead-who > .profile-chip {
        grid-column: 1;
        grid-row: 1;
    }
    .lead-username-clickable {
        grid-column: 2;
        grid-row: 1;
        justify-self: start;
        max-width: 100%;
    }
    .lead-date-sub {
        grid-column: 3;
        grid-row: 1;
    }
    .lead-geo {
        grid-column: 1 / -1;
        grid-row: 2;
    }
    .lead-flags {
        grid-column: 1 / -1;
        grid-row: 3;
    }
    .lead-flags::before {
        display: none;
    }
}


.lead-details .detail-section {
    margin-bottom: 1.5rem;
}

.lead-details .detail-section:last-child {
    margin-bottom: 0;
}

.lead-details h5 {
    margin: 0 0 0.75rem 0;
    font-size: 0.875rem;
    font-weight: var(--weight-semi);
    color: var(--text-secondary);
    text-transform: uppercase;
}

.details-table {
    width: 100%;
    font-size: 0.875rem;
}

.details-table td {
    padding: 0.5rem 0;
}

.details-table td:first-child {
    font-weight: var(--weight-semi);
    color: var(--text-secondary);
    width: 120px;
}

.contact-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.contact-item i {
    margin-right: 0.5rem;
    color: var(--text-secondary);
}

.copyable-username {
    cursor: pointer;
    color: var(--color-brand-text);
    text-decoration: underline;
}

.copyable-username:hover {
    color: var(--color-brand-text);
}

.profile-chip .status-dot { background: currentColor; }
.profile-chip__icon { margin-right: 4px; }

.profile-chip__tg { display: none; }


.profile-chip {
    grid-area: 1 / 1;           
    margin-right: var(--space-2);
    display: inline-flex;
    align-items: center;
    padding: 1px 4px;
    font-size: var(--font-xs);  
    font-weight: var(--weight-regular);
    border-radius: 3px;
    border: 1px solid transparent;
    transition: var(--transition-fast);
    cursor: default;
    flex-shrink: 0;
    white-space: nowrap;
    user-select: none;
    line-height: 1.4;
}

.profile-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}


@media (max-width: 1024px) {
    .profile-chip {
        padding: 1px 4px;
    }
}
@media (max-width: 480px) {
    .profile-chip {
        padding: 1px 3px;
    }
}
@media (max-width: 768px) {
    .profile-chip {
        padding: 1px 4px;
    }
}



.profile-chip[role="button"] {
    cursor: pointer;
}


.profile-chip[role="button"]:hover {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
}

.profile-chip[role="button"]:focus-visible {
    outline: 2px solid var(--color-brand-500);
    outline-offset: 2px;
    border-radius: 3px;
}


.profile-chip--trusted {
    background: rgba(var(--legacy-green-500-rgb), 0.15);
    color: var(--legacy-green-500);
    border: 1px solid rgba(var(--legacy-green-500-rgb), 0.25);
}


.profile-chip--profiled {
    background: rgba(var(--legacy-slate-400-rgb), 0.12);
    color: var(--legacy-slate-400);
    border: 1px solid rgba(var(--legacy-slate-400-rgb), 0.2);
}


.profile-chip--trust-unmeasured {
    background: rgba(var(--data-base-hi-rgb), 0.06);
    color: var(--text-muted);
    border: 1px dashed rgba(var(--data-base-hi-rgb), 0.35);
}


.profile-chip--forming {
    background: rgba(var(--data-base-hi-rgb), 0.08);
    color: var(--text-muted);
    border: 1px solid rgba(var(--data-base-hi-rgb), 0.12);
    
}


.profile-chip--locked {
    background: rgba(var(--data-base-hi-rgb), 0.06);
    color: var(--text-muted);
    border: 1px solid rgba(var(--data-base-hi-rgb), 0.1);
}



.lead-copies { grid-column: 2 / -1; grid-row: 3; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }  
.lead-copies__toggle {
  display: inline-flex; align-items: center; gap: var(--space-1);
  min-height: var(--control-h-sm);                          
  max-width: calc(100% + var(--space-2));
  margin-left: calc(-1 * var(--space-2));                   
  padding: 0 var(--space-2);
  border: 0; border-radius: var(--radius-base); background: transparent;
  color: var(--text-secondary); font-family: inherit; font-size: var(--font-xs); line-height: 1.3;
  text-align: left; cursor: pointer;
}
.lead-copies__toggle:hover { background: var(--surface-hover); color: var(--text-primary); }  
.lead-copies__toggle:focus-visible { outline: 2px solid var(--focus-ring-color); outline-offset: 2px; }  
.lead-copies__chev { width: 14px; height: 14px; flex: none; }


.lead-copies__list { width: 100%; margin-top: var(--space-1); border-top: 1px solid var(--border-subtle); }
.lead-copies__list[hidden], .lead-copies__table tr[hidden] { display: none; }  
.lead-copies__table { width: 100%; min-width: 0; border-collapse: collapse; table-layout: fixed; font-size: var(--font-sm); }  
.lead-copies__table th {
  height: var(--control-h-sm);                              
  padding: 0 var(--space-2); text-align: left; vertical-align: middle;
  font-size: var(--font-sm); font-weight: var(--weight-medium); color: var(--text-muted);
  text-transform: uppercase; letter-spacing: var(--tracking-eyebrow); white-space: nowrap;
  border-bottom: 1px solid var(--border-subtle);
}
.lead-copies__table td {
  height: var(--control-h-md);                              
  padding: 0 var(--space-2); vertical-align: middle;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-bottom: 1px solid var(--border-subtle);
}
.lead-copies__table tbody tr:last-child td { border-bottom: 0; }
.lead-copies__table th:first-child, .lead-copies__table td:first-child { padding-left: 0; }   
.lead-copies__table th:last-child,  .lead-copies__table td:last-child  { padding-right: 0; }
.lead-copies__table .lead-copies__who  { width: 40%; }
.lead-copies__chat { color: var(--text-primary); }
.lead-copies__who  { color: var(--text-secondary); }
.lead-copies__more { padding-inline: var(--space-2); margin: var(--space-1) 0 0 calc(-1 * var(--space-2)); }  


@media (max-width: 480px) {
  .lead-copies__table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .lead-copies__table, .lead-copies__table tbody { display: block; }
  .lead-copies__table tr {
    display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "chat" "who";
    row-gap: 2px; padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle);
  }
  .lead-copies__table tbody tr:last-child { border-bottom: 0; }
  .lead-copies__table td { display: block; height: auto; padding: 0; border: 0; }
  .lead-copies__table td.lead-copies__chat { grid-area: chat; }
  .lead-copies__table td.lead-copies__who  { grid-area: who; width: auto; font-size: var(--font-xs); }
}

/* components/dashboard-funnel.css */
.dash-funnel-title {
  margin: 0 0 var(--space-4);
  
  justify-content: flex-start;
}

.dash-funnel-row {
  
  display: grid;
  grid-template-columns: 1fr 92px 52px;
  align-items: baseline;
  gap: var(--space-3);
  
  padding: var(--space-2) 0;
}

.dash-funnel-row__name {
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

.dash-funnel-row__count {
  font-size: var(--font-base);
  font-weight: var(--weight-semi);
  color: var(--text-primary);
  text-align: right;
}

.dash-funnel-row__pct {
  font-size: var(--font-sm);
  color: var(--text-muted);
  text-align: right;
}


.dash-funnel-bar {
  position: relative;
  
  padding-top: var(--space-4);
  margin-bottom: var(--space-5);
}

.dash-funnel-bar:empty {
  padding-top: 0;
  margin-bottom: 0;
}


.dash-funnel-bar__track {
  display: flex;
  height: 22px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--data-base-hi), var(--data-base-lo));
  overflow: hidden;
}


.dash-funnel-bar__seg {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 100%;
  
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.7);
  background: var(--data-fill-hi);
  font-size: var(--font-2xs);
  
  font-weight: var(--weight-medium);
  letter-spacing: 0.08em;
  
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
}

.dash-funnel-bar__seg--labelled {
  padding: 0 var(--space-3);
}


.dash-funnel-bar__seg--other {
  background: var(--data-fill-lo);
}


.dash-funnel-bar__tick {
  position: absolute;
  top: var(--space-4);
  bottom: 0;
  width: 2px;
  background: var(--color-brand-500);
}


.dash-funnel-bar__tick-label {
  position: absolute;
  right: 0;
  bottom: 100%;
  padding-bottom: var(--space-1);
  font-size: var(--font-2xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-brand-text);
  white-space: nowrap;
}

.dash-funnel-divider {
  margin: var(--space-2) 0;
  border-top: 1px solid var(--border-subtle);
}

.dash-funnel-row--result .dash-funnel-row__name {
  font-weight: var(--weight-semi);
  color: var(--text-primary);
}

.dash-funnel-row--sub .dash-funnel-row__name {
  padding-left: var(--space-4);
}


.dash-funnel-row--sub:not(.dash-funnel-row--result) .dash-funnel-row__count {
  font-weight: var(--weight-regular);
  color: var(--text-secondary);
}


.dash-funnel-breakdown > summary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0 var(--space-1) var(--space-4);
  font-size: var(--font-xs);
  color: var(--text-muted);
  cursor: pointer;
  list-style-position: inside;
}

.dash-funnel-breakdown > summary:hover {
  color: var(--text-secondary);
}


.dash-funnel-breakdown > summary:focus-visible {
  outline: 2px solid var(--color-brand-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}


.dash-funnel-note__caveat {
  color: var(--color-warning-500);
}


.dash-panel--funnel {
  display: flex;
  flex-direction: column;
}

.dash-panel--funnel .dash-funnel-note { margin-top: auto; }

.dash-funnel-note {
  margin-top: var(--space-3);
  font-size: var(--font-xs);
  color: var(--text-muted);
}

.dash-funnel-note b {
  font-weight: var(--weight-semi);
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  
  .dash-funnel-row {
    grid-template-columns: 1fr auto auto;
    gap: var(--space-2);
  }

  .dash-funnel-row__name { white-space: normal; }

  
  .dash-funnel-bar__seg--labelled { padding: 0 var(--space-2); }
}

/* css/modules/delivery-tab.css */
.dlv-card-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}





.dlv-section .card-header-v2 .card-header__text { align-self: center; padding-block: var(--space-2); }
.dlv-section .card-header-v2 .dash-panel-title { margin: 0; }

.dlv-section .card-header-v2 { flex-wrap: wrap; }



.dlv-section { display: flex; flex-direction: column; gap: var(--space-4); padding-top: var(--space-6); padding-bottom: var(--space-8); }
.dlv-section .section-intro { margin-bottom: 0; }
.dlv-role-note {                                   
  display: flex; align-items: center; gap: var(--space-2);
  margin: 0; font-size: var(--font-base); color: var(--text-secondary);
}
.dlv-role-note .icon { width: 16px; height: 16px; flex: none; }
.dlv-role-note[hidden] { display: none; }   



.dlv-rules { table-layout: auto; width: 100%; }
.dlv-rules td { vertical-align: top; padding-top: var(--space-3); padding-bottom: var(--space-3); white-space: normal; }
.dlv-rules th.col-toggle, .dlv-rules td.col-toggle { width: 64px; text-align: center; }
.dlv-rules th.col-arrow,  .dlv-rules td.col-arrow  { width: 16px; padding-left: 0; padding-right: 0; }
.dlv-rules td.col-name, .dlv-rules th.col-name { min-width: 0; max-width: none; width: 42%; }

.dlv-rules td.col-name { white-space: normal; }
.dlv-rules td.col-where { width: 17%; }   
.dlv-rules td.col-today, .dlv-rules th.col-today { width: 104px; text-align: right; }
.dlv-rules td.col-last,  .dlv-rules th.col-last  { width: 132px; }
.dlv-rules td.col-actions { white-space: nowrap; text-align: right; width: 1%; }

@media (min-width: 1280px) {
  .dlv-rules.data-table-v2 td.col-actions { position: static; background: transparent; box-shadow: none; }
  .dlv-rules.data-table-v2 th.col-actions { right: auto; box-shadow: none; }
}
.dlv-rules .toggle { margin-top: 4px; }

.dlv-name {                                        
  display: block; margin: 0 0 var(--space-1);
  font-size: var(--font-md-plus); font-weight: var(--weight-semi);
  line-height: 28px; color: var(--text-primary);
}
.dlv-what {                                        
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2);
  margin: 0; font-size: var(--font-base); line-height: 28px; color: var(--text-secondary);
  overflow: hidden;       
}
.dlv-what .tag-pill { margin: 0; }                 
.dlv-op  { color: var(--text-muted); }             

.dlv-sep { display: none; }

.dlv-axes { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
.dlv-what :has(+ .dlv-sep), .dlv-what > :has(+ .dlv-axes) { margin-right: var(--space-3); }
.dlv-sep + .dlv-axis { position: relative; }
.dlv-sep + .dlv-axis::before {
  content: "·"; position: absolute; top: 0; right: calc(100% + var(--space-2)); color: var(--text-muted);
}
.dlv-axis b { font-weight: var(--weight-medium); color: var(--text-primary); }
.dlv-warn {                                        
  display: flex; align-items: center; gap: var(--space-2); flex-basis: 100%;
  font-size: var(--font-base); line-height: 28px; color: var(--color-warning-text);
}
.dlv-warn .icon { width: 16px; height: 16px; flex: none; }

.dlv-arrow { display: block; width: 16px; height: 16px; margin-top: 6px; color: var(--text-muted); }


.dlv-dests { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.dlv-chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: var(--control-h-sm); max-width: 100%; box-sizing: border-box;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-control); border-radius: var(--radius-base);
  background: var(--surface-sunken);
  font-size: var(--font-base); color: var(--text-primary);
}
.dlv-chip .icon { width: 16px; height: 16px; flex: none; }

.dlv-chip__label { flex: 0 1 auto; min-width: 0; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlv-chip__state { flex: 0 10000 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }  
.dlv-chip--ok      .icon { color: var(--color-success-text); }
.dlv-chip--pending .icon { color: var(--color-warning-text); }
.dlv-chip--pending { border-style: dashed; }
.dlv-chip__state { font-size: var(--font-xs); color: var(--color-warning-text); }
.dlv-none { font-size: var(--font-base); line-height: 28px; color: var(--color-warning-text); margin-right: var(--space-2); }

.dlv-today { display: block; font-size: var(--font-md-plus); font-weight: var(--weight-semi);
  line-height: 28px; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.dlv-last  { display: block; font-size: var(--font-base); line-height: 28px;
  font-variant-numeric: tabular-nums; color: var(--text-secondary); white-space: nowrap; }
.dlv-actions { display: inline-flex; gap: var(--space-2); justify-content: flex-end; align-items: center; }
.dlv-rules tr.is-off .dlv-name, .dlv-rules tr.is-off .dlv-what { color: var(--text-muted); }


@media (min-width: 641px) and (max-width: 1279px) {
  .dlv-rules.data-table-v2--cards { min-width: 0; }
  .dlv-rules.data-table-v2--cards,
  .dlv-rules.data-table-v2--cards tbody { display: block; }
  .dlv-rules.data-table-v2--cards thead {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .dlv-rules.data-table-v2--cards tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--space-3); row-gap: var(--space-1);
    align-items: start; padding: var(--space-3); border-bottom: 1px solid var(--border-subtle);
  }
  .dlv-rules.data-table-v2--cards td[data-cell] {
    display: block; position: static; width: auto; min-width: 0; max-width: none; height: auto;
    padding: 0; border: 0; box-shadow: none; background: transparent; text-align: left;
    white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere;
  }
  .dlv-rules.data-table-v2--cards tbody tr:hover td[data-cell] { background: transparent; }
}


@media (max-width: 1279px) {
  .dlv-rules.data-table-v2--cards tbody tr { grid-template-columns: auto minmax(0, 1fr) auto; }
  .dlv-rules.data-table-v2--cards td[data-cell="toggle"]  { grid-column: 1; grid-row: 1; }
  .dlv-rules.data-table-v2--cards td[data-cell="what"]    { grid-column: 2 / -1; grid-row: 1; }
  .dlv-rules.data-table-v2--cards td[data-cell="arrow"]   { display: none; }
  .dlv-rules.data-table-v2--cards td[data-cell="where"]   { grid-column: 2 / -1; grid-row: 2; }
  .dlv-rules.data-table-v2--cards td[data-cell="today"]   { grid-column: 2; grid-row: 3; text-align: left; }
  .dlv-rules.data-table-v2--cards td[data-cell="last"]    { grid-column: 3; grid-row: 3; text-align: right; }
  .dlv-rules.data-table-v2--cards td[data-cell="actions"] { grid-column: 2 / -1; grid-row: 4; text-align: left; }
  .dlv-rules.data-table-v2--cards td[data-cell="actions"] .dlv-actions { justify-content: flex-start; flex-wrap: wrap; }
  .dlv-rules.data-table-v2--cards .dlv-today { display: inline; margin-right: var(--space-2); }
  .dlv-rules.data-table-v2--cards .dlv-today::before { content: "Сегодня "; font-size: var(--font-xs); font-weight: var(--weight-regular); color: var(--text-muted); }
  .dlv-rules.data-table-v2--cards .dlv-stat__digest { display: inline; }
  .dlv-rules td.col-name, .dlv-rules td.col-where { width: auto; }
}


.dlv-kind { font-size: var(--font-xs); color: var(--text-muted); margin-left: var(--space-2); font-weight: var(--weight-regular); }
.dlv-dest-uses { display: block; font-size: var(--font-xs); color: var(--text-muted); margin-top: 2px; }
.dlv-dest__main { min-width: 0; }
.dlv-connect-why { flex-basis: 100%; text-align: right; font-size: var(--font-xs); color: var(--text-muted); margin: 0; }
@media (max-width: 640px) {
  .card-header-v2.dlv-wrap-head { flex-wrap: wrap; }
  .card-header-v2.dlv-wrap-head .card-header__actions { flex-basis: 100%; flex-wrap: wrap; justify-content: flex-start; }
  .dlv-connect-why { text-align: left; }
}


@media (max-width: 1279px) {
  .dlv-rules.data-table-v2--cards td[data-cell="today"]   { grid-column: 2 / -1; grid-row: 3; }
  .dlv-rules.data-table-v2--cards td[data-cell="last"]    { grid-column: 2 / -1; grid-row: 4; text-align: left; }
  .dlv-rules.data-table-v2--cards td[data-cell="actions"] { grid-row: 5; }
  .dlv-rules.data-table-v2--cards td[data-cell="actions"] .dlv-actions { flex-wrap: nowrap; margin-left: calc(-1 * var(--space-3)); }
  .dlv-rules.data-table-v2--cards .dlv-stat__digest::before { content: "· "; }
  .dlv-rules.data-table-v2--cards .dlv-last { line-height: 1.5; }
  .dlv-rules.data-table-v2--cards td[data-cell="actions"] .dlv-actions { flex-wrap: wrap; }
  .dlv-rules.data-table-v2--cards .dlv-last::before { content: "Последняя доставка: "; font-size: var(--font-xs); color: var(--text-muted); }
}
@media (max-width: 1279px) {
  .dlv-rules.data-table-v2--cards .dlv-last { white-space: normal; }
  .dlv-warn { align-items: flex-start; line-height: 1.5; }
  .dlv-warn .icon { margin-top: 3px; }
}


.dlv-stat {
  font-size: var(--font-sm);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.dlv-stat--none {
  color: var(--text-muted);
}


.dlv-stat.is-unmeasured,
.dlv-dest__stat.is-unmeasured {
  color: var(--text-muted);
}



.dlv-dest-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.dlv-dest {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
}

.dlv-dest__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-h-sm);
  height: var(--control-h-sm);
  flex-shrink: 0;
  border-radius: var(--radius-base);
  background: var(--surface-card);
  color: var(--text-secondary);
}

.dlv-dest__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.dlv-dest__title {
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  line-height: var(--line-snug);
}

.dlv-dest__addr {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  line-height: var(--line-snug);
  overflow-wrap: anywhere;
}

.dlv-dest__stat {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  line-height: var(--line-snug);
}

.dlv-dest__stat--none {
  color: var(--text-muted);
}

.dlv-dest__failure {
  margin: var(--space-1) 0 0;
  font-size: var(--font-sm);
  color: var(--color-error-text);
  line-height: var(--line-snug);
}

.dlv-dest__actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}


@media (min-width: 641px) {
  .dlv-dest-list { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; row-gap: var(--space-2); }
  .dlv-dest-list > .dlv-dest { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; column-gap: var(--space-3); }
  .dlv-dest > .status-indicator { justify-self: start; }
  .dlv-dest__actions { justify-content: flex-end; }
}



.dlv-module {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.dlv-module__lede {
  margin: 0;
  font-size: var(--font-base);
  color: var(--text-secondary);
  line-height: var(--line-base);
}

.dlv-module__note {
  margin: 0;
  font-size: var(--font-sm);
  color: var(--text-muted);
}

.dlv-module__actions {
  display: flex;
  gap: var(--space-2);
}

.dlv-toggle-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}



.dlv-wizard {
  max-width: 560px;
}

.dlv-step {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.dlv-step__lede {
  margin: 0;
  font-size: var(--font-base);
  color: var(--text-secondary);
  line-height: var(--line-base);
}

.dlv-step__note {
  margin: 0;
  font-size: var(--font-sm);
  color: var(--text-muted);
}

.dlv-step__list {
  margin: 0;
  padding-left: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--font-base);
  color: var(--text-primary);
  line-height: var(--line-base);
}

.dlv-link {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--font-sm);
  color: var(--color-brand-text);
  overflow-wrap: anywhere;
}

.dlv-code {
  font-family: var(--font-mono);
  font-size: var(--font-sm);
  padding: 2px var(--space-1);
  border-radius: var(--radius-xs);
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.dlv-code--block {
  display: block;
  margin-top: var(--space-1);
  padding: var(--space-2) var(--space-3);
  overflow-wrap: anywhere;
}



.dlv-secret {
  padding: var(--space-3);
  border: 1px solid var(--color-warning-500);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
}

.dlv-secret__head {
  margin: 0;
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
  color: var(--color-warning-text);
}

.dlv-secret__note {
  margin: var(--space-2) 0 0;
  font-size: var(--font-sm);
  color: var(--text-secondary);
  line-height: var(--line-snug);
}



.dlv-probe {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: var(--surface-sunken);
}

.dlv-probe--ok  { border-color: var(--color-success-500); }
.dlv-probe--bad { border-color: var(--color-error-500); }

.dlv-probe__head {
  margin: 0 0 var(--space-2);
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}

.dlv-probe--ok  .dlv-probe__head { color: var(--color-success-text); }
.dlv-probe--bad .dlv-probe__head { color: var(--color-error-text); }

.dlv-probe__body {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--font-sm);
  color: var(--text-primary);
  line-height: var(--line-snug);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 160px;
  overflow-y: auto;
}

.dlv-probe__body--empty {
  font-family: var(--font-family);
  color: var(--text-secondary);
}



.dlv-note {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-base);
  font-size: var(--font-sm);
  line-height: var(--line-snug);
  border: 1px solid var(--border-subtle);
  background: var(--surface-sunken);
  color: var(--text-secondary);
}

.dlv-note--ok {
  border-color: var(--color-success-500);
  color: var(--color-success-text);
}

.dlv-note--warn {
  border-color: var(--color-warning-500);
  color: var(--color-warning-text);
}

.dlv-note--error {
  border-color: var(--color-error-500);
  color: var(--color-error-text);
}



@media (max-width: 640px) {
  
  .dlv-dest { display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: var(--space-3); row-gap: var(--space-2); align-items: start; }
  .dlv-dest > .dlv-dest__icon { grid-column: 1; grid-row: 1; }
  .dlv-dest > .dlv-dest__main { grid-column: 2; grid-row: 1; }
  .dlv-dest > .status-indicator { grid-column: 2; grid-row: 2; justify-self: start; }
  .dlv-dest > .dlv-dest__actions { grid-column: 2; grid-row: 3; padding-left: 0; margin-left: calc(-1 * var(--space-3)); }
  .dlv-dest__addr { overflow-wrap: anywhere; }
  .dlv-toggle-row {
    align-items: flex-start;
    flex-direction: column;
    gap: var(--space-3);
  }
}


.dlv-probe__detail {
  margin: var(--space-2) 0 0;
  font-size: var(--font-sm);
  color: var(--text-secondary);
  line-height: var(--line-snug);
}


.dlv-stat--assumed {
  border-bottom: 1px dotted var(--text-muted);
  cursor: help;
}


.dlv-stat__digest {
  display: block;
  font-size: var(--font-xs);
  line-height: 1.4;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}


.dlv-dest__addr--none {
  color: var(--text-muted);
}


.dlv-linkbtn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: var(--font-sm);
  color: var(--color-brand-text);
  text-decoration: underline;
  cursor: pointer;
}
.dlv-linkbtn:focus-visible {
  outline: 2px solid var(--focus-ring-color);
  outline-offset: 2px;
}



.dlv-dest-pick {
  display:     flex;
  align-items: center;
  gap:         var(--space-2);
  min-height:  var(--control-h-sm);       
  font-size:   var(--font-sm);            
  color:       var(--text-primary);
}


.dlv-chip--failing .icon { color: var(--color-error-text); }
.dlv-chip--failing .dlv-chip__state { color: var(--color-error-text); }


.dlv-stat.dlv-today { font-size: var(--font-md-plus); }
.dlv-stat.dlv-last { font-size: var(--font-base); }
