/**
 * Contact Central V2 - Design System 2026
 * Version: 1.1.0
 *
 * Design Specification: docs/design/DESIGN-001-Redesign.md
 *
 * 2026 Design Trends Applied:
 * - Softer Dark Mode: Mid-tone backgrounds (#0f172a, #1e293b) instead of pure black
 * - Typography-First: Variable fonts, clear hierarchy, reduced icon dependency
 * - Bento Grid: Modular, asymmetric layouts
 * - Purposeful Micro-interactions: Motion as guidance, not decoration
 * - Accessibility-First: WCAG AA compliant, motion controls, cognitive support
 * - Labels-Left Forms: Form labels positioned left of inputs (stacked on mobile)
 *
 * Note: Liquid Glass effects available but NOT used on sidebar (too grey).
 * Sidebar uses solid dark background with subtle purple gradient overlay.
 */

/* ===========================================
   CSS CUSTOM PROPERTIES
   =========================================== */

:root {
    /* --- Color Palette --- */

    /* Primary - Deep violet with luminous quality */
    --ds-primary-50: #f3f1ff;
    --ds-primary-100: #e9e5ff;
    --ds-primary-200: #d5ceff;
    --ds-primary-300: #b8a8ff;
    --ds-primary-400: #9678ff;
    --ds-primary-500: #7c4dff;
    --ds-primary-600: #6d28d9;
    --ds-primary-700: #5b21b6;
    --ds-primary-800: #4c1d95;
    --ds-primary-900: #3b1578;

    /* Secondary - Warm coral/terracotta */
    --ds-secondary-50: #fff5f3;
    --ds-secondary-100: #ffe8e3;
    --ds-secondary-200: #ffd5cc;
    --ds-secondary-300: #ffb4a3;
    --ds-secondary-400: #ff8a70;
    --ds-secondary-500: #f97066;
    --ds-secondary-600: #e14d42;
    --ds-secondary-700: #c03a30;
    --ds-secondary-800: #9d322a;
    --ds-secondary-900: #822e28;

    /* Accent - Luminous teal */
    --ds-accent-50: #edfffe;
    --ds-accent-100: #c2fffc;
    --ds-accent-200: #85fff8;
    --ds-accent-300: #40fff3;
    --ds-accent-400: #0df5e7;
    --ds-accent-500: #00d9cb;
    --ds-accent-600: #00b0a7;
    --ds-accent-700: #008c86;
    --ds-accent-800: #006f6b;
    --ds-accent-900: #005b58;

    /* Semantic Colors */
    --ds-success: #10b981;
    --ds-success-light: #d1fae5;
    --ds-success-dark: #059669;

    --ds-warning: #f59e0b;
    --ds-warning-light: #fef3c7;
    --ds-warning-dark: #d97706;

    --ds-error: #ef4444;
    --ds-error-light: #fee2e2;
    --ds-error-dark: #dc2626;

    --ds-info: #3b82f6;
    --ds-info-light: #dbeafe;
    --ds-info-dark: #2563eb;

    /* Neutrals - Softer dark mode palette */
    --ds-neutral-0: #ffffff;
    --ds-neutral-50: #f8fafc;
    --ds-neutral-100: #f1f5f9;
    --ds-neutral-200: #e2e8f0;
    --ds-neutral-300: #cbd5e1;
    --ds-neutral-400: #94a3b8;
    --ds-neutral-500: #64748b;
    --ds-neutral-600: #475569;
    --ds-neutral-700: #334155;
    --ds-neutral-800: #1e293b;
    --ds-neutral-900: #0f172a;

    /* Dark Mode Surfaces (Softer, not pure black) */
    --ds-dark-bg: #0f172a;
    --ds-dark-surface: #1e293b;
    --ds-dark-elevated: #334155;
    --ds-dark-border: rgba(148, 163, 184, 0.2);

    /* --- Typography --- */

    /* Font Families */
    --ds-font-sans: 'Inter Variable', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --ds-font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --ds-font-display: 'Plus Jakarta Sans', var(--ds-font-sans);

    /* Font Sizes - Fluid scale */
    --ds-text-xs: clamp(0.6875rem, 0.65rem + 0.1vw, 0.75rem);
    --ds-text-sm: clamp(0.8125rem, 0.775rem + 0.15vw, 0.875rem);
    --ds-text-base: clamp(0.9375rem, 0.9rem + 0.15vw, 1rem);
    --ds-text-lg: clamp(1.0625rem, 1rem + 0.25vw, 1.125rem);
    --ds-text-xl: clamp(1.1875rem, 1.1rem + 0.35vw, 1.25rem);
    --ds-text-2xl: clamp(1.375rem, 1.25rem + 0.5vw, 1.5rem);
    --ds-text-3xl: clamp(1.625rem, 1.4rem + 0.9vw, 1.875rem);
    --ds-text-4xl: clamp(2rem, 1.7rem + 1.2vw, 2.25rem);
    --ds-text-5xl: clamp(2.5rem, 2rem + 2vw, 3rem);

    /* Line Heights */
    --ds-leading-none: 1;
    --ds-leading-tight: 1.25;
    --ds-leading-snug: 1.375;
    --ds-leading-normal: 1.5;
    --ds-leading-relaxed: 1.625;
    --ds-leading-loose: 2;

    /* Font Weights */
    --ds-font-light: 300;
    --ds-font-normal: 400;
    --ds-font-medium: 500;
    --ds-font-semibold: 600;
    --ds-font-bold: 700;

    /* Letter Spacing */
    --ds-tracking-tighter: -0.05em;
    --ds-tracking-tight: -0.025em;
    --ds-tracking-normal: 0;
    --ds-tracking-wide: 0.025em;
    --ds-tracking-wider: 0.05em;
    --ds-tracking-widest: 0.1em;

    /* --- Spacing Scale --- */
    --ds-space-0: 0;
    --ds-space-px: 1px;
    --ds-space-0-5: 0.125rem;
    --ds-space-1: 0.25rem;
    --ds-space-1-5: 0.375rem;
    --ds-space-2: 0.5rem;
    --ds-space-2-5: 0.625rem;
    --ds-space-3: 0.75rem;
    --ds-space-3-5: 0.875rem;
    --ds-space-4: 1rem;
    --ds-space-5: 1.25rem;
    --ds-space-6: 1.5rem;
    --ds-space-7: 1.75rem;
    --ds-space-8: 2rem;
    --ds-space-9: 2.25rem;
    --ds-space-10: 2.5rem;
    --ds-space-12: 3rem;
    --ds-space-14: 3.5rem;
    --ds-space-16: 4rem;
    --ds-space-20: 5rem;
    --ds-space-24: 6rem;
    --ds-space-32: 8rem;

    /* --- Border Radius --- */
    --ds-radius-none: 0;
    --ds-radius-sm: 0.25rem;
    --ds-radius-md: 0.5rem;
    --ds-radius-lg: 0.75rem;
    --ds-radius-xl: 1rem;
    --ds-radius-2xl: 1.5rem;
    --ds-radius-3xl: 2rem;
    --ds-radius-full: 9999px;

    /* --- Shadows --- */
    --ds-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --ds-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --ds-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --ds-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --ds-shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --ds-shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);

    /* Glow shadows for Liquid Glass */
    --ds-glow-primary: 0 0 20px rgba(109, 40, 217, 0.3);
    --ds-glow-accent: 0 0 20px rgba(0, 217, 203, 0.3);
    --ds-glow-soft: 0 8px 32px rgba(0, 0, 0, 0.12);

    /* --- Transitions --- */
    --ds-duration-instant: 50ms;
    --ds-duration-fast: 100ms;
    --ds-duration-normal: 200ms;
    --ds-duration-slow: 300ms;
    --ds-duration-slower: 500ms;

    --ds-ease-default: cubic-bezier(0.4, 0, 0.2, 1);
    --ds-ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ds-ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ds-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ds-ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ds-ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);

    /* --- Z-Index Scale --- */
    --ds-z-dropdown: 1000;
    --ds-z-sticky: 1020;
    --ds-z-fixed: 1030;
    --ds-z-modal-backdrop: 1040;
    --ds-z-modal: 1050;
    --ds-z-popover: 1060;
    --ds-z-tooltip: 1070;
    --ds-z-toast: 1080;

    /* --- Breakpoints (for reference in JS) --- */
    --ds-bp-sm: 768px;
    --ds-bp-md: 768px;
    --ds-bp-lg: 1024px;
    --ds-bp-xl: 1280px;
    --ds-bp-2xl: 1536px;

    /* --- Liquid Glass --- */
    --ds-glass-bg: rgba(255, 255, 255, 0.7);
    --ds-glass-bg-dark: rgba(30, 41, 59, 0.8);
    --ds-glass-border: rgba(255, 255, 255, 0.3);
    --ds-glass-border-dark: rgba(148, 163, 184, 0.2);
    --ds-glass-blur: 16px;
    --ds-glass-blur-heavy: 24px;

    /* --- Layout --- */
    --ds-sidebar-width: 280px;
    --ds-sidebar-collapsed: 72px;
    --ds-header-height: 64px;
    --ds-content-max-width: 1400px;
}

/* ===========================================
   LIQUID GLASS EFFECTS
   =========================================== */

.glass {
    background: var(--ds-glass-bg);
    backdrop-filter: blur(var(--ds-glass-blur));
    -webkit-backdrop-filter: blur(var(--ds-glass-blur));
    border: 1px solid var(--ds-glass-border);
}

.glass-dark {
    background: var(--ds-glass-bg-dark);
    backdrop-filter: blur(var(--ds-glass-blur));
    -webkit-backdrop-filter: blur(var(--ds-glass-blur));
    border: 1px solid var(--ds-glass-border-dark);
}

.glass-heavy {
    backdrop-filter: blur(var(--ds-glass-blur-heavy));
    -webkit-backdrop-filter: blur(var(--ds-glass-blur-heavy));
}

.glass-surface {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.05) 100%
    );
    backdrop-filter: blur(var(--ds-glass-blur));
    -webkit-backdrop-filter: blur(var(--ds-glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.glass-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(var(--ds-glass-blur));
    -webkit-backdrop-filter: blur(var(--ds-glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--ds-radius-xl);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.06),
        0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Dark mode glass */
[data-theme="dark"] .glass,
.dark .glass {
    background: var(--ds-glass-bg-dark);
    border-color: var(--ds-glass-border-dark);
}

/* ===========================================
   TYPOGRAPHY
   =========================================== */

.ds-text-display {
    font-family: var(--ds-font-display);
    font-weight: var(--ds-font-bold);
    line-height: var(--ds-leading-tight);
    letter-spacing: var(--ds-tracking-tight);
}

.ds-text-heading {
    font-family: var(--ds-font-sans);
    font-weight: var(--ds-font-semibold);
    line-height: var(--ds-leading-snug);
    letter-spacing: var(--ds-tracking-tight);
}

.ds-text-body {
    font-family: var(--ds-font-sans);
    font-weight: var(--ds-font-normal);
    line-height: var(--ds-leading-relaxed);
}

.ds-text-label {
    font-family: var(--ds-font-sans);
    font-size: var(--ds-text-sm);
    font-weight: var(--ds-font-medium);
    letter-spacing: var(--ds-tracking-wide);
    text-transform: uppercase;
}

.ds-text-mono {
    font-family: var(--ds-font-mono);
    font-size: 0.9em;
}

/* Type scale */
.ds-h1 { font-size: var(--ds-text-5xl); }
.ds-h2 { font-size: var(--ds-text-4xl); }
.ds-h3 { font-size: var(--ds-text-3xl); }
.ds-h4 { font-size: var(--ds-text-2xl); }
.ds-h5 { font-size: var(--ds-text-xl); }
.ds-h6 { font-size: var(--ds-text-lg); }

/* ===========================================
   BUTTONS
   =========================================== */

.ds-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ds-space-2);
    padding: var(--ds-space-2-5) var(--ds-space-5);
    font-family: var(--ds-font-sans);
    font-size: var(--ds-text-sm);
    font-weight: var(--ds-font-medium);
    line-height: var(--ds-leading-tight);
    border-radius: var(--ds-radius-lg);
    border: none;
    cursor: pointer;
    transition: all var(--ds-duration-normal) var(--ds-ease-default);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
}

.ds-btn:focus-visible {
    outline: 2px solid var(--ds-primary-500);
    outline-offset: 2px;
}

.ds-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Primary */
.ds-btn-primary {
    background: linear-gradient(135deg, var(--ds-primary-600) 0%, var(--ds-primary-700) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(109, 40, 217, 0.25);
}

.ds-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--ds-primary-500) 0%, var(--ds-primary-600) 100%);
    box-shadow: 0 4px 16px rgba(109, 40, 217, 0.35);
    transform: translateY(-1px);
}

.ds-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

/* Secondary */
.ds-btn-secondary {
    background: var(--ds-neutral-100);
    color: var(--ds-neutral-700);
    border: 1px solid var(--ds-neutral-200);
}

.ds-btn-secondary:hover:not(:disabled) {
    background: var(--ds-neutral-200);
    border-color: var(--ds-neutral-300);
}

/* Ghost */
.ds-btn-ghost {
    background: transparent;
    color: var(--ds-neutral-600);
}

.ds-btn-ghost:hover:not(:disabled) {
    background: var(--ds-neutral-100);
    color: var(--ds-neutral-900);
}

