/* ============================================================================
   Aristos-Axis IDE — Core Stylesheet
   Purple Brand System (Jacarta/Lavender/Iris) — April 2026 Rebrand
   Dark theme, 5-pane Cascade layout, smooth transitions, mobile-first
   ============================================================================ */

/* --- Reset & Variables --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Cyberiada Display Font */
@font-face {
    font-family: 'Cyberiada Medium';
    src: url('../fonts/cyberiada_medium.woff2') format('woff2'),
         url('../fonts/cyberiada_medium.woff') format('woff'),
         url('../fonts/Cyberiada-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Core Brand (April 2026 Aristos Purple) */
    --jacarta:          #2D2769;
    --jacarta-d:        #1E1A4A;
    --jacarta-dd:       #15123A;
    --jacarta-ddd:      #0A0820;
    --jacarta-l:        #3D3580;
    --jacarta-ll:       #4A3B8F;
    --jacarta-80:       rgba(45, 39, 105, 0.80);
    --jacarta-20:       rgba(45, 39, 105, 0.20);
    --jacarta-08:       rgba(45, 39, 105, 0.08);

    --lavender:         #9889C0;
    --lavender-l:       #B5A9D3;
    --lavender-ll:      #D4CDE5;
    --lavender-lll:     #EDE9F4;
    --lavender-d:       #7B6EA8;
    --lavender-dd:      #6A5E98;
    --lavender-20:      rgba(152, 137, 192, 0.20);
    --lavender-10:      rgba(152, 137, 192, 0.10);
    --lavender-08:      rgba(152, 137, 192, 0.08);

    --iris:             #C49CE0;
    --iris-soft:        rgba(196, 156, 224, 0.55);
    --iris-glow:        rgba(196, 156, 224, 0.18);

    /* Axis Dark Theme mapped to Purple Brand */
    --ax-bg:            #0A0820;
    --ax-bg-raised:     #15123A;
    --ax-bg-surface:    #1E1A4A;
    --ax-bg-hover:      #2D2769;
    --ax-bg-active:     #3D3580;
    --ax-border:        rgba(152, 137, 192, 0.15);
    --ax-border-focus:  rgba(196, 156, 224, 0.5);
    --ax-text:          #E0E0E0;
    --ax-text-muted:    #9889C0;
    --ax-text-bright:   #FFFFFF;
    --ax-accent:        #C49CE0;
    --ax-accent-hover:  #D4CDE5;
    --ax-accent-dim:    rgba(196, 156, 224, 0.12);
    --ax-success:       #10B981;
    --ax-warning:       #F59E0B;
    --ax-danger:        #EF4444;
    --ax-info:          #7BB0FF;

    /* Brand aliases for backward compatibility */
    --ax-gold:          #C49CE0;
    --ax-gold-l:        #D4CDE5;
    --ax-gold-d:        #9889C0;
    --ax-gold-gradient: linear-gradient(135deg, #2D2769 0%, #9889C0 25%, #C49CE0 50%, #B5A9D3 75%, #7B6EA8 100%);

    /* Typography - Purple Brand System */
    --ax-font:          'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
    --ax-font-ui:       'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --ax-font-logo:     'Cyberiada Medium', 'Inter', sans-serif;
    --ax-font-size:     13px;
    --ax-radius:        14px;
    --ax-radius-sm:     8px;
    --ax-radius-lg:     24px;
    --ax-sidebar-w:     288px;
    --ax-topbar-h:      48px;
    --ax-statusbar-h:   28px;
    --ax-tab-h:         40px;
    --ax-transition:    150ms cubic-bezier(0.4, 0, 0.2, 1);
    --ax-shadow:        0 4px 12px rgba(45,39,105,0.20);
    --ax-shadow-gold:   0 0 20px rgba(196,156,224,0.20);
}

html, body {
    height: 100dvh;
    height: 100vh;
    height: -webkit-fill-available;
    overflow: hidden;
    background: var(--ax-bg);
    color: var(--ax-text);
    font-family: var(--ax-font-ui);
    font-size: var(--ax-font-size);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
}

/* --- Scrollbar (Aristos Purple) --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(152,137,192,0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(196,156,224,0.5); }
* { scrollbar-width: thin; scrollbar-color: rgba(152,137,192,0.3) transparent; }

/* --- Selection (Iris tint) --- */
::selection { background: rgba(196,156,224,0.25); color: var(--ax-text-bright); }

/* ============================================================================
   Layout Shell
   ============================================================================ */
.ax-shell {
    display: grid;
    grid-template-columns: var(--ax-sidebar-w) 1fr;
    grid-template-rows: var(--ax-topbar-h) 1fr var(--ax-statusbar-h);
    grid-template-areas:
        "sidebar topbar"
        "sidebar main"
        "sidebar statusbar";
    height: 100dvh;
    height: 100vh;
    height: -webkit-fill-available;
    width: 100vw;
    overflow: hidden;
}

/* --- Topbar --- */
.ax-topbar {
    grid-area: topbar;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    background: var(--ax-bg-raised);
    border-bottom: 1px solid var(--ax-border);
    z-index: 20;
}
.ax-topbar-title {
    font-weight: 600;
    font-size: 12px;
    color: var(--ax-text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.ax-topbar-spacer { flex: 1; }
.ax-topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* --- Sidebar --- */
.ax-sidebar {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    background: var(--ax-bg-raised);
    border-right: 1px solid var(--ax-border);
    overflow: hidden;
    z-index: 30;
    transition: transform var(--ax-transition), width var(--ax-transition);
}
.ax-sidebar-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--ax-border);
    min-height: var(--ax-topbar-h);
}
.ax-sidebar-logo {
    width: 24px;
    height: 24px;
    background: var(--ax-gold-gradient);
    border-radius: var(--ax-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    color: #fff;
    flex-shrink: 0;
}
.ax-sidebar-brand {
    font-weight: 600;
    font-size: 14px;
    color: var(--ax-text-bright);
    white-space: nowrap;
}
.ax-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 6px;
    border-bottom: 1px solid var(--ax-border);
}
.ax-sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--ax-radius-sm);
    color: var(--ax-text-muted);
    cursor: pointer;
    font-size: 12px;
    transition: background var(--ax-transition), color var(--ax-transition);
    user-select: none;
}
.ax-sidebar-nav-item:hover { background: var(--ax-bg-hover); color: var(--ax-text); }
.ax-sidebar-nav-item.active { background: var(--ax-accent-dim); color: var(--ax-gold); }
.ax-sidebar-nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.ax-sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* --- File Tree --- */
.ax-file-tree {
    padding: 4px 0;
}
.ax-tree-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px 3px calc(var(--depth, 0) * 16px + 8px);
    cursor: pointer;
    font-size: 12px;
    color: var(--ax-text);
    transition: background var(--ax-transition);
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ax-tree-item:hover { background: var(--ax-bg-hover); }
.ax-tree-item.selected { background: rgba(196,156,224,0.1); color: var(--ax-iris); border-left: 2px solid var(--ax-iris); }
.ax-tree-item.context-active { border-right: 2px solid var(--ax-iris); }
.ax-tree-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.7;
}
.ax-tree-chevron {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    transition: transform var(--ax-transition);
    opacity: 0.5;
}
.ax-tree-chevron.open { transform: rotate(90deg); }
.ax-tree-name { overflow: hidden; text-overflow: ellipsis; }
.ax-tree-dir > .ax-tree-children { display: none; }
.ax-tree-dir.expanded > .ax-tree-children { display: block; }

