:root {
    --fx-bg: #ffffff;
    --fx-rail-bg: #f6f7f9;
    --fx-mid-bg: #fbfbfc;
    --fx-border: #e5e7eb;
    --fx-border-strong: #d1d5db;
    --fx-text: #111827;
    --fx-text-secondary: #4b5563;
    --fx-text-muted: #6b7280;
    --fx-pill-active: #eceef2;
    --fx-pill-hover: #f3f4f6;
    --fx-user-bubble: #0f172a;
    --fx-accent: #111827;
    --fx-ok: #10b981;
    --fx-warn: #f59e0b;
    --fx-err: #ef4444;
    --fx-avatar: #fde047;
    --fx-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --fx-shadow-lg: 0 14px 36px rgba(15, 23, 42, 0.14);
    --fx-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --fx-mono: 'JetBrains Mono', Consolas, monospace;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--fx-font);
    color: var(--fx-text);
    background: var(--fx-bg);
    -webkit-font-smoothing: antialiased;
}

[hidden] {
    display: none !important;
}

/* Login Overlay */
.fx-login-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(246, 247, 249, 0.92);
    backdrop-filter: blur(14px);
}

.fx-login-card {
    width: min(410px, 100%);
    padding: 2.2rem;
    background: #ffffff;
    border: 1px solid var(--fx-border);
    border-radius: 20px;
    box-shadow: var(--fx-shadow-lg);
}

.fx-login-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1.6rem;
}

.fx-login-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #111827;
    color: #ffffff;
    font: 700 1.05rem/1 'Outfit', sans-serif;
    display: grid;
    place-items: center;
    letter-spacing: 0.04em;
}

.fx-login-brand h1 {
    margin: 0;
    font: 700 1.45rem/1.2 'Outfit', sans-serif;
}

.fx-login-brand p {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
    color: var(--fx-text-muted);
}

.fx-login-card label {
    display: block;
    margin: 0 0 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--fx-text-secondary);
}

.fx-login-card input {
    width: 100%;
    margin: 0 0 1rem;
    padding: 0.72rem 0.85rem;
    border: 1px solid var(--fx-border-strong);
    border-radius: 10px;
    font: inherit;
    font-size: 0.92rem;
}

.fx-login-card input:focus {
    outline: 2px solid #111827;
    outline-offset: -1px;
}

.fx-login-card button[type="submit"] {
    width: 100%;
    padding: 0.78rem 1rem;
    border: 0;
    border-radius: 10px;
    background: #111827;
    color: #ffffff;
    font: 600 0.92rem var(--fx-font);
    cursor: pointer;
}

.fx-login-card button[type="submit"]:hover {
    background: #1f2937;
}

.fx-login-error {
    margin-top: 0.85rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 0.82rem;
    font-weight: 500;
}

/* 3-Pane Codex Shell */
.fx-shell {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    transition: filter 0.2s ease;
}

.fx-shell.fx-locked {
    filter: blur(10px);
    pointer-events: none;
    user-select: none;
}

/* 1. Left Control Stripe */
.fx-rail {
    width: 56px;
    flex-shrink: 0;
    background: var(--fx-rail-bg);
    border-right: 1px solid var(--fx-border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 12px;
    z-index: 40;
}

.fx-rail-top, .fx-rail-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.fx-rail-btn {
    position: relative;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--fx-text-secondary);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.14s, color 0.14s;
}

.fx-rail-btn:hover {
    background: var(--fx-pill-hover);
    color: var(--fx-text);
}

.fx-rail-btn.active {
    background: #e7e9ee;
    color: var(--fx-text);
}

.fx-rail-active-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #111827;
    opacity: 0;
}

.fx-rail-btn.active .fx-rail-active-dot {
    opacity: 1;
}

.fx-rail-count-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2563eb;
}

.fx-status-pip {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--fx-ok);
    border: 1.5px solid var(--fx-rail-bg);
}

.fx-status-pip.warn { background: var(--fx-warn); }
.fx-status-pip.err { background: var(--fx-err); }

.fx-user-avatar-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1.5px solid #eab308;
    background: var(--fx-avatar);
    color: #422006;
    font: 700 0.74rem/1 var(--fx-font);
    letter-spacing: 0.02em;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
}

.fx-user-avatar-btn:hover {
    transform: scale(1.04);
    box-shadow: 0 2px 8px rgba(234, 179, 8, 0.35);
}

/* Floating Popover Menus (Status, User, Composer Scope) */
.fx-popover-anchor {
    position: relative;
}

.fx-floating-menu {
    position: absolute;
    z-index: 1000;
    background: #ffffff;
    border: 1px solid var(--fx-border);
    border-radius: 14px;
    box-shadow: var(--fx-shadow-lg);
    padding: 8px;
    min-width: 235px;
}

.fx-status-popover {
    left: 48px;
    bottom: 0;
    width: 270px;
    padding: 12px;
}

.fx-user-popover {
    left: 48px;
    bottom: 0;
    width: 240px;
}

.fx-scope-popover {
    left: 0;
    bottom: calc(100% + 10px);
    width: 280px;
    padding: 10px;
}

.fx-menu-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.8rem;
}

.fx-status-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.fx-status-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--fx-text-secondary);
}

.fx-status-item-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.fx-status-sub {
    font-size: 0.72rem;
    color: var(--fx-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fx-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #9ca3af;
}
.fx-dot.ok { background: var(--fx-ok); }
.fx-dot.warn { background: var(--fx-warn); }
.fx-dot.err { background: var(--fx-err); }

.fx-user-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
}