/* Glass Button */
.ds-btn-glass {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.ds-btn-glass:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Sizes */
.ds-btn-sm {
    padding: var(--ds-space-1-5) var(--ds-space-3);
    font-size: var(--ds-text-xs);
    border-radius: var(--ds-radius-md);
}

.ds-btn-lg {
    padding: var(--ds-space-3-5) var(--ds-space-7);
    font-size: var(--ds-text-base);
    border-radius: var(--ds-radius-xl);
}

/* Icon Button */
.ds-btn-icon {
    padding: var(--ds-space-2-5);
    aspect-ratio: 1;
}

.ds-btn-icon.ds-btn-sm { padding: var(--ds-space-1-5); }
.ds-btn-icon.ds-btn-lg { padding: var(--ds-space-3-5); }

/* Danger */
.ds-btn-danger {
    background: #d13438;
    color: white;
}
.ds-btn-danger:hover:not(:disabled) {
    background: #b02a2d;
}

/* Outline variants */
.ds-btn-outline-primary {
    background: transparent;
    color: var(--ds-primary-600);
    border: 1px solid var(--ds-primary-600);
}
.ds-btn-outline-primary:hover:not(:disabled) {
    background: var(--ds-primary-600);
    color: white;
}

.ds-btn-outline-secondary {
    background: transparent;
    color: var(--ds-neutral-600);
    border: 1px solid var(--ds-neutral-300);
}
.ds-btn-outline-secondary:hover:not(:disabled) {
    background: var(--ds-neutral-100);
    color: var(--ds-neutral-800);
    border-color: var(--ds-neutral-400);
}

.ds-btn-outline-danger {
    background: transparent;
    color: #d13438;
    border: 1px solid #d13438;
}
.ds-btn-outline-danger:hover:not(:disabled) {
    background: #d13438;
    color: white;
}

.ds-btn-outline-success {
    background: transparent;
    color: #107c10;
    border: 1px solid #107c10;
}
.ds-btn-outline-success:hover:not(:disabled) {
    background: #107c10;
    color: white;
}

.ds-btn-outline-warning {
    background: transparent;
    color: #f7630c;
    border: 1px solid #f7630c;
}
.ds-btn-outline-warning:hover:not(:disabled) {
    background: #f7630c;
    color: white;
}

.ds-btn-success {
    background: #107c10;
    color: white;
}
.ds-btn-success:hover:not(:disabled) { background: #0e6b0e; }

.ds-btn-warning {
    background: #f7630c;
    color: white;
}
.ds-btn-warning:hover:not(:disabled) { background: #d9560b; }

.ds-btn-info {
    background: #0078d4;
    color: white;
}
.ds-btn-info:hover:not(:disabled) { background: #006cbe; }

.ds-btn-light {
    background: var(--ds-neutral-100);
    color: var(--ds-neutral-700);
}
.ds-btn-light:hover:not(:disabled) { background: var(--ds-neutral-200); }

.ds-btn-dark {
    background: var(--ds-neutral-800);
    color: white;
}
.ds-btn-dark:hover:not(:disabled) { background: var(--ds-neutral-900); }

/* Link style */
.ds-btn-link {
    background: transparent;
    color: var(--ds-neutral-500);
    padding-left: 0;
    padding-right: 0;
}
.ds-btn-link:hover:not(:disabled) {
    color: var(--ds-primary-600);
    text-decoration: none;
}

/* ===========================================
   INPUTS
   =========================================== */

.ds-input {
    width: 100%;
    padding: var(--ds-space-2-5) var(--ds-space-4);
    font-family: var(--ds-font-sans);
    font-size: var(--ds-text-sm);
    line-height: var(--ds-leading-normal);
    color: var(--ds-neutral-900);
    background: var(--ds-neutral-0);
    border: 1px solid var(--ds-neutral-300);
    border-radius: var(--ds-radius-lg);
    transition: all var(--ds-duration-fast) var(--ds-ease-default);
}

.ds-input::placeholder {
    color: var(--ds-neutral-400);
}

.ds-input:hover:not(:disabled) {
    border-color: var(--ds-neutral-400);
}

.ds-input:focus {
    outline: none;
    border-color: var(--ds-primary-500);
    box-shadow: 0 0 0 3px var(--ds-primary-100);
}

.ds-input:disabled {
    background: var(--ds-neutral-100);
    cursor: not-allowed;
}

/* Glass Input */
.ds-input-glass {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Input with icon */
.ds-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.ds-input-icon {
    position: absolute;
    left: var(--ds-space-3);
    color: var(--ds-neutral-400);
    pointer-events: none;
}

.ds-input-group .ds-input {
    padding-left: var(--ds-space-10);
}

/* ===========================================
   CARDS
   =========================================== */

.ds-card {
    background: var(--ds-neutral-0);
    border-radius: var(--ds-radius-xl);
    border: 1px solid var(--ds-neutral-200);
    box-shadow: var(--ds-shadow-sm);
    overflow: hidden;
}

.ds-card-glass {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(var(--ds-glass-blur));
    -webkit-backdrop-filter: blur(var(--ds-glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--ds-glow-soft);
}

.ds-card-header {
    padding: var(--ds-space-5) var(--ds-space-6);
    border-bottom: 1px solid var(--ds-neutral-100);
}

.ds-card-body {
    padding: var(--ds-space-6);
}

.ds-card-footer {
    padding: var(--ds-space-4) var(--ds-space-6);
    background: var(--ds-neutral-50);
    border-top: 1px solid var(--ds-neutral-100);
}

/* Interactive Card */
.ds-card-interactive {
    cursor: pointer;
    transition: all var(--ds-duration-normal) var(--ds-ease-default);
}

@media (hover: hover) {
    .ds-card-interactive:hover {
        transform: translateY(-2px);
        box-shadow: var(--ds-shadow-lg);
        border-color: var(--ds-neutral-300);
    }
}

/* ===========================================
   BENTO GRID
   =========================================== */

.ds-bento {
    display: grid;
    gap: var(--ds-space-4);
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.ds-bento-item {
    min-height: 200px;
}

.ds-bento-item-lg {
    grid-column: span 2;
}

.ds-bento-item-tall {
    grid-row: span 2;
}

@media (max-width: 768px) {
    .ds-bento-item-lg,
    .ds-bento-item-tall {
        grid-column: span 1;
        grid-row: span 1;
    }
}

/* ===========================================
   BADGES & TAGS
   =========================================== */

.ds-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--ds-space-1);
    padding: var(--ds-space-1) var(--ds-space-2-5);
    font-size: var(--ds-text-xs);
    font-weight: var(--ds-font-medium);
    line-height: var(--ds-leading-none);
    border-radius: var(--ds-radius-full);
    white-space: nowrap;
}

.ds-badge-primary {
    background: var(--ds-primary-100);
    color: var(--ds-primary-700);
}

.ds-badge-success {
    background: var(--ds-success-light);
    color: var(--ds-success-dark);
}

.ds-badge-warning {
    background: var(--ds-warning-light);
    color: var(--ds-warning-dark);
}

.ds-badge-error {
    background: var(--ds-error-light);
    color: var(--ds-error-dark);
}

.ds-badge-neutral {
    background: var(--ds-neutral-100);
    color: var(--ds-neutral-600);
}

/* Pill badge with dot */
.ds-badge-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ===========================================
   AVATARS
   =========================================== */

.ds-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--ds-radius-full);
    font-weight: var(--ds-font-semibold);
    color: white;
    background: linear-gradient(135deg, var(--ds-primary-500) 0%, var(--ds-primary-700) 100%);
    flex-shrink: 0;
    overflow: hidden;
}

.ds-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ds-avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.ds-avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.ds-avatar-md { width: 40px; height: 40px; font-size: 14px; }
.ds-avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.ds-avatar-xl { width: 64px; height: 64px; font-size: 20px; }
.ds-avatar-2xl { width: 96px; height: 96px; font-size: 28px; }

/* Avatar group */
.ds-avatar-group {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.ds-avatar-group .ds-avatar {
    margin-left: -8px;
    border: 2px solid var(--ds-neutral-0);
    box-shadow: var(--ds-shadow-sm);
}

.ds-avatar-group .ds-avatar:last-child {
    margin-left: 0;
}

/* ===========================================
   TABLES
   =========================================== */

.ds-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.ds-table th,
.ds-table td {
    padding: var(--ds-space-3) var(--ds-space-4);
    text-align: left;
    border-bottom: 1px solid var(--ds-neutral-100);
}

.ds-table th {
    font-size: var(--ds-text-xs);
    font-weight: var(--ds-font-semibold);
    text-transform: uppercase;
    letter-spacing: var(--ds-tracking-wider);
    color: var(--ds-neutral-500);
    background: var(--ds-neutral-50);
}

.ds-table tbody tr {
    transition: background var(--ds-duration-fast) var(--ds-ease-default);
}

.ds-table tbody tr:hover {
    background: var(--ds-neutral-50);
}

/* ===========================================
   ALERTS
   =========================================== */

.ds-alert {
    display: flex;
    gap: var(--ds-space-3);
    padding: var(--ds-space-4);
    border-radius: var(--ds-radius-lg);
    border: 1px solid transparent;
}

.ds-alert-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.ds-alert-content {
    flex: 1;
    min-width: 0;
}

.ds-alert-title {
    font-weight: var(--ds-font-semibold);
    margin-bottom: var(--ds-space-1);
}

.ds-alert-success {
    background: var(--ds-success-light);
    border-color: var(--ds-success);
    color: var(--ds-success-dark);
}

.ds-alert-warning {
    background: var(--ds-warning-light);
    border-color: var(--ds-warning);
    color: var(--ds-warning-dark);
}

.ds-alert-error {
    background: var(--ds-error-light);
    border-color: var(--ds-error);
    color: var(--ds-error-dark);
}

.ds-alert-info {
    background: var(--ds-info-light);
    border-color: var(--ds-info);
    color: var(--ds-info-dark);
}

/* License Banner (FEAT-018) */
.license-banner {
    text-align: center;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.license-banner-warning {
    background: #fff3cd;
    color: #664d03;
}

.license-banner-grace {
    background: #ffe0b2;
    color: #7a4100;
}

.license-banner-expired {
    background: #f8d7da;
    color: #842029;
}

.license-banner-unlicensed {
    background: #e9ecef;
    color: #495057;
}

.btn-close-sm {
    font-size: 0.65rem;
    padding: 0.25rem;
}

.module-locked-overlay {
    opacity: 0.7;
    pointer-events: none;
    user-select: none;
}

/* ===========================================
   SIDEBAR NAVIGATION
   =========================================== */

.ds-sidebar {
    width: var(--ds-sidebar-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--ds-dark-bg);
    background-image: linear-gradient(135deg, rgba(109, 40, 217, 0.1) 0%, transparent 50%);
    border-right: 1px solid var(--ds-dark-border);
    color: var(--ds-neutral-300);
    transition: width var(--ds-duration-slow) var(--ds-ease-default);
    overflow: hidden;
}

.ds-sidebar.collapsed {
    width: var(--ds-sidebar-collapsed);
}

/* Sidebar Brand */
.ds-sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--ds-space-3);
    padding: var(--ds-space-5);
    border-bottom: 1px solid var(--ds-dark-border);
}

.ds-sidebar-brand-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.ds-sidebar-brand-text {
    font-size: var(--ds-text-lg);
    font-weight: var(--ds-font-bold);
    color: white;
    white-space: nowrap;
    overflow: hidden;
}

/* Sidebar Navigation */
.ds-sidebar-nav {
    flex: 1;
    padding: var(--ds-space-3);
    overflow-y: auto;
    overflow-x: hidden;
}

.ds-sidebar-section {
    margin-bottom: var(--ds-space-6);
}

.ds-sidebar-section-label {
    padding: var(--ds-space-2) var(--ds-space-3);
    font-size: var(--ds-text-xs);
    font-weight: var(--ds-font-semibold);
    text-transform: uppercase;
    letter-spacing: var(--ds-tracking-wider);
    color: var(--ds-neutral-500);
    white-space: nowrap;
}

.ds-sidebar-item {
    display: flex;
    align-items: center;
    gap: var(--ds-space-3);
    padding: var(--ds-space-2-5) var(--ds-space-3);
    margin-bottom: var(--ds-space-1);
    border-radius: var(--ds-radius-lg);
    color: var(--ds-neutral-400);
    text-decoration: none;
    transition: all var(--ds-duration-fast) var(--ds-ease-default);
    cursor: pointer;
}

.ds-sidebar-item:hover {
    background: var(--ds-dark-elevated);
    color: white;
}

.ds-sidebar-item.active {
    background: linear-gradient(135deg, var(--ds-primary-600) 0%, var(--ds-primary-700) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(109, 40, 217, 0.3);
}

.ds-sidebar-item-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ds-sidebar-item-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: var(--ds-text-sm);
    font-weight: var(--ds-font-medium);
}

.ds-sidebar-item-badge {
    padding: var(--ds-space-0-5) var(--ds-space-2);
    font-size: var(--ds-text-xs);
    font-weight: var(--ds-font-semibold);
    background: var(--ds-primary-600);
    color: white;
    border-radius: var(--ds-radius-full);
}

/* Nested Items */
.ds-sidebar-subnav {
    margin-left: var(--ds-space-8);
    margin-top: var(--ds-space-1);
}

.ds-sidebar-subnav .ds-sidebar-item {
    padding: var(--ds-space-2) var(--ds-space-3);
    font-size: var(--ds-text-sm);
}

/* Sidebar Footer */
.ds-sidebar-footer {
    padding: var(--ds-space-4);
    border-top: 1px solid var(--ds-dark-border);
}

.ds-sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--ds-space-3);
    padding: var(--ds-space-2);
    border-radius: var(--ds-radius-lg);
    transition: background var(--ds-duration-fast) var(--ds-ease-default);
    cursor: pointer;
}

.ds-sidebar-user:hover {
    background: var(--ds-dark-elevated);
}

.ds-sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.ds-sidebar-user-name {
    font-size: var(--ds-text-sm);
    font-weight: var(--ds-font-medium);
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ds-sidebar-user-role {
    font-size: var(--ds-text-xs);
    color: var(--ds-neutral-500);
}

/* Collapsed State */
.ds-sidebar.collapsed .ds-sidebar-brand-text,
.ds-sidebar.collapsed .ds-sidebar-section-label,
.ds-sidebar.collapsed .ds-sidebar-item-text,
.ds-sidebar.collapsed .ds-sidebar-item-badge,
.ds-sidebar.collapsed .ds-sidebar-user-info {
    display: none;
}

.ds-sidebar.collapsed .ds-sidebar-brand,
.ds-sidebar.collapsed .ds-sidebar-item,
.ds-sidebar.collapsed .ds-sidebar-user {
    justify-content: center;
}

.ds-sidebar.collapsed .ds-sidebar-item {
    padding: var(--ds-space-3);
}

.ds-sidebar.collapsed .ds-sidebar-subnav {
    margin-left: 0;
}

/* ===========================================
   MODALS
   =========================================== */

.ds-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: var(--ds-z-modal-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--ds-space-4);
}

.ds-modal {
    background: var(--ds-neutral-0);
    border-radius: var(--ds-radius-2xl);
    box-shadow: var(--ds-shadow-2xl);
    max-width: 500px;
    width: 100%;
    max-height: calc(100vh - var(--ds-space-8));
    overflow: hidden;
    z-index: var(--ds-z-modal);
}

.ds-modal-glass {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(var(--ds-glass-blur-heavy));
    -webkit-backdrop-filter: blur(var(--ds-glass-blur-heavy));
}

.ds-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--ds-space-5) var(--ds-space-6);
    border-bottom: 1px solid var(--ds-neutral-100);
}

.ds-modal-title {
    font-size: var(--ds-text-lg);
    font-weight: var(--ds-font-semibold);
    color: var(--ds-neutral-900);
}

.ds-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--ds-radius-md);
    color: var(--ds-neutral-400);
    cursor: pointer;
    transition: all var(--ds-duration-fast) var(--ds-ease-default);
}

.ds-modal-close:hover {
    background: var(--ds-neutral-100);
    color: var(--ds-neutral-600);
}

.ds-modal-body {
    padding: var(--ds-space-6);
    overflow-y: auto;
}

.ds-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--ds-space-3);
    padding: var(--ds-space-4) var(--ds-space-6);
    border-top: 1px solid var(--ds-neutral-100);
    background: var(--ds-neutral-50);
}

