        /* ── Design tokens ──────────────────────────────────────────────── */
        :root {
            --bg:           #0a0a0f;
            --bg-card:      #12121a;
            --bg-hover:     #1a1a2e;
            --border:       #2a2a3e;
            --text:         #e0e0e8;
            --text-dim:     #8888a0;
            --accent:       #6c5ce7;
            --accent-light: #a29bfe;
            --green:        #00b894;
            --orange:       #fdcb6e;
            --red:          #e17055;
            --blue:         #74b9ff;
            --radius:       12px;
            --font:         'Segoe UI', system-ui, -apple-system, sans-serif;
            --mono:         'Fira Code', 'SF Mono', 'Consolas', monospace;
            /* Surface aliases used across the tool views. These were referenced for a long
               time without ever being defined, so those panels rendered flat/transparent. */
            --surface:      #12121a;
            --surface-2:    #1a1a2e;
            --bg2:          #1a1a2e;
            --card:         #12121a;
            --card-bg:      #12121a;
            --card-color:   #6c5ce7;
            --input-bg:     #15151f;
            --border-hi:    #3a3a52;
        }
        [data-theme="light"] {
            --bg:           #f0f0f5;
            --bg-card:      #ffffff;
            --bg-hover:     #e4e4ed;
            --border:       #d0d0dd;
            --text:         #1a1a2e;
            --text-dim:     #666680;
            --accent:       #5a4bd1;
            --accent-light: #6c5ce7;
            --green:        #009d7e;
            --orange:       #c9930e;
            --red:          #c0392b;
            --blue:         #2980b9;
            --surface:      #ffffff;
            --surface-2:    #e9e9f2;
            --bg2:          #e9e9f2;
            --card:         #ffffff;
            --card-bg:      #ffffff;
            --card-color:   #5a4bd1;
            --input-bg:     #ffffff;
            --border-hi:    #b9b9cc;
        }

        /* ── Reset & base ───────────────────────────────────────────────── */
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
        html { overflow-x: hidden; scroll-behavior: smooth; }

        /* ── Transitions & animations ──────────────────────────────────── */
        .view { display: none; animation: fadeIn .2s ease; }
        .view.active { display: block; }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

        /* ── Toast notifications ───────────────────────────────────────── */
        .toast-container {
            position: fixed; bottom: 20px; right: 20px; z-index: 9999;
            display: flex; flex-direction: column; gap: 8px; pointer-events: none;
        }
        .toast {
            background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
            padding: 12px 16px; font-size: 13px; color: var(--text); box-shadow: 0 8px 24px rgba(0,0,0,.3);
            display: flex; align-items: center; gap: 10px; pointer-events: auto;
            animation: toastIn .3s ease; min-width: 240px; max-width: 360px;
        }
        .toast.success { border-left: 3px solid var(--green); }
        .toast.error { border-left: 3px solid var(--red); }
        .toast.info { border-left: 3px solid var(--accent); }
        @keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
        @media (max-width: 768px) {
            .toast-container { bottom: 12px; right: 12px; left: 12px; }
            .toast { min-width: auto; max-width: 100%; }
        }

        /* ── App shell ──────────────────────────────────────────────────── */
        .app {
            display: grid;
            grid-template-columns: 260px 1fr;
            grid-template-rows: 56px 1fr;
            height: 100vh;
        }

        /* ── Mobile hamburger ─────────────────────────────────────────── */
        .mobile-menu-btn {
            display: none; background: none; border: none; color: var(--text);
            font-size: 20px; cursor: pointer; padding: 6px 10px; border-radius: 8px;
        }
        .mobile-menu-btn:hover { background: var(--bg-hover); }
        .sidebar-overlay {
            display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
            z-index: 900; backdrop-filter: blur(2px);
        }

        @media (max-width: 768px) {
            .app { grid-template-columns: 1fr; }
            .mobile-menu-btn { display: block; }
            .sidebar {
                position: fixed; top: 0; left: 0; bottom: 0; width: 280px; max-width: 85vw;
                z-index: 950; transform: translateX(-100%); transition: transform .25s ease;
                box-shadow: 4px 0 20px rgba(0,0,0,.3);
            }
            .sidebar.open { transform: translateX(0); }
            .sidebar-overlay.open { display: block; }
            .main { padding: 16px 14px; }
            .header { padding: 0 12px; gap: 8px; }
            .header .tagline { display: none; }
            .header .header-sep { display: none; }
            .header-right { gap: 6px; }
            .header-right .status-pill { display: none; }
            .view.active { padding: 0 !important; }
            #view-admin { padding: 14px !important; max-width: 100% !important; }
        }

        @media (max-width: 480px) {
            .header .logo { font-size: 16px; letter-spacing: 2px; }
            .header .logo-mark { width: 26px; height: 26px; }
            .header .logo-mark i { font-size: 12px; }
            #auth-user-name { display: none; }
        }

        /* ── Header ─────────────────────────────────────────────────────── */
        .header {
            grid-column: 1 / -1;
            background: var(--bg-card);
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            padding: 0 20px;
            gap: 12px;
            z-index: 10;
        }
        .logo {
            font-size: 20px; font-weight: 800; letter-spacing: 3px;
            background: linear-gradient(135deg, var(--accent), var(--accent-light));
            -webkit-background-clip: text; -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        .logo-mark {
            width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
            background: linear-gradient(135deg, var(--accent), var(--accent-light));
            display: flex; align-items: center; justify-content: center;
            box-shadow: 0 2px 10px rgba(108,92,231,0.4);
        }
        .logo-mark i { color: #fff; font-size: 14px; }
        .header-sep { width: 1px; height: 24px; background: var(--border); }
        .tagline { color: var(--text-dim); font-size: 13px; }
        .header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
        .status-pill {
            display: flex; align-items: center; gap: 6px;
            padding: 4px 12px; border-radius: 20px;
            background: var(--bg-hover); border: 1px solid var(--border);
            font-size: 12px; font-weight: 600;
        }
        .sdot {
            width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim);
            transition: background 0.3s, box-shadow 0.3s; flex-shrink: 0;
        }
        .sdot.online  { background: var(--green);  animation: pulse-g 2s infinite; }
        .sdot.partial { background: var(--orange); animation: pulse-o 2s infinite; }
        .sdot.offline { background: var(--red); }
        .icon-btn {
            background: var(--bg-hover); border: 1px solid var(--border);
            color: var(--text); padding: 6px 10px; border-radius: 8px;
            cursor: pointer; font-size: 14px; transition: all 0.15s;
        }
        .icon-btn:hover { border-color: var(--accent); }

        /* ── Sidebar ─────────────────────────────────────────────────────── */
        .sidebar {
            background: var(--bg-card);
            border-right: 1px solid var(--border);
            overflow-y: auto;
            padding: 14px 10px;
            display: flex;
            flex-direction: column;
            gap: 2px;
        }
        .nav-label {
            font-size: 10px; font-weight: 700; text-transform: uppercase;
            letter-spacing: 1.5px; color: var(--text-dim);
            padding: 8px 10px 4px;
        }
        .nav-sep { height: 1px; background: var(--border); margin: 6px 0; opacity: 0.5; }
        .nav-item {
            display: flex; align-items: center; gap: 9px;
            padding: 10px 12px; border-radius: 8px; cursor: pointer;
            font-size: 13px; color: var(--text-dim); transition: all 0.15s;
            user-select: none; -webkit-tap-highlight-color: transparent;
            min-height: 44px;
        }
        .nav-item:hover { background: var(--bg-hover); color: var(--text); }
        .nav-item:active { transform: scale(0.98); }
        .nav-item.active { background: rgba(108,92,231,0.14); color: var(--accent-light); position: relative; }
        .nav-icon { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; }
        .nav-ico {
            width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
            display: flex; align-items: center; justify-content: center;
            font-size: 12px; background: var(--bg-hover); transition: all 0.15s;
        }
        .nav-item.active .nav-ico { background: rgba(108,92,231,0.2); color: var(--accent-light); }
        .nav-item:hover .nav-ico { background: var(--border); }
        .nav-item.active::before {
            content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
            width: 3px; height: 60%; border-radius: 0 3px 3px 0; background: var(--accent);
        }
        .nav-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); margin-left: auto; flex-shrink: 0; transition: all 0.3s; }
        .nav-dot.online  { background: var(--green); box-shadow: 0 0 5px var(--green); }
        .nav-dot.offline { background: var(--red); }

        /* ── Main ────────────────────────────────────────────────────────── */
        .main { overflow-y: auto; padding: 28px 32px; scroll-behavior: smooth; }
        .main:has(#view-chat.active) { padding: 0; overflow: hidden; }
        @media (max-width: 768px) {
            .main { padding: 16px 12px; }
        }

        .page-hero {
            background: linear-gradient(135deg, rgba(108,92,231,0.08) 0%, transparent 60%);
            border: 1px solid var(--border); border-radius: var(--radius);
            padding: 24px 28px; margin-bottom: 22px; position: relative; overflow: hidden;
        }
        .page-hero::before {
            content: ''; position: absolute; inset: 0;
            background: radial-gradient(ellipse at top left, rgba(108,92,231,0.1), transparent 60%);
            pointer-events: none;
        }
        .page-hero h1 { font-size: 26px; font-weight: 800; margin-bottom: 4px; position: relative; }
        .page-hero p { color: var(--text-dim); font-size: 13px; position: relative; }

        .stats-bar { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
        .stat-chip {
            display: flex; align-items: center; gap: 7px;
            padding: 7px 14px; border-radius: 20px;
            background: var(--bg-card); border: 1px solid var(--border);
            font-size: 12px;
        }
        .stat-chip .dot { width: 7px; height: 7px; border-radius: 50%; }
        .stat-chip strong { color: var(--text); }
        .stat-chip span   { color: var(--text-dim); }

        .service-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
            gap: 14px;
        }
        .svc-card {
            display: flex; flex-direction: column;
            background: var(--bg-card); border: 1px solid var(--border);
            border-radius: var(--radius); overflow: hidden;
            cursor: pointer; transition: all 0.2s;
        }
        .svc-card:hover {
            border-color: var(--accent); transform: translateY(-2px);
            box-shadow: 0 8px 30px rgba(108,92,231,0.12);
        }
        .svc-card.offline { opacity: 0.55; }
        .svc-card.offline:hover { border-color: var(--red); box-shadow: 0 6px 20px rgba(225,112,85,0.1); }
        .svc-card-head { padding: 16px 18px 12px; display: flex; align-items: flex-start; gap: 12px; }
        .svc-card-icon {
            width: 42px; height: 42px; border-radius: 11px;
            display: flex; align-items: center; justify-content: center;
            font-size: 20px; flex-shrink: 0;
        }
        .svc-card-body { flex: 1; min-width: 0; }
        .svc-card-body h3 { font-size: 14px; font-weight: 700; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .svc-card-body p  { font-size: 11px; color: var(--text-dim); line-height: 1.4; }
        .svc-card-badge {
            padding: 3px 8px; border-radius: 20px;
            font-size: 10px; font-weight: 700; text-transform: uppercase;
            flex-shrink: 0; align-self: flex-start; margin-top: 2px;
        }
        .svc-card-badge.checking { background: rgba(136,136,160,0.12); color: var(--text-dim); }
        .svc-card-badge.online   { background: rgba(0,184,148,0.15);    color: var(--green); }
        .svc-card-badge.offline  { background: rgba(225,112,85,0.15);   color: var(--red); }
        .svc-card-foot {
            padding: 10px 18px; border-top: 1px solid var(--border);
            display: flex; align-items: center;
        }
        .svc-card-port { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
        .svc-card-ctas { margin-left: auto; display: flex; gap: 6px; }
        .cta-btn {
            padding: 4px 11px; border-radius: 6px; font-size: 11px; font-weight: 600;
            border: 1px solid var(--border); background: var(--bg-hover);
            color: var(--text-dim); cursor: pointer; transition: all 0.15s;
            text-decoration: none; display: inline-block;
        }
        .cta-btn:hover { border-color: var(--accent); color: var(--text); }
        .cta-btn.primary {
            background: var(--accent); color: #fff; border-color: var(--accent);
        }
        .cta-btn.primary:hover { background: var(--accent-light); border-color: var(--accent-light); }

        /* ── Service view layout ─────────────────────────────────────────── */
        .svc-header {
            display: flex; align-items: center; gap: 14px;
            margin-bottom: 22px; padding-bottom: 18px;
            border-bottom: 1px solid var(--border);
        }
        .svc-icon {
            width: 50px; height: 50px; border-radius: 14px;
            display: flex; align-items: center; justify-content: center;
            font-size: 22px; flex-shrink: 0;
        }
        .svc-meta h2 { font-size: 20px; font-weight: 800; }
        .svc-meta p  { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
        .svc-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

        .badge {
            display: inline-flex; align-items: center; gap: 5px;
            padding: 4px 10px; border-radius: 20px;
            font-size: 11px; font-weight: 700;
        }
        .badge.checking { background: rgba(136,136,160,0.12); color: var(--text-dim); }
        .badge.online   { background: rgba(0,184,148,0.15);    color: var(--green); }
        .badge.offline  { background: rgba(225,112,85,0.15);   color: var(--red); }

        .two-col  { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
        .three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
        @media (max-width: 900px) { .two-col, .three-col { grid-template-columns: 1fr; } }

        /* ── Mobile Responsive ───────────────────────────────────────────── */
        @media (max-width: 768px) {
            /* Layout overrides */
            .service-grid { grid-template-columns: 1fr !important; }
            .svc-header { padding: 16px; gap: 14px; }
            .svc-header-avatar img { width: 44px; height: 44px; border-radius: 12px; }
            .kpi-row { flex-wrap: wrap; }
            .kpi-row .kpi { min-width: 45%; flex: 1; }

            /* GEO tool */
            .geo-topbar { flex-wrap: wrap; gap: 8px; }
            .geo-topbar select { max-width: 160px; }
            .geo-nav-sections { flex-wrap: wrap; gap: 6px; padding: 8px 0; }
            .geo-nav-group { min-width: auto; }
            .geo-nav-group-label { font-size: 9px; }
            .geo-nav-btns { flex-wrap: wrap; }
            .geo-nav-btn { font-size: 11px; padding: 6px 10px; }
            .geo-kpi-strip { flex-wrap: wrap; }
            .geo-filter-row { flex-wrap: wrap; }
            .geo-action-grid { grid-template-columns: 1fr !important; }
            .geo-dash-grid { grid-template-columns: 1fr !important; }
            .geo-kpi-grid { grid-template-columns: 1fr !important; }

            /* Generic layouts */
            .steps { flex-wrap: wrap; gap: 6px; }
            .step-sep { display: none; }
            .tabs { flex-wrap: wrap; }
            .svc-status-grid { grid-template-columns: 1fr !important; }
            .project-list { max-height: none; }

            /* Chat — handled by .chat-layout media queries above */
            #view-chat { height: calc(100vh - 56px) !important; }

            /* Admin forms — force single column */
            [style*="grid-template-columns:1fr 1fr 1fr 120px auto"] { grid-template-columns: 1fr !important; }
            [style*="grid-template-columns:1fr 2fr 1.5fr 110px"] { grid-template-columns: 1fr !important; }
            [style*="grid-template-columns:1fr 1fr 1fr 2fr"] { grid-template-columns: 1fr 1fr !important; }

            /* Modals — full width on mobile */
            [style*="max-width:920px"] { max-width: 100vw !important; width: 100% !important; margin: 8px !important; }
            [style*="max-width:95vw"] { width: 95vw !important; }
            [style*="max-width:92vw"] { width: 92vw !important; }

            /* Tables — allow horizontal scroll */
            .tbl { font-size: 11px; }
            [style*="overflow-x:auto"] { -webkit-overflow-scrolling: touch; }

            /* Press clipping report panel */
            [style*="grid-template-columns:1fr 280px"] { grid-template-columns: 1fr !important; }

            /* Live feed KPI strip in GEO progress */
            [style*="grid-template-columns:1fr 1fr 1fr 2fr"] { grid-template-columns: 1fr 1fr !important; }

            /* Fixed-width cards */
            [style*="min-width:150px"] { min-width: auto !important; }

            /* User management grid */
            [style*="grid-template-columns:1fr 1fr 1fr 120px auto"] { gap: 8px !important; }

            /* Force-wrap flex rows that overflow */
            [style*="display:flex"][style*="gap:"] { flex-wrap: wrap !important; }

            /* Prevent overflow on view containers */
            .view { overflow-x: hidden; }
            .view.active { display: block; overflow-x: hidden; }
        }
        @media (max-width: 480px) {
            .svc-card { padding: 14px; }
            .svc-card-head { flex-wrap: wrap; gap: 8px; }
            .card { padding: 12px; }
            .geo-nav-btn { font-size: 10px; padding: 5px 8px; }
            .geo-topbar { padding: 8px 10px; }
            .tabs .tab-btn { font-size: 11px; padding: 8px 12px; }
            /* Stack all multi-column grids */
            [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
            [style*="grid-template-columns:repeat(2"] { grid-template-columns: 1fr !important; }
            [style*="grid-template-columns:repeat(3"] { grid-template-columns: 1fr !important; }
        }

        /* ── Chat View ───────────────────────────────────────────────────── */
        .chat-layout {
            display: grid;
            grid-template-columns: 280px 1fr;
            height: 100%;
            overflow: hidden;
        }
        .chat-sidebar {
            background: var(--bg-card);
            border-right: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        .chat-sidebar-header {
            padding: 16px 18px;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 12px;
        }
        .chat-sidebar-header img {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            object-fit: cover;
            object-position: top;
            border: 2px solid rgba(108,92,231,.3);
            flex-shrink: 0;
        }
        .chat-sidebar-identity {
            flex: 1;
            min-width: 0;
        }
        .chat-sidebar-identity .name {
            font-size: 13px;
            font-weight: 700;
            color: var(--text);
        }
        .chat-sidebar-identity .status {
            font-size: 10px;
            color: var(--green);
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 4px;
        }
        .chat-sidebar-identity .status::before {
            content: '';
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: var(--green);
        }
        .chat-conv-list {
            flex: 1;
            overflow-y: auto;
            padding: 8px;
        }
        .chat-conv-item {
            cursor: pointer;
            padding: 10px 12px;
            margin-bottom: 4px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: background .15s;
        }
        .chat-conv-item:hover { background: var(--bg-hover); }
        .chat-conv-item.active { background: rgba(108,92,231,.08); border: 1px solid rgba(108,92,231,.15); }
        .chat-conv-item .conv-name {
            font-size: 12px;
            font-weight: 500;
            color: var(--text);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .chat-conv-item .conv-meta {
            font-size: 10px;
            color: var(--text-dim);
        }
        .chat-mcp-panel {
            border-top: 1px solid var(--border);
            padding: 14px 16px 18px;
            flex-shrink: 0;
        }
        .chat-mcp-panel-header {
            display: flex;
            align-items: center;
            gap: 6px;
            margin-bottom: 10px;
        }
        .chat-mcp-panel-header i {
            color: var(--accent);
            font-size: 11px;
        }
        .chat-mcp-panel-header span {
            font-size: 11px;
            font-weight: 700;
            color: var(--text-dim);
            text-transform: uppercase;
            letter-spacing: .5px;
        }
        .chat-mcp-server-item {
            padding: 8px 10px;
            border-radius: 8px;
            background: var(--bg);
            border: 1px solid var(--border);
        }
        .chat-mcp-server-item + .chat-mcp-server-item { margin-top: 4px; }
        .chat-mcp-server-item .server-row {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .chat-mcp-server-item .server-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: var(--green);
            flex-shrink: 0;
        }
        .chat-mcp-server-item .server-info {
            flex: 1;
            min-width: 0;
        }
        .chat-mcp-server-item .server-name {
            font-size: 11px;
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .chat-mcp-server-item .server-tools-count {
            font-size: 9px;
            color: var(--text-dim);
        }
        .chat-mcp-server-item .server-tools-list {
            font-size: 9px;
            color: var(--accent);
            padding: 4px 0 0 14px;
            opacity: .7;
        }
        .chat-main {
            display: flex;
            flex-direction: column;
            height: 100%;
            overflow: hidden;
            background: var(--bg);
        }
        .chat-header {
            padding: 14px 24px;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 14px;
            flex-shrink: 0;
            background: var(--bg-card);
        }
        .chat-header-avatar {
            position: relative;
            flex-shrink: 0;
        }
        .chat-header-avatar img {
            width: 42px;
            height: 42px;
            border-radius: 50%;
            object-fit: cover;
            object-position: top;
            border: 2px solid rgba(108,92,231,.3);
        }
        .chat-header-avatar .online-dot {
            position: absolute;
            bottom: 1px;
            right: 1px;
            width: 10px;
            height: 10px;
            background: var(--green);
            border-radius: 50%;
            border: 2px solid var(--bg-card);
        }
        .chat-header-info {
            flex: 1;
            min-width: 0;
        }
        .chat-header-info .title {
            font-size: 15px;
            font-weight: 700;
            color: var(--text);
        }
        .chat-header-info .subtitle {
            font-size: 11px;
            color: var(--text-dim);
            margin-top: 1px;
        }
        .chat-header-status {
            display: flex;
            align-items: center;
            gap: 5px;
            font-size: 10px;
            color: var(--green);
            font-weight: 600;
        }
        .chat-header-status::before {
            content: '';
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: var(--green);
        }
        .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 24px;
            display: flex;
            flex-direction: column;
            gap: 16px;
        }
        .chat-welcome {
            text-align: center;
            padding: 48px 20px 32px;
            color: var(--text-dim);
        }
        .chat-welcome img {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            object-fit: cover;
            object-position: top;
            border: 3px solid rgba(108,92,231,.3);
            box-shadow: 0 4px 24px rgba(108,92,231,.15);
            margin-bottom: 16px;
        }
        .chat-welcome h3 {
            font-size: 20px;
            font-weight: 800;
            color: var(--text);
            margin-bottom: 8px;
        }
        .chat-welcome p {
            font-size: 13px;
            max-width: 440px;
            margin: 0 auto 24px;
            line-height: 1.7;
            color: var(--text-dim);
        }
        .chat-welcome-chips {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            justify-content: center;
            max-width: 500px;
            margin: 0 auto;
        }
        .chat-msg-user {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            align-items: flex-end;
        }
        .chat-msg-user .bubble {
            background: linear-gradient(135deg, var(--accent), #a29bfe);
            border-radius: 18px 18px 4px 18px;
            padding: 12px 18px;
            max-width: 70%;
            font-size: 13px;
            line-height: 1.6;
            color: #fff;
            box-shadow: 0 2px 12px rgba(108,92,231,.15);
        }
        .chat-msg-user .avatar {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            background: rgba(108,92,231,.08);
            border: 1px solid rgba(108,92,231,.15);
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            font-size: 12px;
            color: var(--accent);
        }
        .chat-msg-mira {
            display: flex;
            gap: 12px;
            align-items: flex-start;
            max-width: 88%;
        }
        .chat-msg-mira img {
            width: 34px;
            height: 34px;
            border-radius: 50%;
            object-fit: cover;
            object-position: top;
            flex-shrink: 0;
            border: 2px solid rgba(108,92,231,.2);
        }
        .chat-msg-mira .bubble {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 4px 18px 18px 18px;
            padding: 14px 18px;
            font-size: 13px;
            line-height: 1.7;
            color: var(--text);
            box-shadow: 0 1px 6px rgba(0,0,0,.04);
            min-width: 0;
            overflow: hidden;
        }
        .chat-msg-mira .bubble .label {
            font-size: 10px;
            font-weight: 700;
            color: var(--accent);
            margin-bottom: 8px;
            text-transform: uppercase;
            letter-spacing: .5px;
        }
        .chat-input-area {
            padding: 16px 24px 20px;
            border-top: 1px solid var(--border);
            display: flex;
            gap: 10px;
            align-items: flex-end;
            flex-shrink: 0;
            background: var(--bg-card);
        }
        .chat-input-area textarea {
            flex: 1;
            resize: none;
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: 12px 16px;
            background: var(--bg);
            color: var(--text);
            font-size: 13px;
            font-family: var(--font);
            outline: none;
            max-height: 120px;
            line-height: 1.5;
            transition: border-color .15s, box-shadow .15s;
        }
        .chat-input-area textarea:focus {
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(108,92,231,.1);
        }
        .chat-input-area .send-btn {
            padding: 11px 18px;
            border-radius: 14px;
            flex-shrink: 0;
        }
        .chat-mobile-toggle {
            display: none;
            background: none;
            border: none;
            color: var(--text);
            font-size: 18px;
            cursor: pointer;
            padding: 6px 8px;
            border-radius: 8px;
            transition: background .15s;
        }
        .chat-mobile-toggle:hover { background: var(--bg-hover); }
        .chat-sidebar-close {
            display: none;
            background: none;
            border: none;
            color: var(--text-dim);
            font-size: 16px;
            cursor: pointer;
            padding: 4px 8px;
            border-radius: 6px;
        }
        .chat-sidebar-close:hover { background: var(--bg-hover); }
        .chat-sidebar-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,.5);
            backdrop-filter: blur(2px);
            z-index: 1000;
        }

        @media (max-width: 768px) {
            .chat-layout { grid-template-columns: 1fr !important; }
            .chat-sidebar {
                position: fixed;
                top: 0;
                left: 0;
                bottom: 0;
                width: 300px;
                max-width: 85vw;
                z-index: 1010;
                transform: translateX(-100%);
                transition: transform .25s ease;
                box-shadow: 4px 0 20px rgba(0,0,0,.3);
            }
            .chat-sidebar.open { transform: translateX(0); }
            .chat-sidebar-overlay.open { display: block; }
            .chat-mobile-toggle { display: flex; }
            .chat-sidebar-close { display: block; }
            .chat-header { padding: 12px 16px; gap: 10px; }
            .chat-header-avatar img { width: 36px; height: 36px; }
            .chat-messages { padding: 16px; }
            .chat-input-area { padding: 12px 16px; }
            .chat-input-area textarea { padding: 10px 14px; border-radius: 12px; }
            .chat-input-area .send-btn { padding: 10px 14px; border-radius: 12px; }
            .chat-msg-user .bubble { max-width: 85%; }
            .chat-msg-mira { max-width: 95%; }
            .chat-welcome { padding: 32px 16px 24px; }
            .chat-welcome img { width: 64px; height: 64px; }
            .chat-welcome h3 { font-size: 17px; }
            .chat-welcome-chips { gap: 6px; }
        }
        @media (max-width: 480px) {
            .chat-header-info .title { font-size: 13px; }
            .chat-header-status { display: none; }
            .chat-welcome p { font-size: 12px; }
            .chat-welcome-chips .mira-chip { font-size: 10px; }
        }

        /* ── Cards ───────────────────────────────────────────────────────── */
        .card {
            background: var(--bg-card); border: 1px solid var(--border);
            border-radius: var(--radius); padding: 18px 20px;
            transition: border-color .15s, box-shadow .15s;
        }
        .card:hover { border-color: rgba(108,92,231,.2); }
        .card + .card { margin-top: 14px; }
        .art-mode-card + .art-mode-card,
        .forge-mode-card + .forge-mode-card { margin-top: 0; }
        .card-row {
            display: flex; align-items: center; gap: 7px;
            font-size: 11px; font-weight: 700; text-transform: uppercase;
            letter-spacing: 0.5px; color: var(--text-dim); margin-bottom: 14px;
        }
        .card-row i { color: var(--accent); }

        /* ── Form elements ───────────────────────────────────────────────── */
        .fg { margin-bottom: 12px; }
        label {
            display: block; font-size: 11px; color: var(--text-dim);
            font-weight: 700; margin-bottom: 4px; text-transform: uppercase;
            letter-spacing: 0.3px;
        }
        input[type="text"],input[type="number"],input[type="url"],input[type="email"],input[type="password"],input[type="search"],select,textarea {
            width: 100%; background: var(--bg); border: 1px solid var(--border);
            color: var(--text); padding: 10px 12px; border-radius: 8px;
            font-size: 13px; font-family: var(--font); outline: none;
            transition: border-color 0.15s, box-shadow 0.15s;
            min-height: 42px;
        }
        input:focus, select:focus, textarea:focus {
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(108,92,231,.1);
        }
        textarea { resize: vertical; min-height: 90px; font-family: var(--mono); font-size: 12px; }
        select { cursor: pointer; }
        input[type="range"] {
            -webkit-appearance: none; appearance: none;
            width: 100%; height: 4px; border-radius: 2px;
            background: var(--border); outline: none; padding: 0; margin: 6px 0;
        }
        input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none; width: 15px; height: 15px;
            border-radius: 50%; background: var(--accent); cursor: pointer;
        }
        .row-inline { display: flex; gap: 8px; align-items: center; }
        .row-inline > *:first-child { flex: 1; }
        .range-val { font-family: var(--mono); font-size: 12px; color: var(--accent); min-width: 36px; text-align: right; }

        /* ── Buttons ─────────────────────────────────────────────────────── */
        .btn {
            padding: 9px 18px; border: none; border-radius: 8px;
            font-size: 13px; font-weight: 600; cursor: pointer;
            transition: all 0.15s; display: inline-flex; align-items: center; gap: 7px;
            -webkit-tap-highlight-color: transparent; touch-action: manipulation;
        }
        .btn:active { transform: scale(0.96); }
        .btn-primary {
            background: linear-gradient(135deg, var(--accent), var(--accent-light));
            color: #fff; box-shadow: 0 4px 14px rgba(108,92,231,0.3);
        }
        .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(108,92,231,0.4); }
        .btn-primary:active { transform: translateY(0) scale(0.97); }
        .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
        .btn-ghost {
            background: var(--bg-hover); color: var(--text);
            border: 1px solid var(--border);
        }
        .btn-ghost:hover { border-color: var(--accent); background: rgba(108,92,231,.06); }
        .btn-ghost:active { transform: scale(0.96); }
        .btn-xs {
            padding: 3px 9px; font-size: 11px; font-weight: 500; cursor: pointer;
            border: 1px solid var(--border); border-radius: 4px;
            background: var(--bg-hover); color: var(--text);
            transition: background 0.12s, border-color 0.12s;
        }
        .btn-xs:hover { border-color: var(--accent); background: rgba(108,92,231,.08); }
        .btn-xs.btn-danger { border-color: #e17055; color: #e17055; }
        .btn-xs.btn-danger:hover { background: rgba(225,112,85,.1); }

        /* ── Response / log area ─────────────────────────────────────────── */
        .resp {
            background: var(--bg); border: 1px solid var(--border);
            border-radius: 8px; padding: 12px; font-family: var(--mono);
            font-size: 12px; line-height: 1.8; min-height: 130px; max-height: 380px;
            overflow-y: auto; color: var(--text-dim); white-space: pre-wrap;
            word-break: break-all;
        }
        .resp.filled { color: var(--text); }
        .c-info    { color: var(--blue); }
        .c-ok      { color: var(--green); }
        .c-warn    { color: var(--orange); }
        .c-err     { color: var(--red); }
        .c-dim     { color: var(--text-dim); }

        /* ── Upload zone ─────────────────────────────────────────────────── */
        .drop-zone {
            border: 2px dashed var(--border); border-radius: var(--radius);
            padding: 22px; text-align: center; cursor: pointer;
            transition: all 0.2s; color: var(--text-dim);
        }
        .drop-zone:hover, .drop-zone.dragover {
            border-color: var(--accent); background: rgba(108,92,231,0.04);
        }
        .drop-zone input { display: none; }
        .drop-zone .dz-icon { font-size: 26px; color: var(--accent); margin-bottom: 6px; opacity: 0.75; }
        .drop-zone p { font-size: 12px; }
        .drop-zone strong { color: var(--accent); }
        .drop-zone .fname { font-family: var(--mono); font-size: 11px; color: var(--green); margin-top: 5px; }

        /* ── KPI row ─────────────────────────────────────────────────────── */
        .kpi-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
        .kpi {
            flex: 1; min-width: 80px;
            background: var(--bg-card); border: 1px solid var(--border);
            border-radius: 10px; padding: 12px; text-align: center;
        }
        .kpi-val  { font-size: 26px; font-weight: 800; line-height: 1; margin-bottom: 3px; }
        .kpi-lbl  { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.3px; }
        .kpi.accent .kpi-val { color: var(--accent-light); }
        .kpi.green  .kpi-val { color: var(--green); }
        .kpi.red    .kpi-val { color: var(--red); }
        .kpi.blue   .kpi-val { color: var(--blue); }
        .kpi.orange .kpi-val { color: var(--orange); }

        /* ── Gateway service status grid ─────────────────────────────────── */
        .svc-status-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
            gap: 8px;
        }
        .svc-stat-card {
            background: var(--bg); border: 1px solid var(--border);
            border-left: 3px solid var(--border);
            border-radius: 8px; padding: 10px 12px;
            display: flex; align-items: center; gap: 9px;
            transition: border-color 0.2s;
        }
        .svc-stat-card.online  { border-left-color: var(--green); }
        .svc-stat-card.offline { border-left-color: var(--red); }
        .svc-stat-card.vacant  { border-left-color: var(--border); opacity: 0.65; }
        .svc-stat-card .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
        .svc-stat-card.online  .dot { background: var(--green); box-shadow: 0 0 5px var(--green); }
        .svc-stat-card.offline .dot { background: var(--red); }
        .svc-stat-card.vacant  .dot { background: var(--text-dim); }
        .svc-stat-info { flex: 1; min-width: 0; }
        .svc-stat-name { font-size: 12px; font-weight: 600; }
        .svc-stat-port { font-size: 10px; font-family: var(--mono); color: var(--text-dim); }
        .svc-stat-lbl  { font-size: 10px; font-weight: 700; }
        .svc-stat-card.online  .svc-stat-lbl { color: var(--green); }
        .svc-stat-card.offline .svc-stat-lbl { color: var(--red); }
        .svc-stat-card.vacant  .svc-stat-lbl { color: var(--text-dim); }

        /* ── Table ───────────────────────────────────────────────────────── */
        .tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
        .tbl th {
            text-align: left; padding: 7px 10px;
            border-bottom: 2px solid var(--border);
            font-size: 10px; font-weight: 700; text-transform: uppercase;
            letter-spacing: 0.5px; color: var(--text-dim);
        }
        .tbl td { padding: 7px 10px; border-bottom: 1px solid var(--border); }
        .tbl tr:hover td { background: var(--bg-hover); }
        .tbl tr:last-child td { border-bottom: none; }

        @keyframes spin { to { transform: rotate(360deg); } }
        @keyframes mira-dot { 0%,80%,100% { opacity:.2; transform:scale(.8); } 40% { opacity:1; transform:scale(1.1); } }

        .svc-card:hover {
            border-color: var(--border-hi, #3a3a58); transform: translateY(-2px);
            box-shadow: 0 8px 30px rgba(0,0,0,0.3);
        }
        .svc-card { position: relative; }
        .svc-card::after {
            content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
            background: transparent; border-radius: var(--radius) var(--radius) 0 0;
            transition: background 0.2s;
        }
        .svc-card:hover::after { background: var(--card-color, var(--accent)); }
        /* ── Gateway status icon ── */
        .svc-stat-icon {
            width: 24px; height: 24px; border-radius: 6px; flex-shrink: 0;
            display: flex; align-items: center; justify-content: center;
            font-size: 11px; background: var(--bg-hover);
        }
        /* ── Copy button ── */
        .resp-copy {
            float: right; padding: 2px 8px; border-radius: 5px; font-size: 10px;
            font-weight: 600; background: var(--bg-hover); border: 1px solid var(--border);
            color: var(--text-dim); cursor: pointer; transition: all 0.15s;
            display: inline-flex; align-items: center; gap: 4px; margin-top: -2px;
        }
        .resp-copy:hover { border-color: var(--accent); color: var(--text); }
        /* ── Pulse animations ── */
        @keyframes pulse-g { 0%,100%{ box-shadow:0 0 0 0 rgba(0,184,148,.5) } 60%{ box-shadow:0 0 0 5px rgba(0,184,148,0) } }
        @keyframes pulse-o { 0%,100%{ box-shadow:0 0 0 0 rgba(253,203,110,.5) } 60%{ box-shadow:0 0 0 5px rgba(253,203,110,0) } }

        /* ── Scrollbar ───────────────────────────────────────────────────── */
        ::-webkit-scrollbar { width: 5px; height: 5px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
        ::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

        /* ── Misc ────────────────────────────────────────────────────────── */
        .mt-12 { margin-top: 12px; }
        .mt-16 { margin-top: 16px; }
        .mb-12 { margin-bottom: 12px; }
        .flex-row { display: flex; gap: 8px; align-items: center; }
        .empty {
            text-align: center; padding: 32px 16px; color: var(--text-dim);
            display: flex; flex-direction: column; align-items: center; gap: 8px;
        }
        .empty i { font-size: 32px; opacity: 0.4; margin-bottom: 8px; display: block; }
        a.nodeco { text-decoration: none; }

        /* ── Tabs ───────────────────────────────────────────────────────── */
        .tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
        .tab-btn { padding: 8px 16px; background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-dim); font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.15s; margin-bottom: -1px; }
        .tab-btn.active { color: var(--accent-light); border-bottom-color: var(--accent); }
        .tab-pane { display: none; }
        .tab-pane.active { display: block; }

        /* ── GEO polish ─────────────────────────────────────────────────── */
        .geo-topbar {
            display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
            padding: 10px 14px; background: var(--surface-2); border-radius: 10px; border: 1px solid var(--border);
            flex-wrap: wrap;
        }
        .geo-chip {
            display: inline-flex; align-items: center; gap: 6px;
            padding: 4px 10px; border-radius: 20px;
            font-size: 10px; font-weight: 700; text-transform: uppercase;
            letter-spacing: .3px; border: 1px solid var(--border);
            background: var(--bg);
        }
        .geo-chip.ok { color: var(--green); border-color: rgba(0,184,148,.35); }
        .geo-chip.info { color: var(--text-dim); }
        .geo-dash-meta {
            display: flex; align-items: center; justify-content: space-between;
            gap: 8px; margin-bottom: 10px; flex-wrap: wrap;
        }
        .geo-dash-grid {
            display: grid; grid-template-columns: auto 1fr; gap: 20px; margin-bottom: 20px; align-items: stretch;
        }
        .geo-kpi-grid {
            display: grid; grid-template-columns: repeat(3,1fr); gap: 12px;
        }
        .geo-error-card {
            text-align: left; padding: 18px; border: 1px solid rgba(225,112,85,.35);
            background: rgba(225,112,85,.08); border-radius: 10px;
            color: var(--text);
        }
        .geo-error-card h4 { font-size: 13px; margin-bottom: 6px; }
        .geo-error-card p { font-size: 12px; color: var(--text-dim); margin-bottom: 10px; }
        .geo-action-grid {
            display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px;
        }
        .geo-action-card {
            background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 14px;
        }
        .geo-action-head {
            display: flex; align-items: center; gap: 7px; margin-bottom: 8px;
            font-size: 12px; font-weight: 700; color: var(--text);
        }
        .geo-action-head i { color: #fdcb6e; }
        .geo-action-card p {
            font-size: 12px; color: var(--text-dim); line-height: 1.6; margin-bottom: 10px;
        }
        .geo-filter-row {
            display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap;
        }
        .geo-filter-btn {
            background: var(--bg); border: 1px solid var(--border); color: var(--text-dim);
            padding: 6px 10px; border-radius: 8px; font-size: 11px; font-weight: 700;
            cursor: pointer; transition: all .15s; display: inline-flex; align-items: center; gap: 6px;
        }
        .geo-filter-btn:hover { border-color: var(--accent); color: var(--text); }
        .geo-filter-btn.active { border-color: rgba(0,184,148,.35); color: var(--green); background: rgba(0,184,148,.08); }
        .geo-rank-list { display: flex; flex-direction: column; gap: 8px; }
        .geo-rank-row {
            display: flex; align-items: center; gap: 10px; border: 1px solid var(--border);
            border-radius: 8px; padding: 8px 10px; background: var(--bg);
        }
        .geo-rank-pos { width: 20px; font-size: 11px; color: var(--text-dim); font-weight: 700; }
        .geo-rank-name { flex: 1; min-width: 0; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .geo-rank-val { font-size: 12px; color: var(--text-dim); font-weight: 700; }
        .geo-bar-block { margin-bottom: 10px; }
        .geo-bar-head { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 4px; color: var(--text-dim); }
        .geo-bar-track { height: 8px; border-radius: 6px; background: var(--border); overflow: hidden; }
        .geo-bar-fill { height: 100%; border-radius: 6px; transition: width .7s ease; }
        /* ── GEO Nav sections (Scrunch-style) ──────────────────────────── */
        .geo-nav-sections { display: flex; align-items: flex-start; gap: 0; margin-bottom: 16px; border-bottom: 1px solid var(--border); padding-bottom: 0; flex-wrap: wrap; }
        /* Admin toggle switch */
        .adm-toggle { width:38px;height:20px;border-radius:10px;background:var(--border);position:relative;cursor:pointer;transition:background .2s }
        .adm-toggle.on { background:#00b894 }
        .adm-toggle-knob { position:absolute;top:3px;left:3px;width:14px;height:14px;border-radius:50%;background:#fff;transition:transform .2s }
        .adm-toggle.on .adm-toggle-knob { transform:translateX(18px) }
        .geo-nav-group { display: flex; flex-direction: column; gap: 4px; padding: 0 20px 0 0; }
        .geo-nav-group-label { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--text-dim); padding: 4px 0 6px; }
        .geo-nav-btns { display: flex; gap: 4px; flex-wrap: wrap; }
        .geo-nav-btn { background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-dim); font-size: 12px; font-weight: 600; padding: 6px 10px 10px; cursor: pointer; border-radius: 6px 6px 0 0; transition: all .15s; display: inline-flex; align-items: center; gap: 6px; margin-bottom: -1px; }
        .geo-nav-btn:hover { color: var(--text); background: var(--bg-hover, rgba(255,255,255,.05)); }
        .geo-nav-btn.active { color: #fdcb6e; border-bottom-color: #fdcb6e; }
        .geo-pane { display: none; }
        .geo-pane.active { display: block; }
        .geo-kpi-strip { display: flex; gap: 10px; flex-wrap: wrap; }
        .geo-kpi-strip .geo-kpi-card { flex: 1; min-width: 120px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; }
        .geo-kpi-strip .geo-kpi-card .kv { font-size: 22px; font-weight: 800; }
        .geo-kpi-strip .geo-kpi-card .kl { font-size: 10px; color: var(--text-dim); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
        .geo-ins-cat { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
        .geo-ins-cat:hover { border-color: #74b9ff; box-shadow: 0 2px 12px rgba(116,185,255,.12); }
        .geo-ins-cat.empty-cat { opacity: .55; cursor: default; }
        .geo-ins-cat.empty-cat:hover { border-color: var(--border); box-shadow: none; }
        .geo-ins-cat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
        .geo-ins-cat-name { font-size: 13px; font-weight: 700; }
        .geo-ins-cat-count { font-size: 28px; font-weight: 800; line-height: 1; margin: 10px 0 4px; }
        .geo-ins-cat-delta { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; background: rgba(0,184,148,.15); color: #00b894; margin-left: 6px; }
        .geo-ins-cat-desc { font-size: 11px; color: var(--text-dim); line-height: 1.5; margin-bottom: 14px; }
        .geo-ins-cat-cta { font-size: 12px; color: #74b9ff; font-weight: 600; text-decoration: none; }
        .geo-ins-cat-cta:hover { text-decoration: underline; }
        /* Site Maps */
        .geo-sm-subtab { background:none;border:none;border-bottom:2px solid transparent;padding:8px 16px;font-size:13px;font-weight:600;color:var(--text-dim);cursor:pointer;transition:color .15s,border-color .15s; }
        .geo-sm-subtab.active { color:var(--text);border-bottom-color:#74b9ff; }
        .geo-sm-subtab:hover:not(.active) { color:var(--text); }
        .geo-sm-score { display:inline-flex;align-items:center;gap:5px; }
        .geo-sm-score .sm-num { font-size:18px;font-weight:800; }
        .geo-sm-badge { font-size:10px;font-weight:700;padding:2px 7px;border-radius:10px; }
        .sm-good { background:rgba(0,184,148,.15);color:#00b894; }
        .sm-average { background:rgba(253,203,110,.15);color:#e6a817; }
        .sm-poor { background:rgba(214,48,49,.12);color:#e84040; }
        .sm-pending { background:rgba(116,185,255,.1);color:#74b9ff; }
        .geo-sm-stat { background:var(--bg-card);border:1px solid var(--border);border-radius:10px;padding:14px 16px; }
        .geo-sm-stat-label { font-size:11px;color:var(--text-dim);margin-bottom:4px; }
        .geo-sm-stat-val { font-size:22px;font-weight:800; }
        .geo-clickable-card { cursor:pointer; }
        .geo-clickable-card:hover { border-color:rgba(108,92,231,.5) !important; box-shadow:0 4px 20px rgba(108,92,231,.10) !important; }
        .geo-action-card.geo-clickable-card:hover { box-shadow:0 4px 20px rgba(108,92,231,.15) !important; background:var(--bg) !important; }
        .geo-topic-tbl thead { position:sticky; top:0; z-index:2; background:var(--bg-card); }
.geo-topic-tbl thead th { padding:10px 14px; font-size:11px; font-weight:600; color:var(--text-dim); white-space:nowrap; }
.geo-topic-tbl tbody tr { border-bottom:1px solid rgba(255,255,255,.04); transition:background .12s; cursor:pointer; }
.geo-topic-tbl tbody tr:hover { background:rgba(108,92,231,.06); }
.geo-topic-tbl td { padding:12px 14px; font-size:13px; vertical-align:middle; }
.geo-sparkline-cell { display:flex; align-items:center; gap:8px; }
.geo-sparkline-stat { display:flex; flex-direction:column; align-items:flex-end; gap:3px; min-width:52px; }
.geo-sparkline-pct { font-weight:700; font-size:13px; }
.geo-trend-badge { display:inline-flex; align-items:center; gap:1px; padding:1px 7px; border-radius:5px; font-size:10px; font-weight:600; border:1px solid; }
.geo-trend-badge.positive { background:rgba(0,184,148,.12); border-color:rgba(0,184,148,.3); color:#00b894; }
.geo-trend-badge.negative { background:rgba(214,48,49,.12); border-color:rgba(214,48,49,.3); color:#d63031; }
.geo-trend-badge.neutral  { background:rgba(99,110,114,.12); border-color:rgba(99,110,114,.3); color:var(--text-dim); }
.geo-comp-list { display:flex; flex-wrap:wrap; gap:4px; align-items:center; }
.geo-comp-chip { display:inline-flex; align-items:center; gap:3px; padding:2px 7px; border-radius:5px; border:1px solid var(--border); background:var(--bg); font-size:10px; white-space:nowrap; }
.geo-comp-chip .geo-chip-name { max-width:14ch; overflow:hidden; text-overflow:ellipsis; }
.geo-comp-more { font-size:10px; color:var(--text-dim); padding:2px 4px; }
.geo-topic-data { display:flex; flex-direction:column; gap:2px; }
.geo-topic-data span.big { font-weight:700; font-size:13px; margin-right:3px; }
.geo-topic-data span.lbl { font-size:11px; color:var(--text-dim); }
.geo-sm-drill { font-size:11px;color:#74b9ff;cursor:pointer;text-decoration:none; }
        .geo-sm-drill:hover { text-decoration:underline; }
        @media (max-width: 980px) {
            .geo-dash-grid { grid-template-columns: 1fr; }
            .geo-kpi-grid { grid-template-columns: 1fr; }
            .geo-action-grid { grid-template-columns: 1fr; }
            .geo-nav-sections { flex-direction: column; }
            .geo-nav-group { padding: 0 0 8px; }
        }

        /* ── Step indicator ─────────────────────────────────────────────── */
        .steps { display: flex; align-items: center; margin-bottom: 18px; }
        .step-node { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: var(--text-dim); padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border); transition: all 0.2s; white-space: nowrap; }
        .step-node.active { color: var(--accent-light); border-color: var(--accent); background: rgba(108,92,231,0.1); }
        .step-node.done   { color: var(--green); border-color: var(--green); }
        .step-sep { flex: 1; height: 1px; background: var(--border); min-width: 10px; max-width: 36px; }

        /* ── Progress bar ────────────────────────────────────────────────── */
        .progress-wrap { background: var(--bg); border-radius: 6px; overflow: hidden; height: 8px; margin: 8px 0; }
        .progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-light)); border-radius: 6px; transition: width 0.4s; }

        /* ── Event feed ─────────────────────────────────────────────────── */
        .event-feed { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; max-height: 220px; overflow-y: auto; padding: 8px; font-family: var(--mono); font-size: 11px; }
        .event-item { padding: 3px 6px; border-radius: 4px; margin-bottom: 2px; line-height: 1.6; }
        .event-item.search   { color: var(--blue); }
        .event-item.progress { color: var(--green); }
        .event-item.error    { color: var(--red); }
        .event-item.cost     { color: var(--orange); }
        .event-item.info, .event-item.default { color: var(--text-dim); }

        /* ── Project list ────────────────────────────────────────────────── */
        .project-list { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; }
        .project-item { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; transition: border-color 0.15s; }
        .project-item:hover { border-color: var(--accent-light); }
        .project-item-info { flex: 1; min-width: 0; }
        .project-item-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .project-item-meta { font-size: 10px; color: var(--text-dim); }
        .project-item-actions { display: flex; gap: 5px; flex-shrink: 0; }
        .icon-action { width: 28px; height: 28px; border-radius: 6px; background: var(--bg-hover); border: 1px solid var(--border); color: var(--text-dim); cursor: pointer; font-size: 11px; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
        .icon-action:hover { border-color: var(--accent); color: var(--accent-light); }
        .icon-action.danger:hover { border-color: var(--red); color: var(--red); }

        /* ── Match badges ────────────────────────────────────────────────── */
        .match-badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 12px; font-size: 10px; font-weight: 700; }
        .match-badge.green  { background: rgba(0,184,148,0.15);  color: var(--green); }
        .match-badge.orange { background: rgba(253,203,110,0.15); color: var(--orange); }
        .match-badge.red    { background: rgba(225,112,85,0.15);  color: var(--red); }

        /* ── Source tiles ────────────────────────────────────────────────── */
        .source-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 14px; }
        .source-tile { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; cursor: pointer; transition: all 0.15s; user-select: none; }
        .source-tile:hover { border-color: var(--accent); }
        .source-tile.selected { border-color: var(--accent); background: rgba(108,92,231,0.08); }
        .source-tile-name { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
        .source-tile-tier { font-size: 10px; color: var(--text-dim); }

        /* ── Column mapping ─────────────────────────────────────────────── */
        .col-map-grid { display: grid; grid-template-columns: 1fr 56px 1fr; gap: 6px 8px; align-items: center; }
        .map-lbl { font-size: 10px; color: var(--text-dim); font-weight: 700; text-transform: uppercase; text-align: center; }

        /* ── Role chips ─────────────────────────────────────────────────── */
        .role-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
        .role-chip { padding: 5px 12px; border-radius: 20px; font-size: 11px; font-weight: 600; border: 1px solid var(--border); background: var(--bg); color: var(--text-dim); cursor: pointer; transition: all 0.15s; user-select: none; }
        .role-chip:hover { border-color: var(--accent); color: var(--text); }
        .role-chip.selected { border-color: var(--accent); background: rgba(108,92,231,0.12); color: var(--accent-light); }

        /* ── Trend cards ─────────────────────────────────────────────────── */
        .trend-card { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; }
        .trend-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
        .trend-rank { width: 26px; height: 26px; border-radius: 50%; background: rgba(108,92,231,0.15); color: var(--accent-light); font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
        .trend-name { font-size: 13px; font-weight: 700; flex: 1; }
        .trend-score { font-family: var(--mono); font-size: 11px; color: var(--orange); font-weight: 700; }
        .trend-desc { font-size: 11px; color: var(--text-dim); }

        /* ── Article list ────────────────────────────────────────────────── */
        .article-item { border-bottom: 1px solid var(--border); padding: 10px 0; }
        .article-item:last-child { border-bottom: none; }
        .article-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
        .article-meta { font-size: 10px; color: var(--text-dim); display: flex; gap: 12px; flex-wrap: wrap; }
        .article-score { padding: 1px 7px; border-radius: 10px; background: rgba(0,184,148,0.12); color: var(--green); font-size: 10px; font-weight: 700; }

        /* ── Chat ────────────────────────────────────────────────────────── */
        .chat-history { max-height: 220px; overflow-y: auto; padding: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; }
        .chat-msg { padding: 8px 12px; border-radius: 8px; margin-bottom: 6px; font-size: 12px; line-height: 1.5; }
        .chat-msg.user { background: rgba(108,92,231,0.12); color: var(--text); margin-left: 20%; }
        .chat-msg.mira { background: var(--bg-hover); color: var(--text); margin-right: 20%; }
        .chat-msg.assistant { background: var(--bg-hover); color: var(--text); margin-right: 20%; }
        .chat-msg.mira strong { color: var(--accent-light); font-size: 10px; display: block; margin-bottom: 3px; }
        .chat-bubble { line-height: 1.5; }
        .chat-input-row { display: flex; gap: 8px; }
        .chat-input-row input { flex: 1; }

        /* ── Mira Markdown Rendering ─────────────────────────────────────── */
        .mira-h2 { font-size: 15px; font-weight: 700; color: var(--text); margin: 16px 0 8px 0; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
        .mira-h2:first-child { margin-top: 4px; }
        .mira-h3 { font-size: 13.5px; font-weight: 700; color: var(--text); margin: 12px 0 6px 0; }
        .mira-h4 { font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin: 10px 0 4px 0; }
        .mira-ul, .mira-ol { margin: 6px 0; padding-left: 20px; }
        .mira-ul li, .mira-ol li { margin-bottom: 3px; line-height: 1.6; }
        .mira-ul li::marker { color: var(--accent); }
        .mira-ol li::marker { color: var(--accent); font-weight: 600; }
        .mira-code { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; font-family: var(--mono); font-size: 11.5px; overflow-x: auto; margin: 10px 0; display: block; line-height: 1.5; }
        .mira-code code { font-family: inherit; font-size: inherit; background: none; padding: 0; }
        .mira-inline-code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-family: var(--mono); font-size: 11.5px; border: 1px solid var(--border); }
        .mira-link { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(108,92,231,.3); transition: border-color .15s; }
        .mira-link:hover { border-bottom-color: var(--accent); }
        .mira-hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
        .mira-blockquote { border-left: 3px solid var(--accent); padding: 4px 12px; margin: 8px 0; color: var(--text-dim); font-style: italic; background: rgba(108,92,231,.04); border-radius: 0 6px 6px 0; }
        .mira-table-wrap { overflow-x: auto; margin: 10px 0; border-radius: 8px; border: 1px solid var(--border); }
        .mira-table { width: 100%; border-collapse: collapse; font-size: 12px; }
        .mira-table th { background: var(--bg); padding: 6px 10px; text-align: left; font-weight: 600; border-bottom: 2px solid var(--border); }
        .mira-table td { padding: 5px 10px; border-bottom: 1px solid var(--border); }
        .mira-table tr:last-child td { border-bottom: none; }
        .mira-table tr:hover td { background: var(--bg-hover); }
        .mira-content { overflow-wrap: break-word; word-break: break-word; }
        .mira-content > br:first-child { display: none; }

        /* Project item shorthand aliases */
        .project-info { flex: 1; min-width: 0; }
        .project-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .project-meta { font-size: 10px; color: var(--text-dim); }
        .project-actions { display: flex; gap: 5px; flex-shrink: 0; }
        .project-item.active { border-color: var(--accent); background: rgba(108,92,231,0.06); }
        .project-ico { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
        /* KPI cards */
        .kpi-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; min-width: 100px; text-align: center; }
        .kpi-val { font-size: 22px; font-weight: 700; line-height: 1.2; }
        .kpi-lbl { font-size: 11px; color: var(--text-dim); margin-top: 3px; }
        /* Source tile active alias */
        .source-tile.active { border-color: var(--accent); background: rgba(108,92,231,0.08); }
        /* Role chip active alias */
        .role-chip.active { border-color: var(--accent); background: rgba(108,92,231,0.12); color: var(--accent-light); }
        /* Trend rank/score */
        .trend-rank { font-size: 11px; font-weight: 700; color: var(--text-dim); margin-bottom: 2px; }
        .trend-name { font-size: 13px; font-weight: 600; }
        .trend-score { font-size: 11px; color: var(--accent-light); }
        .trend-desc { font-size: 11px; color: var(--text-dim); margin-top: 4px; line-height: 1.5; }
        /* Column mapping select */
        .map-sel { padding: 5px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); font-size: 11px; width: 100%; }
        .col-map-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; align-items: center; margin-bottom: 10px; }

        /* ── Buttons ──────────────────────────────────────────────────────── */
        .btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: all 0.15s; text-decoration: none; white-space: nowrap; font-family: var(--font); }
        .btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
        .btn-primary  { background: var(--accent); color: #fff; border-color: var(--accent); }
        .btn-primary:hover  { filter: brightness(1.12); }
        .btn-ghost    { background: var(--bg-hover); color: var(--text); border-color: var(--border); }
        .btn-ghost:hover    { border-color: var(--accent); color: var(--accent-light); }
        .btn-ghost.active   { border-color: var(--accent); color: var(--accent-light); background: rgba(108,92,231,.1); }
        .btn-secondary { background: transparent; color: var(--text-dim); border-color: var(--border); }
        .btn-secondary:hover { border-color: var(--accent); color: var(--text); }

        /* ── Form base ────────────────────────────────────────────────────── */
        input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not(.input-xs), select:not(.select-xs), textarea {
            display: block; width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
            background: var(--bg); color: var(--text); font-size: 13px; font-family: var(--font);
            transition: border-color 0.15s; box-sizing: border-box;
        }
        input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not(.input-xs):focus, select:focus, textarea:focus {
            outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(108,92,231,0.12);
        }
        textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
        .fg { margin-bottom: 12px; }
        .fg label { display: block; font-size: 11px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 5px; }

        /* ── Card ─────────────────────────────────────────────────────────── */
        .card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; }
        .card-row { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }

        /* ── Two-column grid ──────────────────────────────────────────────── */
        .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
        @media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }

        /* ── Service header ───────────────────────────────────────────────── */
        .svc-header {
            display: flex; align-items: center; gap: 18px; padding: 20px 24px;
            background: var(--bg-card); border: 1px solid var(--border);
            border-radius: 16px; margin-bottom: 20px;
            position: relative; overflow: hidden;
        }
        .svc-header::before {
            content: ''; position: absolute; inset: 0;
            background: linear-gradient(135deg, rgba(108,92,231,.04) 0%, transparent 60%);
            pointer-events: none;
        }
        .svc-header-avatar { position: relative; flex-shrink: 0; }
        .svc-header-avatar img {
            width: 56px; height: 56px; border-radius: 14px;
            object-fit: cover; object-position: top; display: block;
            border: 2px solid rgba(108,92,231,.25);
            box-shadow: 0 4px 12px rgba(108,92,231,.1);
        }
        .svc-header-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
        .svc-header-identity { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
        .svc-header-identity h2 { font-size: 17px; font-weight: 800; margin: 0; letter-spacing: -0.3px; }
        .svc-header-role { font-size: 12px; color: var(--text-dim); font-weight: 500; }
        .svc-header-port { font-size: 10px; color: var(--text-dim); background: var(--bg-hover); padding: 2px 7px; border-radius: 6px; font-family: monospace; font-weight: 500; }
        .svc-header-bio { font-size: 12px; color: var(--text-dim); line-height: 1.5; margin: 2px 0 0; max-width: 600px; }
        .svc-header-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
        .svc-header-photo { display: none; }
        .svc-icon { width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; }
        .svc-meta { flex: 1; min-width: 0; }
        .svc-meta h2 { font-size: 18px; font-weight: 800; margin-bottom: 2px; }
        .svc-meta p  { font-size: 12px; color: var(--text-dim); }
        .svc-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

        /* ── Badge ────────────────────────────────────────────────────────── */
        .badge { padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
        .badge.online   { background: rgba(0,184,148,0.12);  color: var(--green);    }
        .badge.offline  { background: rgba(225,112,85,0.12); color: var(--red);      }
        .badge.checking { background: var(--bg-hover);       color: var(--text-dim); }

        /* ── KPI row ──────────────────────────────────────────────────────── */
        .kpi-row { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
        .kpi { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; flex: 1; min-width: 90px; border-left: 3px solid var(--border); }
        .kpi.accent { border-left-color: var(--accent); }  .kpi.green { border-left-color: var(--green); }
        .kpi.red    { border-left-color: var(--red);    }  .kpi.blue  { border-left-color: var(--blue);  }
        .kpi.orange { border-left-color: var(--orange); }

        /* ── Drop zone ────────────────────────────────────────────────────── */
        .drop-zone { border: 2px dashed var(--border); border-radius: 10px; padding: 24px 16px; text-align: center; cursor: pointer; transition: border-color 0.15s; position: relative; }
        .drop-zone:hover { border-color: var(--accent); }
        .drop-zone input[type=file] { display: none; position: absolute; }
        .dz-icon { font-size: 28px; color: var(--text-dim); margin-bottom: 8px; }
        .drop-zone p { font-size: 12px; color: var(--text-dim); margin: 3px 0; }
        .fname { font-size: 11px; color: var(--green); margin-top: 6px; min-height: 18px; }

        /* ── Datapoint tag input ──────────────────────────────────────────── */
        .dp-tag-input { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--surface); cursor: text; min-height: 48px; }
        .dp-tag { display:inline-flex;align-items:center;gap:5px;background:rgba(108,92,231,0.15);color:var(--accent-light);border-radius:20px;padding:2px 10px 2px 10px;font-size:11px;font-weight:600; }
        .dp-tag .rm { cursor:pointer;opacity:0.6;font-size:10px;margin-left:2px; }
        .dp-tag .rm:hover { opacity:1;color:var(--red); }

        /* ── Response / terminal ──────────────────────────────────────────── */
        .resp { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; font-family: var(--mono); font-size: 11px; line-height: 1.7; white-space: pre-wrap; overflow-x: auto; max-height: 360px; min-height: 40px; color: var(--text-dim); }
        .c-ok { color: var(--green); } .c-err { color: var(--red); } .c-warn { color: var(--orange); } .c-info { color: var(--blue); } .c-dim { color: var(--text-dim); }

        /* ── Inline row / range ───────────────────────────────────────────── */
        .row-inline { display: flex; align-items: center; gap: 10px; }
        .row-inline input[type=range] { flex: 1; accent-color: var(--accent); }
        .range-val { font-size: 12px; font-weight: 700; color: var(--accent-light); min-width: 36px; text-align: right; }

        /* ── Service status grid (Gateway) ────────────────────────────────── */
        .svc-status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
        .svc-stat-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; align-items: center; gap: 8px; font-size: 12px; }
        .svc-stat-card .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--border); }
        .svc-stat-card.online  .dot { background: var(--green); }
        .svc-stat-card.offline .dot { background: var(--red);   }
        .svc-stat-card.vacant  .dot { background: var(--text-dim); }
        .svc-stat-info { flex: 1; min-width: 0; }
        .svc-stat-name { font-size: 12px; font-weight: 600; }
        .svc-stat-port { font-size: 10px; color: var(--text-dim); }
        .svc-stat-lbl  { font-size: 11px; font-weight: 700; flex-shrink: 0; }
        .svc-stat-card.online  .svc-stat-lbl { color: var(--green); }
        .svc-stat-card.offline .svc-stat-lbl { color: var(--red);   }
        .svc-stat-card.vacant  .svc-stat-lbl { color: var(--text-dim); }

        /* ── Spinner ──────────────────────────────────────────────────────── */
        @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

        /* ── Content sections (storytelling) ──────────────────────────────── */
        .story-section { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
        .story-section:last-child { border-bottom: none; }
        .story-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
        .story-section p  { font-size: 13px; line-height: 1.8; color: var(--text-dim); white-space: pre-wrap; }

        /* ── Phase indicators (press clipping) ────────────────────────────── */
        .pc-phase { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; border: 1px solid var(--border); background: var(--bg); color: var(--text-dim); display: inline-flex; align-items: center; gap: 4px; }
        .pc-phase.active { border-color: var(--accent); background: rgba(108,92,231,0.1); color: var(--accent-light); }
        .pc-phase.done   { border-color: var(--green);  background: rgba(0,184,148,0.1);  color: var(--green); }

        /* ── Competitor chip (geo) ────────────────────────────────────────── */
        .comp-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; border: 1px solid var(--border); background: var(--bg); max-width: 260px; }
        .comp-chip.accepted { border-color: var(--green); background: rgba(0,184,148,0.08); color: var(--green); }
        .comp-chip-del { cursor: pointer; opacity: 0.5; }
        .comp-chip-del:hover { opacity: 1; color: var(--red); }

        /* ── Trend card header ────────────────────────────────────────────── */
        .trend-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }

        /* ── Mira Chat widget ─────────────────────────────────────────────── */
        .mira-chat-wrap { position: relative; margin-top: 28px; }
        .mira-chat-header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; border-bottom: none; cursor: pointer; user-select: none; }
        .mira-chat-avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #a29bfe); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
        .mira-chat-title { font-size: 14px; font-weight: 700; flex: 1; }
        .mira-chat-subtitle { font-size: 11px; color: var(--text-dim); }
        .mira-chat-toggle { font-size: 11px; color: var(--text-dim); transition: transform 0.2s; }
        .mira-chat-toggle.open { transform: rotate(180deg); }
        .mira-chat-body { background: var(--bg-card); border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; transition: max-height 0.3s ease; max-height: 600px; }
        .mira-chat-body.collapsed { max-height: 0; border-width: 0 1px 1px 1px; }
        .mira-chat-messages { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; max-height: 340px; overflow-y: auto; }
        .mira-msg { max-width: 80%; padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 1.6; }
        .mira-msg.user { background: rgba(108,92,231,0.12); color: var(--text); align-self: flex-end; border-bottom-right-radius: 3px; }
        .mira-msg.mira { background: var(--bg); border: 1px solid var(--border); color: var(--text); align-self: flex-start; border-bottom-left-radius: 3px; }
        .mira-msg.mira .mira-name { font-size: 10px; font-weight: 700; color: var(--accent-light); display: block; margin-bottom: 4px; }
        .mira-msg.thinking { opacity: 0.6; font-style: italic; }
        .mira-chips { padding: 0 16px 10px; display: flex; flex-wrap: wrap; gap: 6px; }
        .mira-chip { padding: 4px 10px; border-radius: 16px; font-size: 11px; border: 1px solid var(--border); background: var(--bg); color: var(--text-dim); cursor: pointer; transition: all 0.15s; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
        .mira-chip svg { flex-shrink: 0; opacity: 0.7; }
        .mira-chip:hover svg { opacity: 1; }
        .mira-chip:hover { border-color: var(--accent); color: var(--text); background: rgba(108,92,231,0.06); }
        .mira-chat-input-row { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--bg); }
        .mira-chat-input { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: 20px; background: var(--bg-card); color: var(--text); font-size: 13px; font-family: var(--font); outline: none; transition: border-color 0.15s; }
        .mira-chat-input:focus { border-color: var(--accent); }
        .mira-chat-send { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); border: none; color: #fff; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: filter 0.15s; }
        .mira-chat-send:hover { filter: brightness(1.15); }
        .mira-chat-send:disabled { opacity: 0.4; cursor: not-allowed; }
        .mira-learn-toast { font-size: 10px; color: var(--green); padding: 3px 8px; border-radius: 8px; background: rgba(0,184,148,0.1); border: 1px solid rgba(0,184,148,0.2); margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; }
        .mira-kb-badge { font-size: 10px; color: var(--text-dim); margin-left: auto; }

        /* ── Mira persona ─────────────────────────────────────────────────── */
        .mira-intro {
            display: flex; align-items: flex-start; gap: 20px;
            background: linear-gradient(135deg, rgba(108,92,231,0.10) 0%, rgba(116,185,255,0.06) 100%);
            border: 1px solid rgba(108,92,231,0.25); border-radius: var(--radius);
            padding: 22px 26px; margin-bottom: 22px; position: relative; overflow: hidden;
        }
        .mira-intro::after {
            content: ''; position: absolute; top: -40px; right: -40px;
            width: 180px; height: 180px; border-radius: 50%;
            background: radial-gradient(circle, rgba(108,92,231,0.08), transparent 70%);
            pointer-events: none;
        }
        .mira-avatar {
            width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0;
            background: linear-gradient(135deg, var(--accent), var(--accent-light));
            display: flex; align-items: center; justify-content: center;
            font-size: 22px; color: #fff;
            box-shadow: 0 0 0 4px rgba(108,92,231,0.15), 0 4px 18px rgba(108,92,231,0.35);
            position: relative; overflow: hidden;
        }
        .mira-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
        .mira-avatar.online::before {
            content: ''; position: absolute; bottom: 2px; right: 2px;
            width: 12px; height: 12px; border-radius: 50%;
            background: var(--green); border: 2px solid var(--bg-card);
            box-shadow: 0 0 6px var(--green);
        }
        .mira-avatar.pulse { animation: mira-pulse 3s ease-in-out infinite; }
        @keyframes mira-pulse {
            0%, 100% { box-shadow: 0 0 0 4px rgba(108,92,231,0.15), 0 4px 18px rgba(108,92,231,0.35); }
            50%       { box-shadow: 0 0 0 8px rgba(108,92,231,0.08), 0 4px 24px rgba(108,92,231,0.5); }
        }
        .mira-intro-body { flex: 1; min-width: 0; }
        .mira-intro-body h2 { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
        .mira-intro-body h2 span { color: var(--accent-light); }
        .mira-intro-body p { font-size: 13px; color: var(--text-dim); line-height: 1.7; }
        .mira-caps { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
        .mira-cap {
            display: inline-flex; align-items: center; gap: 5px;
            padding: 4px 11px; border-radius: 20px; font-size: 11px; font-weight: 600;
            background: rgba(108,92,231,0.1); border: 1px solid rgba(108,92,231,0.2);
            color: var(--accent-light);
        }
        .mira-quote-bar {
            background: var(--bg-card); border: 1px solid var(--border);
            border-left: 3px solid var(--accent);
            border-radius: var(--radius); padding: 12px 18px;
            font-size: 12px; color: var(--text-dim); margin-bottom: 22px;
            display: flex; align-items: center; gap: 10px; min-height: 44px;
        }
        .mira-quote-bar i { color: var(--accent-light); flex-shrink: 0; }
        #mira-quote-text { flex: 1; font-style: italic; transition: opacity 0.4s; }
        /* ── Mira Video Modal ───────────────────────────────────────────── */
        .video-overlay {
            display: none; position: fixed; inset: 0; z-index: 2000;
            background: rgba(0,0,0,0.75); backdrop-filter: blur(6px);
            align-items: center; justify-content: center;
        }
        .video-overlay.open { display: flex; }
        .video-modal {
            position: relative; display: flex; flex-direction: column;
            align-items: center; gap: 20px;
        }
        .video-circle {
            width: 320px; height: 320px; border-radius: 50%; overflow: hidden;
            border: 3px solid var(--accent);
            box-shadow: 0 0 60px rgba(108,92,231,0.45), 0 0 120px rgba(108,92,231,0.15);
            background: var(--bg);
        }
        .video-circle video { width: 100%; height: 100%; object-fit: cover; display: block; transform: scale(1.3) translateY(8%); }
        .video-close {
            position: absolute; top: -14px; right: -14px;
            width: 32px; height: 32px; border-radius: 50%;
            background: var(--bg-card); border: 1px solid var(--border);
            color: var(--text); font-size: 16px; cursor: pointer;
            display: flex; align-items: center; justify-content: center;
            transition: all .15s;
        }
        .video-close:hover { background: #ef4444; border-color: #ef4444; color: #fff; }
        .video-label { text-align: center; font-size: 16px; font-weight: 600; color: var(--text); }
        .video-label span { display: block; font-size: 12px; color: var(--text-dim); font-weight: 400; margin-top: 4px; }
        /* ── Lens Gallery Modal ──────────────────────────────────────────── */
        .lens-gallery-overlay {
            display: none; position: fixed; inset: 0; z-index: 2100;
            background: rgba(0,0,0,0.82); backdrop-filter: blur(4px);
            align-items: center; justify-content: center;
        }
        .lens-gallery-overlay.open { display: flex; }
        .lens-gallery-modal {
            width: min(92vw, 980px);
            max-height: 90vh;
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 12px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            position: relative;
        }
        .lens-gallery-main {
            position: relative;
            border-radius: 10px;
            overflow: hidden;
            background: #0f172a;
            min-height: 320px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .lens-gallery-main img {
            max-width: 100%;
            max-height: 58vh;
            object-fit: contain;
            display: block;
        }
        .lens-gallery-nav {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            width: 34px;
            height: 34px;
            border-radius: 50%;
            border: 1px solid rgba(255,255,255,0.25);
            background: rgba(0,0,0,0.42);
            color: #fff;
            cursor: pointer;
        }
        .lens-gallery-nav.left { left: 10px; }
        .lens-gallery-nav.right { right: 10px; }
        .lens-gallery-thumbs {
            display: flex;
            gap: 6px;
            overflow-x: auto;
            padding-bottom: 2px;
        }
        .lens-gallery-thumbs img {
            width: 74px;
            height: 56px;
            object-fit: cover;
            border-radius: 6px;
            border: 2px solid var(--border);
            cursor: pointer;
            flex-shrink: 0;
        }
        .lens-gallery-thumbs img.active { border-color: var(--green); }
        .lens-gallery-title { font-size: 12px; color: var(--text-dim); }
        .lens-gallery-close {
            position: absolute;
            right: 10px;
            top: 10px;
            width: 30px;
            height: 30px;
            border-radius: 50%;
            border: 1px solid var(--border);
            background: var(--bg-card);
            color: var(--text);
            cursor: pointer;
            z-index: 2;
        }
        /* play badge on avatar */
        .mira-avatar.clickable { cursor: pointer; }
        .mira-avatar .play-badge {
            position: absolute; bottom: 2px; right: 2px;
            width: 20px; height: 20px; border-radius: 50%;
            background: var(--accent); display: flex; align-items: center; justify-content: center;
            font-size: 8px; color: #fff; border: 2px solid var(--bg-card);
            transition: transform .15s;
        }
        .mira-avatar.clickable:hover .play-badge { transform: scale(1.2); }

        /* ── Agent avatars ─────────────────────────────────────────────────── */
        .agent-av {
            display: flex; align-items: center; justify-content: center;
            font-weight: 800; color: #fff; letter-spacing: -0.5px;
            flex-shrink: 0; user-select: none;
        }

        /* ── Team grid ─────────────────────────────────────────────────────── */
        .team-section { margin-bottom: 22px; }
        .team-section-header {
            display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
        }
        .team-section-header .ts-label {
            font-size: 11px; font-weight: 700; text-transform: uppercase;
            letter-spacing: 1px; color: var(--text-dim);
        }
        .team-section-header .ts-sub { font-size: 11px; color: var(--text-dim); }
        .team-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
            gap: 8px;
        }
        .agent-card {
            background: var(--bg-card); border: 1px solid var(--border);
            border-radius: var(--radius); padding: 11px 13px;
            display: flex; align-items: center; gap: 10px;
            cursor: pointer; transition: all 0.18s; position: relative;
        }
        .agent-card:hover {
            border-color: var(--card-color, var(--accent));
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(0,0,0,0.18);
        }
        .agent-card-info { flex: 1; min-width: 0; }
        .agent-card-name { font-size: 13px; font-weight: 700; }
        .agent-card-role { font-size: 10px; color: var(--text-dim); }
        .agent-card-svc  { font-size: 10px; color: var(--text-dim); font-family: var(--mono); margin-top: 1px; }
        .agent-status-dot {
            width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
            background: var(--border); transition: all 0.3s;
        }
        .agent-status-dot.online  { background: var(--green); box-shadow: 0 0 5px var(--green); }
        .agent-status-dot.offline { background: var(--red); }

        /* ── Agent badge in svc header ─────────────────────────────────────── */
        .svc-agent-badge { display: none; }

        /* ── Nav agent sub-label ───────────────────────────────────────────── */
        .nav-agent-sub { font-size: 10px; color: var(--text-dim); line-height: 1.2; margin-top: 1px; }

/* ══ Shared UI kit ═══════════════════════════════════════════════════════════
   State blocks, status tones and section primitives used by every tool.
   Rendered from js/ui.js so the same situation looks the same in every view. */

/* ── State blocks (empty · loading · error) ──────────────────────────────── */
.state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; text-align: center; padding: 44px 20px; color: var(--text-dim);
}
.state.compact { padding: 22px 14px; }
.state > i { font-size: 30px; opacity: .35; }
.state.error > i { opacity: .8; color: var(--red); }
.state-title { font-size: 14px; font-weight: 600; color: var(--text); }
.state-hint { font-size: 12.5px; line-height: 1.5; max-width: 440px; }
.state .btn { margin-top: 6px; }

/* ── Spinner & skeletons ─────────────────────────────────────────────────── */
.ui-spinner {
    width: 22px; height: 22px; border-radius: 50%; display: inline-block;
    border: 2px solid var(--border); border-top-color: var(--accent);
    animation: uiSpin .8s linear infinite;
}
.ui-spinner.sm { width: 14px; height: 14px; }
@keyframes uiSpin { to { transform: rotate(360deg); } }
.skeleton-list { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; }
.skeleton-row {
    height: 34px; border-radius: 8px;
    background: linear-gradient(90deg, var(--bg-hover) 25%, var(--border) 37%, var(--bg-hover) 63%);
    background-size: 400% 100%; animation: uiShimmer 1.4s ease infinite;
}
@keyframes uiShimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) {
    .ui-spinner, .skeleton-row { animation: none; }
}

/* ── Status tones ────────────────────────────────────────────────────────── */
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge.tone-ok   { background: rgba(0,184,148,.12);   color: var(--green);        }
.badge.tone-busy { background: rgba(108,92,231,.14);  color: var(--accent-light); }
.badge.tone-warn { background: rgba(253,203,110,.14); color: var(--orange);       }
.badge.tone-bad  { background: rgba(225,112,85,.12);  color: var(--red);          }
.badge.tone-idle { background: rgba(136,136,160,.12); color: var(--text-dim);     }

/* ── Section header (card titles) ────────────────────────────────────────── */
.section-head {
    display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
    padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.section-head > i { color: var(--accent); font-size: 13px; }
.section-head h3 {
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .8px; color: var(--text); margin: 0;
}
.section-head .section-sub { font-size: 11.5px; color: var(--text-dim); text-transform: none; letter-spacing: 0; font-weight: 500; }
.section-head .section-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }

/* ── Inline help ─────────────────────────────────────────────────────────── */
.hint { font-size: 11.5px; color: var(--text-dim); line-height: 1.5; }
.hint-row {
    display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
    border-radius: 10px; background: var(--bg-hover); border: 1px solid var(--border);
    font-size: 12px; color: var(--text-dim); line-height: 1.5;
}
.hint-row > i { color: var(--accent); margin-top: 2px; flex-shrink: 0; }

/* ── Table conventions ───────────────────────────────────────────────────── */
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl td.actions, .tbl th.actions { text-align: right; white-space: nowrap; }
.tbl .muted { color: var(--text-dim); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* ── Focus visibility (keyboard navigation) ──────────────────────────────── */
.btn:focus-visible, .nav-item:focus-visible, .tab-btn:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ── Home-card and nav status tones (same vocabulary as .badge) ──────────── */
.svc-card-badge.tone-ok   { background: rgba(0,184,148,.15);   color: var(--green);        }
.svc-card-badge.tone-busy { background: rgba(108,92,231,.15);  color: var(--accent-light); }
.svc-card-badge.tone-warn { background: rgba(253,203,110,.15); color: var(--orange);       }
.svc-card-badge.tone-bad  { background: rgba(225,112,85,.15);  color: var(--red);          }
.svc-card-badge.tone-idle { background: rgba(136,136,160,.12); color: var(--text-dim);     }
.nav-dot.tone-ok   { background: var(--green);    }
.nav-dot.tone-busy { background: var(--accent);   }
.nav-dot.tone-warn { background: var(--orange);   }
.nav-dot.tone-bad  { background: var(--red);      }
.nav-dot.tone-idle { background: var(--text-dim); }

/* Explanatory row under a tool header always separates from the content below. */
.hint-row { margin-bottom: 12px; }

/* State blocks keep the UI font even inside monospace response panels. */
.state { font-family: var(--font); white-space: normal; }

/* ── Secondary text, anywhere (not only inside .tbl) ─────────────────────── */
.muted { color: var(--text-dim); }

/* ── Horizontal scroll container for wide tables ─────────────────────────── */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl-wrap > .tbl { min-width: 100%; }

/* ── Counts and timing under a progress bar ──────────────────────────────── */
.progress-meta {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    font-size: 11.5px; color: var(--text-dim); margin-top: 6px; flex-wrap: wrap;
}
.progress-meta .num { font-variant-numeric: tabular-nums; }

/* ── Toast: warning tone (matches uiStatusBadge's warn) ──────────────────── */
.toast.warning { border-left: 3px solid var(--orange); }

/* ── Disabled controls (self-protection rules, read-only roles) ──────────── */
.btn-xs:disabled, .btn:disabled, select:disabled, input:disabled, textarea:disabled {
    opacity: .45; cursor: not-allowed;
}

/* ── Compact form controls inside dense tables and filter bars ───────────── */
/* Element-qualified so these win over the base `input[type=...]` rule, which is
   more specific than a bare class and would otherwise force width:100%. */
.select-xs, .input-xs, select.select-xs, input.input-xs {
    padding: 4px 8px; font-size: 11px; border-radius: 6px;
    width: auto; min-height: 0; min-width: 0;
    border: 1px solid var(--border); background: var(--bg);
    color: var(--text); font-family: var(--font); box-sizing: border-box;
}
.input-xs:focus, .select-xs:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(108, 92, 231, .12);
}

/* ── Destructive action at full size (dialogs) ───────────────────────────── */
.btn.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }

/* ── One-time secret (API key shown once on create/regenerate) ───────────── */
.secret-reveal {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 12px 14px; border-radius: 10px;
    background: rgba(253,203,110,.08); border: 1px solid rgba(253,203,110,.35);
}
.secret-reveal code {
    flex: 1; min-width: 220px; font-family: var(--mono); font-size: 12px;
    word-break: break-all; color: var(--text);
}
.secret-reveal .secret-warning { flex-basis: 100%; font-size: 11.5px; color: var(--orange); }

/* Visually hidden but announced by screen readers. */
.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;
}

/* ── "Report a problem" widget (Mira) ─────────────────────────────────────── */
/* Fixed bottom-right on every page. Sits below toasts and above page content. */
.fb-launcher {
    position: fixed; right: 20px; bottom: 20px; z-index: 900;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 16px; border: none; border-radius: 24px;
    background: var(--accent); color: #fff;
    font-size: 12.5px; font-weight: 700; font-family: inherit; cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
    transition: transform .15s ease, box-shadow .15s ease;
}
.fb-launcher:hover { transform: translateY(-1px); box-shadow: 0 9px 26px rgba(0, 0, 0, .28); }
.fb-launcher:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.fb-launcher i { font-size: 14px; }

.fb-panel {
    position: fixed; right: 20px; bottom: 20px; z-index: 901;
    width: 370px; max-width: calc(100vw - 32px);
    height: 520px; max-height: calc(100vh - 40px);
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--bg-card); color: var(--text);
    border: 1px solid var(--border); border-radius: 14px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, .32);
}
.fb-head {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(108, 92, 231, .10), transparent);
}
.fb-head-title { font-size: 13px; font-weight: 800; }
.fb-head-sub { font-size: 10.5px; color: var(--text-dim); }

.fb-avatar {
    width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: #fff; font-size: 12px; font-weight: 800;
}

.fb-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.fb-msg { display: flex; align-items: flex-start; gap: 8px; }
.fb-msg-user { justify-content: flex-end; }
.fb-bubble {
    max-width: 82%; padding: 8px 12px; border-radius: 12px;
    font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.fb-msg-mira .fb-bubble { background: var(--bg2); border: 1px solid var(--border); border-top-left-radius: 4px; }
.fb-msg-user .fb-bubble { background: var(--accent); color: #fff; border-top-right-radius: 4px; }

.fb-typing { display: inline-flex; gap: 4px; align-items: center; padding: 12px; }
.fb-typing span {
    width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim);
    animation: fb-bounce 1.2s infinite ease-in-out;
}
.fb-typing span:nth-child(2) { animation-delay: .18s; }
.fb-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes fb-bounce { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .fb-typing span { animation: none; } .fb-launcher { transition: none; } }

.fb-composer { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); align-items: flex-end; }
.fb-composer textarea {
    flex: 1; resize: none; padding: 8px 10px; font-family: inherit; font-size: 12.5px;
    color: var(--text); background: var(--input-bg);
    border: 1px solid var(--border); border-radius: 9px;
}
.fb-composer textarea:focus { outline: none; border-color: var(--accent); }
.fb-composer .btn { height: 34px; }

.fb-done { padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 9px; }
.fb-filed { display: flex; align-items: flex-start; gap: 9px; font-size: 12px; }
.fb-filed i { color: var(--green); margin-top: 2px; }
.fb-filed-title { font-weight: 700; }
.fb-filed-sub { color: var(--text-dim); font-size: 11px; line-height: 1.5; }

@media (max-width: 640px) {
    .fb-launcher span { display: none; }
    .fb-launcher { padding: 12px 14px; border-radius: 50%; }
    .fb-panel { right: 12px; left: 12px; bottom: 12px; width: auto; height: min(70vh, 520px); }
}

/* Keep the last row of the Quality tables clear of the floating report widget. */
#view-quality { padding-bottom: 76px; }

/* ── Clocky (time booking) ───────────────────────────────────────────────── */
/* Its primary actions sit bottom-right, exactly where the report widget floats. */
#view-clocky { padding-bottom: 76px; }
.clocky-avatar {
    width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
    font-size: 26px; color: #00cec9; background: rgba(0,206,201,.14);
}
label.clocky-check {
    display: flex; align-items: center; gap: 8px; margin: 0 0 6px; cursor: pointer;
    font-size: 12.5px; font-weight: 500; color: var(--text); text-transform: none; letter-spacing: 0;
}
label.clocky-check input { width: auto; margin: 0; accent-color: var(--accent); }
label.clocky-check.mb-12 { margin-bottom: 14px; }
.clocky-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; font-size: 12px; }
.clocky-grid { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 12px; align-items: end; }
@media (max-width: 800px) { .clocky-grid { grid-template-columns: 1fr 1fr; } }
.clocky-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.clocky-steps { display: flex; gap: 6px; list-style: none; margin: 0 0 14px; padding: 0; flex-wrap: wrap; }
.clocky-steps li { flex: 1; min-width: 110px; }
.clocky-steps button {
    width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
    color: var(--text-dim); font: 600 12px var(--font);
}
.clocky-steps button:disabled { cursor: default; opacity: .55; }
.clocky-step-dot {
    width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: var(--bg-hover); font-size: 11px; font-variant-numeric: tabular-nums;
}
.clocky-steps li.is-active button { border-color: var(--accent); color: var(--text); }
.clocky-steps li.is-active .clocky-step-dot { background: var(--accent); color: #fff; }
.clocky-steps li.is-done .clocky-step-dot { background: rgba(0,184,148,.18); color: var(--green); }

.clocky-day { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-dim); }
.clocky-match-tbl select { min-height: 30px; padding: 4px 8px; font-size: 12px; min-width: 180px; }
.clocky-match-tbl td { vertical-align: top; }
.clocky-match-tbl tr.clocky-will-book td:first-child { box-shadow: inset 3px 0 0 var(--green); }
.clocky-match-tbl tr.clocky-will-book td { background: rgba(0,184,148,.06); }
.clocky-book-flag { color: var(--green); margin-right: 6px; }
.clocky-note { display: block; font-size: 10.5px; color: var(--text-dim); margin-top: 3px; }
.clocky-low { color: var(--orange); }

.clocky-report { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.clocky-report-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.clocky-report-total { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.clocky-report-group { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-dim); margin: 10px 0 4px; }
.clocky-report-row { display: grid; grid-template-columns: minmax(120px, 2fr) 3fr 70px 44px; gap: 10px; align-items: center; font-size: 12px; padding: 2px 0; }
.clocky-report-track { height: 8px; border-radius: 4px; background: var(--bg-hover); overflow: hidden; }
.clocky-report-fill { display: block; height: 100%; border-radius: 4px; background: var(--green); }
.clocky-report-row[data-kind="jobtype"] .clocky-report-fill { background: var(--accent-light); }
.clocky-report-row[data-kind="none"] .clocky-report-fill { background: var(--text-dim); }
.clocky-report-row .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-dim); }

.clocky-profile { cursor: pointer; margin-bottom: 8px; }
.clocky-profile.active { border-color: var(--accent); }
.clocky-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.clocky-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 14px;
    background: var(--bg-hover); border: 1px solid var(--border); font-size: 12px;
}
.clocky-chip button { background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 0 4px; font-size: 13px; }
.clocky-chip button:hover { color: var(--red); }
.clocky-help summary { cursor: pointer; font-size: 12px; color: var(--accent-light); font-weight: 600; }
.clocky-help ol { font-size: 12px; line-height: 1.6; padding-left: 18px; margin: 8px 0; color: var(--text); }
.clocky-projects { max-height: 320px; overflow-y: auto; }
@media (forced-colors: active) { .clocky-match-tbl tr.clocky-will-book td:first-child { border-left: 3px solid CanvasText; } }