/* --- Main Content Area (Cascade Panes) --- */
.ax-main {
    grid-area: main;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--ax-bg);
}

/* --- Pane Container --- */
.ax-pane-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}
.ax-pane-container.horizontal { flex-direction: row; }
.ax-pane-container.vertical { flex-direction: column; }

/* --- Individual Pane --- */
.ax-pane {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--ax-border);
    border-radius: var(--ax-radius-sm);
    margin: 2px;
    background: var(--ax-bg-raised);
    transition: opacity var(--ax-transition), flex var(--ax-transition);
    min-width: 120px;
    min-height: 80px;
    position: relative;
}
.ax-pane.focused { border-color: var(--ax-border-focus); box-shadow: var(--ax-shadow-gold); }
.ax-pane.hidden-pane { display: none; }
.ax-pane-header {
    display: flex;
    align-items: center;
    height: var(--ax-tab-h);
    background: var(--ax-bg-surface);
    border-bottom: 1px solid var(--ax-border);
    padding: 0 4px;
    flex-shrink: 0;
    gap: 2px;
}
.ax-pane-tab {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 11px;
    color: var(--ax-text-muted);
    border-radius: var(--ax-radius-sm) var(--ax-radius-sm) 0 0;
    cursor: pointer;
    transition: background var(--ax-transition), color var(--ax-transition);
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;
}
.ax-pane-tab:hover { background: var(--ax-bg-hover); color: var(--ax-text); }
.ax-pane-tab.active { background: var(--ax-bg-raised); color: var(--ax-text-bright); border-bottom: 2px solid var(--ax-iris); }
.ax-pane-tab-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ax-warning);
    flex-shrink: 0;
    display: none;
}
.ax-pane-tab-dot.unsaved { display: block; }
.ax-pane-spacer { flex: 1; }
.ax-pane-actions {
    display: flex;
    gap: 2px;
}
.ax-pane-body {
    flex: 1;
    overflow: auto;
    position: relative;
}

/* --- Resize Handle --- */
.ax-resize-handle {
    flex-shrink: 0;
    background: transparent;
    z-index: 10;
    transition: background var(--ax-transition);
}
.ax-resize-handle:hover, .ax-resize-handle.active {
    background: var(--ax-iris);
}
.ax-resize-handle.horizontal {
    width: 4px;
    cursor: col-resize;
    margin: 2px 0;
}
.ax-resize-handle.vertical {
    height: 4px;
    cursor: row-resize;
    margin: 0 2px;
}

/* --- Editor Pane --- */
.ax-editor {
    width: 100%;
    height: 100%;
    background: transparent;
    color: var(--ax-text);
    border: none;
    outline: none;
    resize: none;
    padding: 8px 12px;
    font-family: var(--ax-font);
    font-size: var(--ax-font-size);
    line-height: 1.6;
    tab-size: 4;
    white-space: pre;
    overflow: auto;
}
.ax-editor::placeholder { color: var(--ax-text-muted); }
.ax-line-numbers {
    position: absolute;
    left: 0;
    top: 0;
    width: 48px;
    padding: 8px 8px 8px 0;
    text-align: right;
    font-family: var(--ax-font);
    font-size: var(--ax-font-size);
    line-height: 1.6;
    color: var(--ax-text-muted);
    user-select: none;
    pointer-events: none;
    opacity: 0.5;
}
.ax-editor-wrap .ax-editor { padding-left: 56px; }

/* --- Terminal Pane --- */
.ax-terminal {
    width: 100%;
    height: 100%;
    background: var(--ax-bg);
    color: var(--ax-success);
    border: none;
    outline: none;
    resize: none;
    padding: 8px 12px;
    font-family: var(--ax-font);
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow: auto;
}
.ax-terminal-input {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-top: 1px solid var(--ax-border);
    background: var(--ax-bg);
}
.ax-terminal-prompt {
    color: rgba(212,175,55,0.6);
    font-family: var(--ax-font);
    font-size: 12px;
    flex-shrink: 0;
}
.ax-terminal-input input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--ax-text);
    font-family: var(--ax-font);
    font-size: 12px;
}

/* --- AI Chat Pane --- */
.ax-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ax-chat-msg {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: var(--ax-radius);
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: ax-fadeIn 200ms ease;
}
.ax-chat-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(196,156,224,0.12) 0%, rgba(152,137,192,0.08) 100%);
    color: var(--ax-text-bright);
    border: 1px solid rgba(196,156,224,0.22);
    box-shadow: 0 2px 8px rgba(196,156,224,0.08);
}
.ax-chat-msg.assistant {
    align-self: flex-start;
    background: var(--ax-bg-surface);
    color: var(--ax-text);
    border: 1px solid var(--ax-border);
}

/* --- Message Hover Action Buttons --- */
.ax-msg-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: var(--ax-radius-sm, 8px);
    color: var(--ax-text-dim, #666);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 150ms ease;
    -webkit-tap-highlight-color: transparent;
}
.ax-msg-action:hover {
    color: var(--iris, #C49CE0);
    background: rgba(196,156,224,0.12);
    border-color: rgba(196,156,224,0.3);
}
.ax-msg-action:active {
    transform: scale(0.92);
    background: rgba(196,156,224,0.2);
}
/* --- Inline Code (premium styling) --- */
.ax-chat-msg code {
    font-family: var(--ax-font);
    font-size: 12.5px;
    background: rgba(45, 39, 105, 0.4);
    color: var(--iris);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(196,156,224,0.15);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

/* --- Code Blocks (Cascade-style premium) --- */
.ax-chat-msg pre {
    background: linear-gradient(180deg, rgba(21,18,58,0.95) 0%, rgba(10,8,32,0.98) 100%);
    border-radius: 10px;
    padding: 0;
    margin: 12px 0;
    overflow-x: auto;
    font-family: var(--ax-font);
    font-size: 12.5px;
    line-height: 1.6;
    border: 1px solid rgba(152,137,192,0.15);
    box-shadow:
        0 4px 16px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.03);
}
.ax-chat-msg pre code {
    display: block;
    padding: 12px 14px;
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--ax-text-bright);
    overflow-x: auto;
}