/* ===========================================
   LOADERS & SPINNERS
   =========================================== */

.ds-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--ds-neutral-200);
    border-top-color: var(--ds-primary-600);
    border-radius: 50%;
    animation: ds-spin 0.8s linear infinite;
}

.ds-spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.ds-spinner-lg { width: 32px; height: 32px; border-width: 3px; }

@keyframes ds-spin {
    to { transform: rotate(360deg); }
}

/* Skeleton loader */
.ds-skeleton {
    background: linear-gradient(
        90deg,
        var(--ds-neutral-200) 25%,
        var(--ds-neutral-100) 50%,
        var(--ds-neutral-200) 75%
    );
    background-size: 200% 100%;
    animation: ds-shimmer 1.5s infinite;
    border-radius: var(--ds-radius-md);
}

@keyframes ds-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===========================================
   TOOLTIPS
   =========================================== */

.ds-tooltip {
    position: relative;
}

.ds-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: var(--ds-space-1-5) var(--ds-space-3);
    font-size: var(--ds-text-xs);
    font-weight: var(--ds-font-medium);
    color: white;
    background: var(--ds-neutral-900);
    border-radius: var(--ds-radius-md);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--ds-duration-fast) var(--ds-ease-default);
    z-index: var(--ds-z-tooltip);
}

.ds-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ===========================================
   UTILITY CLASSES
   =========================================== */

/* Flex utilities */
.ds-flex { display: flex; }
.ds-flex-col { flex-direction: column; }
.ds-flex-wrap { flex-wrap: wrap; }
.ds-items-center { align-items: center; }
.ds-items-start { align-items: flex-start; }
.ds-items-end { align-items: flex-end; }
.ds-justify-center { justify-content: center; }
.ds-justify-between { justify-content: space-between; }
.ds-justify-end { justify-content: flex-end; }
.ds-gap-1 { gap: var(--ds-space-1); }
.ds-gap-2 { gap: var(--ds-space-2); }
.ds-gap-3 { gap: var(--ds-space-3); }
.ds-gap-4 { gap: var(--ds-space-4); }
.ds-gap-6 { gap: var(--ds-space-6); }
.ds-gap-8 { gap: var(--ds-space-8); }

/* ===========================================
   FORM LAYOUT - Labels Left of Inputs
   =========================================== */

.ds-form-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: var(--ds-space-2) var(--ds-space-4);
    align-items: center;
    margin-bottom: var(--ds-space-3);
}

.ds-form-row label,
.ds-form-row .ds-form-label {
    font-size: var(--ds-text-sm);
    font-weight: var(--ds-font-medium);
    color: var(--ds-neutral-600);
    text-align: right;
    white-space: nowrap;
}

.ds-form-row .ds-input,
.ds-form-row input,
.ds-form-row select,
.ds-form-row textarea {
    width: 100%;
}

/* Wider label variant */
.ds-form-row-wide {
    grid-template-columns: 160px 1fr;
}

/* Narrow label variant */
.ds-form-row-narrow {
    grid-template-columns: 90px 1fr;
}

/* Full-width input (label above) - use sparingly */
.ds-form-row-stacked {
    grid-template-columns: 1fr;
}

.ds-form-row-stacked label,
.ds-form-row-stacked .ds-form-label {
    text-align: left;
    margin-bottom: var(--ds-space-1);
}

/* Form group for multiple rows */
.ds-form-group {
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-1);
}

/* Multi-column form layout */
.ds-form-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--ds-space-6);
}

/* Responsive: Stack labels above inputs on mobile */
@media (max-width: 767.98px) {
    .ds-form-row {
        grid-template-columns: 1fr;
    }

    .ds-form-row label,
    .ds-form-row .ds-form-label {
        text-align: left;
        margin-bottom: var(--ds-space-1);
    }

    .ds-form-row-wide,
    .ds-form-row-narrow {
        grid-template-columns: 1fr;
    }
}

/* Text utilities */
.ds-text-center { text-align: center; }
.ds-text-right { text-align: right; }
.ds-text-muted { color: var(--ds-neutral-500); }
.ds-text-primary { color: var(--ds-primary-600); }
.ds-text-success { color: var(--ds-success); }
.ds-text-warning { color: var(--ds-warning-dark); }
.ds-text-error { color: var(--ds-error); }

/* Background utilities */
.ds-bg-primary { background-color: var(--ds-primary-600); }
.ds-bg-primary-light { background-color: var(--ds-primary-100); }
.ds-bg-muted { background-color: var(--ds-neutral-100); }

/* Spacing utilities */
.ds-p-0 { padding: 0; }
.ds-p-2 { padding: var(--ds-space-2); }
.ds-p-4 { padding: var(--ds-space-4); }
.ds-p-6 { padding: var(--ds-space-6); }
.ds-p-8 { padding: var(--ds-space-8); }

.ds-m-0 { margin: 0; }
.ds-mb-2 { margin-bottom: var(--ds-space-2); }
.ds-mb-4 { margin-bottom: var(--ds-space-4); }
.ds-mb-6 { margin-bottom: var(--ds-space-6); }
.ds-mb-8 { margin-bottom: var(--ds-space-8); }
.ds-mt-auto { margin-top: auto; }

/* Border utilities */
.ds-rounded { border-radius: var(--ds-radius-md); }
.ds-rounded-lg { border-radius: var(--ds-radius-lg); }
.ds-rounded-xl { border-radius: var(--ds-radius-xl); }
.ds-rounded-full { border-radius: var(--ds-radius-full); }
.ds-border { border: 1px solid var(--ds-neutral-200); }

/* Shadow utilities */
.ds-shadow-sm { box-shadow: var(--ds-shadow-sm); }
.ds-shadow-md { box-shadow: var(--ds-shadow-md); }
.ds-shadow-lg { box-shadow: var(--ds-shadow-lg); }
.ds-shadow-xl { box-shadow: var(--ds-shadow-xl); }

/* ===========================================
   ACCESSIBILITY
   =========================================== */

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .ds-skeleton {
        animation: none;
        background: var(--ds-neutral-200);
    }
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--ds-primary-500);
    outline-offset: 2px;
}

/* Skip link */
.ds-skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    padding: var(--ds-space-2) var(--ds-space-4);
    background: var(--ds-primary-600);
    color: white;
    z-index: var(--ds-z-toast);
    transition: top var(--ds-duration-fast) var(--ds-ease-default);
}

.ds-skip-link:focus {
    top: 0;
}

/* Screen reader only */
.ds-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===========================================
   DARK MODE
   =========================================== */

[data-theme="dark"],
.dark {
    --ds-neutral-0: #0f172a;
    --ds-neutral-50: #1e293b;
    --ds-neutral-100: #334155;
    --ds-neutral-200: #475569;
    --ds-neutral-300: #64748b;
    --ds-neutral-400: #94a3b8;
    --ds-neutral-500: #cbd5e1;
    --ds-neutral-600: #e2e8f0;
    --ds-neutral-700: #f1f5f9;
    --ds-neutral-800: #f8fafc;
    --ds-neutral-900: #ffffff;

    color-scheme: dark;
}

[data-theme="dark"] .ds-card,
.dark .ds-card {
    background: var(--ds-dark-surface);
    border-color: var(--ds-dark-border);
}

[data-theme="dark"] .ds-input,
.dark .ds-input {
    background: var(--ds-dark-surface);
    border-color: var(--ds-dark-border);
    color: var(--ds-neutral-900);
}

[data-theme="dark"] .ds-btn-secondary,
.dark .ds-btn-secondary {
    background: var(--ds-dark-surface);
    border-color: var(--ds-dark-border);
    color: var(--ds-neutral-300);
}

/* ===========================================
   PAGE HEADERS
   =========================================== */

.ds-page-header {
    background: linear-gradient(135deg, var(--ds-primary-600) 0%, var(--ds-primary-800) 100%);
    color: white;
    margin: calc(var(--ds-space-4) * -1);
    margin-bottom: var(--ds-space-6);
    padding: var(--ds-space-6);
    border-radius: 0 0 var(--ds-radius-2xl) var(--ds-radius-2xl);
}

.ds-page-header .ds-avatar {
    background: rgba(255, 255, 255, 0.2);
}

.ds-page-header .ds-text-muted {
    color: rgba(255, 255, 255, 0.8);
}

.ds-page-header .ds-mb-0,
.ds-page-header h1,
.ds-page-header h2,
.ds-page-header h3 {
    color: white;
}

.ds-page-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: var(--ds-text-sm);
}

@media (max-width: 767.98px) {
    .ds-page-header {
        margin: -1rem;
        margin-bottom: var(--ds-space-4);
        padding: var(--ds-space-4);
    }
}

/* ===========================================
   BUTTON GROUPS
   =========================================== */

.ds-btn-group {
    display: flex;
    border-radius: var(--ds-radius-lg);
    overflow: hidden;
}

.ds-btn-group .ds-btn {
    border-radius: 0;
}

.ds-btn-group .ds-btn:first-child {
    border-radius: var(--ds-radius-lg) 0 0 var(--ds-radius-lg);
}

.ds-btn-group .ds-btn:last-child {
    border-radius: 0 var(--ds-radius-lg) var(--ds-radius-lg) 0;
}

/* ===========================================
   STAT CARDS
   =========================================== */

.ds-stat-card {
    text-decoration: none;
    border-left: 4px solid var(--ds-primary-600);
}

.ds-stat-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--ds-radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
}

.ds-stat-icon-primary {
    background: linear-gradient(135deg, var(--ds-primary-100) 0%, var(--ds-primary-200) 100%);
    color: var(--ds-primary-600);
}

.ds-stat-icon-secondary {
    background: linear-gradient(135deg, var(--ds-secondary-100) 0%, var(--ds-secondary-200) 100%);
    color: var(--ds-secondary-600);
}

.ds-stat-icon-neutral {
    background: var(--ds-neutral-100);
    color: var(--ds-neutral-600);
}

.ds-stat-secondary {
    color: var(--ds-secondary-600);
}

/* ===========================================
   ACTIVITY LIST
   =========================================== */

.ds-activity-list {
    display: flex;
    flex-direction: column;
}

.ds-activity-item {
    display: flex;
    align-items: flex-start;
    gap: var(--ds-space-3);
    padding: var(--ds-space-4) var(--ds-space-6);
    border-bottom: 1px solid var(--ds-neutral-100);
    transition: background var(--ds-duration-fast) var(--ds-ease-default);
}

.ds-activity-item:hover {
    background: var(--ds-neutral-50);
}

.ds-activity-item:last-child {
    border-bottom: none;
}

.ds-activity-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--ds-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ds-activity-icon.created {
    background: var(--ds-success-light);
    color: var(--ds-success-dark);
}

.ds-activity-icon.updated {
    background: var(--ds-info-light);
    color: var(--ds-info-dark);
}

.ds-activity-icon.deleted {
    background: var(--ds-error-light);
    color: var(--ds-error-dark);
}

.ds-activity-icon.login {
    background: var(--ds-primary-100);
    color: var(--ds-primary-600);
}

.ds-activity-icon.other {
    background: var(--ds-neutral-100);
    color: var(--ds-neutral-600);
}

.ds-activity-content {
    flex: 1;
    min-width: 0;
}

.ds-activity-title {
    font-weight: var(--ds-font-medium);
    color: var(--ds-neutral-900);
}

.ds-activity-time {
    font-size: var(--ds-text-xs);
    color: var(--ds-neutral-400);
    white-space: nowrap;
    margin-left: var(--ds-space-2);
}

.ds-activity-user {
    font-size: var(--ds-text-sm);
    color: var(--ds-neutral-500);
    display: block;
    margin-top: var(--ds-space-1);
}

/* ===========================================
   EMPTY STATES
   =========================================== */

.ds-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--ds-space-8);
    color: var(--ds-neutral-400);
}

.ds-empty-state i {
    font-size: 2.5rem;
    margin-bottom: var(--ds-space-3);
    opacity: 0.5;
}

.ds-empty-state p {
    margin: 0;
}

/* ===========================================
   RECENT ITEMS
   =========================================== */

.ds-recent-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--ds-space-6);
}

.ds-recent-list {
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-1);
}

.ds-recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--ds-space-2) var(--ds-space-3);
    border-radius: var(--ds-radius-md);
    text-decoration: none;
    color: var(--ds-neutral-900);
    transition: background var(--ds-duration-fast) var(--ds-ease-default);
}

.ds-recent-item:hover {
    background: var(--ds-neutral-100);
}

.ds-recent-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ds-recent-time {
    font-size: var(--ds-text-xs);
    color: var(--ds-neutral-400);
    margin-left: var(--ds-space-2);
    white-space: nowrap;
}

@media (max-width: 768px) {
    .ds-recent-grid {
        grid-template-columns: 1fr;
    }
}

/* ===========================================
   TABS
   =========================================== */

.ds-tabs {
    display: flex;
    border-bottom: 1px solid var(--ds-neutral-200);
    margin-bottom: var(--ds-space-4);
}

.ds-tab {
    padding: var(--ds-space-3) var(--ds-space-4);
    color: var(--ds-neutral-600);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--ds-duration-fast) var(--ds-ease-default);
    cursor: pointer;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
}

.ds-tab:hover {
    color: var(--ds-primary-600);
}

.ds-tab.active {
    color: var(--ds-primary-600);
    border-bottom-color: var(--ds-primary-600);
    font-weight: var(--ds-font-semibold);
}

/* ===========================================
   SORTABLE TABLE HEADERS
   =========================================== */

.sortable-header {
    cursor: pointer;
    user-select: none;
    font-weight: var(--ds-font-semibold);
    font-size: var(--ds-text-xs);
    text-transform: uppercase;
    letter-spacing: var(--ds-tracking-wider);
    color: var(--ds-neutral-600);
    padding: var(--ds-space-3);
    transition: color var(--ds-duration-fast) var(--ds-ease-default);
}

.sortable-header:hover {
    color: var(--ds-primary-600);
}

/* ===========================================
   COMPACT FORMS (Label-Left)
   =========================================== */

.compact-form {
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-1);
}

.compact-form .form-row {
    display: grid;
    grid-template-columns: 122px 1fr;
    align-items: center;
    gap: var(--ds-space-2);
}