.fx-user-avatar-sm {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--fx-avatar);
    color: #422006;
    font: 700 0.72rem/1 var(--fx-font);
    display: grid;
    place-items: center;
}

.fx-user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.fx-user-meta strong { font-size: 0.86rem; }
.fx-user-meta span { font-size: 0.74rem; color: var(--fx-text-muted); text-transform: capitalize; }

.fx-menu-divider {
    height: 1px;
    background: var(--fx-border);
    margin: 6px 0;
}

.fx-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--fx-text);
    font: 500 0.84rem var(--fx-font);
    text-decoration: none;
    cursor: pointer;
    text-align: left;
}

.fx-menu-item:hover {
    background: var(--fx-pill-hover);
}

.fx-menu-item kbd {
    margin-left: auto;
    font: 500 0.72rem var(--fx-font);
    color: var(--fx-text-muted);
}

.fx-menu-danger {
    color: #dc2626;
}

/* 2. Middle Pane: History */
.fx-history-pane {
    width: 274px;
    flex-shrink: 0;
    background: var(--fx-mid-bg);
    border-right: 1px solid var(--fx-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.18s ease;
}

.fx-history-pane.collapsed {
    width: 0;
    border-right: 0;
}

.fx-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 12px 8px 14px;
}

.fx-brand-title {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 0;
    padding: 4px 6px;
    margin-left: -6px;
    border-radius: 8px;
    background: transparent;
    font: 700 1.05rem/1 'Outfit', var(--fx-font);
    color: var(--fx-text);
    cursor: pointer;
}

.fx-brand-title:hover {
    background: var(--fx-pill-hover);
}

.fx-history-header-actions {
    display: flex;
    gap: 2px;
}

.fx-icon-btn {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--fx-text-muted);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.fx-icon-btn:hover {
    background: var(--fx-pill-hover);
    color: var(--fx-text);
}

.fx-history-search {
    padding: 0 12px 8px;
}

.fx-history-search input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--fx-border-strong);
    border-radius: 8px;
    font: 400 0.82rem var(--fx-font);
    background: #ffffff;
}

.fx-history-quick {
    padding: 2px 10px 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fx-quick-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--fx-text);
    font: 500 0.85rem var(--fx-font);
    cursor: pointer;
    text-align: left;
}

.fx-quick-row:hover {
    background: var(--fx-pill-hover);
}

.fx-quick-muted {
    color: var(--fx-text-secondary);
}

.fx-dot-ring {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2.5px solid #9ca3af;
    margin: 0 2px;
}

.fx-count-pill {
    margin-left: auto;
    padding: 1px 7px;
    border-radius: 999px;
    background: #e5e7eb;
    color: #374151;
    font: 600 0.72rem/1.4 var(--fx-font);
}

.fx-history-divider {
    height: 1px;
    background: var(--fx-border);
    margin: 4px 12px 8px;
}

.fx-history-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0 10px 16px;
}

.fx-history-empty {
    padding: 18px 10px;
    font-size: 0.8rem;
    color: var(--fx-text-muted);
    line-height: 1.5;
}

.fx-folder-inline-form {
    display: flex;
    gap: 5px;
    padding: 2px 12px 8px;
}

.fx-folder-inline-form input {
    flex: 1;
    min-width: 0;
    padding: 5px 8px;
    border: 1px solid var(--fx-border-strong);
    border-radius: 7px;
    font: 400 0.8rem var(--fx-font);
    background: #ffffff;
}

.fx-history-group {
    margin-bottom: 8px;
    border-radius: 10px;
    transition: background 0.12s ease, outline 0.12s ease;
}

.fx-history-group.drag-over {
    background: #eff6ff;
    outline: 1.5px dashed #3b82f6;
}

.fx-history-group-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 8px;
    color: var(--fx-text-secondary);
    font: 600 0.8rem var(--fx-font);
    cursor: pointer;
    user-select: none;
}

.fx-history-group-head:hover {
    background: var(--fx-pill-hover);
    color: var(--fx-text);
}

.fx-folder-chevron {
    width: 12px;
    height: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--fx-text-muted);
    transition: transform 0.14s ease;
}

.fx-history-group.collapsed .fx-folder-chevron {
    transform: rotate(-90deg);
}

.fx-history-group.collapsed .fx-folder-sessions {
    display: none;
}

.fx-folder-title-text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fx-folder-actions {
    display: none;
    align-items: center;
    gap: 2px;
}

.fx-history-group-head:hover .fx-folder-actions {
    display: inline-flex;
}

.fx-folder-empty-drop {
    padding: 5px 8px 6px 26px;
    font-size: 0.75rem;
    color: var(--fx-text-muted);
    font-style: italic;
}

.fx-root-dropzone {
    margin-top: 6px;
    padding: 8px 10px;
    border: 1.5px dashed transparent;
    border-radius: 9px;
    font-size: 0.75rem;
    color: var(--fx-text-muted);
    text-align: center;
    display: none;
}

.fx-history-scroll.dragging .fx-root-dropzone {
    display: block;
    border-color: var(--fx-border-strong);
    background: #f9fafb;
}

.fx-root-dropzone.drag-over {
    border-color: #3b82f6 !important;
    background: #eff6ff !important;
    color: #1d4ed8;
}

.fx-session-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 8px 6px 24px;
    border-radius: 9px;
    cursor: grab;
    color: var(--fx-text);
    font-size: 0.84rem;
}

