﻿        /* --- CSS Reset & Premium Enterprise Variables --- */

        :root {
            --accent: #3b82f6;
            --accent-hover: #2563eb;
            --accent-glow: rgba(59, 130, 246, 0.3);
            --success: #10b981;
            --success-bg: rgba(16, 185, 129, 0.1);
            --danger: #ef4444;
            --danger-bg: rgba(239, 68, 68, 0.1);
            --warning: #f59e0b;
            --font-sans: 'Inter', system-ui, sans-serif;
            --font-mono: 'JetBrains Mono', monospace;
            --radius-sm: 0.375rem;
            --radius-md: 0.5rem;
            --radius-lg: 0.75rem;
            --radius-xl: 1rem;
            --transition-smooth: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
            --transition-fast: all 0.15s ease;
        }

        :root,
        [data-theme="dark"] {
            color-scheme: dark;
            --bg-base: #000000;
            --bg-surface: #0a0a0a;
            --bg-surface-raised: #111111;
            --bg-surface-float: #1a1a1a;
            --border-subtle: rgba(255, 255, 255, 0.08);
            --border-strong: rgba(255, 255, 255, 0.16);
            --border-glow: rgba(255, 255, 255, 0.25);
            --primary: #ededed;
            --primary-invert: #000000;
            --primary-hover: #ffffff;
            --text-h1: #ededed;
            --text-main: #a1a1aa;
            --text-muted: #71717a;
            --shadow-float: 0 20px 40px -10px rgba(0,0,0,0.8), 0 0 0 1px var(--border-subtle);
            --body-grid: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
            --scrollbar-thumb: rgba(255, 255, 255, 0.15);
            --scrollbar-thumb-hover: rgba(255, 255, 255, 0.25);
            --sidebar-bg: rgba(10, 10, 10, 0.8);
            --header-bg: rgba(0, 0, 0, 0.4);
            --brand-fg: #ffffff;
            --brand-icon-fg: #000000;
            --nav-hover: rgba(255,255,255,0.05);
            --nav-active: rgba(255,255,255,0.1);
            --table-head-bg: rgba(15, 23, 42, 0.98);
            --row-hover-bg: rgba(255,255,255,0.02);
            --overlay-bg: rgba(0, 0, 0, 0.8);
            --modal-header-bg: rgba(255,255,255,0.02);
            --placeholder: #52525b;
            --form-hover-border: rgba(255,255,255,0.25);
            --json-fg: #e2e8f0;
            --btn-primary-shadow: 0 2px 4px rgba(255,255,255,0.1);
            --btn-secondary-hover: rgba(255,255,255,0.1);
            --arg-row-hover: rgba(255,255,255,0.05);
            --arg-row-hover-border: rgba(255,255,255,0.3);
            --skeleton: linear-gradient(90deg, rgba(255,255,255,0.02) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.02) 75%);
            --login-bg: url('data:image/svg+xml;utf8,<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse"><path d="M 40 0 L 0 0 0 40" fill="none" stroke="rgba(255,255,255,0.03)" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grid)" /></svg>');
            --glass-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
            --stat-hover-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
            --role-user-bg: rgba(255,255,255,0.08);
            --ver-pill-bg: rgba(255,255,255,0.07);
            --bb-gutter-bg: rgba(255,255,255,0.015);
            --bb-field-label-bg: rgba(255,255,255,0.03);
            --bb-empty-bg: rgba(255,255,255,0.012);
            --review-thread-bg: rgba(0,0,0,0.15);
            --review-comment-bg: rgba(255,255,255,0.04);
            --review-composer-bg: rgba(59,130,246,0.06);
            --review-diff-pre-bg: rgba(0,0,0,0.2);
            --sync-stat-bg: rgba(255,255,255,0.04);
            --graph-stage-bg: #0a0a0a;
        }

        [data-theme="light"] {
            color-scheme: light;
            --bg-base: #ffffff;
            --bg-surface: #fafafa;
            --bg-surface-raised: #f4f4f5;
            --bg-surface-float: #ffffff;
            --border-subtle: rgba(0, 0, 0, 0.08);
            --border-strong: rgba(0, 0, 0, 0.12);
            --border-glow: rgba(0, 0, 0, 0.2);
            --primary: #18181b;
            --primary-invert: #ffffff;
            --primary-hover: #09090b;
            --text-h1: #09090b;
            --text-main: #3f3f46;
            --text-muted: #71717a;
            --shadow-float: 0 20px 40px -10px rgba(0,0,0,0.12), 0 0 0 1px var(--border-subtle);
            --body-grid: radial-gradient(rgba(0, 0, 0, 0.06) 1px, transparent 1px);
            --scrollbar-thumb: rgba(0, 0, 0, 0.18);
            --scrollbar-thumb-hover: rgba(0, 0, 0, 0.28);
            --sidebar-bg: rgba(255, 255, 255, 0.88);
            --header-bg: rgba(255, 255, 255, 0.82);
            --brand-fg: #09090b;
            --brand-icon-fg: #ffffff;
            --nav-hover: rgba(0,0,0,0.04);
            --nav-active: rgba(0,0,0,0.07);
            --table-head-bg: rgba(250, 250, 250, 0.98);
            --row-hover-bg: rgba(0,0,0,0.02);
            --overlay-bg: rgba(15, 23, 42, 0.45);
            --modal-header-bg: rgba(0,0,0,0.02);
            --placeholder: #a1a1aa;
            --form-hover-border: rgba(0,0,0,0.22);
            --json-fg: #1e293b;
            --btn-primary-shadow: 0 2px 4px rgba(0,0,0,0.08);
            --btn-secondary-hover: rgba(0,0,0,0.05);
            --arg-row-hover: rgba(0,0,0,0.02);
            --arg-row-hover-border: rgba(0,0,0,0.18);
            --skeleton: linear-gradient(90deg, rgba(0,0,0,0.03) 25%, rgba(0,0,0,0.08) 50%, rgba(0,0,0,0.03) 75%);
            --login-bg: url('data:image/svg+xml;utf8,<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse"><path d="M 40 0 L 0 0 0 40" fill="none" stroke="rgba(0,0,0,0.06)" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grid)" /></svg>');
            --glass-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
            --stat-hover-shadow: 0 10px 30px -10px rgba(0,0,0,0.08);
            --role-user-bg: rgba(0,0,0,0.06);
            --ver-pill-bg: rgba(0,0,0,0.06);
            --bb-gutter-bg: rgba(0,0,0,0.03);
            --bb-field-label-bg: rgba(0,0,0,0.03);
            --bb-empty-bg: rgba(0,0,0,0.02);
            --review-thread-bg: rgba(0,0,0,0.03);
            --review-comment-bg: rgba(0,0,0,0.03);
            --review-composer-bg: rgba(59,130,246,0.08);
            --review-diff-pre-bg: rgba(0,0,0,0.04);
            --sync-stat-bg: rgba(0,0,0,0.03);
            --graph-stage-bg: #f8fafc;
        }

        * { margin: 0; padding: 0; box-sizing: border-box; }

        body {
            font-family: var(--font-sans);
            background-color: var(--bg-base);
            background-image: var(--body-grid);
            background-size: 24px 24px;
            color: var(--text-main);
            min-height: 100vh;
            overflow: hidden;
            display: flex;
            -webkit-font-smoothing: antialiased;
        }

        /* Custom Scrollbar */
        ::-webkit-scrollbar { width: 6px; height: 6px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 10px; }
        ::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

        /* --- Typography --- */
        h1, h2, h3, h4 { color: var(--text-h1); font-weight: 600; letter-spacing: -0.03em; }
        h2 { font-size: 1.5rem; margin-bottom: 0.25rem; }
        p { color: var(--text-muted); line-height: 1.6; font-size: 0.875rem; }
        .text-sm { font-size: 0.8125rem; }
        .text-muted { color: var(--text-muted); }
        .font-mono { font-family: var(--font-mono); font-size: 0.8125rem; letter-spacing: -0.01em; }

        /* --- Layout --- */
        .app-container { display: flex; width: 100%; height: 100vh; transition: var(--transition-smooth); }

        /* Sidebar */
        .sidebar {
            width: 260px;
            background: var(--sidebar-bg);
            backdrop-filter: blur(24px);
            border-right: 1px solid var(--border-subtle);
            display: flex; flex-direction: column; padding: 1.5rem 1rem;
            z-index: 40;
        }
        .brand {
            display: flex; align-items: center; gap: 0.75rem; margin-bottom: 2rem; padding: 0 0.5rem;
            font-size: 1.125rem; font-weight: 700; color: var(--brand-fg); letter-spacing: -0.02em;
        }
        .brand-icon {
            background: linear-gradient(135deg, var(--text-h1), var(--text-muted));
            padding: 0.25rem; border-radius: 6px; display: flex; color: var(--brand-icon-fg);
        }
        .nav-links { list-style: none; display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
        .nav-item {
            display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 0.75rem;
            border-radius: var(--radius-sm); color: var(--text-muted); text-decoration: none;
            cursor: pointer; transition: var(--transition-fast); font-weight: 500; font-size: 0.875rem;
        }
        .nav-item:hover { background: var(--nav-hover); color: var(--text-h1); }
        .nav-item.active { background: var(--nav-active); color: var(--text-h1); font-weight: 600; }
        .nav-divider { height: 1px; background: var(--border-subtle); margin: 1rem 0.5rem; }

        /* Main Content */
        .main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }
        .header {
            height: 64px; padding: 0 2.5rem; display: flex; align-items: center; justify-content: space-between;
            background: var(--header-bg); backdrop-filter: blur(12px);
            border-bottom: 1px solid var(--border-subtle); z-index: 30;
        }
        .header-actions {
            display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; justify-content: flex-end;
            max-width: min(100%, 640px);
        }
        .view-container { flex: 1; padding: 2.5rem; overflow-y: auto; display: none; }
        .view-container.active { display: block; animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
        #view-login.active { display: flex; }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

        /* Admin-only elements are hidden unless the body has the role-admin class. */
        body:not(.role-admin) [data-admin] { display: none !important; }
        .role-badge { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.15rem 0.5rem; border-radius: 999px; }
        .role-badge.admin { background: rgba(99,102,241,0.18); color: #a5b4fc; }
        .role-badge.user { background: var(--role-user-bg); color: var(--text-muted); }
        .audit-change { font-family: var(--font-mono, monospace); font-size: 0.72rem; line-height: 1.5; padding: 1px 0; }
        .audit-change .ac-field { color: #c4b5fd; font-weight: 700; }
        .audit-change .ac-old { color: #fca5a5; text-decoration: line-through; }
        .audit-change .ac-new { color: #86efac; }
        .btn-sm { padding: 0.3rem 0.6rem; font-size: 0.78rem; }
        /* Version + sync status badges */
        .ver-pill { font-family: var(--font-mono, monospace); font-size: 0.72rem; font-weight: 700; padding: 0.1rem 0.45rem; border-radius: 6px; background: var(--ver-pill-bg); color: var(--text-main); }
        .sync-badge { display:inline-block; font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.12rem 0.45rem; border-radius: 999px; white-space: nowrap; }
        .sync-badge.synced { background: rgba(16,185,129,0.16); color: #6ee7b7; }
        .sync-badge.modified { background: rgba(245,158,11,0.16); color: #fcd34d; }
        .sync-badge.new { background: rgba(99,102,241,0.18); color: #a5b4fc; }
        .sync-badge.removed { background: rgba(239,68,68,0.16); color: #fca5a5; }
        .sync-badge.review { background: rgba(236,72,153,0.16); color: #f9a8d4; }

        .deploy-progress-meta { display:flex; justify-content:space-between; align-items:baseline; gap:0.75rem; margin-bottom:0.5rem; font-size:0.9rem; font-weight:600; color:var(--text-h1); }
        .deploy-progress-track { height:8px; border-radius:999px; background:var(--border-subtle); overflow:hidden; }
        .deploy-progress-bar { height:100%; width:0; border-radius:999px; background:var(--accent); transition:width 0.25s ease; }
        .deploy-progress-bar.error { background:var(--danger); }
        .deploy-progress-bar.done { background:var(--success); }
        .deploy-progress-detail { margin-top:0.55rem; font-size:0.8rem; }
        .deploy-progress-log { list-style:none; margin:0.85rem 0 0; padding:0; max-height:140px; overflow:auto; font-size:0.75rem; font-family:var(--font-mono); color:var(--text-muted); display:flex; flex-direction:column; gap:0.25rem; }
        .deploy-progress-log li { padding:0.2rem 0; border-bottom:1px solid var(--border-subtle); }
        .deploy-progress-log li:last-child { border-bottom:none; color:var(--text-main); }
        .deploy-sync-errors { margin-top:0.85rem; padding:0.65rem 0.75rem; border-radius:8px; background:var(--danger-bg); border:1px solid rgba(239,68,68,0.35); }
        .deploy-sync-errors-title { margin:0 0 0.45rem; font-size:0.78rem; font-weight:700; text-transform:uppercase; letter-spacing:0.04em; color:var(--danger); }
        .deploy-sync-errors-list { list-style:none; margin:0; padding:0; max-height:220px; overflow:auto; display:flex; flex-direction:column; gap:0.4rem; }
        .deploy-sync-errors-list li { font-size:0.8rem; color:var(--text-main); line-height:1.4; }
        .deploy-sync-errors-list li b { color:var(--text-h1); font-family:var(--font-mono); }

        .reviews-list { display:flex; flex-direction:column; gap:1rem; }
        .reviews-split { display:grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap:1rem; align-items:start; min-height:420px; }
        .reviews-sidebar { display:flex; flex-direction:column; gap:0.5rem; max-height:calc(100vh - 180px); overflow:auto; position:sticky; top:0.5rem; }
        .reviews-detail { min-width:0; }
        .review-nav-item { text-align:left; width:100%; padding:0.75rem 0.85rem; border:1px solid var(--border-subtle); border-radius:10px; background:var(--bg-surface-raised); color:inherit; cursor:pointer; transition:border-color 0.15s, background 0.15s; }
        .review-nav-item:hover { border-color:var(--border-strong); }
        .review-nav-item.active { border-color:var(--accent); background:rgba(59,130,246,0.08); }
        .review-nav-title { font-family:var(--font-mono); font-weight:700; color:var(--text-h1); font-size:0.88rem; word-break:break-word; }
        .review-nav-meta { font-size:0.72rem; color:var(--text-muted); margin-top:0.3rem; line-height:1.35; }
        .review-card { padding:1rem 1.25rem; }
        .review-card-head { display:flex; justify-content:space-between; align-items:flex-start; gap:1rem; margin-bottom:0.75rem; flex-wrap:wrap; }
        .review-card-title { font-family:var(--font-mono); font-weight:700; color:var(--text-h1); }
        .review-diff-stack { display:flex; flex-direction:column; gap:0.75rem; }
        .review-field { border:1px solid var(--border-subtle); border-radius:10px; overflow:hidden; background:var(--bg-surface-raised); }
        .review-field-toggle { width:100%; display:flex; align-items:center; justify-content:space-between; gap:0.75rem; padding:0.65rem 0.85rem; border:none; background:var(--bb-field-label-bg); color:var(--text-h1); cursor:pointer; font-size:0.85rem; font-weight:600; text-align:left; }
        .review-field-toggle:hover { filter:brightness(1.05); }
        .review-field-toggle .chev { color:var(--text-muted); font-size:0.75rem; transition:transform 0.15s; }
        .review-field.open .chev { transform:rotate(90deg); }
        .review-field-body { display:none; }
        .review-field.open .review-field-body { display:block; }
        .review-bb-diff { border:none; border-top:1px solid var(--border-subtle); border-radius:0; overflow:hidden; }
        .review-diff-line-wrap { border-bottom:1px solid rgba(255,255,255,0.04); }
        .review-diff-line-wrap:last-child { border-bottom:none; }
        @media (max-width:900px) {
            .reviews-split { grid-template-columns:1fr; }
            .reviews-sidebar { position:static; max-height:220px; }
        }
        .bb-gutter-click { position:relative; cursor:pointer; user-select:none; }
        .bb-gutter-click:hover { background:rgba(59,130,246,0.15); }
        .bb-add-comment { display:none; position:absolute; right:2px; top:50%; transform:translateY(-50%); font-size:0.7rem; font-weight:700; color:var(--accent); }
        .bb-gutter-click:hover .bb-add-comment { display:inline; }
        .review-anchor-badge { display:inline-block; margin-left:2px; min-width:14px; height:14px; line-height:14px; font-size:0.62rem; font-weight:700; text-align:center; border-radius:7px; background:rgba(236,72,153,0.25); color:#f9a8d4; vertical-align:middle; }
        .review-anchor-threads { padding:0.5rem 0.75rem 0.75rem 3.5rem; background:var(--review-thread-bg); border-top:1px dashed var(--border-subtle); }
        .review-anchor-threads.review-side-r { padding-left: calc(50% + 2.5rem); }
        .review-comment { padding:0.5rem 0.65rem; margin-bottom:0.5rem; border-radius:8px; background:var(--review-comment-bg); border:1px solid var(--border-subtle); }
        .review-comment-head { display:flex; gap:0.5rem; align-items:baseline; margin-bottom:0.35rem; font-size:0.8rem; }
        .review-comment-body { font-size:0.85rem; white-space:pre-wrap; word-break:break-word; }
        .review-comment-actions { display:flex; gap:0.5rem; align-items:center; margin-top:0.4rem; }
        .review-like-btn { display:inline-flex; align-items:center; gap:0.25rem; padding:0.15rem 0.4rem; border:none; background:transparent; color:var(--text-muted); cursor:pointer; font-size:0.75rem; border-radius:6px; }
        .review-like-btn:hover, .review-like-btn.liked { color:#f472b6; background:rgba(236,72,153,0.12); }
        .review-replies { margin-left:0.75rem; margin-top:0.35rem; padding-left:0.65rem; border-left:2px solid var(--border-subtle); }
        .review-inline-composer { padding:0.65rem 0.75rem 0.85rem 3.5rem; background:var(--review-composer-bg); border-top:1px solid var(--border-subtle); }
        @media (max-width:768px) { .review-diff-grid { grid-template-columns:1fr; } }
        .review-diff-col pre { font-size:0.78rem; white-space:pre-wrap; word-break:break-word; max-height:160px; overflow:auto; margin:0; padding:0.6rem; border-radius:8px; background:var(--review-diff-pre-bg); }
        .review-diff-label { font-size:0.72rem; text-transform:uppercase; letter-spacing:0.04em; color:var(--text-muted); margin-bottom:0.35rem; }
        .sync-dot.review { background:#ec4899; }
        .sync-dot { display:inline-block; width:7px; height:7px; border-radius:50%; margin-left:5px; vertical-align:middle; }
        .sync-dot.modified { background:#fcd34d; }
        .sync-dot.new { background:#a5b4fc; }

        /* Pending-change indicator (new "PR") next to a tool name. */
        .pr-dot { display:inline-block; width:8px; height:8px; border-radius:50%; background:#fcd34d; box-shadow:0 0 0 3px rgba(245,158,11,0.18); vertical-align:middle; }

        /* Small count badge on the Sync Status nav item. */
        .nav-pill { margin-left:auto; min-width:18px; height:18px; padding:0 5px; border-radius:999px; background:rgba(245,158,11,0.22); color:#fcd34d; font-size:0.68rem; font-weight:700; display:inline-flex; align-items:center; justify-content:center; }
        .branch-banner { margin-bottom:1rem; padding:0.75rem 1rem; border-radius:var(--radius-md); background:rgba(59,130,246,0.12); border:1px solid rgba(59,130,246,0.25); color:#93c5fd; font-size:0.85rem; display:flex; align-items:center; justify-content:space-between; gap:1rem; flex-wrap:wrap; }
        .branch-banner strong { color:#bfdbfe; }
        .pr-status { font-size:0.72rem; font-weight:700; text-transform:uppercase; letter-spacing:0.04em; padding:0.15rem 0.45rem; border-radius:4px; }
        .pr-status.open { background:rgba(59,130,246,0.2); color:#93c5fd; }
        .pr-status.merged { background:rgba(34,197,94,0.15); color:#86efac; }
        .pr-status.declined { background:rgba(239,68,68,0.15); color:#fca5a5; }

        /* Summary stat cards on the Sync Status page. */
        .sync-stat { display:flex; flex-direction:column; align-items:flex-start; gap:0.1rem; padding:0.6rem 0.9rem; border-radius:10px; background:var(--sync-stat-bg); border:1px solid var(--border-subtle); min-width:120px; }
        .sync-stat-num { font-size:1.35rem; font-weight:800; line-height:1; color:var(--text-h1); }
        .sync-stat-label { font-size:0.72rem; text-transform:uppercase; letter-spacing:0.04em; color:var(--text-muted); }
        .sync-stat.pending { background:rgba(245,158,11,0.12); border-color:rgba(245,158,11,0.35); }
        .sync-stat.pending .sync-stat-num { color:#fcd34d; }
        .sync-stat.ok { background:rgba(16,185,129,0.1); border-color:rgba(16,185,129,0.3); }
        .sync-stat.ok .sync-stat-num { color:#6ee7b7; }
        .sync-stat.synced .sync-stat-num { color:#6ee7b7; }
        .sync-stat.modified .sync-stat-num { color:#fcd34d; }
        .sync-stat.new .sync-stat-num { color:#a5b4fc; }
        .sync-stat.removed .sync-stat-num { color:#fca5a5; }
        .sync-stat.review .sync-stat-num { color:#f9a8d4; }

        /* --- UI Components --- */
        .glass-panel {
            background: var(--bg-surface);
            border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
            padding: 2rem; box-shadow: var(--glass-shadow);
        }

        .theme-toggle-btn {
            width: 36px; height: 36px; padding: 0; flex-shrink: 0;
            border-radius: var(--radius-md); border: 1px solid var(--border-strong);
            background: var(--bg-surface-raised); color: var(--text-h1);
            display: inline-flex; align-items: center; justify-content: center;
            cursor: pointer; transition: var(--transition-fast);
        }
        .theme-toggle-btn:hover { background: var(--nav-hover); border-color: var(--border-glow); }
        .theme-toggle-login {
            position: fixed; top: 1.25rem; right: 1.25rem; z-index: 250;
            box-shadow: var(--glass-shadow);
        }
        body:not(.is-logged-out) .theme-toggle-login { display: none !important; }
        .theme-toggle-header { box-shadow: none; }
        body.is-logged-out .theme-toggle-header { display: none !important; }
        .login-panel { background: var(--bg-surface); backdrop-filter: blur(20px); border: 1px solid var(--border-strong); }

        /* Buttons */
        .btn {
            display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
            padding: 0.5rem 1rem; border-radius: var(--radius-md); font-size: 0.875rem; font-weight: 500;
            border: 1px solid transparent; cursor: pointer; transition: var(--transition-fast); outline: none;
            font-family: inherit; letter-spacing: -0.01em;
        }
        .btn:disabled { opacity: 0.5; cursor: not-allowed; }
        .btn-primary { 
            background: var(--primary); color: var(--primary-invert); 
            box-shadow: var(--btn-primary-shadow);
        }
        .btn-primary:hover:not(:disabled) { background: var(--primary-hover); transform: translateY(-1px); }
        
        .btn-secondary { 
            background: var(--bg-surface-raised); color: var(--text-h1); 
            border-color: var(--border-strong);
        }
        .btn-secondary:hover:not(:disabled) { background: var(--btn-secondary-hover); border-color: var(--border-glow); }
        
        .btn-danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(239,68,68,0.2); }
        .btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.2); }
        
        .btn-icon { padding: 0.375rem; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); border: 1px solid transparent; cursor:pointer; transition: var(--transition-fast); }
        .btn-icon:hover { background: var(--bg-surface-raised); color: var(--text-h1); border-color: var(--border-subtle); }

        /* Inputs & Forms */
        .form-group { margin-bottom: 1.5rem; }
        .form-label { display: block; margin-bottom: 0.5rem; font-size: 0.8125rem; color: var(--text-main); font-weight: 500; }
        .form-control {
            width: 100%; background: var(--bg-base); border: 1px solid var(--border-strong);
            color: var(--text-h1); padding: 0.625rem 0.875rem; border-radius: var(--radius-md);
            font-size: 0.875rem; outline: none; transition: var(--transition-fast); font-family: inherit;
        }
        .form-control::placeholder { color: var(--placeholder); }
        .form-control:hover { border-color: var(--form-hover-border); }
        .form-control:focus { border-color: var(--text-muted); box-shadow: 0 0 0 1px var(--text-muted); }
        textarea.form-control { resize: vertical; min-height: 80px; }
        select.form-control { appearance: none; background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%24%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%2371717a%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpolyline%20points%3D%226%209%2012%2015%2018%209%22%3E%3C%2Fpolyline%3E%3C%2Fsvg%3E'); background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 1rem; padding-right: 2.5rem; cursor: pointer; }
        .form-control-sm { padding: 0.4rem 0.75rem; font-size: 0.8125rem; }

        /* Toggles */
        .toggle-switch { position: relative; display: inline-block; width: 36px; height: 20px; }
        .toggle-switch input { opacity: 0; width: 0; height: 0; }
        .toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--bg-surface-raised); transition: .2s; border-radius: 34px; border: 1px solid var(--border-strong); }
        .toggle-slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 2px; bottom: 2px; background-color: var(--text-muted); transition: .2s; border-radius: 50%; }
        input:checked + .toggle-slider { background-color: var(--primary); border-color: var(--primary); }
        input:checked + .toggle-slider:before { transform: translateX(16px); background-color: var(--primary-invert); }
        input:disabled + .toggle-slider { opacity: 0.5; cursor: not-allowed; }
        .toggle-label-wrap { display: flex; align-items: center; gap: 0.625rem; margin-right: 1.5rem; cursor: pointer; }

        /* Context policy (Bot Integration) */
        .ctx-strategy-badge {
            display: inline-flex; align-items: center; flex-shrink: 0;
            padding: 0.3rem 0.7rem; border-radius: var(--radius-md);
            font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
            color: var(--text-muted); background: var(--bg-surface-raised);
            border: 1px solid var(--border-strong); white-space: nowrap;
        }
        .ctx-policy-section {
            background: var(--bg-surface-raised);
            border: 1px solid var(--border-strong);
            border-radius: var(--radius-md);
            padding: 1.15rem 1.25rem;
            margin-bottom: 1rem;
            transition: opacity 0.2s ease, border-color 0.2s ease;
        }
        .ctx-policy-section.is-disabled { opacity: 0.72; }
        .ctx-policy-section-head {
            display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
        }
        .ctx-policy-title {
            font-size: 0.9rem; font-weight: 600; color: var(--text-h1); margin-bottom: 0.35rem;
        }
        .ctx-policy-hint {
            margin: 0; font-size: 0.75rem; line-height: 1.55; color: var(--text-muted);
            max-width: 36rem;
        }
        .ctx-policy-body { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--border-subtle); }
        .ctx-policy-example {
            margin: 0.85rem 0 0; padding: 0.55rem 0.75rem;
            font-size: 0.75rem; line-height: 1.45; color: var(--text-main);
            background: var(--bg-base); border: 1px dashed var(--border-strong);
            border-radius: var(--radius-sm);
        }
        .ctx-policy-example:empty { display: none; }

        /* Cards / Dashboard */
        .grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
        .stat-card { display: flex; align-items: center; gap: 1.25rem; padding: 1.5rem; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); transition: var(--transition-smooth); }
        .stat-card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--stat-hover-shadow); }
        .stat-icon { width: 48px; height: 48px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; background: var(--bg-surface-raised); border: 1px solid var(--border-subtle); }
        .stat-info h3 { font-size: 1.75rem; margin-bottom: 0.125rem; font-weight: 700; color: var(--text-h1); }
        .stat-info p { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; margin: 0; color: var(--text-muted); font-weight: 600;}

        /* Data Table & Filters */
        .table-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: 1rem; }
        .filter-group { display: flex; align-items: center; gap: 0.5rem; background: var(--bg-base); padding: 0.375rem; border-radius: var(--radius-md); border: 1px solid var(--border-strong); }
        
        .table-container { width: 100%; overflow-x: auto; max-height: calc(100vh - 250px); border-radius: var(--radius-md); border: 1px solid var(--border-strong); background: var(--bg-surface); }
        table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; }
        th, td { padding: 0.875rem 1.5rem; border-bottom: 1px solid var(--border-subtle); }
        th { font-weight: 500; color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; position: sticky; top: 0; background: var(--table-head-bg); z-index: 10; box-shadow: 0 1px 0 var(--border-strong); }
        td { font-size: 0.875rem; vertical-align: middle; }
        tr:hover td { background: var(--row-hover-bg); }
        tr:last-child td { border-bottom: none; }
        
        .badge { display: inline-flex; align-items: center; padding: 0.125rem 0.625rem; border-radius: 999px; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.02em; border: 1px solid transparent; }
        .badge.get { color: #34d399; background: rgba(52, 211, 153, 0.1); border-color: rgba(52,211,153,0.2); }
        .badge.post { color: #60a5fa; background: rgba(96, 165, 250, 0.1); border-color: rgba(96,165,250,0.2); }
        .badge.put { color: #fbbf24; background: rgba(251, 191, 36, 0.1); border-color: rgba(251,191,36,0.2); }
        .badge.delete { color: #f87171; background: rgba(248, 113, 113, 0.1); border-color: rgba(248,113,113,0.2); }

        /* Dynamic Rows (Arguments Builder) */
        .arg-row { display: grid; gap: 1rem; align-items: center; padding: 1.25rem; background: var(--bg-surface-raised); border: 1px solid var(--border-strong); border-radius: var(--radius-md); margin-bottom: 0.75rem; transition: var(--transition-fast); grid-template-columns: 2fr 1fr 1.5fr 3fr auto auto auto; }
        .arg-row.const-arg-row { grid-template-columns: 1fr 1fr 1.5fr auto; }
        .arg-row:hover { border-color: var(--arg-row-hover-border); background: var(--arg-row-hover); }
        .arg-row .form-group { margin-bottom: 0; }
        
        .payload-row { display: grid; gap: 1rem; align-items: center; padding: 1rem; background: var(--bg-surface-raised); border: 1px solid var(--border-strong); border-radius: var(--radius-md); margin-bottom: 0.75rem; grid-template-columns: 2fr 1.5fr 3fr auto; }
        .payload-row .form-group { margin-bottom: 0; }

        /* Modals */
        .modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--overlay-bg); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; z-index: 100; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
        .modal-overlay.active { opacity: 1; pointer-events: all; }
        .modal-content { background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: var(--radius-xl); width: 90%; max-width: 500px; box-shadow: var(--shadow-float); transform: scale(0.95) translateY(10px); transition: var(--transition-smooth); overflow: hidden; display: flex; flex-direction: column; }
        .modal-overlay.active .modal-content { transform: scale(1) translateY(0); }
        .modal-header { padding: 1.5rem 2rem; border-bottom: 1px solid var(--border-subtle); display: flex; justify-content: space-between; align-items: center; background: var(--modal-header-bg); }
        .modal-body { padding: 2rem; overflow-y: auto; max-height: 75vh; }
        .modal-footer { padding: 1.25rem 2rem; border-top: 1px solid var(--border-subtle); display: flex; justify-content: flex-end; gap: 0.75rem; background: var(--bg-base); }
        .modal-fullscreen .modal-content { max-width: 95vw; height: 92vh; }

        /* Tabs */
        .tabs { display: flex; border-bottom: 1px solid var(--border-strong); margin-bottom: 1.5rem; gap: 1.5rem; }
        .tab-btn { background: none; border: none; padding: 0.5rem 0; color: var(--text-muted); cursor: pointer; font-size: 0.875rem; font-weight: 500; border-bottom: 2px solid transparent; transition: var(--transition-fast); margin-bottom: -1px; }
        .tab-btn:hover { color: var(--text-h1); }
        .tab-btn.active { color: var(--text-h1); border-bottom-color: var(--text-h1); }
        .tab-content { display: none; height: 100%; flex-direction: column; }
        .tab-content.active { display: flex; animation: fadeIn 0.3s ease forwards; }

        /* Bitbucket-style Diff Viewer */
        .araxis-container { border: 1px solid var(--border-strong); border-radius: var(--radius-md); overflow: hidden; background: var(--bg-base); display: flex; flex-direction: column; }
        .araxis-header { display: grid; grid-template-columns: 44px 1fr 44px 1fr; background: var(--bg-surface-raised); border-bottom: 1px solid var(--border-strong); }
        .araxis-header div { padding: 0.6rem 1rem; font-size: 0.7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
        .araxis-header div:first-child { border-right: 1px solid var(--border-strong); }

        .bb-scroll { max-height: 55vh; overflow: auto; }
        .araxis-field-label { padding: 0.45rem 1rem; background: var(--bb-field-label-bg); font-size: 0.72rem; color: var(--text-main); font-weight: 700; border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); text-transform: uppercase; letter-spacing: 0.04em; position: sticky; left: 0; }

        .bb-diff { font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.5; }
        .bb-line { display: grid; grid-template-columns: 44px 1fr 44px 1fr; }
        .bb-gutter { padding: 0 0.5rem; text-align: right; color: var(--text-muted); opacity: 0.6; user-select: none; background: var(--bb-gutter-bg); border-right: 1px solid var(--border-subtle); }
        .bb-gutter.g-del { background: rgba(248,81,73,0.18); color: #ffa198; opacity: 0.9; }
        .bb-gutter.g-ins { background: rgba(63,185,80,0.18); color: #7ee787; opacity: 0.9; }
        .bb-code { padding: 0 0.5rem 0 0.25rem; white-space: pre-wrap; word-break: break-word; color: var(--text-main); border-right: 1px solid var(--border-subtle); }
        .bb-code:last-child { border-right: none; }
        .bb-code .bb-sign { display: inline-block; width: 0.9em; color: var(--text-muted); opacity: 0.7; }
        .bb-del { background: rgba(248,81,73,0.12); color: #ffb4ad; }
        .bb-del .bb-sign { color: #f85149; opacity: 1; }
        .bb-ins { background: rgba(63,185,80,0.12); color: #9ff0a8; }
        .bb-ins .bb-sign { color: #3fb950; opacity: 1; }
        /* Intra-line (word-level) highlights: stronger than the line background. */
        .bb-word { border-radius: 3px; padding: 0 1px; }
        .bb-word.del { background: rgba(248,81,73,0.40); color: #ffd7d3; }
        .bb-word.ins { background: rgba(63,185,80,0.40); color: #c7f7cd; }
        .bb-empty { background: var(--bb-empty-bg); }

        /* JSON Viewer */
        pre.json-viewer { background: var(--bg-base); padding: 1.5rem; border-radius: var(--radius-md); border: 1px solid var(--border-strong); overflow: auto; color: var(--json-fg); font-family: var(--font-mono); font-size: 0.8125rem; line-height: 1.6; }

        /* Toasts */
        .toast-container { position: fixed; bottom: 2rem; right: 2rem; display: flex; flex-direction: column; gap: 0.75rem; z-index: 200; }
        .toast { background: var(--bg-surface-raised); border: 1px solid var(--border-strong); padding: 1rem 1.25rem; border-radius: var(--radius-md); box-shadow: var(--shadow-float); display: flex; align-items: center; gap: 0.75rem; transform: translateX(120%); transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1); font-weight: 500; font-size: 0.875rem;}
        .toast.show { transform: translateX(0); }
        .toast.success { border-left: 3px solid var(--success); }
        .toast.error { border-left: 3px solid var(--danger); }
        .toast.info { border-left: 3px solid var(--primary); }

        /* Skeletons */
        .skeleton { background: var(--skeleton); background-size: 200% 100%; animation: loading 1.5s infinite; border-radius: var(--radius-sm); }
        @keyframes loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
        .empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; justify-content: center; }

        /* Logged out state */
        .is-logged-out .sidebar { display: none !important; }
        .is-logged-out .header { display: none !important; }
        .is-logged-out .main-content { justify-content: center; align-items: center; background: var(--login-bg); }

        /* Utilities */
        .flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; } .gap-2 { gap: 0.5rem; } .gap-3 { gap: 0.75rem; } .gap-4 { gap: 1rem; } .mt-4 { margin-top: 1rem; } .mb-4 { margin-bottom: 1.5rem; } .w-full { width: 100%; }
        svg { flex-shrink: 0; }

        /* Mobile */
        @media (max-width: 768px) {
            .app-container:not(.is-logged-out) { flex-direction: column; }
            .sidebar { width: 100%; padding: 1rem; border-right: none; border-bottom: 1px solid var(--border-subtle); flex-direction: row; align-items: center; justify-content: space-between; z-index: 50;}
            .brand { margin-bottom: 0; font-size: 1rem; }
            .nav-links { flex-direction: row; overflow-x: auto; flex: none; gap: 0.25rem; margin-left: 1rem; }
            .nav-item { padding: 0.5rem; }
            .nav-item span { display: none; }
            .nav-divider { display: none; }
            .header { padding: 0 1rem; height: 60px; }
            .view-container { padding: 1rem; }
            .table-toolbar { flex-direction: column; align-items: stretch; }
            .filter-group { flex-wrap: wrap; }
            .arg-row, .payload-row { grid-template-columns: 1fr; }
            .araxis-header { grid-template-columns: 32px 1fr 32px 1fr; }
            .bb-line { grid-template-columns: 32px 1fr 32px 1fr; }
            .bb-diff { font-size: 0.72rem; }
        }

        /* --- Relationship Graph --- */
        .graph-legend { display:flex; flex-wrap:wrap; align-items:center; gap:1rem 1.25rem; padding:0.6rem 0.9rem; margin-bottom:1rem; border-radius:10px; background:rgba(255,255,255,0.03); border:1px solid var(--border-subtle); font-size:0.78rem; color:var(--text-main); }
        .graph-legend-item { display:inline-flex; align-items:center; gap:0.45rem; }
        .graph-legend-dot { width:14px; height:14px; border-radius:7px; display:inline-block; }
        .graph-legend-dot.node { background:rgba(59,130,246,0.18); border:1.5px solid var(--accent); }
        .graph-legend-dot.node-isolated { background:rgba(255,255,255,0.04); border:1.5px dashed var(--text-muted); }
        .graph-legend-dot.node-inactive { background:rgba(255,255,255,0.03); border:1.5px solid var(--border-strong); opacity:0.6; }
        .graph-legend-edge { width:26px; height:0; border-top:2px solid var(--text-muted); display:inline-block; position:relative; }
        .graph-legend-edge::after { content:''; position:absolute; right:-2px; top:-4px; border-left:6px solid var(--text-muted); border-top:4px solid transparent; border-bottom:4px solid transparent; }
        .graph-legend-edge.hidden { border-top:2px dashed rgba(245,158,11,0.7); }
        .graph-legend-edge.hidden::after { border-left-color:rgba(245,158,11,0.7); }
        .graph-legend-hint { margin-left:auto; font-size:0.74rem; }

        .graph-stage { position:relative; width:100%; height:calc(100vh - 320px); min-height:380px; padding:0; overflow:hidden; border-radius:var(--radius-lg); background:var(--graph-stage-bg); }
        .graph-content { position:absolute; inset:0; width:100%; height:100%; }
        .graph-cy { width:100%; height:100%; min-height:360px; }
        .graph-svg { display:block; cursor:grab; touch-action:none; }
        .graph-svg.panning { cursor:grabbing; }

        .graph-empty { position:absolute; inset:0; }
        .graph-empty-icon { color:var(--accent); opacity:0.7; margin-bottom:0.75rem; }
        .graph-spinner { width:38px; height:38px; border-radius:50%; border:3px solid rgba(255,255,255,0.1); border-top-color:var(--accent); animation:graph-spin 0.8s linear infinite; }
        @keyframes graph-spin { to { transform:rotate(360deg); } }

        .graph-node { cursor:grab; }
        .graph-node.dragging { cursor:grabbing; }
        .graph-node-pill { fill:rgba(59,130,246,0.16); stroke:var(--accent); stroke-width:1.5; transition:fill 0.15s ease, stroke 0.15s ease; }
        .graph-node:hover .graph-node-pill { fill:rgba(59,130,246,0.3); stroke:var(--accent-hover); }
        .graph-node-label { fill:var(--text-h1); font-family:var(--font-mono); font-size:12px; font-weight:600; pointer-events:none; user-select:none; }
        .graph-node.isolated .graph-node-pill { fill:rgba(255,255,255,0.03); stroke:var(--text-muted); stroke-dasharray:4 3; }
        .graph-node.isolated .graph-node-label { fill:var(--text-main); }
        .graph-node.inactive { opacity:0.55; }
        .graph-node.inactive .graph-node-pill { fill:rgba(255,255,255,0.02); stroke:var(--border-strong); }

        .graph-lane { fill:rgba(148,163,184,0.04); stroke:rgba(148,163,184,0.16); stroke-width:1; stroke-dasharray:3 5; }
        .graph-lane.alt { fill:rgba(148,163,184,0.08); }
        .graph-lane-label { fill:rgba(148,163,184,0.85); font-size:11px; font-weight:700; letter-spacing:0.03em; text-transform:uppercase; user-select:none; pointer-events:none; }

        .graph-edge { fill:none; stroke:rgba(161,161,170,0.5); stroke-width:1.6; transition:stroke 0.15s ease, stroke-width 0.15s ease, opacity 0.15s ease; }
        .graph-edge:hover { stroke:var(--accent); stroke-width:2.4; }

        /* Path highlighting when a node is selected (click) */
        .graph-svg.has-selection .graph-node:not(.hl) { opacity:0.2; }
        .graph-svg.has-selection .graph-edge:not(.hl) { opacity:0.07; }
        .graph-svg.has-selection .graph-edge-label:not(.hl) { opacity:0.12; }
        .graph-edge.hl { stroke:var(--accent); stroke-width:3; opacity:1; }
        .graph-edge.hl.incoming { stroke:#34d399; }
        .graph-edge.hl.outgoing { stroke:#60a5fa; }
        .graph-node.hl .graph-node-pill { stroke-width:2.4; }
        .graph-node.selected .graph-node-pill { stroke:var(--accent); stroke-width:3; fill:rgba(59,130,246,0.32); }
        .graph-node { cursor:pointer; }
        .graph-edge.hidden { stroke:rgba(245,158,11,0.4); stroke-width:1.4; stroke-dasharray:5 4; }
        .graph-edge.hidden:hover { stroke:var(--warning); stroke-width:2.2; }
        .graph-arrow-head { fill:rgba(161,161,170,0.65); }
        .graph-arrow-head.hidden { fill:rgba(245,158,11,0.55); }
        .graph-edge-label { cursor:default; }
        .graph-edge-label rect { fill:var(--bg-surface-float); stroke:var(--border-subtle); stroke-width:1; }
        .graph-edge-label text { fill:var(--text-main); font-size:10px; font-weight:600; letter-spacing:0.01em; text-transform:lowercase; pointer-events:none; }
        .graph-edge-label:hover rect { fill:var(--bg-surface-raised); stroke:var(--accent); }
        .graph-edge-label:hover text { fill:var(--text-h1); }
        .graph-edge-label.hidden rect { stroke:rgba(245,158,11,0.4); stroke-dasharray:4 3; }
        .graph-edge-label.hidden text { fill:var(--text-muted); font-style:italic; }
        .graph-edge-label.hidden:hover rect { stroke:var(--warning); }

        .graph-tooltip { position:absolute; z-index:20; max-width:280px; padding:0.5rem 0.7rem; border-radius:8px; background:var(--bg-surface-float); border:1px solid var(--border-strong); color:var(--text-main); font-size:0.78rem; line-height:1.4; box-shadow:var(--shadow-float); pointer-events:none; }

        @media (max-width: 768px) {
            .graph-stage { height:calc(100vh - 360px); min-height:320px; }
            .graph-legend-hint { display:none; }
        }

        /* --- AI profile chips & multi-result --- */
        .ai-chip-list { display:flex; flex-wrap:wrap; gap:0.5rem; }
        .ai-chip { display:inline-flex; align-items:center; gap:0.45rem; padding:0.4rem 0.7rem; border-radius:999px; border:1px solid var(--border-subtle); background:rgba(255,255,255,0.03); font-size:0.82rem; cursor:pointer; user-select:none; transition:border-color 0.15s ease, background 0.15s ease; }
        .ai-chip:hover { border-color:var(--accent); }
        .ai-chip input { accent-color:var(--accent); cursor:pointer; margin:0; }
        .ai-chip.checked { border-color:var(--accent); background:rgba(59,130,246,0.12); }
        .ai-chip-def { font-size:0.62rem; font-weight:700; text-transform:uppercase; letter-spacing:0.04em; padding:0.05rem 0.4rem; border-radius:999px; background:rgba(99,102,241,0.18); color:#a5b4fc; }
        .ai-chip-empty { font-size:0.82rem; color:var(--text-muted); }

        .ai-chooser-bar { padding:0.85rem 1rem; border:1px solid var(--border-subtle); border-radius:10px; background:rgba(255,255,255,0.02); margin-bottom:1rem; }

        .ai-results { display:grid; grid-template-columns:repeat(auto-fit, minmax(320px, 1fr)); gap:1rem; }
        .ai-result-card { border:1px solid var(--border-subtle); border-radius:10px; background:rgba(255,255,255,0.02); display:flex; flex-direction:column; overflow:hidden; }
        .ai-result-head { display:flex; align-items:center; justify-content:space-between; gap:0.5rem; padding:0.6rem 0.8rem; border-bottom:1px solid var(--border-subtle); background:rgba(255,255,255,0.02); }
        .ai-result-name { font-weight:600; font-size:0.85rem; color:var(--text-h1); }
        .ai-result-status { font-size:0.72rem; color:var(--text-muted); }
        .ai-result-body { padding:0.8rem; }
        .ai-result-output { white-space:pre-wrap; word-break:break-word; background:rgba(255,255,255,0.03); border:1px solid var(--border-subtle); border-radius:8px; padding:0.8rem; max-height:260px; overflow:auto; font-family:var(--font-mono,monospace); font-size:0.82rem; margin:0; min-height:48px; }
        .ai-result-output.error { color:var(--danger); border-color:rgba(239,68,68,0.4); background:rgba(239,68,68,0.06); }
        .ai-result-why { padding:0 0.8rem 0.4rem; }
        .ai-result-why-label { display:flex; align-items:center; gap:0.35rem; font-size:0.72rem; font-weight:700; letter-spacing:0.02em; text-transform:uppercase; color:var(--accent); margin-bottom:0.35rem; }
        .ai-result-why-label::before { content:"\1F4A1"; font-size:0.85rem; }
        .ai-result-why-text { white-space:pre-wrap; word-break:break-word; font-size:0.8rem; line-height:1.55; color:var(--text-main); background:rgba(59,130,246,0.07); border:1px solid rgba(59,130,246,0.25); border-radius:8px; padding:0.6rem 0.7rem; }
        .ai-result-why-text.muted { color:var(--text-muted); font-style:italic; background:transparent; border-style:dashed; }

        /* Holistic optimization view */
        .holistic-empty { padding:0.5rem; }
        .holistic-loading { text-align:center; padding:2.5rem 1rem; }
        .holistic-profile-tabs { display:flex; flex-wrap:wrap; gap:0.4rem; margin-bottom:1rem; }
        .holistic-tab.active { border-color:var(--accent); color:var(--accent); }
        .holistic-cards { display:flex; flex-direction:column; gap:1rem; }
        .holistic-card { padding:1rem 1.1rem; border:1px solid var(--border-subtle); }
        .holistic-card.unchanged { opacity:0.85; }
        .holistic-card-head { display:flex; justify-content:space-between; align-items:flex-start; gap:0.75rem; margin-bottom:0.75rem; flex-wrap:wrap; }
        .holistic-tool-name { font-weight:700; color:var(--text-h1); font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:0.9rem; }
        .holistic-check { display:flex; align-items:center; gap:0.35rem; font-size:0.8rem; cursor:pointer; white-space:nowrap; }
        .holistic-diff-grid { display:grid; grid-template-columns:1fr 1fr; gap:0.75rem; }
        @media (max-width: 900px) { .holistic-diff-grid { grid-template-columns:1fr; } }
        .holistic-diff-label { font-size:0.7rem; font-weight:700; text-transform:uppercase; letter-spacing:0.04em; color:var(--text-muted); margin-bottom:0.35rem; }
        .holistic-diff-text { margin:0; padding:0.65rem 0.75rem; background:rgba(15,23,42,0.35); border:1px solid var(--border-subtle); border-radius:8px; font-size:0.78rem; line-height:1.5; white-space:pre-wrap; word-break:break-word; max-height:220px; overflow:auto; }
        .holistic-diff-text.suggested { border-color:rgba(59,130,246,0.35); background:rgba(59,130,246,0.06); }
        .holistic-why { margin-top:0.75rem; }
        .holistic-why-label { font-size:0.72rem; font-weight:700; letter-spacing:0.02em; text-transform:uppercase; color:var(--accent); margin-bottom:0.35rem; }
        .holistic-why-text { font-size:0.8rem; line-height:1.55; color:var(--text-main); background:rgba(59,130,246,0.07); border:1px solid rgba(59,130,246,0.25); border-radius:8px; padding:0.6rem 0.7rem; white-space:pre-wrap; }
        .holistic-error { padding:1rem; border-color:rgba(239,68,68,0.35); }

        /* Tool form wizard */
        .wizard-steps { display:flex; gap:0.35rem; margin-bottom:1.25rem; flex-wrap:wrap; }
        .wizard-step { flex:1; min-width:5.5rem; display:flex; align-items:center; gap:0.45rem; padding:0.55rem 0.7rem; border:1px solid var(--border-subtle); border-radius:10px; background:rgba(15,23,42,0.35); color:var(--text-muted); font-size:0.78rem; cursor:pointer; transition:border-color 0.15s, color 0.15s; }
        .wizard-step:hover { border-color:var(--border-strong); color:var(--text-main); }
        .wizard-step.active { border-color:var(--accent); color:var(--text-h1); background:rgba(59,130,246,0.08); }
        .wizard-step.done { color:var(--text-main); }
        .wizard-step-num { width:1.35rem; height:1.35rem; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; font-size:0.72rem; font-weight:700; background:rgba(148,163,184,0.2); flex-shrink:0; }
        .wizard-step.active .wizard-step-num { background:var(--accent); color:#fff; }
        .wizard-step.done .wizard-step-num { background:rgba(34,197,94,0.25); color:#86efac; }
        .wizard-panel { display:none; margin-bottom:0; padding:1.25rem; }
        .wizard-panel.active { display:block; }
        .wizard-panel-title { font-size:1rem; margin:0 0 0.35rem; color:var(--text-h1); }
        .wizard-panel-hint { font-size:0.82rem; margin:0 0 1.1rem; }
        .wizard-review-dl { display:grid; gap:0.65rem; margin:0; font-size:0.85rem; }
        .wizard-review-dl > div { display:grid; grid-template-columns:7rem 1fr; gap:0.5rem; padding:0.5rem 0; border-bottom:1px solid var(--border-subtle); }
        .wizard-review-dl dt { margin:0; font-weight:600; color:var(--text-muted); font-size:0.75rem; text-transform:uppercase; letter-spacing:0.03em; }
        .wizard-review-dl dd { margin:0; word-break:break-word; }
        .sf-mode-options { display:flex; flex-direction:column; gap:0.5rem; margin-top:0.5rem; }
        .sf-mode-option { display:flex; gap:0.6rem; cursor:pointer; align-items:flex-start; }
        .sf-mode-option input { margin-top:0.35rem; flex-shrink:0; }
        .sf-mode-card { display:flex; flex-direction:column; gap:0.2rem; padding:0.65rem 0.75rem; border:1px solid var(--border-subtle); border-radius:8px; flex:1; font-size:0.82rem; }
        .sf-mode-option input:checked + .sf-mode-card { border-color:var(--accent); background:rgba(59,130,246,0.06); }

        /* Legacy → structured parse review */
        .desc-parse-format-hint { white-space:pre-wrap; margin:0 0 1rem; padding:0.65rem 0.75rem; border-radius:8px; background:rgba(15,23,42,0.35); border:1px solid var(--border-subtle); font-family:var(--font-mono, ui-monospace, monospace); font-size:0.75rem; line-height:1.45; }
        .desc-parse-unmatched { margin:0 0 1rem; padding:0.55rem 0.75rem; border-radius:8px; background:rgba(245,158,11,0.1); border:1px solid rgba(245,158,11,0.35); color:var(--text-main); }
        .desc-parse-list { display:flex; flex-direction:column; gap:1rem; }
        .desc-parse-field { border:1px solid var(--border-subtle); border-radius:10px; padding:0.75rem; background:rgba(15,23,42,0.2); }
        .desc-parse-field-head { display:flex; align-items:center; justify-content:space-between; gap:0.5rem; margin-bottom:0.5rem; font-size:0.875rem; }
        .desc-parse-badge { font-size:0.68rem; font-weight:600; text-transform:uppercase; letter-spacing:0.04em; padding:0.15rem 0.45rem; border-radius:999px; }
        .desc-parse-badge.detected { background:rgba(34,197,94,0.15); color:#22c55e; }
        .desc-parse-badge.empty { background:rgba(148,163,184,0.15); color:var(--text-muted); }
        .desc-parse-actions { display:flex; gap:0.5rem; margin-top:0.5rem; }
        .desc-parse-decision.active[data-decision="accept"] { border-color:#22c55e; color:#22c55e; background:rgba(34,197,94,0.08); }
        .desc-parse-decision.active[data-decision="reject"] { border-color:var(--danger); color:var(--danger); background:rgba(239,68,68,0.08); }

        .ai-result-actions { padding:0.4rem 0.8rem 0.8rem; }

        /* AI profile dropdown (graph toolbar) */
        .ai-profile-menu { position:relative; display:inline-block; }
        .ai-profile-menu > summary { list-style:none; cursor:pointer; display:inline-flex; align-items:center; gap:0.4rem; }
        .ai-profile-menu > summary::-webkit-details-marker { display:none; }
        .ai-menu-count { font-size:0.7rem; opacity:0.85; }
        .ai-profile-popover { position:absolute; right:0; top:calc(100% + 6px); z-index:30; min-width:240px; max-height:320px; overflow:auto; padding:0.6rem; border-radius:10px; background:var(--bg-surface-float); border:1px solid var(--border-strong); box-shadow:var(--shadow-float); display:flex; flex-direction:column; gap:0.45rem; }

        /* Graph zoom controls */
        .graph-zoom-group { display:inline-flex; gap:2px; }
        .graph-zoom-btn { min-width:30px; padding-left:0; padding-right:0; font-size:1rem; line-height:1; font-weight:700; }

        /* "Viewing a historical version" banner */
        .graph-history-banner { display:flex; align-items:center; justify-content:space-between; gap:1rem; flex-wrap:wrap; padding:0.6rem 0.9rem; margin-bottom:0.75rem; border-radius:10px; background:rgba(245,158,11,0.12); border:1px solid rgba(245,158,11,0.4); color:var(--text-h1); font-size:0.82rem; }
        .graph-hist-tools { max-width:340px; max-height:70px; overflow:auto; display:block; font-size:0.76rem; color:var(--text-muted); line-height:1.5; }
        .graph-hist-ver { font-weight:700; color:var(--accent); }

        /* Quality Control */
        .qc-tabs { display:flex; gap:0.35rem; margin-bottom:1rem; }
        .qc-tab { flex:0 0 auto; min-width:8.5rem; padding:0.55rem 1rem; border:1px solid var(--border-subtle); border-radius:10px; background:rgba(15,23,42,0.35); color:var(--text-muted); font-size:0.85rem; cursor:pointer; transition:border-color 0.15s, color 0.15s; }
        .qc-tab:hover { border-color:var(--border-strong); color:var(--text-main); }
        .qc-tab.active { border-color:var(--accent); color:var(--text-h1); background:rgba(59,130,246,0.08); }
        .qc-tab-panel { display:none; }
        .qc-tab-panel.active { display:block; }
        .qc-status-line { margin:0.85rem 0 0; font-size:0.82rem; color:var(--text-main); font-family:var(--font-mono); }
        .qc-split { display:grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap:1rem; align-items:start; }
        .qc-split-side { min-width:0; }
        .qc-run-history, .qc-result-list { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:0.4rem; max-height:220px; overflow:auto; }
        .qc-result-list { max-height:calc(100vh - 420px); }
        .qc-run-item, .qc-result-item { padding:0.7rem 0.8rem; border:1px solid var(--border-subtle); border-radius:10px; background:var(--bg-surface-raised); cursor:pointer; }
        .qc-run-item:hover, .qc-result-item:hover { border-color:var(--border-strong); }
        .qc-result-item.active { border-color:var(--accent); background:rgba(59,130,246,0.08); }
        .qc-result-item-head { display:flex; justify-content:space-between; gap:0.5rem; align-items:center; }
        .qc-score { font-family:var(--font-mono); font-weight:700; color:var(--text-h1); }
        .qc-result-snippet { margin-top:0.3rem; font-size:0.78rem; color:var(--text-muted); display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
        .qc-detail-body { font-size:0.88rem; line-height:1.75; }
        .qc-report-rtl { direction:rtl; text-align:right; unicode-bidi:isolate; }
        .qc-report-rtl .qc-compare-table th,
        .qc-report-rtl .qc-compare-table td { text-align:right; }
        .qc-report-rtl ul { padding-right:1.2rem; padding-left:0; }
        .qc-report-rtl .qc-score,
        .qc-report-rtl .qc-bar-val,
        .qc-report-rtl .qc-detail-scores strong,
        .qc-report-rtl .qc-dash-kpis strong { direction:ltr; unicode-bidi:isolate; display:inline-block; }
        .qc-report-rtl .qc-finding p { text-align:right; }
        .qc-report-rtl .qc-summary,
        .qc-report-rtl .qc-analysis { text-align:right; }
        .qc-detail-scores { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0.6rem; margin-bottom:1rem; }
        .qc-detail-scores div { padding:0.65rem 0.7rem; border-radius:10px; background:var(--bg-surface-raised); border:1px solid var(--border-subtle); }
        .qc-detail-scores span { display:block; font-size:0.7rem; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.04em; }
        .qc-detail-scores strong { font-size:1.1rem; color:var(--text-h1); }
        .qc-summary { font-size:0.92rem; color:var(--text-h1); }
        .qc-metrics { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:0.4rem; margin:0.75rem 0 1rem; }
        .qc-metric { display:flex; justify-content:space-between; gap:0.5rem; font-size:0.75rem; padding:0.35rem 0.5rem; border-radius:8px; background:var(--bg-surface); }
        .qc-metric.has-fail { background:rgba(239,68,68,0.12); color:var(--text-h1); }
        .qc-finding { padding:0.7rem 0; border-bottom:1px solid var(--border-subtle); }
        .qc-finding-head { display:flex; justify-content:space-between; gap:0.5rem; margin-bottom:0.3rem; }
        .qc-analysis { white-space:pre-wrap; color:var(--text-main); }
        .qc-report-history { max-height:calc(100vh - 280px); }
        .qc-run-filter.on { border-color:var(--accent); color:var(--text-h1); background:rgba(59,130,246,0.08); }
        .qc-run-actions { display:flex; gap:0.35rem; margin-top:0.45rem; }
        .qc-run-actions .btn { padding:0.2rem 0.5rem; font-size:0.72rem; }
        .qc-dash-kpis { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:0.6rem; margin-bottom:1rem; }
        .qc-dash-kpis div { padding:0.7rem 0.75rem; border-radius:10px; background:var(--bg-surface-raised); border:1px solid var(--border-subtle); }
        .qc-dash-kpis span { display:block; font-size:0.7rem; color:var(--text-muted); }
        .qc-dash-kpis strong { font-size:1.15rem; color:var(--text-h1); }
        .qc-bar-row { display:grid; grid-template-columns: minmax(9rem, 12rem) 1fr auto; gap:0.55rem; align-items:center; margin-bottom:0.5rem; }
        .qc-bar-label { font-size:0.78rem; }
        .qc-bar-track { height:8px; background:var(--bg-surface); border-radius:99px; overflow:hidden; }
        .qc-bar-fill { height:100%; background:rgba(239,68,68,0.7); border-radius:99px; min-width:0; }
        .qc-bar-val { font-family:var(--font-mono); font-size:0.78rem; min-width:4.5rem; text-align:right; }
        .qc-delta-good { color:#86efac; }
        .qc-delta-bad { color:#fca5a5; }
        .qc-compare-table { width:100%; border-collapse:collapse; font-size:0.8rem; }
        .qc-compare-table th, .qc-compare-table td { padding:0.4rem 0.45rem; border-bottom:1px solid var(--border-subtle); text-align:left; }
        .qc-compare-table th { color:var(--text-muted); font-weight:600; font-size:0.72rem; }
        .qc-issue-thread { padding:0.55rem 0; border-bottom:1px solid var(--border-subtle); cursor:pointer; }
        .qc-issue-thread:hover { color:var(--text-h1); }
        .qc-bucket { font-size:0.7rem; text-transform:uppercase; letter-spacing:0.04em; color:var(--text-muted); }
        .qc-progress { margin-top:0.9rem; }
        .qc-progress-track { height:8px; background:var(--bg-surface); border-radius:99px; overflow:hidden; border:1px solid var(--border-subtle); }
        .qc-progress-fill { height:100%; width:0; background:var(--accent); border-radius:99px; transition:width 0.35s ease; }
        .qc-progress-meta { display:flex; justify-content:space-between; gap:0.75rem; margin-top:0.4rem; font-size:0.78rem; color:var(--text-muted); font-family:var(--font-mono); }
        .qc-chat { display:flex; flex-direction:column; gap:0.7rem; max-height:calc(100vh - 360px); overflow:auto; padding:0.15rem 0.1rem 0.4rem; }
        .qc-chat-msg { max-width:min(42rem, 88%); padding:0.7rem 0.9rem; border-radius:14px; border:1px solid var(--border-subtle); }
        .qc-chat-msg.user { align-self:flex-end; background:var(--role-user-bg); }
        .qc-chat-msg.assistant { align-self:flex-start; background:rgba(59,130,246,0.08); border-color:rgba(59,130,246,0.22); }
        .qc-chat-meta { display:flex; justify-content:space-between; gap:0.75rem; font-size:0.7rem; color:var(--text-muted); margin-bottom:0.3rem; }
        .qc-chat-text { white-space:pre-wrap; word-break:break-word; color:var(--text-h1); line-height:1.5; }
        #qc-live-chat { max-height:calc(100vh - 340px); }
        .qc-run-item.active, .qc-stored-item.active { border-color: var(--accent); background: rgba(59,130,246,0.08); }
        @media (max-width: 900px) {
            .qc-split { grid-template-columns: 1fr; }
            .qc-detail-scores { grid-template-columns:repeat(2,minmax(0,1fr)); }
            .qc-dash-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
            .qc-bar-row { grid-template-columns: 1fr auto; }
            .qc-bar-label { grid-column:1 / -1; }
        }
