@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Space+Grotesk:wght@600;700&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 40px;
    --space-8: 48px;
    --radius-xs: 8px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --font-base: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-display: 'Space Grotesk', 'Plus Jakarta Sans', sans-serif;
    --text-xs: 13px;
    --text-sm: 14px;
    --text-md: 15px;
    --text-lg: 18px;
    --text-xl: 24px;
    --text-2xl: 32px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.08), 0 1px 1px rgba(16, 24, 40, 0.04);
    --shadow-md: 0 10px 26px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 24px 56px rgba(15, 23, 42, 0.12);
    --transition-fast: 150ms ease;
    --sidebar-width: 324px;
    --sidebar-collapsed-width: 80px;
    --crm-mobile-inline-gap: 12px;
    --crm-mobile-menu-side-gap: 0px;
    --crm-mobile-content-pad: 14px;
    --touch-target-mobile: 44px;
    --mobile-card-padding: 16px;
    --mobile-table-cell-pad-x: 12px;
}

/* Hide scrollbars globally without disabling scrolling. */
* {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

*::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

html,
body {
    min-height: 100%;
    touch-action: pan-x pan-y;
}

html {
    font-family: var(--font-base);
    color-scheme: dark;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-synthesis: none;
}

body.crm-body {
    margin: 0;
    display: flex;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: background-color var(--transition-fast), color var(--transition-fast);
    overflow-x: hidden;
    line-height: 1.55;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.crm-body,
body.crm-body * {
    box-sizing: border-box;
}

body.crm-theme-switching,
body.crm-theme-switching *,
body.crm-theme-switching *::before,
body.crm-theme-switching *::after {
    transition: none !important;
    animation: none !important;
}

body.theme-dark {
    --bg-primary: #151518;
    --bg-secondary: #151518;
    --bg-card: #09090B;
    --border-color: #25252c;
    --text-primary: #e7eef8;
    --text-secondary: #9caec3;
    --accent-primary: #2b7fff;
    --accent-hover: #1f6ee6;
    --danger: #ef4444;
    --success: #3b82f6;
    --warning: #d97706;
    --surface-soft: #151518;
    --surface-soft-hover: #1c1c20;
    --bg-muted: #111217;
    --nav-hover-bg: rgba(255, 255, 255, 0.03);
    --nav-active-bg: rgba(43, 127, 255, 0.18);
    --nav-active-border: rgba(43, 127, 255, 0.34);
    --bg-overlay: rgba(9, 9, 11, 0.72);
    --outline: var(--border-color);
    --accent: var(--accent-primary);
    --accent-strong: #5aa1ff;
    --accent-soft: rgba(43, 127, 255, 0.16);
    --text: var(--text-primary);
    --muted: var(--text-secondary);
    --text-strong: var(--text-primary);
    --surface-card: var(--bg-card);
    --surface-elevated: #09090B;
}

body.theme-light {
    --bg-primary: #f9fafb;
    --bg-secondary: #f3f5f7;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --text-primary: #0f172a;
    --text-secondary: #5f6675;
    --accent-primary: #169a6d;
    --accent-hover: #12845d;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #ca8a04;
    --surface-soft: #f8fafc;
    --surface-soft-hover: #f1f5f9;
    --bg-muted: #f3f6fa;
    --nav-hover-bg: rgba(22, 154, 109, 0.06);
    --nav-active-bg: rgba(22, 154, 109, 0.14);
    --nav-active-border: rgba(22, 154, 109, 0.3);
    --bg-overlay: rgba(30, 41, 59, 0.2);
    --outline: var(--border-color);
    --accent: var(--accent-primary);
    --accent-strong: #12845d;
    --accent-soft: rgba(22, 154, 109, 0.1);
    --text: var(--text-primary);
    --muted: var(--text-secondary);
    --text-strong: var(--text-primary);
    --surface-card: var(--bg-card);
    --surface-elevated: #f8fafe;
}

.crm-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: 16px 14px;
    background: var(--bg-card);
    border-right: 0;
    z-index: 60;
    transition: width var(--transition-fast), padding var(--transition-fast), background-color var(--transition-fast);
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.crm-sidebar::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.crm-sidebar::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--border-color) 75%, transparent);
    border-radius: 999px;
}

.crm-sidebar-toggle {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    transition: all var(--transition-fast);
}

.crm-sidebar-toggle span {
    width: 14px;
    height: 1.6px;
    background: currentColor;
    border-radius: 4px;
}

.crm-sidebar-toggle:hover {
    color: var(--text-primary);
    border-color: var(--accent-primary);
    background: var(--surface-soft-hover);
}

.crm-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    min-height: 48px;
    padding: 6px 6px 10px;
    border-bottom: 0;
    margin-bottom: var(--space-2);
}

.crm-brand-main {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.crm-brand-logo-toggle {
    border: 0;
    background: transparent;
    padding: 0;
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.crm-brand-logo-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-primary) 30%, transparent);
    border-radius: 8px;
}

.crm-brand img {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    object-fit: cover;
    transition: filter var(--transition-fast);
}

body.theme-dark .crm-brand img {
    filter: none;
}

body.theme-light .crm-brand img {
    filter: brightness(0) saturate(100%);
}

.crm-brand h1 {
    margin: 0;
    font-family: var(--font-display);
    letter-spacing: 0.08em;
    font-size: 14px;
    color: var(--text-primary);
}

.crm-brand span {
    font-size: var(--text-xs);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.crm-theme-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin: 4px 4px 2px;
}