.fx-session-row.root-session {
    padding-left: 10px;
}

.fx-session-row:active {
    cursor: grabbing;
}

.fx-session-row.dragging-item {
    opacity: 0.45;
}

.fx-session-row:hover {
    background: var(--fx-pill-hover);
}

.fx-session-row.active {
    background: var(--fx-pill-active);
    font-weight: 500;
}

.fx-session-title {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fx-session-actions {
    display: none;
    align-items: center;
    gap: 2px;
}

.fx-session-row:hover .fx-session-actions,
.fx-session-row.active .fx-session-actions {
    display: inline-flex;
}

.fx-sess-act-btn {
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--fx-text-muted);
    font-size: 0.72rem;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.fx-sess-act-btn:hover {
    background: #dcdfe5;
    color: var(--fx-text);
}

/* 3. Right Pane: Main Stage */
.fx-stage {
    flex: 1;
    min-width: 0;
    background: var(--fx-bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fx-view {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.fx-stage-header {
    height: 50px;
    flex-shrink: 0;
    padding: 0 18px;
    border-bottom: 1px solid #f1f3f5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.fx-stage-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.fx-folder-icon {
    color: var(--fx-text-muted);
    flex-shrink: 0;
}

.fx-stage-title {
    margin: 0;
    font: 600 0.92rem/1.2 var(--fx-font);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.fx-title-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: 2px;
}

.fx-title-act-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border: 1px solid var(--fx-border);
    border-radius: 7px;
    background: #ffffff;
    color: var(--fx-text-muted);
    font: 500 0.73rem/1.2 var(--fx-font);
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.fx-title-act-btn:hover {
    background: var(--fx-pill-hover);
    border-color: var(--fx-border-strong);
    color: var(--fx-text);
}

.fx-title-act-danger:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.fx-mcp-pills {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    margin-right: 4px;
}

.fx-mcp-pill {
    padding: 2px 8px;
    border-radius: 999px;
    font: 600 0.68rem/1.4 var(--fx-font);
    letter-spacing: 0.02em;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}
.fx-mcp-pill.dcs { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.fx-mcp-pill.cas { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }

.fx-stage-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fx-save-toast {
    font-size: 0.76rem;
    color: var(--fx-text-muted);
    margin-right: 4px;
}

.fx-header-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border: 1px solid var(--fx-border);
    border-radius: 8px;
    background: #ffffff;
    color: var(--fx-text-secondary);
    font: 500 0.78rem var(--fx-font);
    cursor: pointer;
}

.fx-header-btn:hover:not(:disabled) {
    background: var(--fx-pill-hover);
    color: var(--fx-text);
}

.fx-header-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

/* Chat Stream */
.fx-chat-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 24px 24px 12px;
}

.fx-chat-messages {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 22px;
    transition: max-width 0.18s ease;
}

.fx-chat-messages:has(.fx-chart-card),
.fx-chat-messages.fx-visual-wide {
    max-width: 1080px;
}

/* Welcome Empty State */
.fx-welcome {
    margin: 6vh auto 2rem;
    max-width: 680px;
    text-align: center;
}

.fx-welcome-badge {
    width: 48px;
    height: 48px;
    margin: 0 auto 14px;
    border-radius: 14px;
    background: #111827;
    color: #ffffff;
    font: 700 1.1rem 'Outfit', sans-serif;
    display: grid;
    place-items: center;
}

.fx-welcome h3 {
    margin: 0 0 6px;
    font: 700 1.4rem 'Outfit', var(--fx-font);
}

.fx-welcome p {
    margin: 0 auto 24px;
    max-width: 500px;
    color: var(--fx-text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.fx-starter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    text-align: left;
}

.fx-starter-card {
    padding: 13px 14px;
    border: 1px solid var(--fx-border);
    border-radius: 13px;
    background: #fbfbfc;
    cursor: pointer;
    transition: border-color 0.14s, background 0.14s;
}

.fx-starter-card:hover {
    border-color: #9ca3af;
    background: #f3f4f6;
}

.fx-starter-tag {
    display: inline-block;
    font: 600 0.68rem var(--fx-font);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--fx-text-muted);
    margin-bottom: 5px;
}

.fx-starter-card p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--fx-text);
    line-height: 1.4;
}

/* User Bubble (Codex Right-Aligned Dark Pill) */
.fx-msg-user {
    align-self: flex-end;
    max-width: min(76%, 560px);
    padding: 10px 18px;
    border-radius: 20px;
    background: var(--fx-user-bubble);
    color: #ffffff;
    font-size: 0.92rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Assistant Message */
.fx-msg-assistant {
    align-self: stretch;
    color: var(--fx-text);
    font-size: 0.93rem;
    line-height: 1.65;
}

/* Agentic Tool Trace ("Worked for Xs >") */
.fx-trace-details {
    margin-bottom: 10px;
}

.fx-trace-summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--fx-text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    padding: 3px 0;
}

.fx-trace-summary::-webkit-details-marker {
    display: none;
}

.fx-trace-summary:hover {
    color: var(--fx-text);
}

.fx-trace-caret {
    transition: transform 0.15s ease;
    font-size: 0.78rem;
}

.fx-trace-details[open] .fx-trace-caret {
    transform: rotate(90deg);
}

.fx-trace-list {
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid var(--fx-border);
    border-radius: 11px;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fx-trace-step {
    font-size: 0.8rem;
    line-height: 1.45;
    border-bottom: 1px dashed #e5e7eb;
    padding-bottom: 6px;
}
.fx-trace-step:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.fx-trace-step-head {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.fx-trace-tag {
    font: 600 0.72rem var(--fx-mono);
    padding: 1px 6px;
    border-radius: 5px;
    background: #e5e7eb;
    color: #111827;
}

.fx-trace-tool {
    font: 500 0.78rem var(--fx-mono);
    color: #1f2937;
}

.fx-trace-meta {
    margin-left: auto;
    font-size: 0.74rem;
    color: var(--fx-text-muted);
}

.fx-trace-query {
    margin-top: 3px;
    font: 400 0.74rem var(--fx-mono);
    color: var(--fx-text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Live Streaming Status */
.fx-live-progress {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 0;
    color: var(--fx-text-secondary);
    font-size: 0.85rem;
}

.fx-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #d1d5db;
    border-top-color: #111827;
    border-radius: 50%;
    animation: fx-spin 0.75s linear infinite;
}

@keyframes fx-spin {
    to { transform: rotate(360deg); }
}

/* Markdown Body */
.fx-md h1, .fx-md h2, .fx-md h3, .fx-md h4 {
    margin: 1.1em 0 0.45em;
    line-height: 1.3;
    font-weight: 600;
}
.fx-md h3:first-child { margin-top: 0.2em; }
.fx-md p { margin: 0.55em 0; }
.fx-md .fx-hr {
    border: 0;
    border-top: 1px solid var(--fx-border);
    margin: 1em 0;
}
.fx-md ul, .fx-md ol { margin: 0.5em 0; padding-left: 1.35rem; }
.fx-md li { margin: 0.25em 0; }
.fx-md code {
    font-family: var(--fx-mono);
    font-size: 0.84em;
    padding: 0.14em 0.38em;
    border-radius: 5px;
    background: #f3f4f6;
    color: #111827;
}
.fx-md pre {
    padding: 12px 14px;
    border-radius: 10px;
    background: #111827;
    color: #f9fafb;
    overflow-x: auto;
}
.fx-md pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.fx-table-wrap {
    overflow-x: auto;
    margin: 0.8em 0;
    border: 1px solid var(--fx-border);
    border-radius: 10px;
}

.fx-md table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.fx-md th, .fx-md td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--fx-border);
    text-align: left;
    vertical-align: top;
}

.fx-md th {
    background: #f9fafb;
    font-weight: 600;
    color: var(--fx-text-secondary);
}

.fx-md tr:last-child td {
    border-bottom: 0;
}

.fx-cite-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    margin: 0 1px;
    border-radius: 5px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    font: 600 0.74rem var(--fx-mono);
    cursor: pointer;
}
.fx-cite-btn:hover {
    background: #dbeafe;
}

.fx-tool-ref {
    display: inline-block;
    padding: 1px 5px;
    margin: 0 1px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: #f3f4f6;
    color: #374151;
    font: 600 0.74rem var(--fx-mono);
    cursor: pointer;
}
.fx-tool-ref:hover {
    background: #e5e7eb;
}

/* Sources Card & Follow-up Chips */
.fx-sources-box {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid var(--fx-border);
    border-radius: 11px;
    background: #fbfbfc;
}

.fx-sources-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fx-text-muted);
    margin-bottom: 7px;
}

