﻿        
        :root {
            --primary: #0f172a;
            --crm-primary: #0f172a;
            --crm-accent: #0ea5e9;
            --crm-accent-2: #3b82f6;
            --crm-bg: #020617;
            --crm-surface: #0f172a;
            --crm-text: #e2e8f0;
            --crm-text-muted: #94a3b8;
            --crm-btn-primary-bg: #0ea5e9;
            --crm-btn-primary-hover: #0284c7;
            --crm-btn-secondary-bg: #334155;
            --crm-nav-active-from: #0ea5e9;
            --crm-nav-active-to: #3b82f6;
            --crm-theme-color: #0ea5e9;
            --crm-background-color: #0f172a;
            --crm-font-body: 'Inter', system-ui, sans-serif;
            --crm-font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
        }
        
        body {
            font-family: var(--crm-font-body);
            background-color: var(--crm-bg);
            color: var(--crm-text);
        }
        
        .font-display {
            font-family: var(--crm-font-display);
            font-weight: 600;
        }

        .bg-sky-600, .bg-sky-700, .bg-emerald-700 {
            background-color: var(--crm-btn-primary-bg) !important;
        }
        .bg-sky-600:hover, .bg-sky-700:hover, .bg-emerald-700:hover {
            background-color: var(--crm-btn-primary-hover) !important;
        }
        .bg-slate-700, .bg-slate-800 {
            background-color: var(--crm-btn-secondary-bg);
        }

        .captcha-tile {
            border: 2px solid transparent;
            background: transparent;
            cursor: pointer;
            border-radius: 6px;
            min-height: 0;
        }
        .captcha-tile:hover {
            background: rgba(56, 189, 248, 0.12);
        }
        .captcha-tile.selected {
            border-color: #38bdf8;
            background: rgba(56, 189, 248, 0.28);
            box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.5);
        }

        .crm-card {
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            min-width: 0;
            overflow: hidden;
        }
        
        .crm-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
        }

        .crm-card-line,
        .entity-detail-value {
            overflow-wrap: anywhere;
            word-break: break-word;
        }

        .nav-tab {
            position: relative;
        }
        
        .nav-tab .nav-tab-close {
            margin-left: 0.35rem;
            opacity: 0.45;
            font-size: 0.65rem;
            line-height: 1;
            padding: 0.1rem 0.25rem;
            border-radius: 0.35rem;
        }
        .nav-tab .nav-tab-close:hover { opacity: 1; background: rgba(248, 113, 113, 0.25); }
        .nav-tab.drag-over { outline: 1px dashed rgba(56, 189, 248, 0.6); }
        .ef-cols-1 { grid-template-columns: 1fr; }
        .ef-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .ef-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
        .ef-cols-fill { grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); }
        #settings-efaktura-panel { max-height: calc(100vh - 6rem); }
        #ef-toggle-scroll.ef-fill-height { max-height: none; flex: 1 1 auto; min-height: 12rem; }

        .nav-tab.active:after {
            content: '';
            position: absolute;
            bottom: -1px;
            left: 0;
            right: 0;
            height: 3px;
            background: linear-gradient(to right, var(--crm-nav-active-from), var(--crm-nav-active-to));
            border-radius: 3px 3px 0 0;
        }

        .structure-node {
            transition: all 0.2s ease;
        }
        
        .structure-node:hover {
            transform: scale(1.02);
            box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
        }

        .snap-module {
            border: 1px solid #e2e8f0;
            box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
        }

        .mini-card {
            font-size: 0.75rem;
            line-height: 1rem;
        }

        .crm-table th {
            background: #0f172a;
            font-weight: 600;
            color: #94a3b8;
        }

        .section-header {
            background: linear-gradient(90deg, #0f172a, #1e2937);
            color: white;
        }

        #global-loader { transition: opacity 0.2s; }
        #global-loader.hidden { opacity: 0; pointer-events: none; }
        .loader-spinner {
            width: 48px; height: 48px;
            border: 3px solid rgba(148, 163, 184, 0.3);
            border-top-color: #38bdf8;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }
        @keyframes spin { to { transform: rotate(360deg); } }
        .route-stop-card { cursor: grab; }
        .route-stop-card.dragging { opacity: 0.5; }

        /* Tab bar: hide (clip) items out of frame instead of scroll. User can use tab prefs (right click or settings) to hide/show tabs to fit. No horizontal scroll on tab strip. */
        .nav-tabs-wrap {
            overflow-x: hidden;
            overflow-y: hidden;
            flex-wrap: nowrap !important;
            cursor: default;
            padding-bottom: 2px;
            margin-bottom: 0;
        }
        .nav-tabs-wrap.can-pan { cursor: grab; }
        .nav-tabs-wrap.dragging { cursor: grabbing; user-select: none; }
        .nav-tabs-outer {
            min-width: 0;
            overflow: hidden;
            scrollbar-width: none;
            -ms-overflow-style: none;
        }
        #main-app > .border-b.border-slate-800 { overflow: hidden; }
        .nav-remote-badge {
            flex-shrink: 0;
            position: sticky;
            right: 0;
            z-index: 2;
            background: linear-gradient(90deg, transparent 0%, rgb(15 23 42) 12%, rgb(15 23 42) 100%);
            padding-left: 0.5rem;
        }
        .guide-hover-tip { animation: fadeIn 0.15s ease; }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
        #help-menu-dropdown { min-width: 11rem; }

        .settings-search-hidden { display: none !important; }
        #settings-scroll-area { scroll-behavior: smooth; }
        @media (max-width: 768px) {
            #settings-scroll-area { max-height: none; }
            #tab-logistics .grid { grid-template-columns: 1fr !important; }
            #logistics-map { min-height: 280px; height: 50vh; }
            .nav-tabs-wrap { padding-bottom: 4px; }
            .nav-tab { flex-shrink: 0; font-size: 0.75rem; padding: 0.5rem 0.75rem !important; }
            .stat-box .text-4xl { font-size: 1.75rem; }
            #logistics-map { min-height: 240px; }
            .logistics-driver-marker { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.45); }
            .logistics-driver-marker.live { animation: logistics-pulse 1.5s ease-in-out infinite; }
            @keyframes logistics-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); } 50% { box-shadow: 0 0 0 10px rgba(34,197,94,0); } }
            .mobile-stack { flex-direction: column !important; align-items: stretch !important; }
            .touch-target { min-height: 44px; min-width: 44px; }
            #main-app { padding-bottom: 72px; }
        }

        .tree-line {
            border-left: 2px solid #64748b;
        }
        
        .stat-box {
            transition: transform 0.2s ease;
        }
        
        .stat-box:hover {
            transform: translateY(-1px);
        }

        /* Adaptive graph containers so titles never cut off at top; content sized to fit */
        .graph-container {
            display: flex;
            flex-direction: column;
            min-height: fit-content;
            height: auto;
            overflow: visible;
            border: 1px solid #334155;
            border-radius: 12px;
            background: #0f172a;
            padding: 8px;
        }
        .graph-title {
            font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
            font-weight: 600;
            font-size: 1rem;
            color: #f1f5f9;
            margin-bottom: 4px;
            padding: 2px 4px;
            white-space: normal;
            word-break: break-word;
            flex: 0 0 auto;
        }
        /* Section titles stand out above body text (~10% larger, bolder) */
        h1, h2, h3, .crm-section-title {
            font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
            font-weight: 700;
            letter-spacing: -0.02em;
            color: #f8fafc;
        }
        h1 { font-size: 2.06rem; line-height: 1.2; }
        h2.text-3xl, .tab-content h2.text-3xl { font-size: 2.06rem; line-height: 1.2; }
        h2.text-2xl, .tab-content h2.text-2xl {
            font-size: 1.79rem;
            line-height: 1.25;
        }
        h2.text-xl { font-size: 1.38rem; line-height: 1.3; }
        h3.text-lg { font-size: 1.24rem; line-height: 1.35; }
        h3.font-medium, h3.font-semibold { font-weight: 700; }
        .tab-content .font-medium.mb-2,
        .tab-content .font-medium.mb-1,
        .tab-content .font-medium.mb-3 {
            font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
            font-size: 1.05rem;
            font-weight: 700;
            color: #e2e8f0;
        }
        /* Faint border on all buttons for definition */
        button:not(.nav-tab-close):not([class*="border-0"]) {
            border: 1px solid rgba(148, 163, 184, 0.32) !important;
        }
        button.nav-tab {
            border-color: rgba(100, 116, 139, 0.45) !important;
        }
        button.nav-tab.active {
            border-color: rgba(56, 189, 248, 0.55) !important;
        }
        #notif-panel {
            min-width: 16rem;
            max-width: 22rem;
            max-height: 18rem;
            overflow: auto;
        }
        .graph-container canvas {
            flex: 1 1 auto;
            min-height: 220px;
            width: 100%;
            display: block;
            background: #020617;
            border-radius: 8px;
        }
        #chat-toast-container { position: fixed; top: 4.5rem; right: 1rem; z-index: 9999; width: 18rem; pointer-events: none; }
        .chat-toast { pointer-events: auto; background: #0f172a; border: 1px solid #38bdf8; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.4); animation: slideIn 0.25s ease; }
        @keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
        .chat-bubble-me { margin-left: auto; max-width: 75%; background: #0369a1; border-radius: 12px 12px 2px 12px; }
        .chat-bubble-other { margin-right: auto; max-width: 75%; background: #334155; border-radius: 12px 12px 12px 2px; }
        #chat-monitor-overlay { z-index: 10000; }

        /* Master navigation — horizontal scroll */
        .master-tab-scroll,
        .master-subtab-scroll {
            overflow-x: auto;
            overflow-y: hidden;
            flex-wrap: nowrap;
            scrollbar-width: thin;
            scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
            -webkit-overflow-scrolling: touch;
        }
        .master-tab-scroll::-webkit-scrollbar,
        .master-subtab-scroll::-webkit-scrollbar { height: 5px; }
        .master-tab-scroll::-webkit-scrollbar-thumb,
        .master-subtab-scroll::-webkit-scrollbar-thumb {
            background: rgba(148, 163, 184, 0.35);
            border-radius: 999px;
        }

        .crm-app-header {
            background: linear-gradient(180deg, rgba(15, 23, 42, 0.96) 0%, rgba(15, 23, 42, 0.88) 100%);
        }
        .crm-nav-bar {
            background: rgba(15, 23, 42, 0.92);
        }

        /* Light theme */
        html[data-crm-theme="light"] {
            --crm-bg: #f1f5f9;
            --crm-surface: #ffffff;
            --crm-text: #0f172a;
            --crm-text-muted: #64748b;
            --crm-btn-secondary-bg: #e2e8f0;
        }
        html[data-crm-theme="light"] body {
            background-color: var(--crm-bg);
            color: var(--crm-text);
        }
        html[data-crm-theme="light"] .crm-app-header,
        html[data-crm-theme="light"] .crm-nav-bar {
            background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 250, 252, 0.92) 100%);
            border-color: #e2e8f0 !important;
        }
        html[data-crm-theme="light"] .bg-slate-900,
        html[data-crm-theme="light"] .bg-slate-950 {
            background-color: #ffffff !important;
        }
        html[data-crm-theme="light"] .bg-slate-800 {
            background-color: #f1f5f9 !important;
        }
        html[data-crm-theme="light"] .text-slate-300,
        html[data-crm-theme="light"] .text-slate-400,
        html[data-crm-theme="light"] .text-slate-500 {
            color: #64748b !important;
        }
        html[data-crm-theme="light"] .border-slate-700,
        html[data-crm-theme="light"] .border-slate-800 {
            border-color: #e2e8f0 !important;
        }
        html[data-crm-theme="light"] .master-tab-btn {
            color: #475569 !important;
        }
        html[data-crm-theme="light"] .master-tab-btn.bg-slate-800 {
            background-color: #e0f2fe !important;
            color: #0369a1 !important;
        }
        html[data-crm-theme="light"] .master-subtab-btn.text-teal-200 {
            color: #0f766e !important;
        }