.crm-theme-switch button {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 8px 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.crm-theme-switch button:hover,
.crm-theme-switch button.is-active {
    border-color: var(--accent-primary);
    background: var(--accent-soft);
    color: var(--accent-primary);
}

.crm-nav-label {
    margin: 10px 8px 6px;
    font-size: 11px;
    letter-spacing: 0.14em;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.crm-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.crm-nav-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.crm-nav-link-main {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.crm-nav-link--toggle {
    width: 100%;
    justify-content: space-between;
    text-align: left;
    background: transparent;
}

.crm-nav-chevron {
    font-size: 11px;
    color: var(--text-secondary);
    transition: transform var(--transition-fast), color var(--transition-fast);
}

.crm-nav-item.is-open > .crm-nav-link--toggle .crm-nav-chevron {
    transform: rotate(180deg);
}

.crm-nav-item.is-active > .crm-nav-link--toggle .crm-nav-chevron {
    color: var(--accent-primary);
}

.crm-subnav {
    display: none;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 0;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.crm-nav-item.is-open > .crm-subnav {
    display: flex;
}

.crm-subnav-link {
    min-height: 36px;
    padding: 8px 11px;
    border-radius: 8px;
    border: 1px solid transparent;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    display: flex;
    align-items: center;
    transition: all var(--transition-fast);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-subnav-link:hover {
    background: transparent;
    border-color: transparent;
    color: var(--text-primary);
}

.crm-subnav-link.is-active {
    color: var(--accent-primary);
    background: color-mix(in srgb, var(--accent-primary) 10%, transparent);
    border-color: transparent;
    font-weight: 600;
}

.crm-nav-link {
    position: relative;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 11px 12px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    font-size: 15px;
    font-weight: 500;
    transition: all var(--transition-fast);
    line-height: 1;
}

.crm-nav-link svg {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
    transform-origin: center;
    transition: transform 220ms cubic-bezier(0.22, 0.8, 0.2, 1), filter 220ms ease;
}

.crm-nav-link:hover {
    background: transparent;
    color: var(--text-primary);
    border-color: transparent;
}

.crm-nav-link:focus-visible {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-primary) 25%, transparent);
}

.crm-nav-link.is-active {
    background: var(--nav-active-bg);
    border-color: transparent;
    color: var(--accent-primary);
    font-weight: 600;
}

.crm-nav-link.is-active svg {
    color: var(--accent-primary);
}

.crm-nav-link.is-active::before {
    content: '';
    position: absolute;
    left: -2px;
    width: 4px;
    top: 8px;
    bottom: 8px;
    border-radius: 999px;
    background: var(--accent-primary);
}

.crm-sidebar-footer {
    margin-top: auto;
    padding: 10px 6px 4px;
    border-top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.crm-sidebar-footer-left {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}

.crm-sidebar-footer span {
    font-size: var(--text-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.crm-sidebar-footer a {
    text-decoration: none;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 7px 12px;
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.crm-sidebar-footer a:hover {
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.crm-topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    min-height: 64px;
    padding: 8px 12px;
    border-bottom: 0;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: stretch;
    z-index: 50;
    transition: left var(--transition-fast), background-color var(--transition-fast);
}

.crm-topbar-main {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 0;
    border-radius: 10px;
    background: color-mix(in srgb, var(--bg-card) 96%, transparent);
    padding: 10px 12px;
    min-width: 0;
}

.crm-topbar-left,
.crm-topbar-right {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.crm-topbar-right {
    margin-left: auto;
    gap: 14px;
}

.crm-topbar-title {
    margin: 0;
    font-size: 1rem;
    line-height: 1.15;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.crm-topbar-icons {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: var(--text-secondary);
}

.crm-topbar-icon-btn {
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    color: currentColor;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.crm-topbar-icon-btn:hover {
    background: color-mix(in srgb, var(--surface-soft) 72%, transparent);
    color: var(--text-primary);
}

.crm-topbar-icon-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    transform-origin: center;
    transition: transform 200ms cubic-bezier(0.22, 0.8, 0.2, 1), filter 200ms ease;
}

.crm-subnav-icon svg,
.crm-mobile-menu-btn svg,
.crm-topbar-award svg {
    transform-origin: center;
    transition: transform 220ms cubic-bezier(0.22, 0.8, 0.2, 1), filter 220ms ease;
}

@media (hover: hover) and (pointer: fine) {
    .crm-nav-link:hover svg,
    .crm-nav-link:focus-visible svg {
        transform: translateY(-1px) scale(1.08);
        filter: drop-shadow(0 2px 6px color-mix(in srgb, var(--accent-primary) 28%, transparent));
    }

    .crm-subnav-link:hover .crm-subnav-icon svg,
    .crm-subnav-link:focus-visible .crm-subnav-icon svg {
        transform: translateY(-1px) scale(1.06);
        filter: drop-shadow(0 2px 5px color-mix(in srgb, var(--accent-primary) 24%, transparent));
    }

    .crm-topbar-icon-btn:hover svg,
    .crm-topbar-icon-btn:focus-visible svg {
        transform: translateY(-1px) scale(1.1);
        filter: drop-shadow(0 2px 5px color-mix(in srgb, var(--accent-primary) 24%, transparent));
    }

    .crm-topbar-award:hover svg {
        transform: rotate(-8deg) scale(1.08);
    }
}

@media (prefers-reduced-motion: reduce) {
    .crm-nav-link svg,
    .crm-subnav-icon svg,
    .crm-topbar-icon-btn svg,
    .crm-mobile-menu-btn svg,
    .crm-topbar-award svg {
        transition: none !important;
    }

    .crm-nav-link:hover svg,
    .crm-nav-link:focus-visible svg,
    .crm-subnav-link:hover .crm-subnav-icon svg,
    .crm-subnav-link:focus-visible .crm-subnav-icon svg,
    .crm-topbar-icon-btn:hover svg,
    .crm-topbar-icon-btn:focus-visible svg,
    .crm-topbar-award:hover svg {
        transform: none !important;
        filter: none !important;
    }
}

.crm-topbar-progress-wrap {
    display: grid;
    gap: 4px;
    min-width: 180px;
}

.crm-topbar-progress-head {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.crm-topbar-award {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--accent);
    font-size: 0.86rem;
    font-weight: 700;
}

.crm-topbar-award svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
}

.crm-topbar-meta {
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 700;
}

.crm-topbar-progress-track {
    width: 100%;
    height: 7px;
    border-radius: 999px;
    background: color-mix(in srgb, #343d55 88%, var(--surface-soft));
    overflow: hidden;
}

.crm-topbar-progress-bar {
    display: block;
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 70%, #2563eb), color-mix(in srgb, var(--accent) 35%, #60a5fa));
}

.crm-mobile-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text-primary);
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    transition: border-color var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
}

.crm-mobile-menu-btn:hover {
    border-color: var(--accent-primary);
    background: var(--surface-soft-hover);
}

.crm-mobile-menu-btn svg {
    width: 18px;
    height: 18px;
}

.crm-mobile-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
    z-index: 70;
}

.crm-topbar-user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    min-width: 0;
}

.crm-topbar-user-info {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.crm-topbar-user-info strong {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 700;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-topbar-user-info small {
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1;
}

.crm-topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 75%, #1e40af);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.crm-main {
    margin-left: var(--sidebar-width);
    padding: calc(64px + var(--space-4)) var(--space-5) var(--space-6);
    width: calc(100% - var(--sidebar-width));
    transition: margin-left var(--transition-fast), width var(--transition-fast);
    min-width: 0;
}

.crm-page-header {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    align-items: flex-end;
    margin-bottom: var(--space-5);
}

.crm-eyebrow {
    font-size: 12px;
    letter-spacing: 0.14em;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin: 0 0 var(--space-2);
}

.crm-page-header h1,
.crm-page-header h2 {
    margin: 0;
    font-family: var(--font-display);
    letter-spacing: -0.01em;
    font-size: clamp(26px, 3vw, 36px);
    color: var(--text-primary);
}

.crm-page-header p {
    margin: var(--space-2) 0 0;
    color: var(--text-secondary);
    max-width: 68ch;
}

.crm-header-actions,
.crm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.crm-btn,
button,
input[type="submit"],
input[type="button"] {
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    height: 38px;
    padding: 0 14px;
    font-family: inherit;
    font-weight: 600;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.crm-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
}

.crm-btn--primary {
    background: var(--accent-primary);
    color: #ffffff;
}

.crm-btn--primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.crm-btn--ghost,
button,
input[type="submit"],
input[type="button"] {
    border-color: var(--border-color);
    color: var(--text-secondary);
    background: var(--bg-card);
}

.crm-btn--ghost:hover,
button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.crm-btn--danger {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 35%, var(--border-color));
}

.crm-btn--danger:hover {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    border-color: var(--danger);
}

.crm-grid {
    display: grid;
    gap: var(--space-4);
}

.crm-grid--kpi {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: var(--space-5);
}

.crm-card,
.crm-shell-card {
    background: var(--bg-card);
    border: 1px solid color-mix(in srgb, var(--border-color) 72%, transparent);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.crm-card--glow {
    box-shadow: var(--shadow-md);
}

.crm-card:hover {
    border-color: color-mix(in srgb, var(--accent-primary) 34%, var(--border-color));
}

.crm-kpi {
    border: 1px solid color-mix(in srgb, var(--border-color) 70%, transparent);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    padding: var(--space-4);
    transition: all var(--transition-fast);
}

.crm-kpi:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--accent-primary) 42%, var(--border-color));
    box-shadow: var(--shadow-sm);
}

.crm-kpi small {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    color: var(--text-secondary);
}

.crm-kpi strong {
    display: block;
    margin-top: var(--space-2);
    font-size: var(--text-2xl);
    line-height: 1.2;
    color: var(--text-primary);
}

.crm-signal-up,
.crm-main .crm-signal-up {
    color: var(--success) !important;
}

.crm-signal-down,
.crm-main .crm-signal-down {
    color: var(--danger) !important;
}

.crm-signal-neutral,
.crm-main .crm-signal-neutral {
    color: var(--text-secondary) !important;
}

.crm-signal-up::before,
.crm-signal-down::before {
    display: inline-block;
    margin-right: 6px;
    font-size: 0.82em;
    vertical-align: middle;
}

.crm-signal-up::before {
    content: '↑';
}

.crm-signal-down::before {
    content: '↓';
}
.crm-scroll-note,
.crm-tag {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.crm-badge.success,
.crm-badge.warning,
.crm-badge.danger {
    animation: crmBadgePulse 1.8s ease-in-out infinite;
}

.crm-tag {
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.crm-alert {
    border: 1px solid color-mix(in srgb, var(--success) 34%, var(--border-color));
    background: color-mix(in srgb, var(--success) 12%, var(--bg-card));
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    animation: crmFadeIn var(--transition-fast) ease;
}

.crm-alert.is-error {
    border-color: color-mix(in srgb, var(--danger) 45%, var(--border-color));
    background: color-mix(in srgb, var(--danger) 12%, var(--bg-card));
}

.crm-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.crm-section-head h2,
.crm-section-head h3,
.crm-card h2,
.crm-card h3 {
    margin: 0;
    color: var(--text-primary);
}

.crm-section-head p {
    margin: var(--space-2) 0 0;
    color: var(--text-secondary);
}

.crm-filter,
.crm-input,
input[type="text"],
input[type="search"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="file"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: var(--text-sm);
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

select,
.crm-filter {
    color-scheme: dark;
}

body.theme-light select,
body.theme-light .crm-filter {
    color-scheme: light;
}

select option,
select optgroup {
    background: var(--bg-card);
    color: var(--text-primary);
}

input[type="file"] {
    min-height: 44px;
    padding: 8px 10px;
    color: var(--text-secondary);
}

input[type="file"]::file-selector-button {
    margin-right: 10px;
    border: 1px solid var(--border-color);
    background: var(--surface-soft);
    color: var(--text-primary);
    padding: 6px 11px;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
}

input[type="file"]::file-selector-button:hover {
    border-color: var(--accent-primary);
    background: color-mix(in srgb, var(--accent-primary) 10%, var(--surface-soft));
}

input[type="file"][accept*="image"] {
    display: block;
    min-height: 96px;
    border-style: dashed;
    border-width: 1.5px;
    background: var(--surface-soft);
    padding: 14px;
    line-height: 1.4;
    width: 100%;
}

.form-inline input[type="file"][accept*="image"] {
    flex: 1 1 100%;
}

input[type="file"][accept*="image"]::file-selector-button {
    margin-right: 12px;
    padding: 8px 12px;
}

.crm-upload-control {
    border: 1.5px dashed color-mix(in srgb, var(--border-color) 82%, var(--text-secondary) 18%);
    background: var(--surface-soft);
    min-height: 104px;
    padding: 12px;
    display: grid;
    align-content: start;
    gap: 10px;
    width: 100%;
    transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.crm-upload-control.is-dragover {
    border-color: var(--accent-primary);
    background: color-mix(in srgb, var(--accent-primary) 10%, var(--surface-soft));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-primary) 20%, transparent);
}

.crm-upload-input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
}

.crm-upload-meta {
    display: grid;
    gap: 4px;
}

.crm-upload-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.crm-upload-hint,
.crm-upload-file {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    word-break: break-word;
}

.crm-upload-hint {
    display: block;
}

.crm-upload-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.crm-upload-actions .crm-btn {
    height: 34px;
    padding: 0 12px;
    white-space: nowrap;
}

@media (max-width: 640px) {
    :root {
        --crm-mobile-inline-gap: 12px;
        --crm-mobile-menu-side-gap: 12px;
        --crm-mobile-content-pad: 12px;
    }

    .crm-upload-control {
        flex-direction: column;
        align-items: stretch;
    }
    .crm-upload-actions {
        justify-content: flex-start;
    }
}

textarea {
    min-height: 96px;
    resize: none;
}

.crm-filter:focus,
.crm-input:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 22%, transparent);
}

.crm-form {
    display: grid;
    gap: var(--space-4);
}

.crm-react-toolbar {
    display: grid;
    gap: 0.65rem;
    grid-template-columns: minmax(220px, 2fr) minmax(140px, 1fr);
    margin: 0.65rem 0 0.5rem;
}

.crm-react-toolbar__meta {
    margin: 0 0 0.6rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

body.crm-is-navigating .crm-main {
    opacity: 0.68;
    transform: translateY(2px);
    transition: opacity 160ms ease, transform 160ms ease;
}

body.crm-is-navigating::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 100%;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
    z-index: 120;
    animation: crmNavLoading 900ms linear infinite;
    pointer-events: none;
}

.crm-field label {
    display: block;
    margin-bottom: 6px;
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.crm-chip-grid,
.crm-vitrine-grid,
.crm-product-grid {
    display: grid;
    gap: var(--space-3);
}

.crm-chip-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.crm-product-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.crm-vitrine-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.crm-chip,
.crm-product-card,
.crm-vitrine-card,
.crm-list > li {
    border: 1px solid color-mix(in srgb, var(--border-color) 70%, transparent);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    transition: all var(--transition-fast);
}

.crm-chip {
    padding: var(--space-3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.crm-chip:hover,
.crm-product-card:hover,
.crm-vitrine-card:hover,
.crm-list > li:hover {
    border-color: color-mix(in srgb, var(--accent-primary) 45%, var(--border-color));
    transform: translateY(-1px);
}

.crm-product-card,
.crm-vitrine-card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.crm-product-card figure,
.crm-vitrine-card figure {
    margin: 0;
    background: var(--surface-soft);
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 65%, transparent);
}

.crm-product-body {
    padding: var(--space-4);
    display: grid;
    gap: var(--space-2);
}

.crm-product-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.crm-pill,
.crm-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--surface-soft);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
}

.crm-badge.success {
    color: var(--success);
    border-color: color-mix(in srgb, var(--success) 35%, var(--border-color));
    background: color-mix(in srgb, var(--success) 10%, transparent);
}

.crm-badge.warning {
    color: var(--warning);
    border-color: color-mix(in srgb, var(--warning) 35%, var(--border-color));
    background: color-mix(in srgb, var(--warning) 12%, transparent);
}

.crm-badge.danger {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 35%, var(--border-color));
    background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.crm-status-good {
    color: var(--success) !important;
    border-color: color-mix(in srgb, var(--success) 35%, var(--border-color)) !important;
    background: color-mix(in srgb, var(--success) 10%, transparent) !important;
}

.crm-status-warn {
    color: var(--warning) !important;
    border-color: color-mix(in srgb, var(--warning) 35%, var(--border-color)) !important;
    background: color-mix(in srgb, var(--warning) 12%, transparent) !important;
}

.crm-status-bad {
    color: var(--danger) !important;
    border-color: color-mix(in srgb, var(--danger) 35%, var(--border-color)) !important;
    background: color-mix(in srgb, var(--danger) 12%, transparent) !important;
}

.crm-status-info {
    color: var(--accent-primary) !important;
    border-color: color-mix(in srgb, var(--accent-primary) 35%, var(--border-color)) !important;
    background: color-mix(in srgb, var(--accent-primary) 11%, transparent) !important;
}

.crm-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.crm-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface-soft);
    text-align: left;
    vertical-align: middle;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12px;
    padding: 12px 10px;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 68%, transparent);
}