.fx-sources-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.fx-source-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid var(--fx-border);
    border-radius: 8px;
    background: #ffffff;
    font-size: 0.78rem;
    color: var(--fx-text);
    cursor: pointer;
}
.fx-source-chip:hover {
    border-color: #9ca3af;
    background: var(--fx-pill-hover);
}

.fx-followups {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.fx-followup-btn {
    padding: 6px 12px;
    border: 1px solid var(--fx-border);
    border-radius: 999px;
    background: #f9fafb;
    color: var(--fx-text-secondary);
    font: 500 0.8rem var(--fx-font);
    cursor: pointer;
    text-align: left;
}
.fx-followup-btn:hover {
    background: #eceef2;
    color: var(--fx-text);
}

.fx-msg-toolbar {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Codex Bottom Composer */
.fx-composer-outer {
    flex-shrink: 0;
    padding: 8px 20px 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, #ffffff 24%);
}

.fx-composer-card {
    max-width: 800px;
    margin: 0 auto;
    border: 1px solid var(--fx-border-strong);
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
    padding: 10px 12px 8px 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.fx-composer-card:focus-within {
    border-color: #9ca3af;
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.08);
}

.fx-scope-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 10px;
    margin-bottom: 6px;
    border-radius: 8px;
    background: #ecfdf5;
    color: #065f46;
    font-size: 0.78rem;
}

.fx-scope-banner button {
    border: 0;
    background: transparent;
    color: #047857;
    font-weight: 600;
    cursor: pointer;
}

#chat-input {
    width: 100%;
    border: 0;
    outline: none;
    resize: none;
    max-height: 180px;
    font: 400 0.94rem/1.5 var(--fx-font);
    color: var(--fx-text);
    background: transparent;
    padding: 2px 2px 6px;
}

.fx-composer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 4px;
}

.fx-composer-left, .fx-composer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fx-composer-icon-btn {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--fx-text-secondary);
    display: grid;
    place-items: center;
    cursor: pointer;
}
.fx-composer-icon-btn:hover {
    background: var(--fx-pill-hover);
    color: var(--fx-text);
}