/* --- File Header for Code Blocks --- */
.ax-chat-msg .code-block-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(90deg, rgba(45,39,105,0.6) 0%, rgba(30,26,74,0.4) 100%);
    border-bottom: 1px solid rgba(152,137,192,0.12);
    border-radius: 10px 10px 0 0;
    font-family: var(--ax-font-ui);
    font-size: 11px;
    font-weight: 600;
    color: var(--lavender);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.ax-chat-msg .code-block-header::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: var(--iris);
    box-shadow: 0 0 8px var(--iris-glow);
}
.ax-chat-msg .code-block-header.file-js::before { background: #F7DF1E; }
.ax-chat-msg .code-block-header.file-css::before { background: #264DE4; }
.ax-chat-msg .code-block-header.file-php::before { background: #777BB4; }
.ax-chat-msg .code-block-header.file-html::before { background: #E34C26; }

/* --- Syntax Highlighting Colors (diff-style) --- */
.ax-chat-msg .code-add {
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
    display: inline-block;
    width: 100%;
    padding: 0 4px;
    margin: 0 -4px;
}
.ax-chat-msg .code-del {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
    display: inline-block;
    width: 100%;
    padding: 0 4px;
    margin: 0 -4px;
    text-decoration: line-through;
}
.ax-chat-msg .code-line-num {
    color: var(--lavender-d);
    user-select: none;
    min-width: 2.5rem;
    text-align: right;
    padding-right: 12px;
    margin-right: 8px;
    border-right: 1px solid rgba(152,137,192,0.1);
}
.ax-chat-input-wrap {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    border-top: 1px solid var(--ax-border);
    background: var(--ax-bg-surface);
}
.ax-chat-input {
    flex: 1;
    background: var(--ax-bg);
    border: 1px solid var(--ax-border);
    border-radius: var(--ax-radius);
    padding: 6px 10px;
    color: var(--ax-text);
    font-family: var(--ax-font-ui);
    font-size: 13px;
    outline: none;
    resize: none;
    min-height: 36px;
    max-height: 120px;
    transition: border-color var(--ax-transition);
}
.ax-chat-input:focus { border-color: var(--iris); box-shadow: 0 0 0 3px rgba(196,156,224,0.15), 0 4px 12px rgba(196,156,224,0.1); }

/* --- Preview Pane --- */
.ax-preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}

/* --- Status Bar --- */
.ax-statusbar {
    grid-area: statusbar;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    background: var(--ax-bg-raised);
    border-top: 1px solid var(--ax-border);
    font-size: 11px;
    color: var(--ax-text-muted);
    z-index: 20;
}
.ax-statusbar-left, .ax-statusbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.ax-statusbar-left { flex: 1; }
.ax-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ax-status-indicator.saved { background: var(--ax-success); }
.ax-status-indicator.saving { background: var(--ax-warning); animation: ax-pulse 1s infinite; }
.ax-status-indicator.error { background: var(--ax-danger); }

/* --- Buttons --- */
.ax-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 8px;
    border: 1px solid var(--ax-border);
    border-radius: var(--ax-radius-sm);
    background: var(--ax-bg-surface);
    color: var(--ax-text);
    font-family: var(--ax-font-ui);
    font-size: 11px;
    cursor: pointer;
    transition: background var(--ax-transition), border-color var(--ax-transition), color var(--ax-transition);
    white-space: nowrap;
    user-select: none;
}
.ax-btn:hover { background: var(--ax-bg-hover); border-color: var(--ax-text-muted); }
.ax-btn:active { background: var(--ax-bg-active); }
.ax-btn.primary { background: var(--ax-purple-gradient); background-size: 200% auto; border-color: transparent; color: #000; font-weight: 600; }
.ax-btn.primary:hover { background-position: right center; box-shadow: var(--ax-shadow-purple); }
.ax-btn svg { width: 14px; height: 14px; }
.ax-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: var(--ax-radius-sm);
    background: transparent;
    color: var(--ax-text-muted);
    cursor: pointer;
    transition: background var(--ax-transition), color var(--ax-transition);
}
.ax-icon-btn:hover { background: var(--ax-bg-hover); color: var(--ax-text); }
.ax-icon-btn svg { width: 14px; height: 14px; }

/* --- Toast Notifications --- */
.ax-toast-container {
    position: fixed;
    bottom: calc(var(--ax-statusbar-h) + 8px);
    right: 12px;
    z-index: 1000;
    display: flex;
    flex-direction: column-reverse;
    gap: 6px;
    pointer-events: none;
}
.ax-toast {
    padding: 8px 14px;
    border-radius: var(--ax-radius);
    font-size: 12px;
    background: var(--ax-bg-surface);
    border: 1px solid var(--ax-border);
    color: var(--ax-text);
    box-shadow: var(--ax-shadow);
    pointer-events: auto;
    animation: ax-slideUp 200ms ease;
    max-width: 320px;
}
.ax-toast.success { border-color: var(--ax-success); }
.ax-toast.error { border-color: var(--ax-danger); }
.ax-toast.warning { border-color: var(--ax-warning); }

/* --- Animations --- */
@keyframes ax-fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes ax-slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes ax-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* --- Optimistic UI --- */
.ax-optimistic { opacity: 0.7; transition: opacity var(--ax-transition); }
.ax-optimistic.confirmed { opacity: 1; }
.ax-optimistic.failed { opacity: 1; border-left: 2px solid var(--ax-danger); }

/* --- Gold Focus Ring (Aristos signature) --- */
.ax-btn:focus-visible, .ax-icon-btn:focus-visible {
    outline: 2px solid rgba(212,175,55,0.5);
    outline-offset: 2px;
    border-radius: var(--ax-radius-sm);
}

/* --- Card Hover Lift (Aristos signature) --- */
.ax-card-lift {
    transition: all 0.25s ease;
}
.ax-card-lift:hover {
    border-color: rgba(212,175,55,0.3);
    box-shadow: 0 0 20px rgba(212,175,55,0.15);
    transform: translateY(-1px);
}

/* --- Workspace Picker (overlay) --- */
.ax-workspace-picker {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ax-fadeIn 200ms ease;
}
.ax-workspace-picker-inner {
    background: var(--ax-bg-raised);
    border: 1px solid var(--ax-border);
    border-radius: var(--ax-radius);
    padding: 24px;
    width: 420px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
}
.ax-workspace-picker-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--ax-text-bright);
    margin-bottom: 16px;
}
.ax-workspace-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--ax-border);
    border-radius: var(--ax-radius);
    cursor: pointer;
    margin-bottom: 8px;
    transition: border-color var(--ax-transition), background var(--ax-transition);
}
.ax-workspace-card:hover { border-color: var(--ax-iris); background: rgba(196,156,224,0.05); }
.ax-workspace-card-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--ax-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.ax-workspace-card-info { flex: 1; min-width: 0; }
.ax-workspace-card-name { font-weight: 600; font-size: 14px; color: var(--ax-text-bright); }
.ax-workspace-card-meta { font-size: 11px; color: var(--ax-text-muted); }