.crm-table td {
    padding: 12px 10px;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 52%, transparent);
    color: var(--text-primary);
    vertical-align: middle;
}

.crm-table tbody tr:last-child td {
    border-bottom: 0;
}

.crm-table th.crm-col-actions,
.crm-table td.crm-col-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
    padding-right: 6px;
}

.crm-table td.crm-col-actions .crm-action-menu {
    position: relative;
    display: inline-block;
}

.crm-action-menu__trigger {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.crm-action-menu__trigger svg {
    width: 16px;
    height: 16px;
}

.crm-action-menu__trigger::marker,
.crm-action-menu__trigger::-webkit-details-marker {
    display: none;
}

.crm-action-menu[open] .crm-action-menu__trigger {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-primary) 18%, transparent);
}

.crm-action-menu__list {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 120;
    min-width: 168px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
    padding: 0.35rem;
    display: grid;
    gap: 0.25rem;
}

.crm-action-menu.is-dropup .crm-action-menu__list {
    top: auto;
    bottom: calc(100% + 6px);
}

.crm-action-menu__list form {
    margin: 0;
}

.crm-action-menu__list a,
.crm-action-menu__list button {
    width: 100%;
    text-align: left;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 0.45rem 0.55rem;
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
}

.crm-action-menu__list a:hover,
.crm-action-menu__list button:hover {
    border-color: var(--accent-primary);
    background: var(--surface-soft);
}