.fx-composer-mode {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: var(--fx-text-muted);
}

.fx-model-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--fx-text-secondary);
    font: 500 0.8rem var(--fx-font);
    cursor: pointer;
}
.fx-model-pill:hover {
    background: var(--fx-pill-hover);
    color: var(--fx-text);
}

.fx-send-btn {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: #111827;
    color: #ffffff;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: opacity 0.15s;
}
.fx-send-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.fx-mcp-checklist {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fx-mcp-check-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 0.82rem;
    cursor: pointer;
}
.fx-mcp-check-row:hover {
    background: var(--fx-pill-hover);
}
.fx-mcp-check-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* DOCUMENTS & PROJECTS Contextual Split Views (Left Sub-Pane + Right Sub-Stage) */
.fx-split-view {
    flex-direction: row;
    overflow: hidden;
}

.fx-sub-pane {
    width: 274px;
    flex-shrink: 0;
    background: var(--fx-mid-bg);
    border-right: 1px solid var(--fx-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.18s ease;
}

.fx-sub-pane.collapsed {
    width: 0;
    border-right: 0;
}

.fx-sub-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px 10px;
}

.fx-sub-pane-title {
    font: 700 0.92rem/1 'Outfit', var(--fx-font);
    letter-spacing: 0.03em;
    color: var(--fx-text);
}

.fx-sub-pane-search {
    padding: 0 12px 10px;
}

.fx-sub-pane-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 10px 16px;
}

.fx-sub-stage {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--fx-bg);
}

.fx-filter-section {
    margin-bottom: 8px;
}

.fx-filter-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px 6px;
    font: 600 0.7rem/1.2 var(--fx-font);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fx-text-muted);
}

.fx-tree-expand-btns {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-transform: none;
    letter-spacing: 0;
}

.fx-link-btn {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--fx-text-secondary);
    font: 500 0.72rem var(--fx-font);
    cursor: pointer;
}
.fx-link-btn:hover {
    color: var(--fx-text);
    text-decoration: underline;
}

.fx-side-nav-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fx-side-nav-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 9px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--fx-text-secondary);
    font: 400 0.82rem var(--fx-font);
    text-align: left;
    cursor: pointer;
}
.fx-side-nav-btn:hover {
    background: var(--fx-pill-hover);
    color: var(--fx-text);
}
.fx-side-nav-btn.active {
    background: var(--fx-pill-active);
    color: var(--fx-text);
    font-weight: 600;
}
.fx-side-nav-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fx-side-nav-count {
    flex-shrink: 0;
    font-size: 0.72rem;
    color: var(--fx-text-muted);
}

.fx-side-twister {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: var(--fx-text-muted);
    transition: transform 0.14s ease, background 0.12s ease, color 0.12s ease;
}
.fx-side-twister:hover {
    background: rgba(15, 23, 42, 0.08);
    color: var(--fx-text);
}
.fx-side-twister.expanded {
    transform: rotate(90deg);
    color: var(--fx-text);
}
.fx-side-twister-spacer {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    display: inline-block;
}

.fx-doc-status-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--fx-text-secondary);
}

.fx-pane-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 18px 24px;
}

/* CASbot Cloned Hierarchical Filesystem Navigator */
.fx-fs-navigator-pane {
    overflow-x: auto;
    overflow-y: auto;
}

.fx-doc-tree {
    min-width: 0;
}

.document-folder-node {
    min-width: 0;
}
.document-folder-node + .document-folder-node {
    margin-top: 2px;
}

.document-folder-row {
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 0;
    border-bottom: 1px solid #f1f3f5;
    border-radius: 8px;
    background: #fbfbfc;
    color: var(--fx-text);
    font-family: var(--fx-font);
    text-align: left;
    cursor: pointer;
    transition: background 0.14s ease;
}
.document-folder-row:hover {
    background: #f1f5f9;
}
.document-folder-row.expanded {
    background: #f3f6fb;
}

.document-folder-chevron {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--fx-text-muted);
    transition: transform 0.15s ease;
}
.document-folder-row.expanded .document-folder-chevron {
    transform: rotate(90deg);
    color: #2563eb;
}

.document-folder-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #f59e0b;
}

.document-folder-name {
    min-width: 0;
    overflow: hidden;
    font-size: 0.83rem;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.document-folder-count {
    flex-shrink: 0;
    padding: 1px 8px;
    border: 1px solid var(--fx-border);
    border-radius: 999px;
    background: #ffffff;
    color: var(--fx-text-muted);
    font-size: 0.7rem;
    font-weight: 600;
}

.document-folder-children {
    min-width: 0;
    margin-left: 16px;
    padding-left: 13px;
    border-left: 1px solid #e2e8f0;
}

.document-folder-table {
    min-width: 980px;
    margin: 0;
    border: 1px solid var(--fx-border);
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
}

.document-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.document-table th,
.document-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f3f5;
    text-align: left;
    vertical-align: top;
}

.document-table th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.74rem;
    color: var(--fx-text-secondary);
    white-space: nowrap;
}

.document-table tr:last-child td {
    border-bottom: 0;
}

.document-table tbody tr:hover {
    background: #f9fafb;
}

.document-table tbody tr.selected-row {
    background: #f0fdf4;
}

.document-select-cell {
    width: 34px;
    text-align: center !important;
}