/* --- Loading Skeleton (Purple shimmer) --- */
.ax-skeleton {
    background: linear-gradient(90deg, #1a1a1a 25%, rgba(196,156,224,0.08) 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: ax-shimmer 2.5s linear infinite;
    border-radius: var(--ax-radius-sm);
}
@keyframes ax-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================================
   Responsive
   ============================================================================ */
.ax-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 25;
}

@media (max-width: 1024px) {
    :root { --ax-sidebar-w: 240px; }
}

@media (max-width: 768px) {
    .ax-shell {
        grid-template-columns: 1fr;
        grid-template-areas:
            "topbar"
            "main"
            "statusbar";
    }
    .ax-sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        width: 280px;
        transform: translateX(-100%);
        z-index: 40;
        box-shadow: var(--ax-shadow);
    }
    .ax-sidebar.open { transform: translateX(0); }
    .ax-sidebar-overlay.open { display: block; z-index: 35; }
    .ax-pane-container { flex-direction: column; }
    .ax-resize-handle.horizontal { width: 100%; height: 4px; cursor: row-resize; }
}

@media (max-width: 480px) {
    :root { --ax-font-size: 12px; --ax-topbar-h: 44px; }
    .ax-pane-header { height: 34px; }
    .ax-pane-tab { font-size: 10px; padding: 4px 8px; min-height: 44px; }
    .ax-chat-msg { max-width: 95%; }
    .ax-workspace-picker-inner { padding: 16px; }
    .ax-icon-btn { width: 44px; height: 44px; }
}

/* ============================================================================
   Axis Input Bar — World-class conversational input
   ============================================================================ */

/* Container: floating glass panel */
.ax-input-dock {
    position: relative;
    padding: 8px 12px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    background: linear-gradient(to top, rgba(10,10,10,0.98) 0%, rgba(10,10,10,0.92) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-shrink: 0;
    z-index: 10;
}

/* The main input shell */
.ax-input-shell {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 0;
    background: var(--ax-bg-surface);
    border: 1.5px solid var(--ax-border);
    border-radius: 20px;
    padding: 6px 6px 6px 16px;
    transition: border-color 250ms ease, box-shadow 250ms ease, transform 100ms ease;
    will-change: border-color, box-shadow;
}
.ax-input-shell:focus-within {
    border-color: rgba(196,156,224,0.45);
    box-shadow: 0 0 0 1px rgba(196,156,224,0.12), 0 4px 24px rgba(196,156,224,0.08), 0 0 60px rgba(196,156,224,0.04);
}
.ax-input-shell:focus-within .ax-input-glow {
    opacity: 1;
}

/* Ambient glow behind shell on focus */
.ax-input-glow {
    position: absolute;
    inset: -1px;
    border-radius: 21px;
    background: linear-gradient(135deg, rgba(196,156,224,0.06), rgba(212,205,229,0.03), rgba(196,156,224,0.06));
    opacity: 0;
    transition: opacity 400ms ease;
    pointer-events: none;
    z-index: -1;
}

/* Textarea */
.ax-input-shell textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #E0E0E0;
    font-family: 'Montserrat', -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    padding: 8px 0;
    resize: none;
    max-height: 160px;
    min-height: 22px;
    field-sizing: content;
    -webkit-appearance: none;
    appearance: none;
}
.ax-input-shell textarea::placeholder {
    color: #555;
    transition: color 200ms ease;
}
.ax-input-shell:focus-within textarea::placeholder {
    color: #777;
}

/* Action buttons row inside shell */
.ax-input-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    align-self: flex-end;
    padding-bottom: 2px;
}

/* Icon buttons in the input */
.ax-input-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: background 200ms ease, transform 120ms ease, opacity 200ms ease;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.ax-input-btn:active {
    transform: scale(0.9);
}
.ax-input-btn.ghost {
    background: transparent;
    color: #555;
}
.ax-input-btn.ghost:hover {
    background: rgba(255,255,255,0.05);
    color: #999;
}

/* Send button — purple gradient, prominent */
.ax-input-btn.send {
    background: linear-gradient(135deg, #C49CE0, #D4CDE5, #9889C0);
    background-size: 200% auto;
    color: #000;
    width: 38px;
    height: 38px;
    margin: -2px;
    margin-right: -2px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(196,156,224,0.3);
    transition: background-position 400ms ease, transform 120ms ease, box-shadow 200ms ease, opacity 200ms ease;
}
.ax-input-btn.send:hover {
    background-position: right center;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(196,156,224,0.4);
}
.ax-input-btn.send:active {
    transform: scale(0.88);
}
.ax-input-btn.send.disabled {
    opacity: 0.3;
    pointer-events: none;
}
/* Stop button variant */
.ax-input-btn.stop {
    background: #EF4444;
    color: #fff;
    width: 38px;
    height: 38px;
    animation: pulseStop 1.5s ease-in-out infinite;
}
@keyframes pulseStop {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
    50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

/* Voice button states */
.ax-input-btn.voice {
    background: transparent;
    color: #555;
    position: relative;
}
.ax-input-btn.voice:hover {
    background: rgba(196,156,224,0.08);
    color: var(--iris);
}
.ax-input-btn.voice.recording {
    background: rgba(239,68,68,0.15);
    color: #EF4444;
    animation: voicePulse 1.2s ease-in-out infinite;
}
@keyframes voicePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.3); }
    50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}
/* Voice ring animation */
.ax-voice-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(239,68,68,0.4);
    animation: voiceRing 1.5s ease-out infinite;
    pointer-events: none;
}
@keyframes voiceRing {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* Bottom helper row */
.ax-input-helpers {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px 0;
    min-height: 24px;
}
.ax-input-helper-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #555;
    background: none;
    border: none;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 6px;
    transition: color 200ms ease, background 200ms ease;
    -webkit-tap-highlight-color: transparent;
}
.ax-input-helper-btn:hover {
    color: var(--iris);
    background: rgba(196,156,224,0.06);
}
.ax-input-hint {
    font-size: 10px;
    color: #444;
    letter-spacing: 0.3px;
    transition: opacity 200ms ease;
}