.crm-action-menu__icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.crm-action-menu__danger {
    color: var(--danger) !important;
    border-color: color-mix(in srgb, var(--danger) 55%, var(--border-color)) !important;
}

.crm-table tbody tr {
    transition: background-color var(--transition-fast);
}

.crm-table tbody tr:hover {
    background: color-mix(in srgb, var(--accent-primary) 8%, var(--bg-card));
}

.crm-table tbody tr[data-status="ativo"],
.crm-table tbody tr[data-status="pago"],
.crm-table tbody tr[data-status="aprovado"],
.crm-table tbody tr[data-status="concluido"],
.crm-table tbody tr[data-status="entregue"],
table tbody tr[data-status="ativo"],
table tbody tr[data-status="pago"],
table tbody tr[data-status="aprovado"],
table tbody tr[data-status="concluido"],
table tbody tr[data-status="entregue"] {
    box-shadow: inset 3px 0 0 color-mix(in srgb, var(--success) 70%, transparent);
}

.crm-table tbody tr[data-status="pendente"],
.crm-table tbody tr[data-status="aguardando"],
.crm-table tbody tr[data-status="processando"],
.crm-table tbody tr[data-status="analise"],
table tbody tr[data-status="pendente"],
table tbody tr[data-status="aguardando"],
table tbody tr[data-status="processando"],
table tbody tr[data-status="analise"] {
    box-shadow: inset 3px 0 0 color-mix(in srgb, var(--warning) 74%, transparent);
}