.document-title-cell {
    min-width: 200px;
    max-width: 260px;
    font-weight: 600;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.pdf-document-link {
    color: #1d4ed8;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.pdf-document-link:hover {
    color: #1e40af;
}

.document-path-cell {
    min-width: 180px;
    max-width: 250px;
    color: var(--fx-text-muted);
    font-family: var(--fx-mono);
    font-size: 0.74rem;
    word-break: break-all;
}

.document-summary-cell {
    min-width: 340px;
    color: var(--fx-text-secondary);
    line-height: 1.45;
}

/* PDF Viewer Split */
.fx-pdf-workspace {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 300px 1fr;
}

.fx-pdf-sidebar {
    border-right: 1px solid var(--fx-border);
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #fbfbfc;
}

.fx-pdf-meta-block h3 {
    margin: 4px 0 10px;
    font-size: 1rem;
    line-height: 1.35;
}

.fx-meta-dl {
    margin: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 10px;
    font-size: 0.78rem;
}
.fx-meta-dl dt { color: var(--fx-text-muted); font-weight: 500; }
.fx-meta-dl dd { margin: 0; color: var(--fx-text); word-break: break-all; }

.fx-pdf-desc {
    font-size: 0.8rem;
    color: var(--fx-text-secondary);
    line-height: 1.5;
}

.fx-pdf-actions {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.fx-pdf-frame-wrap {
    position: relative;
    background: #eef0f3;
    display: flex;
    flex-direction: column;
}

.fx-pdf-frame-wrap iframe {
    width: 100%;
    height: 100%;
    border: 0;
    flex: 1;
}

.fx-pdf-empty {
    margin: auto;
    padding: 24px;
    color: var(--fx-text-muted);
    font-size: 0.88rem;
    text-align: center;
}

/* PROJECTS Navigation & Detail */
.fx-projects-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fx-project-item {
    padding: 9px 11px;
    border-radius: 9px;
    border: 1px solid transparent;
    cursor: pointer;
}
.fx-project-item:hover { background: var(--fx-pill-hover); }
.fx-project-item.active {
    background: var(--fx-pill-active);
}
.fx-project-item strong { display: block; font-size: 0.85rem; }
.fx-project-item span { font-size: 0.74rem; color: var(--fx-text-muted); }

.fx-project-detail {
    flex: 1;
    min-height: 0;
    padding: 22px;
    overflow-y: auto;
}

.fx-proj-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.fx-proj-section {
    border: 1px solid var(--fx-border);
    border-radius: 12px;
    padding: 14px;
}

.fx-proj-section h4 {
    margin: 0 0 10px;
    font-size: 0.85rem;
}

/* Modal / Control Panel */
.fx-modal {
    border: 0;
    padding: 0;
    border-radius: 18px;
    width: min(840px, 94vw);
    max-height: 88vh;
    box-shadow: var(--fx-shadow-lg);
    background: #ffffff;
    color: var(--fx-text);
}

.fx-modal-sm {
    width: min(440px, 92vw);
}

.fx-modal::backdrop {
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(4px);
}

.fx-modal-shell {
    display: flex;
    flex-direction: column;
    max-height: 88vh;
}

.fx-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--fx-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fx-modal-header h2 {
    margin: 2px 0 0;
    font: 700 1.15rem 'Outfit', var(--fx-font);
}

.fx-eyebrow {
    font: 600 0.68rem var(--fx-font);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fx-text-muted);
}

.fx-lock-bar {
    padding: 10px 20px;
    background: #f9fafb;
    border-bottom: 1px solid var(--fx-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.fx-lock-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    color: var(--fx-text-secondary);
}

.fx-lock-badge {
    padding: 2px 8px;
    border-radius: 999px;
    font: 600 0.72rem var(--fx-font);
}
.fx-lock-badge.locked { background: #fef3c7; color: #92400e; }
.fx-lock-badge.unlocked { background: #d1fae5; color: #065f46; }

.fx-lock-form {
    padding: 12px 20px;
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    display: grid;
    gap: 10px;
}

.fx-lock-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.fx-modal-body {
    padding: 18px 20px 22px;
    overflow-y: auto;
}

.fx-settings-tabs {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--fx-border);
    margin-bottom: 16px;
    padding-bottom: 8px;
}

.fx-stab {
    padding: 7px 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--fx-text-secondary);
    font: 600 0.84rem var(--fx-font);
    cursor: pointer;
}
.fx-stab.active {
    background: #111827;
    color: #ffffff;
}

.fx-segmented {
    display: inline-flex;
    padding: 3px;
    border-radius: 10px;
    background: #f3f4f6;
    gap: 3px;
}

.fx-seg-btn {
    padding: 6px 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font: 600 0.82rem var(--fx-font);
    color: var(--fx-text-secondary);
    cursor: pointer;
}
.fx-seg-btn.active {
    background: #ffffff;
    color: var(--fx-text);
    box-shadow: var(--fx-shadow-sm);
}

.fx-provider-card, .fx-mcp-card, .fx-mcp-create-card {
    margin-top: 14px;
    padding: 16px;
    border: 1px solid var(--fx-border);
    border-radius: 13px;
    background: #fbfbfc;
}

.fx-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.fx-cred-badge {
    padding: 2px 8px;
    border-radius: 999px;
    font: 600 0.72rem var(--fx-font);
    background: #f3f4f6;
    color: var(--fx-text-muted);
}
.fx-cred-badge.ok {
    background: #d1fae5;
    color: #065f46;
}

.fx-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.fx-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.fx-field-group label, .fx-label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--fx-text-secondary);
}