/* Transcription overlay */
.ax-voice-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10,10,10,0.95);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 5;
    animation: fadeIn .2s ease-out;
}
.ax-voice-bars {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 24px;
}
.ax-voice-bars span {
    display: block;
    width: 3px;
    background: var(--ax-iris);
    border-radius: 2px;
    animation: voiceBar 0.8s ease-in-out infinite;
}
.ax-voice-bars span:nth-child(1) { height: 8px; animation-delay: 0s; }
.ax-voice-bars span:nth-child(2) { height: 16px; animation-delay: 0.1s; }
.ax-voice-bars span:nth-child(3) { height: 24px; animation-delay: 0.2s; }
.ax-voice-bars span:nth-child(4) { height: 16px; animation-delay: 0.3s; }
.ax-voice-bars span:nth-child(5) { height: 8px; animation-delay: 0.4s; }
@keyframes voiceBar {
    0%, 100% { transform: scaleY(0.4); opacity: 0.5; }
    50% { transform: scaleY(1); opacity: 1; }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .ax-input-dock { padding: 6px 8px; }
    .ax-input-shell { border-radius: 16px; padding: 4px 4px 4px 12px; }
    .ax-input-shell textarea { font-size: 16px; /* prevent iOS zoom */ }
    .ax-input-btn { width: 40px; height: 40px; }
    .ax-input-btn.send, .ax-input-btn.stop { width: 42px; height: 42px; }
    .ax-input-helpers { padding: 4px 4px 0; }
    .ax-input-hint { display: none; }
}
@media (max-width: 480px) {
    .ax-input-shell textarea { font-size: 16px; padding: 6px 0; }
    .ax-input-btn { width: 42px; height: 42px; }
    .ax-input-btn.send, .ax-input-btn.stop { width: 44px; height: 44px; }
}

/* ============================================================================
   Quick Actions — Tool Modals & FAB
   ============================================================================ */

/* Tool card on dashboard */
.ax-tool-card {
    position: relative;
    padding: 1.25rem;
    border-radius: var(--radius-sm, 8px);
    background: var(--ax-card, #141414);
    border: 1px solid var(--ax-border, #1f1f1f);
    cursor: pointer;
    transition: all 200ms ease;
    overflow: hidden;
}
.ax-tool-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--tool-accent, #C49CE0);
    opacity: 0;
    transition: opacity 200ms;
}
.ax-tool-card:hover {
    border-color: var(--tool-accent, #C49CE0);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3), 0 0 0 1px var(--tool-accent, rgba(196,156,224,0.2));
}
.ax-tool-card:hover::before { opacity: 1; }
.ax-tool-card .ax-tool-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 0.75rem;
    transition: transform 200ms;
}
.ax-tool-card:hover .ax-tool-icon { transform: scale(1.1); }

/* Tool modal overlay */
.ax-tool-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: axFadeIn 200ms ease-out;
}
.ax-tool-modal-body {
    width: 600px;
    max-width: 94vw;
    max-height: 85vh;
    max-height: 85dvh;
    background: #0f0f0f;
    border: 1px solid #262626;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0,0,0,0.5), 0 0 0 1px rgba(212,175,55,0.08);
    animation: axSlideUp 300ms cubic-bezier(0.16, 1, 0.3, 1);
}
.ax-tool-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #1f1f1f;
    flex-shrink: 0;
}
.ax-tool-modal-header .ax-tool-badge {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.ax-tool-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}
.ax-tool-modal-footer {
    padding: 0 16px 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    flex-shrink: 0;
    position: relative;
}
.ax-tool-input-dock {
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 16px;
    transition: border-color 300ms ease, box-shadow 300ms ease;
    overflow: hidden;
}
.ax-tool-input-dock:focus-within {
    border-color: var(--tool-accent, rgba(212,175,55,0.4));
    box-shadow: 0 0 0 3px var(--tool-glow, rgba(212,175,55,0.08)), 0 4px 20px rgba(0,0,0,0.3);
}
.ax-tool-input-dock .ax-tool-input-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 14px 8px;
}
.ax-tool-input-dock .ax-tool-kbd {
    font-size: 10px;
    color: #444;
    display: flex;
    align-items: center;
    gap: 4px;
    user-select: none;
}
.ax-tool-input-dock .ax-tool-kbd kbd {
    display: inline-block;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    padding: 1px 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    color: #555;
    line-height: 1.4;
}
.ax-tool-save-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.ax-tool-input {
    width: 100%;
    background: transparent;
    border: none;
    padding: 14px 60px 6px 16px;
    color: #e0e0e0;
    font-family: 'Montserrat', sans-serif;
    font-size: 13.5px;
    line-height: 1.5;
    resize: none;
    outline: none;
    min-height: 44px;
    max-height: 120px;
}
.ax-tool-input::placeholder { color: #4a4a4a; }
/* Send button */
.ax-tool-send-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    font-weight: 700;
    font-size: 13px;
    transition: all 200ms cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
    z-index: 2;
}
.ax-tool-send-btn:hover {
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 0 20px var(--tool-glow, rgba(212,175,55,0.2));
}
.ax-tool-send-btn:active { transform: translateY(-50%) scale(0.95); }
.ax-tool-send-btn.stop { background: #ef4444; color: #fff; }
.ax-tool-send-btn.stop:hover { box-shadow: 0 0 20px rgba(239,68,68,0.3); }
/* Suggestion pills */
.ax-tool-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 16px 20px 8px;
}
.ax-tool-suggestion {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid #2a2a2a;
    background: rgba(255,255,255,0.02);
    color: #888;
    transition: all 180ms ease;
    white-space: nowrap;
}
.ax-tool-suggestion:hover {
    border-color: var(--tool-accent, #C49CE0);
    color: var(--tool-accent, #C49CE0);
    background: var(--tool-glow, rgba(196,156,224,0.06));
    transform: translateY(-1px);
}
.ax-tool-suggestion svg { opacity: 0.5; transition: opacity 180ms; }
.ax-tool-suggestion:hover svg { opacity: 1; }
/* Empty state upgrade */
.ax-tool-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px 16px;
    text-align: center;
    gap: 12px;
}
.ax-tool-empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.ax-tool-empty-icon::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 20px;
    background: inherit;
    opacity: 0.3;
    filter: blur(12px);
    z-index: -1;
}
.ax-tool-empty h3 {
    font-size: 15px;
    font-weight: 600;
    color: #e0e0e0;
    margin: 0;
}
.ax-tool-empty p {
    font-size: 12.5px;
    color: #666;
    max-width: 320px;
    line-height: 1.5;
    margin: 0;
}
.ax-tool-response {
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 10px;
    padding: 16px;
    color: #ccc;
    font-size: 13px;
    line-height: 1.7;
    min-height: 120px;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
.ax-tool-response-bubble {
    background: #111;
    border: 1px solid #1a1a1a;
    border-radius: 16px;
    border-top-left-radius: 4px;
    padding: 12px 16px;
    color: #ccc;
    font-size: 13px;
    line-height: 1.7;
    word-break: break-word;
}
.ax-tool-response-bubble pre {
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 12px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 12px;
}
.ax-tool-response-bubble code {
    font-size: 12px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
.ax-tool-response-bubble p { margin: 4px 0; }
.ax-tool-response-bubble ul, .ax-tool-response-bubble ol { padding-left: 20px; margin: 6px 0; }
.ax-tool-response-bubble li { margin: 2px 0; }
.ax-tool-response-bubble h1, .ax-tool-response-bubble h2, .ax-tool-response-bubble h3 { color: #e5e5e5; margin: 12px 0 6px; }
.ax-tool-response .streaming-cursor::after,
.streaming-cursor::after {
    content: '▊';
    animation: blink 0.8s steps(2) infinite;
    color: var(--iris);
}
.ax-tool-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid #333;
    background: transparent;
    color: #aaa;
    transition: all 150ms;
}
.ax-tool-chip:hover { border-color: #555; color: #ddd; }
.ax-tool-chip.active {
    border-color: var(--chip-color, #C49CE0);
    background: var(--chip-bg, rgba(196,156,224,0.1));
    color: var(--chip-color, #C49CE0);
}

/* FAB — floating action button (Aristos World-Class UX) */
.ax-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 90;
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--ax-gold-gradient);
    background-size: 200% auto;
    color: #0a0a0a;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    border: none;
    box-shadow: 
        0 8px 32px rgba(196,156,224,0.4),
        0 0 0 0 rgba(196,156,224,0),
        inset 0 1px 0 rgba(255,255,255,0.2);
    transition: all 400ms var(--ease-spring);
    will-change: transform, box-shadow, background-position;
    font-weight: 700;
}
.ax-fab:hover {
    transform: scale(1.12) translateY(-2px);
    background-position: right center;
    box-shadow: 
        0 12px 48px rgba(196,156,224,0.6),
        0 0 0 6px rgba(196,156,224,0.15),
        inset 0 1px 0 rgba(255,255,255,0.3);
}
.ax-fab:active { 
    transform: scale(0.96) translateY(0); 
    transition: all 120ms var(--ease-in);
}
.ax-fab.open {
    transform: rotate(135deg) scale(1.05);
    background: linear-gradient(135deg, var(--jacarta-dd) 0%, var(--jacarta) 100%);
    color: var(--iris);
    box-shadow: 
        0 8px 32px rgba(45,39,105,0.6),
        0 0 0 3px rgba(196,156,224,0.3),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

/* FAB menu (Aristos World-Class UX) */
.ax-fab-menu {
    position: fixed;
    bottom: 92px;
    right: 24px;
    z-index: 89;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-end;
    animation: axSlideUp 400ms var(--ease-spring);
}
.ax-fab-item {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: all 300ms var(--ease-spring);
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    animation: axFabItemReveal 500ms var(--ease-spring) forwards;
}
.ax-fab-item:nth-child(1) { animation-delay: 100ms; }
.ax-fab-item:nth-child(2) { animation-delay: 150ms; }
.ax-fab-item:nth-child(3) { animation-delay: 200ms; }
.ax-fab-item:nth-child(4) { animation-delay: 250ms; }
.ax-fab-item:hover { 
    transform: translateX(-8px) scale(1.02); 
}
.ax-fab-item-label {
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(21,18,58,0.95) 0%, rgba(30,26,74,0.9) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(196,156,224,0.2);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ax-text-bright);
    white-space: nowrap;
    box-shadow: 
        0 8px 32px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.1);
    transition: all 300ms var(--ease-spring);
}
.ax-fab-item:hover .ax-fab-item-label {
    background: linear-gradient(135deg, rgba(45,39,105,0.95) 0%, rgba(61,53,128,0.9) 100%);
    border-color: rgba(196,156,224,0.4);
    box-shadow: 
        0 12px 48px rgba(196,156,224,0.3),
        inset 0 1px 0 rgba(255,255,255,0.15);
}
.ax-fab-item-btn {
    width: 48px; height: 48px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid rgba(196,156,224,0.3);
    cursor: pointer;
    box-shadow: 
        0 6px 24px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.2);
    transition: all 300ms var(--ease-spring);
    position: relative;
    overflow: hidden;
}
.ax-fab-item-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(196,156,224,0.1), transparent);
    opacity: 0;
    transition: opacity 300ms var(--ease-spring);
}
.ax-fab-item-btn:hover { 
    transform: scale(1.15) translateY(-2px);
    border-color: rgba(196,156,224,0.6);
    box-shadow: 
        0 12px 48px rgba(196,156,224,0.4),
        inset 0 1px 0 rgba(255,255,255,0.3);
}
.ax-fab-item-btn:hover::before {
    opacity: 1;
}
.ax-fab-item-btn:active {
    transform: scale(1.05) translateY(0);
    transition: all 120ms var(--ease-in);
}