.crm-table tbody tr[data-status="inativo"],
.crm-table tbody tr[data-status="falha"],
.crm-table tbody tr[data-status="erro"],
.crm-table tbody tr[data-status="cancelado"],
.crm-table tbody tr[data-status="recusado"],
.crm-table tbody tr[data-status="expirado"],
table tbody tr[data-status="inativo"],
table tbody tr[data-status="falha"],
table tbody tr[data-status="erro"],
table tbody tr[data-status="cancelado"],
table tbody tr[data-status="recusado"],
table tbody tr[data-status="expirado"] {
    box-shadow: inset 3px 0 0 color-mix(in srgb, var(--danger) 74%, transparent);
}

.crm-empty {
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-soft);
    color: var(--text-secondary);
    padding: var(--space-6) var(--space-4);
    text-align: center;
}

.crm-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: var(--space-3);
}

.crm-list > li {
    padding: var(--space-3);
}

.crm-main--wide {
    max-width: 100%;
}

.crm-main code,
.crm-main pre,
.vitrine-domain-ip {
    font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
}

.crm-main pre {
    background: var(--surface-soft);
    border: 1px solid color-mix(in srgb, var(--border-color) 68%, transparent);
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    overflow: auto;
}

.form-section {
    border-top: 1px solid color-mix(in srgb, var(--border-color) 58%, transparent);
    padding-top: var(--space-4);
}

.form-section:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.form-grid {
    display: grid;
    gap: var(--space-3);
}

@media (min-width: 900px) {
    .form-grid--two {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .form-grid--three {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.form-inline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.list-stack {
    display: grid;
    gap: var(--space-2);
}

.list-stack > div {
    border: 1px solid color-mix(in srgb, var(--border-color) 68%, transparent);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    padding: var(--space-2);
}

.vitrine-domain-steps,
.vitrine-product-scroll {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) transparent;
}

.vitrine-domain-steps li,
.vitrine-product-item {
    border-color: var(--border-color) !important;
    background: var(--surface-soft) !important;
}

.vitrine-product-item:hover {
    border-color: color-mix(in srgb, var(--accent-primary) 40%, var(--border-color)) !important;
    background: var(--surface-soft-hover) !important;
}

.vitrine-preview-card iframe {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

.rt-dashboard-host .crm-card,
.rt-dashboard-host .rt-dashboard__vitrine-card {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

.rt-dashboard-host .rt-status {
    border: 1px solid color-mix(in srgb, var(--border-color) 68%, transparent);
}

.rt-dashboard-host .rt-dashboard__list-item,
.rt-dashboard-host .rt-dashboard__vitrine-card {
    transition: transform var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
}

.rt-dashboard-host .rt-dashboard__list-item:hover,
.rt-dashboard-host .rt-dashboard__vitrine-card:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--accent-primary) 40%, var(--border-color));
}

.login-frame,
.login-shell,
.login-hero,
.login-panel__card,
.login-insights,
.login-stat-card,
.login-feature {
    transition: all var(--transition-fast);
}

button.is-loading,
input[type="submit"].is-loading,
.crm-btn.is-loading {
    opacity: 0.86;
    pointer-events: none;
    position: relative;
}

button.is-loading,
.crm-btn.is-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button.is-loading svg,
.crm-btn.is-loading svg {
    width: 14px;
    height: 14px;
}

.crm-loading {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    border-radius: 999px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: crmSpin 800ms linear infinite;
}

.crm-skeleton {
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, var(--surface-soft) 25%, var(--surface-soft-hover) 50%, var(--surface-soft) 75%);
    background-size: 200% 100%;
    animation: crmSkeleton 1.4s linear infinite;
}

.crm-metric-highlight {
    border-color: color-mix(in srgb, var(--accent-primary) 44%, var(--border-color));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-primary) 35%, transparent);
}

.crm-sticky-save {
    position: sticky;
    bottom: var(--space-4);
    margin-top: var(--space-4);
    z-index: 30;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
}

.crm-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
}

.crm-product-form {
    gap: var(--space-5);
}

.crm-product-form .crm-rating .star,
.comment-rating .star {
    color: color-mix(in srgb, var(--text-secondary) 35%, transparent);
}

.crm-product-form .crm-rating .star.is-active,
.comment-rating .star.is-active {
    color: #f59e0b;
}

.crm-product-form .order-bump-panel,
.crm-product-form .ob-dropdown,
.crm-product-form .list-stack > div {
    background: var(--surface-soft);
    border-color: var(--border-color);
}

.crm-product-form .ob-dropdown li {
    border-bottom-color: var(--border-color);
}

.crm-product-form .ob-dropdown li:hover {
    background: var(--surface-soft-hover);
}

.create-vitrine-hero,
.create-vitrine-guide {
    background: linear-gradient(140deg, color-mix(in srgb, var(--accent-primary) 18%, var(--bg-card)), var(--bg-card)) !important;
    border-color: var(--border-color) !important;
}

.create-vitrine-pills li,
.create-vitrine-steps li,
.create-vitrine-kpis .crm-kpi {
    background: var(--surface-soft) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary);
}

.create-vitrine-hint,
.create-vitrine-slug,
.create-vitrine-steps mark {
    color: var(--text-secondary);
}

.create-vitrine-steps mark {
    background: color-mix(in srgb, var(--accent-primary) 16%, transparent);
}

.vitrine-domain-steps li,
.vitrine-product-item,
.comment-photo-card,
.comment-avatar,
.comment-preview__photos img {
    border-color: var(--border-color) !important;
    background: var(--surface-soft) !important;
}

.vitrine-product-item:hover,
.comment-photo-card:hover {
    border-color: color-mix(in srgb, var(--accent-primary) 45%, var(--border-color)) !important;
    background: var(--surface-soft-hover) !important;
}

.comment-photo-card input:not(:checked) + .comment-photo-card__label {
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    border-color: color-mix(in srgb, var(--danger) 45%, var(--border-color));
    color: var(--danger);
}

.comment-photo-card input:checked + .comment-photo-card__label {
    background: color-mix(in srgb, var(--success) 10%, transparent);
    border-color: color-mix(in srgb, var(--success) 45%, var(--border-color));
    color: var(--success);
}