.fx-input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--fx-border-strong);
    border-radius: 8px;
    font: 400 0.85rem var(--fx-font);
    background: #ffffff;
    color: var(--fx-text);
}

.fx-inline-row {
    display: flex;
    gap: 6px;
}

.fx-form-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
}

.fx-btn-primary {
    padding: 7px 14px;
    border: 0;
    border-radius: 8px;
    background: #111827;
    color: #ffffff;
    font: 600 0.82rem var(--fx-font);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.fx-btn-primary:hover:not(:disabled) { background: #1f2937; }
.fx-btn-primary:disabled { opacity: 0.45; cursor: default; }

.fx-btn-secondary {
    padding: 7px 12px;
    border: 1px solid var(--fx-border-strong);
    border-radius: 8px;
    background: #ffffff;
    color: var(--fx-text);
    font: 500 0.82rem var(--fx-font);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.fx-btn-secondary:hover:not(:disabled) { background: var(--fx-pill-hover); }

.fx-mini-btn {
    padding: 3px 8px;
    border: 1px solid var(--fx-border);
    border-radius: 6px;
    background: #ffffff;
    font: 500 0.74rem var(--fx-font);
    color: var(--fx-text-secondary);
    cursor: pointer;
}
.fx-mini-btn:hover { background: var(--fx-pill-hover); }

.fx-mcp-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.fx-help-text {
    margin: 2px 0 0;
    font-size: 0.78rem;
    color: var(--fx-text-muted);
}

.fx-mcp-cards-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.fx-mcp-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.fx-mcp-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fx-mcp-tools-drawer {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.fx-tool-chip {
    padding: 2px 7px;
    border-radius: 6px;
    background: #eef2ff;
    color: #3730a3;
    font: 500 0.72rem var(--fx-mono);
}

.fx-status-note {
    font-size: 0.78rem;
    color: var(--fx-text-secondary);
    margin-right: auto;
}

.fx-stack-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fx-empty-card {
    padding: 32px;
    border: 1px dashed var(--fx-border-strong);
    border-radius: 12px;
    text-align: center;
    color: var(--fx-text-muted);
    font-size: 0.86rem;
}

/* Interactive Visual Charts Mode & Quickview Chart Widgets */
.fx-quick-visual {
    color: #1769aa;
}
.fx-quick-visual:hover {
    background: #eef6fc;
    color: #0f4c81;
}

.fx-visual-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    background: #eef6fc;
    border: 1px solid #bfdbfe;
    color: #1769aa;
    font: 600 0.68rem/1.3 var(--fx-font);
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.fx-sess-visual-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #1769aa;
    margin-right: 5px;
    flex-shrink: 0;
}

.fx-visual-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--fx-border);
    background: #f9fafb;
    color: var(--fx-text-secondary);
    font: 500 0.76rem/1.2 var(--fx-font);
    cursor: pointer;
    transition: background 0.14s, border-color 0.14s, color 0.14s;
}
.fx-visual-toggle-btn:hover {
    background: var(--fx-pill-hover);
    color: var(--fx-text);
}
.fx-visual-toggle-btn[aria-pressed="true"] {
    background: #eef6fc;
    border-color: #60a5fa;
    color: #1769aa;
    font-weight: 600;
}

.fx-modal-xl {
    width: min(1220px, 96vw);
    max-height: 92vh;
}

.fx-chart-modal-body {
    background: #f6f8fb;
}

.fx-chart-card {
    margin: 14px 0;
    padding: 18px 20px;
    border: 1px solid #dfe5ec;
    border-radius: 14px;
    background: #f6f8fb;
    color: #17202a;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.fx-chart-modal-body .fx-chart-card {
    margin: 0;
    border: 0;
    padding: 4px;
    box-shadow: none;
}

.fx-chart-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.fx-chart-titles {
    min-width: 220px;
    flex: 1;
}

.fx-chart-eyebrow {
    font: 700 0.68rem/1.2 var(--fx-font);
    color: #1769aa;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.fx-chart-title {
    margin: 0 !important;
    font: 700 1.4rem/1.2 'Outfit', var(--fx-font) !important;
    color: #17202a;
}

.fx-chart-subtitle {
    margin: 5px 0 0 !important;
    font-size: 0.82rem;
    color: #697586;
}

.fx-chart-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.fx-chart-view-switch {
    display: inline-flex;
    padding: 2px;
    border: 1px solid #d5dde6;
    border-radius: 8px;
    background: #ffffff;
    gap: 2px;
}

.fx-view-sw-btn {
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #697586;
    padding: 4px 8px;
    font: 600 0.72rem/1 var(--fx-font);
    cursor: pointer;
}
.fx-view-sw-btn:hover {
    color: #17202a;
}
.fx-view-sw-btn.active {
    background: #eef4f8;
    color: #1769aa;
}

.fx-chart-act-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 9px;
    border: 1px solid #d5dde6;
    border-radius: 8px;
    background: #ffffff;
    color: #374151;
    font: 600 0.73rem/1 var(--fx-font);
    cursor: pointer;
}
.fx-chart-act-btn:hover {
    background: #eef4f8;
    border-color: #9fc2d9;
    color: #1769aa;
}

.fx-chart-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.fx-chart-kpi {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 14px;
}
.fx-chart-kpi-label {
    font-size: 0.73rem;
    color: #697586;
}
.fx-chart-kpi-val {
    font: 700 1.25rem/1.2 var(--fx-font);
    color: #17202a;
    margin-top: 4px;
}
.fx-chart-kpi-delta {
    font-size: 0.72rem;
    color: #129c9a;
    margin-top: 2px;
}