@keyframes axFabItemReveal {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes axFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes axSlideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 768px) {
    .ax-fab { bottom: 16px; right: 16px; width: 52px; height: 52px; }
    .ax-fab-menu { bottom: 76px; right: 16px; gap: 10px; }
    .ax-fab-item-btn { width: 44px; height: 44px; }
    .ax-fab-item-label { padding: 6px 12px; font-size: 11px; }
    .ax-tool-modal-body { max-width: 100vw; width: 100vw; height: 100vh; height: 100dvh; height: -webkit-fill-available; max-height: none; border-radius: 0; border: none; box-shadow: none; }
    .ax-tool-modal-content { padding: 12px; }
    .ax-tool-modal-footer { padding: 0 12px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
    .ax-tool-suggestions { padding: 12px 12px 4px; }
    .ax-tool-empty { padding: 20px 16px 8px; }
    .ax-tool-input-dock { border-radius: 12px; }
}

/* ============================================================================
   PWA Install Banner
   ============================================================================ */
.ax-install-banner {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 200;
    background: linear-gradient(135deg, #111 0%, #1a1a1a 100%);
    border-top: 1px solid rgba(212,175,55,0.3);
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.5);
    animation: axSlideUp 300ms cubic-bezier(0.16, 1, 0.3, 1);
}
.ax-install-banner img {
    width: 44px; height: 44px;
    border-radius: 10px;
    flex-shrink: 0;
}
.ax-install-banner-text {
    flex: 1; min-width: 0;
}
.ax-install-banner-text .title {
    font-size: 13px; font-weight: 700; color: #e0e0e0;
}
.ax-install-banner-text .subtitle {
    font-size: 11px; color: #888; margin-top: 1px;
}
.ax-install-btn {
    padding: 8px 20px;
    border-radius: 8px;
    background: linear-gradient(135deg, #C49CE0, #9889C0);
    color: #0a0a0a;
    font-size: 12px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 150ms;
}
.ax-install-btn:active { transform: scale(0.95); }
.ax-install-dismiss {
    padding: 6px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    flex-shrink: 0;
}
.ax-install-dismiss:hover { color: #aaa; }

/* ============================================================================
   Surface Duo 2 — Dual Screen & Hinge Gap
   ============================================================================ */

/* Spanning: dual landscape (side by side) */
@media (horizontal-viewport-segments: 2) {
    /* Account for the hinge gap between screens */
    :root {
        --duo-hinge-width: env(viewport-segment-width 0 0, 0px);
        --duo-left-width: env(viewport-segment-right 0 0, 50vw);
        --duo-right-left: env(viewport-segment-left 1 0, 50vw);
    }
    /* IDE: sidebar on left screen, editor on right screen */
    .ax-duo-aware {
        column-gap: env(viewport-segment-right 0 0, 0px);
    }
    /* FAB avoids the hinge */
    .ax-fab {
        right: 24px;
    }
}

/* Spanning: dual portrait (top and bottom) */
@media (vertical-viewport-segments: 2) {
    :root {
        --duo-hinge-height: env(viewport-segment-height 0 0, 0px);
    }
}

/* Fold API fallback for older browsers */
@media (screen-spanning: single-fold-vertical) {
    :root {
        --duo-fold-width: env(fold-width, 0px);
    }
    .ax-fab {
        right: 24px;
    }
}

/* ============================================================================
   Mobile Input Visibility — Ensure always visible
   ============================================================================ */

/* Fix for virtual keyboard pushing content off screen */
@media (max-width: 1024px) {
    /* Ensure the main app container uses dvh for dynamic viewport height */
    .ax-app-shell {
        height: 100dvh;
        height: -webkit-fill-available;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    /* Input dock must stick to bottom regardless of keyboard */
    .ax-input-dock {
        position: sticky;
        bottom: 0;
        z-index: 60;
        flex-shrink: 0;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
    /* Pane content scrolls, not the whole page */
    .ax-pane-scroll {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
}

/* Surface Duo single screen portrait — optimize for one-handed use */
@media (max-width: 540px) {
    .ax-input-dock {
        padding: 6px 10px;
        padding-bottom: max(6px, env(safe-area-inset-bottom));
    }
    .ax-input-shell textarea {
        font-size: 16px; /* prevent iOS zoom */
        min-height: 40px;
    }
    /* Larger touch targets for single-hand */
    .ax-input-btn { min-width: 44px; min-height: 44px; }
    .ax-fab { bottom: 12px; right: 12px; width: 54px; height: 54px; }
    .ax-fab-menu { bottom: 72px; right: 12px; gap: 8px; }
    .ax-fab-item-btn { width: 46px; height: 46px; }
    .ax-fab-item-label { padding: 6px 10px; font-size: 10px; }
    /* Tab bar scrollable */
    .ax-tab-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ============================================================================
   Atlas Design System — Purple Brand Micro-Animations & Effects
   ============================================================================ */

/* --- Animated Custom Properties --- */
@property --mesh-x {
    syntax: '<percentage>';
    initial-value: 30%;
    inherits: false;
}
@property --mesh-y {
    syntax: '<percentage>';
    initial-value: 20%;
    inherits: false;
}
@property --glow-a {
    syntax: '<number>';
    initial-value: 0.35;
    inherits: false;
}
@property --orbit-rot {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

/* --- Extended Motion System --- */
:root {
    /* Spring physics easings */
    --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in:     cubic-bezier(0.45, 0, 0.55, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.27, 1.55);
    --ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --t-fast:      160ms;
    --t:           320ms;
    --t-slow:      600ms;
    --t-reveal:    1000ms;
    --t-cine:      1400ms;

    /* Mesh gradients */
    --mesh-hero:
        radial-gradient(at var(--mesh-x, 30%) var(--mesh-y, 20%), rgba(152, 137, 192, 0.40) 0px, transparent 50%),
        radial-gradient(at 75% 80%, rgba(196, 156, 224, 0.28) 0px, transparent 55%),
        radial-gradient(at 10% 95%, rgba(123, 176, 255, 0.18) 0px, transparent 45%),
        radial-gradient(at 95% 10%, rgba(45, 39, 105, 0.90) 0px, transparent 60%),
        linear-gradient(160deg, #0A0820 0%, #15123A 45%, #2D2769 100%);

    --mesh-dark:
        radial-gradient(at 85% 15%, rgba(152, 137, 192, 0.16) 0px, transparent 50%),
        radial-gradient(at 15% 85%, rgba(196, 156, 224, 0.10) 0px, transparent 55%),
        linear-gradient(165deg, #0A0820 0%, #15123A 40%, #1E1A4A 100%);

    /* Shadow glows */
    --shadow-glow:      0 0 80px rgba(196, 156, 224, 0.25), 0 0 40px rgba(152, 137, 192, 0.3);
    --shadow-rim:       inset 0 1px 0 rgba(255,255,255,0.08), inset 0 -1px 0 rgba(0,0,0,0.12);
}

/* --- Film Grain Overlay --- */
.ax-grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.04;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.18 0 0 0 0 0.15 0 0 0 0 0.41 0 0 0 0.95 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* --- Mesh Hero Background --- */
.ax-mesh-hero {
    background: var(--mesh-hero);
    position: relative;
}
.ax-mesh-hero::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 50% 70%, transparent 0%, rgba(10, 8, 32, 0.45) 70%, rgba(10, 8, 32, 0.85) 100%);
    pointer-events: none;
    z-index: 0;
}

/* --- Glass Card (Atlas signature) --- */
.ax-glass-card {
    background: rgba(30, 26, 74, 0.55);
    border: 1px solid rgba(196, 156, 224, 0.18);
    border-radius: 22px;
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    box-shadow:
        0 40px 80px -20px rgba(10, 8, 32, 0.55),
        0 16px 30px -16px rgba(10, 8, 32, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: hidden;
}
.ax-glass-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(196, 156, 224, 0.4) 50%, transparent 100%);
    pointer-events: none;
}

/* --- Orbital Mark Animation --- */
.ax-orbit-mark {
    position: absolute;
    width: clamp(280px, 36vw, 520px);
    height: clamp(280px, 36vw, 520px);
    pointer-events: none;
    opacity: 0;
    animation: orbit-enter 2s var(--ease-out) 0.8s forwards,
               orbit-drift 14s ease-in-out 2.8s infinite alternate;
    z-index: 1;
    mix-blend-mode: screen;
}
.ax-orbit-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 30px 60px rgba(196, 156, 224, 0.35));
}
.ax-orbit-mark::before {
    content: '';
    position: absolute;
    inset: -20%;
    background: radial-gradient(circle, rgba(196, 156, 224, 0.22) 0%, transparent 65%);
    z-index: -1;
    animation: halo-pulse 8s ease-in-out infinite;
}
@keyframes orbit-enter {
    0% { opacity: 0; transform: scale(0.85) rotate(-12deg); }
    100% { opacity: 0.6; transform: scale(1) rotate(0deg); }
}
@keyframes orbit-drift {
    0%   { transform: translate(0, 0); }
    50%  { transform: translate(-20px, 18px); }
    100% { transform: translate(14px, -12px); }
}
@keyframes halo-pulse {
    0%, 100% { opacity: 0.85; transform: scale(1); }
    50%      { opacity: 1; transform: scale(1.08); }
}

/* --- Floating Particles --- */
.ax-particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}
.ax-particle {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    animation: particle-drift 10s ease-in-out infinite alternate;
}
.ax-particle:nth-child(1) {
    left: 18%; top: 30%;
    background: var(--iris);
    box-shadow: 0 0 12px var(--iris), 0 0 24px var(--iris-glow);
    animation-duration: 9s;
}
.ax-particle:nth-child(2) {
    left: 78%; top: 70%;
    background: var(--lavender-l);
    box-shadow: 0 0 12px rgba(181, 169, 211, 0.6);
    animation-duration: 12s;
    animation-delay: -3s;
}
.ax-particle:nth-child(3) {
    left: 60%; top: 18%;
    background: var(--ax-info);
    box-shadow: 0 0 12px rgba(123, 176, 255, 0.4);
    animation-duration: 11s;
    animation-delay: -5s;
}
@keyframes particle-drift {
    0%   { transform: translate(0, 0) scale(1); opacity: 0.5; }
    50%  { transform: translate(18px, -14px) scale(1.35); opacity: 0.9; }
    100% { transform: translate(-12px, 22px) scale(0.85); opacity: 0.4; }
}

/* --- Floating Label Input (Atlas signature) --- */
.ax-float-field {
    position: relative;
    margin-bottom: 1rem;
}
.ax-float-input {
    width: 100%;
    padding: 1.25rem 0.9rem 0.55rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(196, 156, 224, 0.15);
    border-radius: 12px;
    color: var(--white);
    font-family: var(--ax-font-ui);
    font-size: 0.98rem;
    line-height: 1.3;
    letter-spacing: -0.005em;
    transition: border-color var(--t-fast) var(--ease-smooth), background var(--t-fast) var(--ease-smooth), box-shadow var(--t-fast) var(--ease-smooth);
    -webkit-appearance: none;
    appearance: none;
}
.ax-float-input::placeholder { color: transparent; }
.ax-float-input:hover:not(:focus) {
    border-color: rgba(196, 156, 224, 0.3);
    background: rgba(255, 255, 255, 0.06);
}
.ax-float-input:focus {
    outline: none;
    border-color: var(--iris);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 0 4px rgba(196, 156, 224, 0.14), 0 0 24px -6px var(--iris-soft);
}
.ax-float-label {
    position: absolute;
    left: 0.95rem;
    top: 1rem;
    font-family: var(--ax-font-ui);
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--lavender-d);
    letter-spacing: 0.01em;
    pointer-events: none;
    transform-origin: left center;
    transition: transform var(--t-fast) var(--ease-smooth), color var(--t-fast) var(--ease-smooth);
}
.ax-float-input:focus + .ax-float-label,
.ax-float-input:not(:placeholder-shown) + .ax-float-label {
    transform: translateY(-0.65rem) scale(0.72);
    color: var(--iris);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 800;
}

/* --- Animated Button (Atlas signature) --- */
.ax-btn-animated {
    width: 100%;
    margin-top: 1.2rem;
    padding: 0.95rem 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    background: linear-gradient(135deg, var(--iris) 0%, var(--lavender) 60%, var(--iris) 100%);
    background-size: 200% 100%;
    background-position: 0% 50%;
    border: 0;
    border-radius: 14px;
    color: var(--jacarta-dd);
    font-family: var(--ax-font-ui);
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 20px 40px -12px rgba(196, 156, 224, 0.45),
        0 8px 16px -6px rgba(152, 137, 192, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    transition: transform var(--t-fast) var(--ease-smooth), box-shadow var(--t) var(--ease-smooth), background-position 0.6s var(--ease-smooth);
}
.ax-btn-animated:hover:not(:disabled) {
    background-position: 100% 50%;
    transform: translateY(-1px);
    box-shadow:
        0 24px 50px -10px rgba(196, 156, 224, 0.6),
        0 10px 20px -6px rgba(152, 137, 192, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.ax-btn-animated:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 12px 24px -8px rgba(196, 156, 224, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.ax-btn-animated:disabled { opacity: 0.65; cursor: progress; }
.ax-btn-animated.is-loading .ax-btn-text,
.ax-btn-animated.is-loading svg { opacity: 0; }
.ax-btn-animated.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(45, 39, 105, 0.25);
    border-top-color: var(--jacarta-dd);
    border-radius: 50%;
    animation: btn-spinner 0.7s linear infinite;
}
@keyframes btn-spinner { to { transform: rotate(360deg); } }

/* --- Kinetic Typography --- */
.ax-kinetic-title {
    font-family: var(--ax-font-logo);
    font-weight: 500;
    font-size: clamp(3.5rem, 11vw, 8.5rem);
    line-height: 0.95;
    letter-spacing: 0.02em;
    color: #fff;
    margin: 0 0 0.4rem;
    text-shadow: 0 4px 50px rgba(10, 8, 32, 0.5);
}
.ax-kinetic-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(0.4em) rotate(5deg);
    animation: char-in 1.1s var(--ease-out) forwards;
}
.ax-kinetic-title .char:nth-child(1) { animation-delay: 0.30s; }
.ax-kinetic-title .char:nth-child(2) { animation-delay: 0.38s; }
.ax-kinetic-title .char:nth-child(3) { animation-delay: 0.46s; }
.ax-kinetic-title .char:nth-child(4) { animation-delay: 0.54s; }
.ax-kinetic-title .char:nth-child(5) { animation-delay: 0.62s; }
@keyframes char-in {
    0% { opacity: 0; transform: translateY(0.4em) rotate(5deg); }
    100% { opacity: 1; transform: translateY(0) rotate(0deg); }
}

/* --- Fade Up Animation --- */
.ax-fade-up {
    opacity: 0;
    transform: translateY(10px);
    animation: fade-up 1.0s var(--ease-out) forwards;
}
.ax-fade-up.delay-1 { animation-delay: 0.2s; }
.ax-fade-up.delay-2 { animation-delay: 0.6s; }
.ax-fade-up.delay-3 { animation-delay: 1.0s; }
.ax-fade-up.delay-4 { animation-delay: 1.2s; }
@keyframes fade-up {
    to { opacity: 1; transform: translateY(0); }
}

/* --- Session Pulse Dot --- */
.ax-pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--iris);
    box-shadow: 0 0 10px var(--iris), 0 0 18px var(--iris-glow);
    animation: session-pulse 2.6s ease-in-out infinite;
}
@keyframes session-pulse {
    0%, 100% { opacity: 0.5; transform: scale(0.9); }
    50%      { opacity: 1; transform: scale(1.15); }
}

/* --- Card Shake (error state) --- */
.ax-shake { animation: card-shake 0.45s var(--ease-out); }
@keyframes card-shake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-8px); }
    40%      { transform: translateX(7px); }
    60%      { transform: translateX(-5px); }
    80%      { transform: translateX(4px); }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .ax-orbit-mark, .ax-particle, .ax-kinetic-title .char, .ax-fade-up,
    .ax-pulse-dot, .ax-orbit-mark::before {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}