.compact-form .form-row label {
    font-size: 0.75rem;
    color: var(--ds-neutral-500);
    text-align: right;
    padding-right: var(--ds-space-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.compact-form.readonly .form-row span {
    font-weight: 500;
}

.compact-form .form-control-sm,
.compact-form .form-select-sm {
    padding: 0.2rem 0.4rem;
    font-size: 0.8rem;
    height: auto;
    min-height: 1.75rem;
}

@media (max-width: 767.98px) {
    .compact-form .form-row {
        grid-template-columns: 1fr;
    }
    .compact-form .form-row label {
        text-align: left;
        margin-bottom: var(--ds-space-1);
    }
}

/* ===========================================
   CULTURE DATE INPUT
   =========================================== */

.culture-date-input {
    position: relative;
}

.culture-date-picker-overlay {
    position: absolute;
    top: 0;
    right: 0;
    width: 2rem;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
}

.culture-date-picker-overlay::-webkit-calendar-picker-indicator {
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* ===========================================
   ADDITIONAL MARGIN UTILITIES
   =========================================== */

.ds-mt-0 { margin-top: 0; }
.ds-mt-2 { margin-top: var(--ds-space-2); }
.ds-mt-4 { margin-top: var(--ds-space-4); }
.ds-mt-6 { margin-top: var(--ds-space-6); }

.ds-mb-0 { margin-bottom: 0; }
.ds-mb-1 { margin-bottom: var(--ds-space-1); }
.ds-mb-3 { margin-bottom: var(--ds-space-3); }

.ds-flex-1 { flex: 1; }
.ds-min-w-0 { min-width: 0; }

/* ===========================================
   BOOTSTRAP OVERRIDES
   Apply design system tokens to Bootstrap components
   =========================================== */

/* Cards */
.card {
    border: 1px solid var(--ds-neutral-200);
    border-radius: var(--ds-radius-xl);
    box-shadow: var(--ds-shadow-sm);
    overflow: hidden;
}

/* Cards that contain dropdowns/autocompletes need visible overflow */
.card.card-overflow-visible {
    overflow: visible;
}

/* Page size free text input */
.page-size-input {
    width: 60px;
    text-align: center;
    padding: 2px 4px;
    font-size: var(--ds-font-size-sm, 0.8125rem);
}

/* Merge result editable input */
.merge-result-input {
    font-size: var(--ds-font-size-xs, 0.75rem) !important;
    padding: 2px 6px !important;
    height: auto !important;
    min-height: 28px;
}

.card-header {
    border-bottom: 1px solid var(--ds-neutral-100);
}

/* Buttons */
/* Form controls */
.form-check-input:checked {
    background-color: var(--ds-primary-600);
    border-color: var(--ds-primary-600);
}

/* Table */
.table-primary {
    --bs-table-bg: var(--ds-primary-100);
}

.table > tbody > tr > td {
    padding: var(--ds-space-3);
    vertical-align: middle;
}

/* Compact table variant - reduced row height */
.table-compact > tbody > tr > td {
    padding: var(--ds-space-2);
}

.table-compact > thead > tr > th {
    padding: var(--ds-space-2);
}

/* Clickable table row */
.clickable-row {
    cursor: pointer;
}

/* Table row hover state */
.contact-row {
    transition: background-color var(--ds-duration-fast) var(--ds-ease-default);
}

.contact-row:hover {
    background-color: var(--ds-neutral-50);
}

/* Pagination */
.page-item.active .page-link {
    background-color: var(--ds-primary-600);
    border-color: var(--ds-primary-600);
}

.page-link {
    color: var(--ds-primary-600);
    border-radius: var(--ds-radius-md);
}

.page-link:hover {
    color: var(--ds-primary-600);
    background-color: var(--ds-neutral-100);
}

/* Nav Tabs */
.nav-tabs .nav-link {
    color: var(--ds-neutral-600);
    border: none;
    border-bottom: 2px solid transparent;
    transition: all var(--ds-duration-fast) var(--ds-ease-default);
}

.nav-tabs .nav-link:hover {
    color: var(--ds-primary-600);
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--ds-primary-600);
    border-color: var(--ds-primary-600);
    font-weight: var(--ds-font-semibold);
}

/* Visibility Badge */
.visibility-badge {
    font-size: var(--ds-text-xs);
    padding: var(--ds-space-1) var(--ds-space-2);
    border-radius: var(--ds-radius-full);
}

/* Disabled fieldset styling (read-only forms) */
fieldset[disabled] .form-control,
fieldset[disabled] .form-select {
    background-color: transparent;
    border-color: transparent;
    padding-left: 0;
    cursor: default;
}

fieldset[disabled] .form-control:focus,
fieldset[disabled] .form-select:focus {
    box-shadow: none;
}

/* Top bar elements */
.profile-link:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-radius: var(--ds-radius-md);
}

.logout-btn {
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background-color: transparent;
    transition: all var(--ds-duration-fast) var(--ds-ease-default);
}

.logout-btn:hover {
    background-color: var(--ds-primary-700);
    border-color: var(--ds-primary-700);
    color: white;
}

/* Table row hover states */
.account-row,
.user-row,
.group-row,
.audit-row {
    transition: background-color var(--ds-duration-fast) var(--ds-ease-default);
}

.account-row:hover,
.user-row:hover,
.group-row:hover,
.audit-row:hover {
    background-color: rgba(64, 31, 113, 0.03);
}

/* Table header styling */
.table > thead > tr > th {
    font-weight: var(--ds-font-semibold);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    color: var(--ds-neutral-800);
    padding: 0.875rem 0.75rem;
}

/* Role badges */
.badge.role-admin {
    background-color: var(--ds-primary-600);
}

.badge.role-manager {
    background-color: var(--ds-secondary-400);
    color: var(--ds-neutral-800);
}

.badge.role-user {
    background-color: var(--ds-neutral-100);
    color: var(--ds-neutral-800);
}

/* Audit event badges */
.badge.event-auth-success { background-color: #107c10; }
.badge.event-auth-fail { background-color: #d13438; }
.badge.event-auth-logout { background-color: #6c757d; }
.badge.event-create { background-color: #0078d4; }
.badge.event-update { background-color: #f7630c; }
.badge.event-delete { background-color: #d13438; }
.badge.event-import { background-color: #5c2d91; }
.badge.event-export { background-color: #00b294; }
.badge.event-exchange { background-color: #00a4ef; }

/* Upload zones */
.upload-zone {
    transition: all var(--ds-duration-fast) var(--ds-ease-default);
}

.upload-zone:hover {
    background-color: rgba(64, 31, 113, 0.03);
}

/* Selectable cards (import wizard) */
.selectable-card {
    transition: all var(--ds-duration-fast) var(--ds-ease-default);
    border: 2px solid transparent;
}

.selectable-card:hover {
    border-color: var(--ds-primary-600);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.selectable-card.selected {
    border-color: var(--ds-primary-600) !important;
    background-color: rgba(64, 31, 113, 0.03);
}

/* Pagination disabled state */
.page-item.disabled .page-link {
    color: #6c757d;
    background-color: var(--ds-neutral-100);
}

.page-link:focus {
    box-shadow: 0 0 0 0.2rem rgba(64, 31, 113, 0.25);
}

/* Login card */
.login-card {
    background: white;
    border-radius: var(--ds-radius-xl);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    padding: 2.5rem;
    max-width: min(400px, calc(100vw - 2rem));
    width: 100%;
}

/* Input group focus state */
.input-group-text {
    border-right: none;
}

.input-group .form-control {
    border-left: none;
}

.input-group:focus-within .input-group-text {
    border-color: var(--ds-primary-600);
}

.input-group:focus-within .form-control {
    border-color: var(--ds-primary-600);
    box-shadow: none;
}

/* ===========================================
   STANDARDIZED CLASSES (Unprefixed Aliases)
   These provide consistent naming across the app
   =========================================== */

/* Page Header - Purple Gradient (ALL PAGES) */
.page-header {
    background: linear-gradient(135deg, var(--ds-primary-600) 0%, var(--ds-primary-800) 100%);
    color: white;
    margin: -1.25rem -1.25rem 1rem -1.25rem;
    padding: 0.85rem 1.25rem;
    border-radius: 0 0 var(--ds-radius-2xl) var(--ds-radius-2xl);
}

.page-header .page-title,
.page-header h1,
.page-header h2,
.page-header h3,
.page-header h4 {
    color: white;
    margin-bottom: 0;
    font-weight: 600;
}

.page-header .page-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.page-header .avatar {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}


.page-header .text-muted {
    color: rgba(255, 255, 255, 0.7) !important;
}

@media (max-width: 767.98px) {
    .page-header {
        margin: -1rem -1rem 0.75rem -1rem;
        padding: 0.65rem 1rem;
    }
}

/* Avatar - Standard Sizes */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--ds-radius-full);
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--ds-primary-500) 0%, var(--ds-primary-700) 100%);
    flex-shrink: 0;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-xs { width: 24px; height: 24px; font-size: 0.625rem; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-md { width: 40px; height: 40px; font-size: 0.875rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1rem; }
.avatar-xl { width: 64px; height: 64px; font-size: 1.25rem; }
.avatar-2xl { width: 80px; height: 80px; font-size: 1.5rem; }

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th,
.data-table td {
    padding: 0.875rem 0.75rem;
    vertical-align: middle;
}

.table-header,
.data-table thead tr {
    background-color: var(--ds-neutral-100);
}

.table-header th,
.data-table thead th {
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    color: var(--ds-neutral-600);
    border-bottom: 1px solid var(--ds-neutral-200);
}

.data-row {
    transition: background-color var(--ds-duration-fast) var(--ds-ease-default);
}

.data-row:hover {
    background-color: rgba(64, 31, 113, 0.03);
}

.col-checkbox {
    width: 40px;
    padding-left: 1rem !important;
}

.col-actions {
    width: 120px;
    text-align: center;
}

/* Modal Overlay */
.modal-overlay {
    background-color: rgba(0, 0, 0, 0.5);
}

/* Search Input Group */
.search-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-group .search-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--ds-neutral-400);
    pointer-events: none;
    z-index: 1;
}

.search-input-group .form-control {
    padding-left: 2.5rem;
}

/* Spinner Variants */
.spinner-primary {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--ds-neutral-200);
    border-top-color: var(--ds-primary-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-primary-sm {
    width: 1rem;
    height: 1rem;
    border-width: 2px;
}

.spinner-primary-lg {
    width: 3rem;
    height: 3rem;
    border-width: 4px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Icon Utilities */
.icon-primary { color: var(--ds-primary-600); }
.icon-secondary { color: var(--ds-secondary-500); }
.icon-success { color: #107c10; }
.icon-warning { color: #f7630c; }
.icon-danger { color: #d13438; }
.icon-muted { color: var(--ds-neutral-400); }

.icon-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--ds-radius-lg);
}

.icon-box-primary {
    background: linear-gradient(135deg, var(--ds-primary-100) 0%, var(--ds-primary-200) 100%);
    color: var(--ds-primary-600);
}

.icon-box-secondary {
    background: linear-gradient(135deg, var(--ds-secondary-100) 0%, var(--ds-secondary-200) 100%);
    color: var(--ds-secondary-600);
}

.icon-box-success {
    background: var(--ds-success-light);
    color: #107c10;
}

.icon-box-neutral {
    background: var(--ds-neutral-100);
    color: var(--ds-neutral-600);
}

/* Wizard Components */
.wizard-container {
    max-width: 800px;
    margin: 0 auto;
}

.wizard-header {
    text-align: center;
    margin-bottom: 2rem;
}

.wizard-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.wizard-progress-line {
    position: absolute;
    top: 20px;
    left: 40px;
    right: 40px;
    height: 2px;
    background-color: var(--ds-neutral-200);
    z-index: 0;
}

.wizard-progress-line-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: var(--ds-primary-600);
    transition: width var(--ds-duration-normal) var(--ds-ease-default);
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.wizard-step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    background-color: var(--ds-neutral-100);
    color: var(--ds-neutral-400);
    border: 2px solid var(--ds-neutral-200);
    transition: all var(--ds-duration-fast) var(--ds-ease-default);
}

.wizard-step-label {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--ds-neutral-500);
    text-align: center;
    max-width: 80px;
}

.wizard-step-active .wizard-step-circle {
    background-color: var(--ds-primary-600);
    border-color: var(--ds-primary-600);
    color: white;
}

.wizard-step-active .wizard-step-label {
    color: var(--ds-primary-600);
    font-weight: 600;
}

.wizard-step-completed .wizard-step-circle {
    background-color: #107c10;
    border-color: #107c10;
    color: white;
}

.wizard-step-completed .wizard-step-label {
    color: #107c10;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--ds-neutral-300);
    border-radius: var(--ds-radius-xl);
    padding: 2rem;
    text-align: center;
    transition: all var(--ds-duration-fast) var(--ds-ease-default);
    cursor: pointer;
    background-color: var(--ds-neutral-50);
}

.upload-zone:hover {
    border-color: var(--ds-primary-600);
    background-color: rgba(64, 31, 113, 0.03);
}

.upload-zone-active,
.upload-zone.active {
    border-color: var(--ds-primary-600);
    border-style: solid;
    background-color: rgba(64, 31, 113, 0.05);
}

.upload-zone-success {
    border-color: #107c10;
    background-color: rgba(16, 124, 16, 0.05);
}

.upload-zone-icon {
    font-size: 3rem;
    color: var(--ds-neutral-400);
    margin-bottom: 1rem;
}

.upload-zone:hover .upload-zone-icon {
    color: var(--ds-primary-600);
}

/* Stat Cards */
.stat-card {
    text-decoration: none;
    border-left: 4px solid var(--ds-primary-600);
    transition: transform var(--ds-duration-fast) var(--ds-ease-default),
                box-shadow var(--ds-duration-fast) var(--ds-ease-default);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--ds-shadow-lg);
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--ds-radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
}

.stat-icon-primary {
    background: linear-gradient(135deg, var(--ds-primary-100) 0%, var(--ds-primary-200) 100%);
    color: var(--ds-primary-600);
}

.stat-icon-secondary {
    background: linear-gradient(135deg, var(--ds-secondary-100) 0%, var(--ds-secondary-200) 100%);
    color: var(--ds-secondary-600);
}

.stat-icon-success {
    background: rgba(16, 124, 16, 0.1);
    color: #107c10;
}

.stat-icon-neutral {
    background: var(--ds-neutral-100);
    color: var(--ds-neutral-600);
}

.stat-card-success { border-left-color: #107c10; }
.stat-card-warning { border-left-color: #f7630c; }
.stat-card-danger { border-left-color: #d13438; }
.stat-card-info { border-left-color: #0078d4; }

/* Config Card (Import Wizard) */
.config-card {
    background-color: var(--ds-neutral-100);
    border: none;
    border-radius: var(--ds-radius-xl);
}

.config-card .card-body {
    padding: 1.5rem;
}

/* Metric Card */
.metric-card {
    text-align: center;
    padding: 1rem;
}

.metric-card .metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--ds-neutral-800);
}

.metric-card .metric-label {
    font-size: 0.75rem;
    color: var(--ds-neutral-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Settings Panel */
.settings-panel {
    margin-bottom: 1.5rem;
}

.settings-panel .card-header {
    background: transparent;
    border-bottom: 1px solid var(--ds-neutral-100);
    padding: 1rem 1.5rem;
}

.settings-panel .card-body {
    padding: 1.5rem;
}

/* Settings Two-Column Layout */
.settings-layout {
    display: flex;
    gap: 1.5rem;
    min-height: 500px;
}

.settings-sidebar {
    width: 220px;
    flex-shrink: 0;
}

.settings-content {
    flex: 1;
    min-width: 0;
}

/* Settings Sidebar Nav */
.settings-nav-section {
    margin-bottom: 1rem;
}

.settings-nav-section-title {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ds-neutral-400);
    padding: 0.25rem 0.75rem;
    margin-bottom: 0.25rem;
}

.settings-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--ds-radius-sm);
    color: var(--ds-neutral-600);
    text-decoration: none;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.settings-nav-link:hover {
    background-color: var(--ds-neutral-50);
    color: var(--ds-neutral-800);
    text-decoration: none;
}

.settings-nav-link.active {
    background-color: var(--ds-primary-50);
    color: var(--ds-primary);
    font-weight: 500;
}

.settings-nav-link i {
    font-size: 1rem;
    width: 1.25rem;
    text-align: center;
}

/* Connection Status Dot */
.settings-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: auto;
    flex-shrink: 0;
}

/* Responsive: collapse sidebar on small screens */
@media (max-width: 768px) {
    .settings-layout {
        flex-direction: column;
    }

    .settings-sidebar {
        width: 100%;
        display: flex;
        overflow-x: auto;
        gap: 0.25rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid var(--ds-neutral-100);
        margin-bottom: 1rem;
    }

    .settings-nav-section {
        display: flex;
        gap: 0.25rem;
        margin-bottom: 0;
    }

    .settings-nav-section-title {
        display: none;
    }

    .settings-nav-link {
        white-space: nowrap;
        padding: 0.375rem 0.75rem;
        font-size: 0.8125rem;
    }
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}

.empty-state-icon {
    font-size: 3rem;
    color: var(--ds-neutral-300);
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--ds-neutral-600);
    margin-bottom: 0.5rem;
}

.empty-state-message {
    color: var(--ds-neutral-500);
    margin-bottom: 1.5rem;
    max-width: 300px;
}

/* Activity List (unprefixed) */
.activity-list {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--ds-neutral-100);
    transition: background var(--ds-duration-fast) var(--ds-ease-default);
}

.activity-item:hover {
    background: var(--ds-neutral-50);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--ds-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon.created { background: var(--ds-success-light); color: #107c10; }
.activity-icon.updated { background: var(--ds-info-light); color: #0078d4; }
.activity-icon.deleted { background: var(--ds-error-light); color: #d13438; }
.activity-icon.login { background: var(--ds-primary-100); color: var(--ds-primary-600); }
.activity-icon.other { background: var(--ds-neutral-100); color: var(--ds-neutral-600); }

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-weight: 500;
    color: var(--ds-neutral-800);
}

.activity-time {
    font-size: 0.75rem;
    color: var(--ds-neutral-400);
    white-space: nowrap;
}

.activity-user {
    font-size: 0.875rem;
    color: var(--ds-neutral-500);
    margin-top: 0.25rem;
}

/* Recent List (unprefixed) */
.recent-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: var(--ds-radius-md);
    text-decoration: none;
    color: var(--ds-neutral-800);
    transition: background var(--ds-duration-fast) var(--ds-ease-default);
}

.recent-item:hover {
    background: var(--ds-neutral-100);
}

.recent-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-time {
    font-size: 0.75rem;
    color: var(--ds-neutral-400);
    margin-left: 0.5rem;
}

/* Bento Grid (unprefixed) */
.bento-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
}

.bento-grid-2-1 {
    grid-template-columns: 2fr 1fr;
}

.bento-grid-1-2 {
    grid-template-columns: 1fr 2fr;
}

@media (max-width: 768px) {
    .bento-grid-2-1,
    .bento-grid-1-2 {
        grid-template-columns: 1fr;
    }
}

/* Chart Container */
.chart-container {
    max-height: 250px;
    position: relative;
}

/* Form Row (unprefixed) */
.form-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.form-row label {
    font-size: 0.75rem;
    color: var(--ds-neutral-500);
    text-align: right;
    padding-right: 0.5rem;
}

@media (max-width: 767.98px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    .form-row label {
        text-align: left;
        margin-bottom: 0.25rem;
    }
}

/* Tabs (unprefixed) */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--ds-neutral-200);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1rem;
    color: var(--ds-neutral-600);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--ds-duration-fast) var(--ds-ease-default);
    cursor: pointer;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
}

.tab:hover {
    color: var(--ds-primary-600);
}

.tab.active {
    color: var(--ds-primary-600);
    border-bottom-color: var(--ds-primary-600);
    font-weight: 600;
}

/* Success Icon (completion states) */
.success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #107c10;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

/* Not Found Page */
.not-found-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 2rem;
}

.not-found-title {
    font-size: 6rem;
    font-weight: 700;
    color: var(--ds-primary-600);
    line-height: 1;
    margin-bottom: 1rem;
}

.not-found-message {
    font-size: 1.25rem;
    color: var(--ds-neutral-600);
    margin-bottom: 2rem;
}

/* Error Page */
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 2rem;
}

/* Selectable Card (import wizard) */
.selectable-card {
    cursor: pointer;
    transition: all var(--ds-duration-fast) var(--ds-ease-default);
    border: 2px solid transparent;
}

.selectable-card:hover {
    border-color: var(--ds-primary-600);
    transform: translateY(-2px);
    box-shadow: var(--ds-shadow-lg);
}

.selectable-card.selected {
    border-color: var(--ds-primary-600);
    background-color: rgba(64, 31, 113, 0.03);
}

/* Preview Table */
.preview-table {
    max-height: 350px;
    overflow-y: auto;
}

.preview-table .table {
    margin-bottom: 0;
}

.preview-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Color Picker Option */
.color-picker-option {
    width: 24px;
    height: 24px;
    border-radius: var(--ds-radius-full);
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform var(--ds-duration-fast) var(--ds-ease-default);
}

.color-picker-option:hover {
    transform: scale(1.1);
}

.color-picker-option.selected {
    border-color: var(--ds-neutral-800);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--ds-neutral-800);
}

/* ===========================================
   GLOBAL STYLES (merged from app.css)
   =========================================== */

html, body {
    font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
    color: var(--ds-primary-600);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--ds-primary-600);
}