.fx-chart-tabs {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid #dfe5ec;
    margin: 12px 0 12px;
    overflow-x: auto;
}

.fx-chart-tab {
    border: 1px solid #dfe5ec;
    border-bottom: 0;
    background: #eef4f8;
    color: #1769aa;
    border-radius: 8px 8px 0 0;
    padding: 7px 12px;
    cursor: pointer;
    font: 700 0.78rem/1.2 var(--fx-font);
    white-space: nowrap;
}
.fx-chart-tab:hover {
    background: #e3eef6;
}
.fx-chart-tab.active {
    background: #ffffff;
    color: #17202a;
    position: relative;
    bottom: -1px;
}

.fx-chart-legend-card,
.fx-chart-panel {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 11px;
    padding: 14px 16px;
    margin-top: 10px;
}

.fx-chart-legend-title {
    font: 700 0.84rem/1.2 var(--fx-font);
    color: #17202a;
    margin-bottom: 8px;
}

.fx-chart-legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 16px;
    font-size: 0.78rem;
    color: #697586;
}

.fx-chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.fx-chart-legend-item strong {
    color: #17202a;
}

.fx-band-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
    flex-shrink: 0;
}

.fx-chart-panel-title {
    margin: 0 0 10px !important;
    font: 700 0.96rem/1.3 var(--fx-font) !important;
    color: #17202a;
}

.fx-chart-panel-sub {
    margin: -4px 0 10px !important;
    font-size: 0.78rem;
    color: #697586;
}

.fx-chart-table-wrap {
    overflow-x: auto;
    border: 0 !important;
    margin: 0 !important;
}

.fx-chart-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem !important;
}

.fx-chart-data-table th,
.fx-chart-data-table td {
    padding: 8px 8px !important;
    border-bottom: 1px solid #e5e7eb !important;
    white-space: nowrap;
    vertical-align: middle !important;
}

.fx-chart-data-table th {
    background: transparent !important;
    font: 600 0.68rem/1.2 var(--fx-font) !important;
    color: #697586 !important;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.fx-chart-data-table th.num,
.fx-chart-data-table td.num {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}

.fx-chart-data-table td.group-cell {
    font-weight: 500;
    color: #17202a;
}

.fx-sort-th {
    border: 0;
    padding: 0;
    background: transparent;
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
}
.fx-sort-th:hover {
    color: #17202a;
}

.fx-heat-col {
    min-width: 195px;
}

.fx-heat-bar {
    display: flex;
    height: 21px;
    min-width: 190px;
    border-radius: 5px;
    overflow: hidden;
    background: #eef1f4;
}

.fx-composition-bar {
    display: flex;
    height: 28px;
    width: 100%;
    border-radius: 7px;
    overflow: hidden;
    background: #eef1f4;
}

.fx-heat-seg {
    min-width: 2px;
    height: 100%;
    transition: opacity 0.12s;
}
.fx-heat-seg:hover {
    opacity: 0.85;
}

.fx-pct-muted {
    color: #697586;
    font-size: 0.75rem;
}

/* Vertical Column Chart */
.fx-vbar-plot {
    height: 225px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 24px 8px 6px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 10px;
    overflow-x: auto;
}

.fx-vbar-col {
    flex: 1;
    min-width: 44px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.fx-vbar-track {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.fx-vbar-fill {
    width: 100%;
    max-width: 54px;
    min-height: 2px;
    border-radius: 6px 6px 2px 2px;
    position: relative;
    transition: filter 0.12s;
}
.fx-vbar-fill:hover {
    filter: brightness(1.08);
}

.fx-vbar-val {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font: 600 0.68rem/1 var(--fx-font);
    color: #17202a;
    white-space: nowrap;
}

.fx-vbar-label {
    margin-top: 7px;
    max-width: 82px;
    font-size: 0.7rem;
    color: #697586;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Horizontal Bar Chart */
.fx-hbar-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.fx-hbar-row {
    display: grid;
    grid-template-columns: minmax(110px, 180px) 1fr auto;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
}

.fx-hbar-label {
    font-weight: 500;
    color: #17202a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fx-hbar-track {
    height: 18px;
    border-radius: 5px;
    background: #eef1f4;
    overflow: hidden;
}

.fx-hbar-fill {
    height: 100%;
    border-radius: 5px;
}

.fx-hbar-metric {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.fx-hbar-bytes {
    margin-left: 8px;
    color: #697586;
    font-size: 0.74rem;
}

/* Donut Chart */
.fx-donut-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 20px;
    align-items: center;
}

.fx-donut-svg-box {
    display: flex;
    justify-content: center;
}

.fx-chart-empty {
    padding: 22px;
    text-align: center;
    color: #697586;
    font-size: 0.82rem;
}

@media (max-width: 860px) {
    .fx-donut-layout {
        grid-template-columns: 1fr;
    }
    .fx-hbar-row {
        grid-template-columns: 110px 1fr auto;
    }
}

@media (max-width: 860px) {
    .fx-history-pane {
        position: fixed;
        left: 56px;
        top: 0;
        bottom: 0;
        z-index: 35;
        box-shadow: var(--fx-shadow-lg);
    }
    .fx-pdf-workspace, .fx-projects-layout {
        grid-template-columns: 1fr;
    }
}