.rt-dashboard__kpi,
.rt-dashboard__vitrine-card,
.rt-dashboard__list-item,
.rt-gateway__card,
.rt-dashboard__chart,
.rt-dashboard__list {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

.rt-dashboard__kpi strong,
.rt-dashboard__kpi span,
.rt-dashboard__chart-grid strong,
.rt-dashboard__value,
.rt-dashboard__list-item strong,
.rt-dashboard__vitrine-card h4 {
    color: var(--text-primary) !important;
}

.rt-dashboard__kpi small,
.rt-dashboard__list-item small,
.rt-dashboard__footer,
.rt-dashboard__header p,
.rt-dashboard__vitrine-card p,
.rt-dashboard__vitrine-card span {
    color: var(--text-secondary) !important;
}

.rt-dashboard__list-item,
.rt-dashboard__vitrine-card,
.rt-gateway__legend-item {
    transition: all var(--transition-fast);
}

.rt-dashboard__list-item:hover,
.rt-dashboard__vitrine-card:hover,
.rt-gateway__legend-item:hover {
    border-color: color-mix(in srgb, var(--accent-primary) 42%, var(--border-color)) !important;
    transform: translateY(-1px);
}

.rt-status {
    border: 1px solid var(--border-color);
}

.rt-status--paid {
    background: color-mix(in srgb, var(--success) 22%, transparent) !important;
    color: var(--success) !important;
}

.rt-status--pending {
    background: color-mix(in srgb, var(--warning) 22%, transparent) !important;
    color: var(--warning) !important;
}

.rt-status--failed {
    background: color-mix(in srgb, var(--danger) 20%, transparent) !important;
    color: var(--danger) !important;
}

.pagination,
.crm-pagination {
    margin-top: var(--space-4);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.pagination a,
.pagination span,
.crm-pagination a,
.crm-pagination span {
    min-width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    padding: 0 10px;
}

.pagination .active,
.crm-pagination .active {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: var(--accent-soft);
}

body.sidebar-collapsed .crm-sidebar {
    width: var(--sidebar-collapsed-width);
    min-width: var(--sidebar-collapsed-width);
    max-width: var(--sidebar-collapsed-width);
    padding: 10px 8px;
}

body.sidebar-collapsed .crm-nav-link {
    justify-content: center;
    padding-left: 8px;
    padding-right: 8px;
}

body.sidebar-collapsed .crm-subnav,
body.sidebar-collapsed .crm-nav-chevron {
    display: none !important;
}

body.sidebar-collapsed .crm-brand {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

body.sidebar-collapsed .crm-brand .crm-brand-main > div,
body.sidebar-collapsed .crm-nav-label,
body.sidebar-collapsed .crm-sidebar-footer span,
body.sidebar-collapsed .crm-theme-switch {
    display: none;
}

body.sidebar-collapsed .crm-brand .crm-sidebar-toggle {
    display: none;
}

body.sidebar-collapsed .crm-brand .crm-brand-main {
    width: 100%;
    justify-content: center;
}

body.sidebar-collapsed .crm-nav-link:not(.crm-nav-link--toggle) > span {
    display: none;
}

body.sidebar-collapsed .crm-nav-link--toggle .crm-nav-link-main > span {
    display: none;
}

body.sidebar-collapsed .crm-nav-link--toggle .crm-nav-link-main {
    width: 100%;
    justify-content: center;
}

body.sidebar-collapsed .crm-topbar {
    left: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .crm-main {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
}

body.sidebar-collapsed .crm-nav-link.is-active::before {
    left: 0;
}

@keyframes crmSkeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes crmSpin {
    to { transform: rotate(360deg); }
}

@keyframes crmFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes crmBadgePulse {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-1px); }
}

@keyframes crmNavLoading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@media (max-width: 1200px) {
    .crm-grid--kpi {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .crm-mobile-menu-btn {
        display: inline-flex;
    }

    .crm-sidebar {
        width: min(var(--sidebar-width), 88vw);
        min-width: min(var(--sidebar-width), 88vw);
        max-width: min(var(--sidebar-width), 88vw);
        transform: translate3d(calc(-100% - 14px), 0, 0);
        opacity: 0;
        visibility: hidden;
        will-change: transform, opacity;
        transition:
            transform 260ms cubic-bezier(0.22, 0.8, 0.2, 1),
            opacity 180ms ease,
            visibility 0ms linear 260ms,
            width var(--transition-fast),
            padding var(--transition-fast),
            background-color var(--transition-fast);
        z-index: 90;
    }

    body.sidebar-open .crm-sidebar {
        transform: translate3d(0, 0, 0);
        opacity: 1;
        visibility: visible;
        transition:
            transform 260ms cubic-bezier(0.22, 0.8, 0.2, 1),
            opacity 180ms ease,
            visibility 0ms linear 0ms,
            width var(--transition-fast),
            padding var(--transition-fast),
            background-color var(--transition-fast);
    }

    body.sidebar-open .crm-mobile-overlay {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .crm-topbar {
        left: 0;
        right: 0;
        z-index: 80;
    }

    body.sidebar-collapsed .crm-topbar {
        left: 0 !important;
        right: 0 !important;
    }

    body:not(.sidebar-open) .crm-mobile-menu-btn {
        position: relative;
        width: 34px;
        height: 34px;
        border: 0;
        background: transparent;
        box-shadow: none;
        padding: 0;
    }

    body:not(.sidebar-open) .crm-mobile-menu-btn:hover {
        border-color: transparent;
        background: transparent;
    }

    body:not(.sidebar-open) .crm-mobile-menu-btn svg {
        display: none;
    }

    body:not(.sidebar-open) .crm-mobile-menu-btn::before {
        content: '';
        width: 34px;
        height: 34px;
        border-radius: 8px;
        border: 1px solid var(--border-color);
        background-color: transparent;
        background-image: url('https://blackfystore.com/uploads/logo1.png');
        background-repeat: no-repeat;
        background-position: center;
        background-size: cover;
        display: block;
    }

    body.theme-light:not(.sidebar-open) .crm-mobile-menu-btn::before {
        filter: brightness(0) saturate(100%);
    }

    .crm-topbar-main {
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px 12px;
    }

    .crm-topbar-left,
    .crm-topbar-right {
        width: 100%;
        min-width: 0;
    }

    .crm-topbar-right {
        margin-left: 0;
        justify-content: space-between;
        gap: 10px;
    }

    .crm-topbar-progress-wrap {
        min-width: 0;
        flex: 1 1 180px;
    }

    .crm-main {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        padding-top: calc(64px + var(--space-5));
        padding-bottom: var(--space-6);
        padding-left: max(var(--crm-mobile-content-pad), calc(env(safe-area-inset-left, 0px) + 10px)) !important;
        padding-right: max(var(--crm-mobile-content-pad), calc(env(safe-area-inset-right, 0px) + 10px)) !important;
    }

    body.sidebar-collapsed .crm-main {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
    }

    body.sidebar-collapsed .crm-sidebar {
        width: var(--sidebar-width);
        min-width: var(--sidebar-width);
        max-width: min(var(--sidebar-width), 88vw);
        padding: 14px 12px;
    }

    body.sidebar-collapsed .crm-brand,
    body.sidebar-collapsed .crm-brand .crm-brand-main,
    body.sidebar-collapsed .crm-nav-link,
    body.sidebar-collapsed .crm-nav-link--toggle .crm-nav-link-main {
        justify-content: flex-start;
    }

    body.sidebar-collapsed .crm-brand .crm-brand-main > div,
    body.sidebar-collapsed .crm-nav-label,
    body.sidebar-collapsed .crm-sidebar-footer span,
    body.sidebar-collapsed .crm-theme-switch,
    body.sidebar-collapsed .crm-nav-link:not(.crm-nav-link--toggle) > span,
    body.sidebar-collapsed .crm-nav-link--toggle .crm-nav-link-main > span {
        display: initial;
    }

    body.sidebar-collapsed .crm-nav-item.is-open > .crm-subnav {
        display: flex !important;
    }

    body.sidebar-collapsed .crm-nav-chevron {
        display: inline-block !important;
    }

    .crm-page-header,
    .crm-section-head {
        flex-direction: column;
        align-items: flex-start;
        padding-left: 2px;
        padding-right: 2px;
    }

    /* Global compact scale for mobile content across pages */
    .crm-main {
        font-size: 14px;
    }

    .crm-main .crm-page-header h1,
    .crm-main .crm-page-header h2 {
        font-size: 1.4rem;
        line-height: 1.2;
    }

    .crm-main .crm-page-header p {
        font-size: 0.92rem;
        line-height: 1.45;
    }

    .crm-main .crm-kpi strong,
    .crm-main .rt-dashboard__kpi strong,
    .crm-main .rt-dashboard__value,
    .crm-main .db-kpi strong,
    .crm-main .mt-kpi strong {
        font-size: 1.08rem !important;
        line-height: 1.02 !important;
    }

    .crm-main .crm-kpi small,
    .crm-main .rt-dashboard__kpi small,
    .crm-main .rt-dashboard__list-item small,
    .crm-main .mt-kpi small {
        font-size: 0.7rem !important;
    }

    .crm-main .crm-badge,
    .crm-main .crm-pill {
        height: 24px;
        font-size: 10px;
        padding: 0 8px;
    }

    .crm-main .crm-table th,
    .crm-main .crm-table td {
        font-size: 0.82rem;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    /* Prevent mobile browsers from auto-zooming when focusing form fields */
    .crm-filter,
    .crm-input,
    input[type="text"],
    input[type="search"],
    input[type="email"],
    input[type="url"],
    input[type="number"],
    input[type="password"],
    input[type="tel"],
    input[type="date"],
    input[type="time"],
    input[type="datetime-local"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

@media (max-width: 780px) {
    .crm-react-toolbar {
        grid-template-columns: 1fr;
    }

    .crm-main {
        max-width: 100%;
        overflow-x: hidden;
    }

    .crm-main > * {
        min-width: 0;
        max-width: 100%;
    }

    .crm-main [class*="topbar"],
    .crm-main [class*="toolbar"] {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .crm-main [class*="topbar"] > *,
    .crm-main [class*="toolbar"] > * {
        min-width: 0;
        max-width: 100%;
    }

    .crm-main [class*="tabs"] {
        min-width: 0;
        max-width: 100%;
    }

    .crm-main [class*="title"],
    .crm-main [class*="user"] strong {
        overflow-wrap: anywhere;
    }
}

@media (max-width: 640px) {
    .crm-topbar {
        padding-top: 6px;
        padding-bottom: 6px;
        padding-left: 6px;
        padding-right: 6px;
        min-height: 56px;
    }

    .crm-topbar-main {
        padding: 8px 10px;
        flex-wrap: nowrap;
    }

    .crm-topbar-left,
    .crm-topbar-right {
        width: auto;
        min-width: 0;
    }

    .crm-topbar-left {
        flex: 1 1 auto;
    }

    .crm-topbar-right {
        margin-left: auto;
        gap: 8px;
        justify-content: flex-end;
    }

    .crm-topbar-title,
    .crm-topbar-progress-wrap {
        display: none;
    }

    .crm-topbar-progress-wrap {
        min-width: 130px;
    }

    .crm-topbar-icons {
        margin-left: 2px;
    }

    .crm-topbar-user {
        gap: 0;
    }

    .crm-topbar-avatar {
        width: 30px;
        height: 30px;
        font-size: 11px;
    }

    .crm-main {
        padding-top: calc(56px + var(--space-4));
        padding-bottom: var(--space-5);
        padding-left: max(var(--crm-mobile-content-pad), calc(env(safe-area-inset-left, 0px) + 8px)) !important;
        padding-right: max(var(--crm-mobile-content-pad), calc(env(safe-area-inset-right, 0px) + 8px)) !important;
    }

    .crm-grid--kpi {
        grid-template-columns: 1fr;
    }

    .crm-topbar-user-info {
        display: none;
    }

    /* Additional Global Responsiveness Fixes */
    .crm-card,
    .crm-shell-card {
        padding: 14px;
    }
    
    .crm-eyebrow {
        font-size: 8px;
        letter-spacing: 0.1em;
        margin-bottom: 2px;
    }

    .crm-page-header h1,
    .crm-page-header h2 {
        font-size: 1.22rem;
        line-height: 1.25;
    }

    .crm-page-header p {
        font-size: 0.86rem;
        line-height: 1.5;
        margin-top: 6px;
    }

    .crm-card,
    .crm-shell-card,
    .rt-dashboard__kpi,
    .rt-dashboard__vitrine-card,
    .rt-dashboard__list-item {
        font-size: 0.84rem;
    }

    .crm-kpi strong,
    .rt-dashboard__kpi strong,
    .rt-dashboard__value,
    .db-kpi strong,
    .mt-kpi strong {
        font-size: 1.2rem !important;
        line-height: 1.05 !important;
    }

    .crm-kpi small,
    .rt-dashboard__kpi small,
    .rt-dashboard__list-item small,
    .mt-kpi small {
        font-size: 10px !important;
    }
    
    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-inline .crm-btn,
    .form-inline button {
        width: 100%;
        justify-content: center;
    }
    
    .crm-actions,
    .crm-header-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .crm-actions .crm-btn,
    .crm-header-actions .crm-btn {
        width: 100%;
        justify-content: center;
    }

    /* Table Responsiveness Wrapper injected by menu.php */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: var(--space-4);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        background: var(--bg-card);
    }
    
    .table-responsive .crm-table {
        margin-bottom: 0;
        border: none;
    }
    
    .table-responsive .crm-table th,
    .table-responsive .crm-table td {
        white-space: nowrap;
    }
    
    .table-responsive .crm-table th:first-child,
    .table-responsive .crm-table td:first-child {
        border-left: none;
    }
    
    .table-responsive .crm-table th:last-child,
    .table-responsive .crm-table td:last-child {
        border-right: none;
    }
    
    .table-responsive .crm-table tr:last-child td {
        border-bottom: none;
    }
    
    .crm-sticky-save {
        flex-direction: column;
        bottom: 12px;
        padding: 12px;
    }
    
    .crm-sticky-save .crm-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Dialog/Modal responsiveness if they exist */
    dialog, 
    .crm-modal {
        max-width: calc(100vw - 32px);
        margin: 16px;
    }
}

/* Global UI polish for all modules except live map screen. */
body.crm-body:not(.crm-body--globe) {
    --crm-content-max: 1640px;
    --crm-content-max-wide: 1840px;
    --crm-table-density: 44px;
}

body.crm-body:not(.crm-body--globe) .crm-page-header {
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

body.crm-body:not(.crm-body--globe) .crm-page-header p {
    margin-top: 6px;
    max-width: 72ch;
}

body.crm-body:not(.crm-body--globe) .crm-card,
body.crm-body:not(.crm-body--globe) .crm-shell-card,
body.crm-body:not(.crm-body--globe) .crm-kpi {
    border-radius: 12px;
}

body.crm-body:not(.crm-body--globe) .crm-card,
body.crm-body:not(.crm-body--globe) .crm-shell-card {
    padding: clamp(14px, 1.2vw, 20px);
}

body.crm-body:not(.crm-body--globe) .crm-btn,
body.crm-body:not(.crm-body--globe) button,
body.crm-body:not(.crm-body--globe) input[type="submit"],
body.crm-body:not(.crm-body--globe) input[type="button"] {
    border-radius: 10px;
}

body.crm-body:not(.crm-body--globe) .crm-table thead th {
    letter-spacing: 0.04em;
}

body.crm-body:not(.crm-body--globe) .crm-table tbody tr {
    min-height: var(--crm-table-density);
}

body.crm-body:not(.crm-body--globe) .crm-table td {
    line-height: 1.38;
}

body.crm-body:not(.crm-body--globe) .crm-action-menu__trigger {
    width: 34px;
    height: 34px;
    border-radius: 9px;
}

body.crm-body:not(.crm-body--globe) .crm-action-menu__trigger svg {
    width: 15px;
    height: 15px;
}

body.crm-body:not(.crm-body--globe) .crm-action-menu__list {
    min-width: 190px;
    border-radius: 10px;
    padding: 0.35rem;
    gap: 0.28rem;
}

body.crm-body:not(.crm-body--globe) .crm-action-menu__list a,
body.crm-body:not(.crm-body--globe) .crm-action-menu__list button {
    border-radius: 8px;
    min-height: 34px;
}

@media (min-width: 1600px) {
    body.crm-body:not(.crm-body--globe) .crm-main {
        padding-left: clamp(12px, 1.1vw, 22px);
        padding-right: clamp(12px, 1.1vw, 22px);
    }

    body.crm-body:not(.crm-body--globe) .crm-main > * {
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }

    body.crm-body:not(.crm-body--globe) .crm-main.crm-main--wide > * {
        max-width: none;
    }
}

@media (max-width: 980px) {
    .crm-btn,
    button,
    input[type="submit"],
    input[type="button"] {
        min-height: var(--touch-target-mobile);
        height: auto;
        padding: 10px 16px;
        font-weight: 700;
    }

    .crm-filter,
    .crm-input,
    input[type="text"],
    input[type="search"],
    input[type="email"],
    input[type="url"],
    input[type="number"],
    input[type="password"],
    input[type="tel"],
    input[type="date"],
    input[type="time"],
    input[type="datetime-local"],
    select,
    textarea {
        min-height: var(--touch-target-mobile);
        padding-top: 11px;
        padding-bottom: 11px;
    }

    .crm-card,
    .crm-shell-card,
    .rt-dashboard__kpi,
    .rt-dashboard__vitrine-card,
    .rt-dashboard__list-item,
    .rt-dashboard__chart,
    .rt-gateway__card {
        padding: var(--mobile-card-padding);
        border-radius: 16px;
    }

    .crm-topbar {
        padding-left: max(8px, env(safe-area-inset-left, 0px));
        padding-right: max(8px, env(safe-area-inset-right, 0px));
    }

    .crm-topbar-main {
        border-radius: 12px;
    }

    .crm-page-header {
        margin-bottom: 18px;
    }

    .crm-page-header h1,
    .crm-page-header h2 {
        letter-spacing: -0.015em;
    }

    .table-responsive {
        border-radius: 12px;
    }

    .table-responsive .crm-table th,
    .table-responsive .crm-table td,
    .crm-table th,
    .crm-table td {
        padding-left: var(--mobile-table-cell-pad-x);
        padding-right: var(--mobile-table-cell-pad-x);
    }
}

@media (max-width: 640px) {
    :root {
        --touch-target-mobile: 44px;
        --mobile-card-padding: 15px;
        --mobile-table-cell-pad-x: 10px;
    }

    .crm-topbar-main {
        border-radius: 11px;
    }

    .crm-page-header {
        margin-bottom: 14px;
    }

    .crm-page-header h1,
    .crm-page-header h2 {
        font-size: 1.18rem;
        line-height: 1.3;
    }

    .crm-page-header p {
        font-size: 0.88rem;
    }
}