.table-dark {
    background-color: var(--ds-primary-600);
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* Login page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--ds-primary-600) 0%, var(--ds-neutral-800) 100%);
}

.login-card {
    background: white;
    padding: 2.5rem;
    border-radius: var(--ds-radius-xl);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: min(400px, calc(100vw - 2rem));
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    color: var(--ds-primary-600);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--ds-neutral-600);
}

.empty-layout {
    min-height: 100vh;
}

/* ===========================================
   SIDEBAR NAVIGATION
   =========================================== */

.sidebar {
    background: var(--ds-dark-bg);
    background-image: linear-gradient(135deg, rgba(109, 40, 217, 0.1) 0%, transparent 50%);
    border-right: 1px solid var(--ds-dark-border);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-header {
    padding-bottom: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
}

.tagline {
    color: var(--ds-secondary-400);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    margin-left: 3.25rem;
}

.brand-divider {
    height: 2px;
    background: linear-gradient(to right, var(--ds-secondary-500), transparent);
    margin-top: 1rem;
    width: 60px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 1rem;
}

.nav-section-title {
    color: var(--ds-neutral-400);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0;
    margin-bottom: 0.25rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    color: var(--ds-neutral-300);
    text-decoration: none;
    border-radius: var(--ds-radius-lg);
    margin-bottom: 0.25rem;
    transition: all var(--ds-duration-fast) var(--ds-ease-default);
}

.sidebar-nav .nav-link:hover {
    background-color: var(--ds-dark-elevated);
    color: white;
}

.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, var(--ds-primary-600) 0%, var(--ds-primary-700) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(109, 40, 217, 0.3);
}

.sidebar-nav .nav-link .bi {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
}

.nav-text {
    font-size: 0.9375rem;
}

/* Sidebar Footer */
.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--ds-dark-border);
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--ds-radius-lg);
    transition: background var(--ds-duration-fast) var(--ds-ease-default);
    flex: 1;
    min-width: 0;
    color: inherit;
}

.sidebar-user:hover {
    background: var(--ds-dark-elevated);
}

.sidebar-logout-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--ds-radius-lg);
    border: none;
    background: transparent;
    color: var(--ds-neutral-400);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--ds-duration-fast) var(--ds-ease-default);
    flex-shrink: 0;
}

.sidebar-logout-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.sidebar-logout-btn i {
    font-size: 1.125rem;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--ds-primary-500), var(--ds-primary-700));
    border-radius: var(--ds-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-user-name {
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    color: var(--ds-neutral-400);
    font-size: 0.75rem;
}

/* Top Row - Removed, user info moved to sidebar footer */

/* ===========================================
   RESPONSIVE UTILITIES
   =========================================== */

/* Mobile visibility */
@media (max-width: 767.98px) {
    .d-mobile-none {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .d-mobile-only {
        display: none !important;
    }
}

/* Touch-friendly buttons */
@media (max-width: 767.98px) {
    .btn-touch {
        min-height: 44px;
        min-width: 44px;
    }

    .btn-group-touch > .btn {
        min-width: 44px;
        min-height: 44px;
        padding: 0.5rem;
    }
}

/* Responsive table */
@media (max-width: 767.98px) {
    .table th.d-none-mobile,
    .table td.d-none-mobile {
        display: none !important;
    }

    .table-mobile-compact td,
    .table-mobile-compact th {
        padding: 0.5rem 0.25rem !important;
    }

    .table .btn-sm {
        padding: 0.375rem 0.5rem;
    }
}

/* Responsive cards */
@media (max-width: 767.98px) {
    .card-body {
        padding: 1rem;
    }

    .card-header {
        padding: 0.75rem 1rem;
    }
}

/* Page content padding */
@media (max-width: 767.98px) {
    .mx-n4 {
        margin-left: -1rem !important;
        margin-right: -1rem !important;
    }

    .px-4 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

/* Responsive pagination */
@media (max-width: 575.98px) {
    .pagination .page-item.d-none-xs {
        display: none !important;
    }

    .pagination .page-link {
        min-width: 40px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Responsive modal */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
}

/* Top row mobile */
@media (max-width: 767.98px) {
    .top-row {
        min-height: 56px;
    }

    .top-row .profile-link span:not(.rounded-circle):not([class*="bi-"]) {
        display: none;
    }
}

/* ===========================================
   FEAT-020: Responsive Utility Classes
   =========================================== */

/* Clickable row */
.ds-clickable { cursor: pointer; }

/* Truncation utilities */
.ds-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-truncate-sm { max-width: 120px; }
.ds-truncate-md { max-width: 200px; }
.ds-truncate-lg { max-width: 400px; }

@media (max-width: 767.98px) {
    .ds-truncate-sm { max-width: 80px; }
    .ds-truncate-md { max-width: 140px; }
    .ds-truncate-lg { max-width: 200px; }
}

/* Table column width utilities */
.ds-col-xs { width: 60px; }
.ds-col-sm { width: 80px; }
.ds-col-100 { width: 100px; }
.ds-col-md { width: 120px; }
.ds-col-lg { width: 180px; }

/* Filter input sizing */
.ds-filter-primary { flex: 2; min-width: 0; }
.ds-filter-secondary { flex: 1; min-width: 0; }

@media (max-width: 767.98px) {
    .ds-filter-primary,
    .ds-filter-secondary { flex-basis: 100%; }
}

/* Filter bar container */
.ds-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ds-space-3);
    align-items: center;
}

@media (max-width: 767.98px) {
    .ds-filter-bar {
        flex-direction: column;
    }
    .ds-filter-bar > * {
        width: 100%;
    }
}

/* Scroll containers */
.ds-scroll-xs { max-height: 100px; overflow-y: auto; }
.ds-scroll-sm { max-height: 200px; overflow-y: auto; }
.ds-scroll-md { max-height: 350px; overflow-y: auto; }

/* Avatar sizing override for responsive */
.ds-avatar-responsive {
    width: min(150px, 40vw);
    height: min(150px, 40vw);
}

/* Wizard stepper progress lines */
.stepper-line-track,
.stepper-line-fill {
    top: 20px;
    height: 2px;
    z-index: 0;
    left: 20px;
    right: 20px;
}
.stepper-line-track {
    background-color: var(--ds-neutral-100);
}
.stepper-line-fill {
    background-color: var(--ds-primary-600);
    right: auto;
    max-width: calc(100% - 40px);
}

/* Wizard stepper responsive */
@media (max-width: 767.98px) {
    .ds-wizard-stepper .small {
        font-size: 0.65rem;
    }
    .ds-wizard-stepper .rounded-circle {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.75rem;
    }
    .stepper-line-track,
    .stepper-line-fill {
        top: 16px;
        left: 16px;
        right: 16px;
    }
    .stepper-line-fill {
        max-width: calc(100% - 32px);
    }
}

/* ===========================================
   SETUP WIZARD
   (migrated from SetupWizard.razor inline style)
   =========================================== */

.setup-wizard {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.wizard-progress {
    position: relative;
}

.wizard-step {
    flex: 1;
    text-align: center;
    position: relative;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--ds-neutral-100);
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.5rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.wizard-step.active .step-circle {
    background-color: var(--ds-primary-600);
    color: white;
}

.wizard-step.completed .step-circle {
    background-color: #107c10;
    color: white;
}

.step-label {
    font-size: 0.85rem;
    color: #6c757d;
}

.wizard-step.active .step-label {
    color: var(--ds-primary-600);
    font-weight: 600;
}

.wizard-step.completed .step-label {
    color: #107c10;
}

.setup-wizard .progress-bar {
    background-color: var(--ds-primary-600);
}

@media (max-width: 767.98px) {
    .setup-wizard {
        max-width: calc(100vw - 2rem);
        padding: 0 0.5rem;
    }
    .step-circle {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    .step-label {
        font-size: 0.7rem;
    }
}

/* Scrollable tabs on mobile */
@media (max-width: 767.98px) {
    .ds-tabs-scrollable {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .ds-tabs-scrollable .nav-link {
        white-space: nowrap;
    }
}

/* ===========================================
   AUTOCOMPLETE DROPDOWNS
   (migrated from CompanyAutocomplete.razor inline style)
   =========================================== */

.company-autocomplete,
.country-autocomplete {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: var(--ds-z-dropdown);
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: min(300px, 50vh);
    overflow-y: auto;
}

.autocomplete-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--bs-border-color-translucent, rgba(0,0,0,0.05));
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background-color: var(--bs-primary-bg-subtle, #e7f1ff);
}

.autocomplete-item.loading,
.autocomplete-item.no-results {
    color: var(--bs-secondary, #6c757d);
    cursor: default;
}

.autocomplete-item.loading:hover,
.autocomplete-item.no-results:hover {
    background-color: transparent;
}

.autocomplete-item .company-name {
    font-weight: 500;
}

.autocomplete-item .company-address {
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 50%;
}

.form-control.dropdown-open {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* ===== FEAT-009: Search Match Highlighting ===== */
.search-matches {
    font-size: 0.85rem;
    line-height: 1.4;
}

.search-match-item {
    margin-bottom: 0.25rem;
}

.search-match-item:last-child {
    margin-bottom: 0;
}

.match-field {
    font-weight: 500;
    margin-right: 0.25rem;
}

.match-snippet {
    word-break: break-word;
}

.search-highlight {
    background-color: #fff3cd;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 500;
}

/* Dark mode support */
[data-bs-theme="dark"] .search-highlight {
    background-color: #664d03;
    color: #fff3cd;
}

/* ===========================================
   BADGE SELECT INPUT (FEAT-006)
   =========================================== */

.badge-select-container {
    position: relative;
}

/* B-128: the BadgeSelect dropdown overflowed its enclosing card and was painted under the
   next sibling card (e.g. "Sichtbarkeit"). Lifting only the local container isn't enough —
   siblings of the card rank by document order in the parent stacking context, so we have
   to elevate the entire enclosing card. Uses :has() to target any card that currently owns
   focus inside a BadgeSelect; fallback rule keeps the container itself elevated for layouts
   where the BadgeSelect is not inside a .card. */
.badge-select-container:focus-within {
    z-index: var(--ds-z-dropdown);
}

.card:has(.badge-select-container:focus-within) {
    position: relative;
    z-index: var(--ds-z-dropdown);
    /* .card sets overflow: hidden for rounded-corner clipping, which otherwise crops
       the BadgeSelect option list when it overflows the card boundary. Override only
       while the dropdown is actually open. */
    overflow: visible;
}

.badge-select-input {
    min-height: calc(1.5em + 0.5rem + 2px);
    height: auto;
    cursor: text;
    padding: 0.15rem 0.25rem;
}

.badge-select-text-input {
    border: none;
    outline: none;
    background: transparent;
    flex: 1 1 60px;
    min-width: 60px;
    font-size: 0.875rem;
    padding: 0.1rem 0.25rem;
}

.badge-remove {
    font-size: 0.5rem;
    padding: 0.15rem;
    opacity: 0.8;
}

.badge-remove:hover {
    opacity: 1;
}

.badge-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: var(--ds-z-dropdown);
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
}

.badge-select-item {
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--bs-border-color-translucent, rgba(0,0,0,0.05));
}

.badge-select-item:last-child {
    border-bottom: none;
}

.badge-select-item:hover,
.badge-select-item.selected {
    background-color: var(--bs-primary-bg-subtle, #e7f1ff);
}

.badge-select-item.no-results {
    color: var(--bs-secondary, #6c757d);
    cursor: default;
}

.badge-select-item.no-results:hover {
    background-color: transparent;
}

/* FEAT-017: Hero stat card with breakdown bar */
.stat-hero-card {
    border-left: 4px solid var(--ds-primary-600);
}

.breakdown-bar {
    display: flex;
    height: 2.5rem;
    border-radius: var(--ds-radius-md);
    overflow: hidden;
    gap: 2px;
}

.breakdown-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: white;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: opacity 0.15s;
    min-width: 3rem;
}

.breakdown-segment:hover {
    opacity: 0.85;
    color: white;
}

.segment-persons {
    background: var(--ds-primary-600);
}

.segment-companies {
    background: var(--ds-neutral-500);
}

.breakdown-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 0.5rem;
}

@media (max-width: 576px) {
    .breakdown-label {
        font-size: 0.75rem;
    }
}

/* ===========================================
   MAIN LAYOUT
   (migrated from MainLayout.razor.css)
   =========================================== */

.page {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page > main {
    flex: 1;
}

@media (min-width: 641px) {
    .page {
        flex-direction: row;
    }

    .page .sidebar {
        width: 250px;
        height: 100vh;
        position: sticky;
        top: 0;
        overflow-y: auto;
        flex-shrink: 0;
    }

    .page > main > article {
        padding-left: 2rem !important;
        padding-right: 1.5rem !important;
    }
}

/* Mobile Navigation Toggle */
.mobile-nav-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 1035;
    width: 44px;
    height: 44px;
    border: none;
    background-color: var(--ds-primary-600);
    border-radius: var(--ds-radius-lg);
    color: white;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background-color var(--ds-duration-fast) var(--ds-ease-default);
}

.mobile-nav-toggle:hover {
    background-color: var(--ds-primary-700);
}

.mobile-nav-toggle:focus {
    outline: 2px solid var(--ds-secondary-500);
    outline-offset: 2px;
}

/* Mobile Overlay */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1036;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-nav-overlay.open {
    display: block;
    opacity: 1;
}

/* Mobile-specific layout */
@media (max-width: 767.98px) {
    .mobile-nav-toggle {
        display: flex;
    }

    .page .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        z-index: 1037;
        width: 280px;
        height: 100vh;
        transition: left 0.3s ease;
    }

    .page .sidebar.open {
        left: 0;
    }

    .page > main {
        width: 100%;
    }

    .page > main > .content {
        padding-top: 3.5rem !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

/* Blazor Error UI */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ===========================================
   RECONNECT MODAL
   (migrated from ReconnectModal.razor.css)
   =========================================== */

.components-reconnect-first-attempt-visible,
.components-reconnect-repeated-attempt-visible,
.components-reconnect-failed-visible,
.components-pause-visible,
.components-resume-failed-visible,
.components-rejoining-animation {
    display: none;
}

#components-reconnect-modal.components-reconnect-show .components-reconnect-first-attempt-visible,
#components-reconnect-modal.components-reconnect-show .components-rejoining-animation,
#components-reconnect-modal.components-reconnect-paused .components-pause-visible,
#components-reconnect-modal.components-reconnect-resume-failed .components-resume-failed-visible,
#components-reconnect-modal.components-reconnect-retrying,
#components-reconnect-modal.components-reconnect-retrying .components-reconnect-repeated-attempt-visible,
#components-reconnect-modal.components-reconnect-retrying .components-rejoining-animation,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-failed .components-reconnect-failed-visible {
    display: block;
}

#components-reconnect-modal {
    background-color: white;
    width: min(20rem, calc(100vw - 2rem));
    margin: 20vh auto;
    padding: 2rem;
    border: 0;
    border-radius: 0.5rem;
    box-shadow: 0 3px 6px 2px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: display 0.5s allow-discrete, overlay 0.5s allow-discrete;
    animation: components-reconnect-modal-fadeOutOpacity 0.5s both;
}

#components-reconnect-modal[open] {
    animation: components-reconnect-modal-slideUp 1.5s cubic-bezier(.05, .89, .25, 1.02) 0.3s,
               components-reconnect-modal-fadeInOpacity 0.5s ease-in-out 0.3s;
    animation-fill-mode: both;
}

#components-reconnect-modal::backdrop {
    background-color: rgba(0, 0, 0, 0.4);
    animation: components-reconnect-modal-fadeInOpacity 0.5s ease-in-out;
    opacity: 1;
}

@keyframes components-reconnect-modal-slideUp {
    0% { transform: translateY(30px) scale(0.95); }
    100% { transform: translateY(0); }
}

@keyframes components-reconnect-modal-fadeInOpacity {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes components-reconnect-modal-fadeOutOpacity {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

.components-reconnect-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

#components-reconnect-modal p {
    margin: 0;
    text-align: center;
}

#components-reconnect-modal button {
    border: 0;
    background-color: #6b9ed2;
    color: white;
    padding: 4px 24px;
    border-radius: 4px;
}

#components-reconnect-modal button:hover {
    background-color: #3b6ea2;
}

#components-reconnect-modal button:active {
    background-color: #6b9ed2;
}

.components-rejoining-animation {
    position: relative;
    width: 80px;
    height: 80px;
}

.components-rejoining-animation div {
    position: absolute;
    border: 3px solid #0087ff;
    opacity: 1;
    border-radius: 50%;
    animation: components-rejoining-animation 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

.components-rejoining-animation div:nth-child(2) {
    animation-delay: -0.5s;
}

@keyframes components-rejoining-animation {
    0% { top: 40px; left: 40px; width: 0; height: 0; opacity: 0; }
    4.9% { top: 40px; left: 40px; width: 0; height: 0; opacity: 0; }
    5% { top: 40px; left: 40px; width: 0; height: 0; opacity: 1; }
    100% { top: 0; left: 0; width: 80px; height: 80px; opacity: 0; }
}

/* ===========================================
   PRINT STYLES
   =========================================== */

@media print {
    /* Hide UI chrome */
    .sidebar, .mobile-nav-toggle, .mobile-nav-overlay,
    .pagination, .license-banner,
    #blazor-error-ui { display: none !important; }

    /* Hide buttons except those marked for print */
    .btn:not(.ds-print-visible) { display: none !important; }

    /* Reset layout */
    .page { display: block !important; }
    main { width: 100% !important; }
    .content { padding: 0 !important; }

    /* Cards */
    .card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }

    /* Tables — show all columns including mobile-hidden ones */
    .table { font-size: 10pt; }
    .d-none-mobile,
    .d-none.d-md-table-cell,
    .d-none.d-lg-table-cell,
    .d-none.d-xl-table-cell { display: table-cell !important; }

    /* Typography */
    body { font-size: 11pt; color: #000; }
    a { color: #000; text-decoration: underline; }
}

/* ============================================================
   FEAT-021: MOBILE EXPERIENCE
   ============================================================ */

/* Loading skeleton shown during viewport detection */
.mobile-loading-skeleton {
    min-height: 100vh;
    background: var(--ds-neutral-50, #f8f9fa);
}

/* Mobile shell — wraps content + tab bar */
.mobile-shell {
    display: none; /* Hidden on desktop by default */
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--ds-neutral-50, #f8f9fa);
}

/* Mobile page content area */
.mobile-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-page-content {
    padding: 0 1rem 1rem;
}

/* ---- Bottom Tab Bar ---- */
.mobile-tab-bar {
    display: none; /* Hidden on desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(68px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid var(--ds-neutral-200, #e8e5f0);
    align-items: flex-start;
    justify-content: space-around;
    padding-top: 6px;
    padding-bottom: env(safe-area-inset-bottom, 8px);
    z-index: var(--ds-z-sticky, 1030);
}

.mobile-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--ds-neutral-400, #94a3b8);
    min-width: 64px;
    padding: 4px 0;
    -webkit-tap-highlight-color: transparent;
}

.mobile-tab:hover,
.mobile-tab:visited {
    color: var(--ds-neutral-400, #94a3b8);
    text-decoration: none;
}

.mobile-tab.active {
    color: var(--ds-primary, #6d28d9);
}

.mobile-tab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-size: 1.15rem;
    border-radius: 14px;
    transition: background 0.15s ease;
}

.mobile-tab.active .mobile-tab-icon {
    background: #ede9fe;
    width: 48px;
}

.mobile-tab-label {
    line-height: 1;
}

/* ---- Mobile Placeholder Screens ---- */
.mobile-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.5rem;
    min-height: 60vh;
}

.mobile-placeholder-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #f5f3ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--ds-neutral-400, #94a3b8);
    margin-bottom: 1.25rem;
}

.mobile-placeholder-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ds-neutral-900, #1a1a2e);
    margin-bottom: 0.5rem;
}

.mobile-placeholder-text {
    font-size: 0.85rem;
    color: var(--ds-neutral-500, #64748b);
    line-height: 1.5;
    max-width: 280px;
    margin-bottom: 1.5rem;
}

/* ---- Mobile Media Query ---- */
@media (max-width: 767.98px) {
    /* Show mobile shell, hide desktop layout elements */
    .mobile-shell {
        display: flex;
    }

    .mobile-tab-bar {
        display: flex;
    }

    /* Add bottom padding to mobile content so tab bar doesn't cover it */
    .mobile-content {
        padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
    }

    /* Hide the desktop hamburger on mobile (replaced by bottom tab bar) */
    .mobile-nav-toggle {
        display: none !important;
    }

    .mobile-nav-overlay {
        display: none !important;
    }
}

/* ---- Mobile Home / Search (FEAT-021 Phase 2) ---- */

.m-home {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.m-home-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem 0.25rem;
}

.m-home-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--ds-neutral-900, #1a1a2e);
    margin: 0;
}

.m-home-refresh {
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    color: var(--ds-neutral-500, #64748b);
    font-size: 1.2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.m-home-refresh:active {
    background: var(--ds-neutral-100, #f1f0f5);
}

.m-home-refresh.spinning i {
    animation: m-spin 0.8s linear infinite;
}

@keyframes m-spin {
    to { transform: rotate(360deg); }
}

/* Search bar */
.m-search-bar {
    margin: 0.5rem 1rem 0.75rem;
    background: #f5f3ff;
    border-radius: 14px;
    padding: 0;
    display: flex;
    align-items: center;
    border: 2px solid transparent;
    transition: border-color 0.15s, background 0.15s;
}

.m-search-bar.focused {
    border-color: var(--ds-primary, #6d28d9);
    background: #fff;
}

.m-search-icon {
    padding-left: 14px;
    color: var(--ds-neutral-400, #94a3b8);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.m-search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 10px;
    font-size: 0.9rem;
    color: var(--ds-neutral-900, #1a1a2e);
    outline: none;
    min-width: 0;
}

.m-search-input::placeholder {
    color: var(--ds-neutral-400, #94a3b8);
}

.m-search-clear {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: var(--ds-neutral-400, #94a3b8);
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

/* Section headers */
.m-section-header {
    padding: 0.75rem 1rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ds-neutral-400, #94a3b8);
}

/* Contact cards */
.m-contact-list {
    display: flex;
    flex-direction: column;
}

.m-contact-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 1rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--ds-neutral-100, #f1f0f5);
    -webkit-tap-highlight-color: transparent;
    min-height: 56px;
}

.m-contact-card:last-child {
    border-bottom: none;
}

.m-contact-card:active {
    background: var(--ds-neutral-50, #f8f9fa);
}

/* Avatars */
.m-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    flex-shrink: 0;
}

.m-contact-info {
    flex: 1;
    min-width: 0;
}

.m-contact-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ds-neutral-900, #1a1a2e);
}

.m-contact-name strong {
    font-weight: 800;
    color: var(--ds-primary, #6d28d9);
}

.m-contact-company {
    font-size: 0.78rem;
    color: var(--ds-neutral-500, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.m-chevron {
    color: var(--ds-neutral-300, #cbd5e1);
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* Loading */
.m-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 2rem;
    color: var(--ds-neutral-400, #94a3b8);
    font-size: 0.85rem;
}

.m-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--ds-neutral-200, #e8e5f0);
    border-top-color: var(--ds-primary, #6d28d9);
    border-radius: 50%;
    animation: m-spin 0.6s linear infinite;
}

/* Skeleton loading */
.m-skeleton-list {
    display: flex;
    flex-direction: column;
}

.m-skeleton-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 1rem;
}

.m-skeleton-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--ds-neutral-200, #e8e5f0);
    animation: m-pulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

.m-skeleton-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.m-skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: var(--ds-neutral-200, #e8e5f0);
    animation: m-pulse 1.5s ease-in-out infinite;
}

.m-skeleton-line.w-60 { width: 60%; }
.m-skeleton-line.w-40 { width: 40%; }

@keyframes m-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Empty states */
.m-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.5rem 1.5rem;
}

.m-empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #f5f3ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--ds-neutral-400, #94a3b8);
    margin-bottom: 1rem;
}

.m-empty-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ds-neutral-900, #1a1a2e);
    margin: 0 0 0.25rem;
}

.m-empty-text {
    font-size: 0.8rem;
    color: var(--ds-neutral-500, #64748b);
    margin: 0 0 1rem;
    line-height: 1.4;
}

.m-empty-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: var(--ds-neutral-400, #94a3b8);
}

/* Error card */
.m-error-card {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0.5rem 1rem;
    padding: 0.75rem 1rem;
    background: #fef2f2;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #dc2626;
}

.m-error-card i {
    font-size: 1rem;
    flex-shrink: 0;
}

.m-retry-btn {
    margin-left: auto;
    border: none;
    background: none;
    color: #dc2626;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

/* ---- Mobile Contact Detail (FEAT-021 Phase 3) ---- */

.m-detail {
    display: flex;
    flex-direction: column;
}

.m-detail-back {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.5rem 1rem 0.25rem;
    font-size: 0.9rem;
    color: var(--ds-primary, #6d28d9);
    font-weight: 500;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.m-detail-back i {
    font-size: 1rem;
}

/* Hero */
.m-detail-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1rem 0.75rem;
    gap: 4px;
}

.m-avatar-lg {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.5rem;
    color: #fff;
}

.m-skeleton-avatar-lg {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--ds-neutral-200, #e8e5f0);
    animation: m-pulse 1.5s ease-in-out infinite;
}

.m-detail-name {
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    color: var(--ds-neutral-900, #1a1a2e);
    margin-top: 4px;
}

.m-detail-subtitle {
    font-size: 0.85rem;
    color: var(--ds-neutral-500, #64748b);
    text-align: center;
}

/* Quick actions */
.m-quick-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 0.5rem 1rem 1rem;
}

.m-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.m-action-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #f5f3ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--ds-primary, #6d28d9);
    transition: background 0.15s;
}

.m-action-circle.active {
    background: #ede9fe;
    color: #d97706;
}

.m-action-circle:active {
    background: #ede9fe;
}

.m-action-label {
    font-size: 0.65rem;
    color: var(--ds-neutral-500, #64748b);
    font-weight: 500;
}

/* Info card */
.m-info-section {
    padding: 0 1rem;
    margin-bottom: 0.75rem;
}

.m-info-card {
    background: #fafafe;
    border-radius: 14px;
    border: 1px solid var(--ds-neutral-100, #f1f0f5);
    overflow: hidden;
}

.m-info-row {
    display: flex;
    align-items: center;
    padding: 11px 14px;
    gap: 12px;
    border-bottom: 1px solid var(--ds-neutral-100, #f1f0f5);
    text-decoration: none;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}

.m-info-row:last-child {
    border-bottom: none;
}

.m-info-row:active {
    background: var(--ds-neutral-50, #f8f9fa);
}

.m-info-icon {
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--ds-neutral-400, #94a3b8);
    flex-shrink: 0;
}

.m-info-content {
    flex: 1;
    min-width: 0;
}

.m-info-label {
    font-size: 0.65rem;
    color: var(--ds-neutral-400, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.m-info-value {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ds-neutral-900, #1a1a2e);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.m-info-value.link {
    color: var(--ds-primary, #6d28d9);
}

/* Notes */
.m-notes-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    border: none;
    background: none;
    padding: 8px 0;
    font-size: 0.8rem;
    color: var(--ds-neutral-500, #64748b);
    font-weight: 500;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.m-notes-content {
    font-size: 0.85rem;
    color: var(--ds-neutral-700, #334155);
    line-height: 1.5;
    padding: 0.25rem 0 0.5rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Activity peek */
.m-activity-row {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    gap: 10px;
    border-bottom: 1px solid var(--ds-neutral-100, #f1f0f5);
}

.m-activity-row:last-child {
    border-bottom: none;
}

.m-activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ds-primary, #6d28d9);
    flex-shrink: 0;
}

.m-activity-dot.outbound {
    background: var(--ds-neutral-400, #94a3b8);
}

.m-activity-text {
    flex: 1;
    font-size: 0.8rem;
    color: var(--ds-neutral-600, #475569);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.m-activity-time {
    font-size: 0.7rem;
    color: var(--ds-neutral-400, #94a3b8);
    flex-shrink: 0;
}

.m-see-all {
    display: block;
    text-align: center;
    padding: 10px;
    color: var(--ds-primary, #6d28d9);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

/* ---- Mobile Utility Classes (FEAT-021) ---- */
.m-pt-3 { padding-top: 3rem; }
.m-mt-1 { margin-top: 0.5rem; }
.m-flex-1 { flex: 1; }
.m-flex-2 { flex: 2; }
.m-flex-3 { flex: 3; }
.m-skeleton-name { height: 16px; margin-top: 8px; }
.m-skeleton-subtitle { height: 12px; }
/* ---- Call Log Dialog (FEAT-021) ---- */

.call-log-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1060;
    padding: 1rem;
}

.call-log-dialog {
    background: #fff;
    border-radius: 20px;
    padding: 1.5rem;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.call-log-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1rem;
}

.call-log-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #f5f3ff;
    color: var(--ds-primary, #6d28d9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.call-log-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ds-neutral-900, #1a1a2e);
}

.call-log-phone {
    font-size: 0.9rem;
    color: var(--ds-primary, #6d28d9);
    font-weight: 500;
}

.call-log-contact {
    font-size: 0.8rem;
    color: var(--ds-neutral-500, #64748b);
}

.call-log-prompt {
    font-size: 0.85rem;
    color: var(--ds-neutral-600, #475569);
    line-height: 1.4;
    margin-bottom: 1.25rem;
}

.call-log-form {
    margin-bottom: 1rem;
}

.call-log-actions {
    display: flex;
    gap: 0.5rem;
}

.call-log-btn {
    flex: 1;
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    -webkit-tap-highlight-color: transparent;
}

.call-log-btn.primary {
    background: var(--ds-primary, #6d28d9);
    color: #fff;
}

.call-log-btn.primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.call-log-btn.secondary {
    background: var(--ds-neutral-100, #f1f0f5);
    color: var(--ds-neutral-700, #334155);
}

.m-success-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.75rem 1rem;
    background: #f0fdf4;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #16a34a;
}

.m-signout-btn {
    width: 100%;
    background: #fef2f2;
    color: #dc2626;
    text-align: center;
    padding: 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* ---- Mobile Contact Form (FEAT-021 Phase 4) ---- */

.m-form {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.m-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem 0.75rem;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
    border-bottom: 1px solid var(--ds-neutral-100, #f1f0f5);
}

.m-form-cancel {
    border: none;
    background: none;
    color: var(--ds-neutral-500, #64748b);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    -webkit-tap-highlight-color: transparent;
}

.m-form-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ds-neutral-900, #1a1a2e);
}

.m-form-save {
    border: none;
    background: var(--ds-primary, #6d28d9);
    color: #fff;
    border-radius: 8px;
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.m-form-save.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.m-spinner-sm {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: m-spin 0.6s linear infinite;
}

.m-form-body {
    padding: 0.75rem 1rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.m-form-row {
    display: flex;
    gap: 0.5rem;
}

.m-form-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.m-form-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--ds-neutral-500, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.m-required {
    color: #dc2626;
}

.m-form-input {
    width: 100%;
    background: #f5f3ff;
    border: 2px solid var(--ds-neutral-200, #e8e5f0);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.85rem;
    color: var(--ds-neutral-900, #1a1a2e);
    outline: none;
    transition: border-color 0.15s, background 0.15s;
    font-family: inherit;
}

.m-form-input:focus {
    border-color: var(--ds-primary, #6d28d9);
    background: #fff;
}

.m-form-input.filled {
    background: #fff;
    border-color: var(--ds-primary, #6d28d9);
}

.m-form-input::placeholder {
    color: var(--ds-neutral-400, #94a3b8);
}

select.m-form-input {
    appearance: auto;
}

.m-form-textarea {
    resize: vertical;
    min-height: 60px;
}

/* Discard dialog */
.m-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    padding: 1rem;
}

.m-dialog {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    max-width: 320px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.m-dialog-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ds-neutral-900, #1a1a2e);
    margin-bottom: 0.5rem;
}

.m-dialog-text {
    font-size: 0.85rem;
    color: var(--ds-neutral-500, #64748b);
    line-height: 1.4;
    margin-bottom: 1.25rem;
}

.m-dialog-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.m-dialog-btn {
    border: none;
    background: var(--ds-neutral-100, #f1f0f5);
    color: var(--ds-neutral-700, #334155);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.m-dialog-btn.danger {
    background: #fef2f2;
    color: #dc2626;
}

/* ---- Swiss Address Autocomplete (FEAT-023) ---- */

.swiss-address-autocomplete {
    position: relative;
    width: 100%;
}

.swiss-address-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 2px solid var(--ds-primary, #6d28d9);
    border-radius: 8px;
    margin-top: 2px;
    max-height: min(220px, 50vh);
    overflow-y: auto;
    z-index: var(--ds-z-dropdown, 1020);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.swiss-address-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--ds-neutral-100, #f1f0f5);
}

.swiss-address-item:last-child {
    border-bottom: none;
}

.swiss-address-item:hover,
.swiss-address-item.selected {
    background: #f5f3ff;
}

.swiss-address-item.loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ds-neutral-400, #94a3b8);
    font-size: 0.8rem;
    cursor: default;
}

.swiss-address-main {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--ds-neutral-900, #1a1a2e);
}

.swiss-address-detail {
    font-size: 0.75rem;
    color: var(--ds-neutral-500, #64748b);
}

/* FEAT-023 Phase 2-3: Address Enrichment & Verification */
.address-enrich-section {
    padding-top: 0.25rem;
    border-top: 1px solid var(--ds-neutral-100, #f1f5f9);
}

.address-enrich-preview {
    background: var(--ds-neutral-50, #f8fafc);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    border-left: 3px solid var(--ds-primary, #6d28d9);
}

.address-verify-result {
    padding-top: 0.25rem;
}

/* ---- Database Info Panel ---- */
.db-stat-card {
    background: var(--ds-neutral-50, #f8f9fa);
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
}

.db-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ds-neutral-900, #1a1a2e);
}

.db-stat-label {
    font-size: 0.7rem;
    color: var(--ds-neutral-400, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ═══════════════════════════════════════════
   FEAT-028: Contact Photos
   ═══════════════════════════════════════════ */

.contact-photo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.contact-photo-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--ds-neutral-100, #f1f5f9);
    border: 3px solid var(--ds-neutral-200, #e2e8f0);
}

.contact-photo-wrapper.editable {
    cursor: pointer;
}

.contact-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.contact-photo-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--ds-primary, #6d28d9);
    background: var(--ds-primary-50, #f5f3ff);
}

.contact-photo-upload {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 36px;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.contact-photo-wrapper.editable:hover .contact-photo-upload {
    opacity: 1;
}

.contact-photo-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(220, 53, 69, 0.85);
    color: white;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
}

.contact-photo-wrapper.editable:hover .contact-photo-remove {
    opacity: 1;
}

.contact-photo-remove:hover {
    background: rgba(220, 53, 69, 1);
}

/* Contact list photo (36x36) */
.contact-list-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.contact-list-initials {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ds-primary, #6d28d9);
    background: var(--ds-primary-50, #f5f3ff);
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════
   FEAT-029: Teams Integration
   ═══════════════════════════════════════════ */

.teams-action-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-teams {
    background: #5b5fc7;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: background 0.2s;
    text-decoration: none;
}

.btn-teams:hover {
    background: #4b4fb7;
    color: white;
    text-decoration: none;
}

.btn-teams-sm {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #5b5fc7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
    padding: 0;
}

.btn-teams-sm:hover {
    background: rgba(91, 95, 199, 0.1);
    color: #4b4fb7;
    text-decoration: none;
}

/* ═══════════════════════════════════════════
   FEAT-030: M365 Contact Intelligence
   ═══════════════════════════════════════════ */

.suggestion-list {
    display: flex;
    flex-direction: column;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--ds-neutral-100, #f1f5f9);
    transition: background 0.15s;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--ds-neutral-50, #f8fafc);
}

.suggestion-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ds-primary, #6d28d9);
    background: var(--ds-primary-50, #f5f3ff);
    flex-shrink: 0;
}

.suggestion-info {
    flex: 1;
    min-width: 0;
}

.suggestion-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--ds-neutral-900, #1a1a2e);
}

.suggestion-detail {
    font-size: 0.75rem;
    color: var(--ds-neutral-500, #64748b);
}

.suggestion-email {
    font-size: 0.75rem;
    color: var(--ds-neutral-400, #94a3b8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-actions {
    flex-shrink: 0;
}


/* ==============================
   FEAT-051: Contact Discovery
   ============================== */

.discovery-list {
    display: flex;
    flex-direction: column;
}

.discovery-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--ds-neutral-100, #f1f5f9);
    transition: background 0.15s, opacity 0.3s;
}

.discovery-item:last-child {
    border-bottom: none;
}

.discovery-item:hover {
    background: var(--ds-neutral-50, #f8fafc);
}

.discovery-item-dismissing {
    opacity: 0.4;
}

.discovery-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ds-info, #0284c7);
    background: var(--ds-info-50, #f0f9ff);
    flex-shrink: 0;
}

.discovery-info {
    flex: 1;
    min-width: 0;
}

.discovery-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--ds-neutral-900, #1a1a2e);
}

.discovery-email {
    font-size: 0.75rem;
    color: var(--ds-neutral-500, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.discovery-count {
    font-size: 0.7rem;
}

.discovery-actions {
    flex-shrink: 0;
}

@keyframes spin-animation {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin-animation {
    animation: spin-animation 1s linear infinite;
}


/* ==============================
   FEAT-031: Duplicate Detection
   ============================== */

.duplicate-card {
    border: 1px solid var(--ds-neutral-200, #e2e8f0);
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.duplicate-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
/* Match evidence row */
.duplicate-evidence {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary, #f9fafb);
    border-bottom: 1px solid var(--border-color-light, #f3f4f6);
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.match-evidence-item {
    background: #fff;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 0.25rem;
    padding: 0.125rem 0.5rem;
    font-family: var(--font-mono, monospace);
    font-size: 0.75rem;
    color: var(--text-primary, #1f2937);
}

.duplicate-card-selected {
    border-color: var(--primary, #3b82f6);
    background-color: rgba(59, 130, 246, 0.02);
}

/* Bulk actions toolbar */
.duplicate-bulk-toolbar {
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    margin-bottom: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.duplicate-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: var(--ds-neutral-50, #f8f9fa);
    border-bottom: 1px solid var(--ds-neutral-200, #e2e8f0);
}

.duplicate-contact-col {
    padding: 0.5rem;
    border-radius: 8px;
    background: var(--ds-neutral-50, #f8f9fa);
}

.duplicate-fields {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.duplicate-fields .field-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.duplicate-fields .field-label {
    flex-shrink: 0;
    width: 100px;
    color: var(--ds-neutral-500, #64748b);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.confidence-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
}

.confidence-high {
    background: var(--ds-success-600, #16a34a);
}

.confidence-medium {
    background: var(--ds-warning-500, #eab308);
    color: var(--ds-neutral-900, #1a1a2e);
}

.confidence-low {
    background: var(--ds-warning-600, #d97706);
}

.match-tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--ds-primary-700, #1d4ed8);
    background: var(--ds-primary-50, #eff6ff);
    border: 1px solid var(--ds-primary-200, #bfdbfe);
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.merge-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0.5rem 1.25rem;
    background: var(--ds-neutral-50, #f8f9fa);
    border-top: 1px solid var(--ds-neutral-200, #e2e8f0);
}

.field-diff {
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}

.field-diff-match {
    background: rgba(22, 163, 74, 0.1);
}

.field-diff-different {
    background: rgba(234, 179, 8, 0.15);
}

.merge-log-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ds-neutral-500, #64748b);
    border-bottom: 2px solid var(--ds-neutral-200, #e2e8f0);
}

.merge-log-table td {
    font-size: 0.85rem;
    vertical-align: middle;
}

/* ---- FEAT-032: Exchange Contact Import ---- */
.exc-import-preview-table .table {
    font-size: 0.875rem;
}

.exc-import-preview-table .table thead th {
    border-bottom: 2px solid var(--ds-neutral-200, #e2e8f0);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
}

.exc-import-category-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25em 0.6em;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 0.2em;
}

.exc-import-category-new {
    background-color: rgba(16, 124, 16, 0.12);
    color: #107c10;
}

.exc-import-category-existing {
    background-color: var(--ds-neutral-100, #f1f5f9);
    color: var(--ds-neutral-500, #64748b);
}

.exc-import-category-potentialduplicate {
    background-color: rgba(232, 163, 23, 0.14);
    color: #b37a00;
}

.exc-import-stats .card {
    border-radius: 8px;
}

.exc-import-progress {
    text-align: center;
    padding: 2rem 0;
}

.exc-import-result .card {
    border-radius: 8px;
}

/* Import preview detail panel */
.import-detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    max-width: 90vw;
    background: white;
    z-index: 1050;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.2s ease;
    display: flex;
    flex-direction: column;
}

/* About page container */
.about-page { max-width: 900px; }

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* ===== FEAT-052: Dashboard Grid ===== */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 640px));
    gap: 1rem;
    justify-content: center;
}

.dashboard-grid .widget-1col {
    grid-column: span 1;
    max-width: 640px;
}

.dashboard-grid .widget-2col {
    grid-column: span 2;
    max-width: 1280px;
}

/* Responsive: 1 column on mobile */
@media (max-width: 767.98px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-grid .widget-2col {
        grid-column: span 1;
    }
}

/* 3 columns on wide screens */
@media (min-width: 1600px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, minmax(0, 640px));
    }
}

/* 4 columns on ultra-wide */
@media (min-width: 2240px) {
    .dashboard-grid {
        grid-template-columns: repeat(4, minmax(0, 640px));
    }
}

.dashboard-widget .card {
    height: 100%;
}

/* Widget header action buttons (gear + remove) */
.widget-settings-btn,
.widget-remove-btn {
    opacity: 0;
    transition: opacity 0.15s ease;
    padding: 0.25rem;
    line-height: 1;
    color: var(--text-muted);
}
.widget-settings-btn:hover {
    color: var(--primary);
}
.widget-remove-btn:hover {
    color: var(--danger);
}
.dashboard-widget .card-header:hover .widget-settings-btn,
.dashboard-widget .card-header:hover .widget-remove-btn {
    opacity: 1;
}
/* Always show on touch devices */
@media (hover: none) {
    .widget-settings-btn,
    .widget-remove-btn {
        opacity: 1;
    }
}

/* Width toggle in settings panel */
.widget-width-toggle .form-check {
    padding: 0.25rem 0;
    padding-left: 1.5em;
}

/* ===== Generic Slide Panel (shared by catalog + settings) ===== */

.slide-panel-backdrop,
.widget-catalog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1040;
    animation: fadeIn 0.15s ease;
}

.slide-panel,
.widget-catalog-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    background: var(--bg-primary, #fff);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.25s ease;
}
.slide-panel.open,
.widget-catalog-panel.open {
    transform: translateX(0);
}

.slide-panel-header,
.widget-catalog-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    flex-shrink: 0;
}

.slide-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
}

.slide-panel-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color, #e5e7eb);
    flex-shrink: 0;
}

.widget-catalog-search {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    flex-shrink: 0;
}

.widget-catalog-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.widget-catalog-category {
    padding: 0.5rem 0;
}

.widget-catalog-category-header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0.5rem 1.25rem 0.25rem;
    margin: 0;
}

.widget-catalog-item {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color-light, #f3f4f6);
    transition: background-color 0.1s ease;
}
.widget-catalog-item:hover {
    background-color: var(--bg-secondary, #f9fafb);
}

.widget-catalog-icon {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-subtle, #eff6ff);
    color: var(--primary);
    border-radius: 0.5rem;
    font-size: 1rem;
    flex-shrink: 0;
}

.widget-catalog-action {
    flex-shrink: 0;
    align-self: center;
}

/* Mobile: full-screen slide panels */
@media (max-width: 767.98px) {
    .slide-panel,
    .widget-catalog-panel {
        width: 100%;
    }
}

/* ===== Floating Add Widget FAB ===== */

.dashboard-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: var(--primary, #3b82f6);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 1030;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.dashboard-fab-icon {
    font-size: 1.75rem;
    font-weight: 300;
    line-height: 1;
}
.dashboard-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}
.dashboard-fab:active {
    transform: scale(0.95);
}
/* Mobile: above bottom nav */
@media (max-width: 767.98px) {
    .dashboard-fab {
        bottom: calc(var(--mobile-nav-height, 3.5rem) + 1rem);
    }
}

/* ===== Empty Dashboard State ===== */

.dashboard-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
}
.dashboard-empty-state-content {
    text-align: center;
    max-width: 320px;
}

/* ===== Undo & Error Toasts ===== */

.dashboard-undo-toast,
.dashboard-error-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    color: #fff;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1060;
    animation: slideUpFadeIn 0.2s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.dashboard-undo-toast {
    background: var(--gray-800, #1f2937);
}
.dashboard-error-toast {
    background: var(--danger, #dc3545);
}

/* Mobile: position toasts above bottom nav */
@media (max-width: 767.98px) {
    .dashboard-undo-toast,
    .dashboard-error-toast {
        bottom: calc(var(--mobile-nav-height, 3.5rem) + 1rem);
        left: 1rem;
        right: 1rem;
        transform: none;
    }
}

@keyframes slideUpFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(1rem); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Widget highlight after adding */
.widget-highlight .card {
    animation: widgetPulse 1.5s ease;
}
@keyframes widgetPulse {
    0%   { box-shadow: 0 0 0 0 var(--primary-subtle, rgba(59, 130, 246, 0.4)); }
    30%  { box-shadow: 0 0 0 6px var(--primary-subtle, rgba(59, 130, 246, 0.25)); }
    100% { box-shadow: 0 0 0 0 transparent; }
}

/* Chart canvas sizing (Chart.js needs explicit height) */
.chart-canvas {
    width: 100% !important;
    height: 200px !important;
}
.chart-canvas-sm {
    width: 100% !important;
    height: 180px !important;
}

/* ===== Contact Identity Header (redesign proposal) ===== */

.contact-identity-header {
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 0.5rem;
    padding: 0.5rem;
    margin-top: 0.75rem;
    margin-bottom: 1rem;
}

.contact-identity-avatar {
    position: relative;
    width: 96px;
    height: 96px;
    flex-shrink: 0;
}
.contact-identity-avatar img {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color, #e5e7eb);
}
.contact-identity-initials {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--primary-subtle, #eff6ff);
    color: var(--primary, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
    border: 2px solid var(--border-color, #e5e7eb);
}
.contact-identity-avatar-upload {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary, #3b82f6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
    border: 2px solid #fff;
}
.contact-identity-avatar:hover .contact-identity-avatar-upload {
    opacity: 1;
}
.contact-identity-avatar-remove {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--danger, #dc3545);
    color: #fff;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
    padding: 0;
    line-height: 1;
}
.contact-identity-avatar:hover .contact-identity-avatar-remove {
    opacity: 1;
}

/* Profile page: larger avatar */
.profile-identity-avatar {
    width: 128px;
    height: 128px;
}
.profile-identity-avatar img {
    width: 128px;
    height: 128px;
}
.profile-identity-avatar .contact-identity-initials {
    width: 128px;
    height: 128px;
    font-size: 2.5rem;
}
.profile-identity-avatar .contact-identity-avatar-upload {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
}
.profile-identity-avatar .contact-identity-avatar-remove {
    width: 26px;
    height: 26px;
    font-size: 0.65rem;
}

/* ===== FEAT-052 P2: Drag & Drop ===== */

/* Drag handle */
.widget-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    color: var(--text-muted);
    cursor: grab;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}
.widget-drag-handle:hover {
    opacity: 1;
    color: var(--text-primary);
}
.widget-drag-handle:active {
    cursor: grabbing;
}

/* Drag ghost (cloned element, follows cursor) */
.widget-drag-ghost {
    position: fixed;
    z-index: 1100;
    opacity: 0.9;
    transform: scale(1.02);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    transition: none;
}

/* Original widget while being dragged */
.widget-dragging {
    opacity: 0.3;
}

/* Grid state during drag */
.dashboard-grid-dragging {
    user-select: none;
    -webkit-user-select: none;
}

/* Displaced widgets shift smoothly during drag */
.widget-displacing {
    transition: transform 0.2s ease;
}

/* Drop zone placeholder */
.widget-drop-zone {
    border: 2px dashed var(--primary, #3b82f6);
    border-radius: 0.5rem;
    min-height: 80px;
    background: var(--primary-subtle, rgba(59, 130, 246, 0.05));
    animation: dropZonePulse 1s ease infinite;
    grid-column: span 1;
}
.widget-drop-zone-2col {
    grid-column: span 2;
}

@keyframes dropZonePulse {
    0%, 100% { background: var(--primary-subtle, rgba(59, 130, 246, 0.05)); }
    50%      { background: rgba(59, 130, 246, 0.1); }
}

/* ============================================================
   FEAT-057 · Import History
   ============================================================ */
.cursor-pointer { cursor: pointer; }

.import-source-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}
.import-source-csv        { background: var(--ds-info-100,  #dbeafe); color: var(--ds-info-700,  #1d4ed8); }
.import-source-messerli   { background: var(--ds-accent-100, #fef3c7); color: var(--ds-accent-700, #92400e); }
.import-source-dynamics-365 { background: #e0e7ff; color: #3730a3; }
.import-source-exchange   { background: var(--ds-success-100, #dcfce7); color: var(--ds-success-700, #15803d); }
.import-source-other      { background: var(--ds-neutral-200, #e5e7eb); color: var(--ds-neutral-700, #374151); }

.import-source-info {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: var(--ds-neutral-100, #f3f4f6);
    color: var(--ds-neutral-600, #4b5563);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* ============================================================
   Import Wizard · Configure step (/contacts/import)
   ============================================================ */

/* Step number pill for sequential decisions (Detection → Strategy).
   Signals "these two belong together" by numbering them 1 and 2.
   Lives inside the card header, next to the icon + title. */
.ds-step-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--ds-primary-100, #ede9fe);
    color: var(--ds-primary-700, #6d28d9);
    font-size: 0.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin-right: 0.625rem;
    flex-shrink: 0;
}

/* Import identity card — the metadata column (Source + Tag).
   White background + thin border + a 3px primary accent bar on the left
   visually separates "descriptive metadata" from "prescriptive decisions"
   without introducing a new card primitive. */
.ds-import-identity {
    background: #ffffff !important;
    border: 1px solid var(--ds-neutral-200, #e5e7eb) !important;
    position: relative;
    overflow: hidden;
}

.ds-import-identity::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--ds-primary-600);
}

.ds-import-identity .card-body {
    padding-left: 1.375rem; /* account for the accent bar so content doesn't collide */
}

/* Small-caps microtype for the field labels inside the identity card.
   Tighter, more "metadata-ish" than the default form-label. */
.ds-import-identity-label {
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
    margin-bottom: 0.375rem;
}

/* ===== FEAT-060: Manual Activity History ===== */

/* Card body: constrain height so the History section doesn't push
   everything below it off-screen when many entries exist. Scrolls
   internally. ~300px ≈ 4–5 entries visible before scrolling. */
.feat060-card-body {
    max-height: 300px;
    overflow-y: auto;
}

/* Type icon column */
.feat060-type-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* Subject truncation */
.feat060-subject {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Inline preview (expanded) */
.feat060-preview {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    max-height: 1.5em;
    line-height: 1.5;
}

/* Detail / chevron buttons — tap-friendly */
.feat060-detail-btn,
.feat060-chevron-btn {
    min-width: 28px;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--ds-radius-md, 6px);
    transition: background 0.15s ease;
}

.feat060-detail-btn:hover,
.feat060-chevron-btn:hover {
    background: var(--ds-neutral-100, #f0f0f0);
}

/* Disabled-by-admin info icon */
.feat060-disabled-icon {
    cursor: help;
    font-size: 0.875rem;
}

/* Detail modal: preserve line breaks in description */
.feat060-detail-description {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.6;
}

/* Mobile: larger touch targets + layout polish */
@media (max-width: 767.98px) {
    .feat060-detail-btn,
    .feat060-chevron-btn {
        min-width: 44px;
        min-height: 44px;
    }

    /* Shrink textarea from rows=4 to ~3 rows on narrow screens
       (spec §Mobile: save vertical space) */
    .modal .feat060-form-description {
        max-height: 4.5rem;
    }

    /* Author/date line: wrap gracefully on very narrow screens */
    .feat060-meta-line {
        flex-wrap: wrap;
        gap: 0.25rem !important;
    }

    /* "Show More" button: full-width on mobile for easy tapping */
    .feat060-show-more {
        width: 100%;
    }
}

