@import url('https://cdn.jsdelivr.net/npm/@xterm/xterm@6.1.0-beta.197/css/xterm.css');

/* Monaspace Neon */
@font-face {
    font-family: 'Monaspace Neon';
    src: url('./fonts/MonaspaceNeon-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Monaspace Neon';
    src: url('./fonts/MonaspaceNeon-Bold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

/* Terminal Search Bar (VS Code Style - Exact Match) */
.search-bar {
    position: absolute;
    top: -10px;
    right: 58px;
    z-index: 100;
    display: flex;
    align-items: center;
    background-color: #252526;
    height: 33px;
    /* Exact VS Code height */
    padding: 0 4px;
    /* Exact VS Code padding */
    border-radius: 0 0 4px 4px;
    /* Rounded bottom */
    box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.36);
    /* Exact VS Code shadow */
    border: none;
    /* VS Code uses shadow, not border */
}

.terminal-wrapper.maximized .search-bar {
    top: 0;
}

.search-bar .search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-right: 6px;
}

.search-bar input {
    background-color: #3c3c3c;
    border: 1px solid transparent;
    /* Transparent border default */
    color: #cccccc;
    font-family: inherit;
    font-size: 13px;
    height: 23px;
    /* Exact VS Code input height */
    width: 240px;
    padding: 3px 6px 0 6px;
    /* Increase top padding */
    padding-right: 70px;
    outline: none;
    border-radius: 2px;
    box-sizing: border-box;
    line-height: normal;
    /* Reset line-height */
}

.search-bar input:focus {
    border-color: #007fd4;
    /* VS Code Focus Blue */
}

/* Overlay Options inside Input */
.search-bar .search-options {
    position: absolute;
    right: 2px;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
}

.search-bar .option-btn {
    background: transparent;
    border: none;
    color: #c5c5c5;
    width: 20px;
    height: 20px;
    border-radius: 3px;
    margin: 0 1px;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.search-bar .option-btn:hover {
    background-color: rgba(90, 93, 94, 0.31);
    /* VS Code hover style */
}

.search-bar .option-btn.active {
    color: #ffffff;
    /* Active text white */
    background-color: rgba(0, 127, 212, 0.4);
    /* VS Code active blue */
}

/* Navigation & Close Buttons */
.search-bar .nav-btn,
.search-bar .close-btn,
.search-bar .icon-btn {
    background: transparent;
    border: none;
    color: #cccccc;
    width: 24px;
    height: 24px;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    padding: 0;
}

.search-bar .nav-btn:hover,
.search-bar .close-btn:hover,
.search-bar .icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.search-bar button:disabled {
    color: #586e75;
    /* Muted */
    cursor: default;
    opacity: 0.5;
}

.search-bar button:disabled:hover {
    background-color: transparent;
}

.search-bar .search-results {
    color: #cccccc;
    font-size: 12px;
    margin: 0 8px;
    width: 80px;
    /* Fixed width */
    min-width: 80px;
    text-align: left;
    white-space: nowrap;
    display: flex;
    align-items: center;
    height: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-top: 2px;
    /* Visual center tweak */
}

/* Make search selection highly visible. */
.xterm .xterm-selection div {
    background-color: #ffffff !important;
    mix-blend-mode: difference;
    opacity: 1 !important;
}

:root {
    color-scheme: dark;
    --bg-base: #002b36;
    --bg-surface: #073642;
    --text-base: #839496;
    --text-muted: #586e75;
    --text-highlight: #93a1a1;
    --border-color: rgba(88, 110, 117, 0.5);
    --accent-color: #268bd2;
    --app-height: 100%;
    --app-width: 100%;
}

/* Fix Monaco Editor Box Sizing Context */
.monaco-editor,
.monaco-editor * {
    box-sizing: content-box;
}

html {
    height: 100%;
    width: 100%;
    position: fixed;
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-text-size-adjust: 100%;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    font-family: 'Monaspace Neon', "SF Mono Terminal", "SFMono-Regular", "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
    background-color: var(--bg-base);
    color: var(--text-base);
    /* Lock viewport using JS calculated dimensions and offsets */
    position: fixed;
    top: var(--app-top, 0px);
    left: var(--app-left, 0px);
    width: var(--app-width);
    height: var(--app-height);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    overscroll-behavior: none;
}

/* Prevent scroll chaining on scrollable elements */
.tab-list,
.file-tree,
.image-preview-container,
.editor-content,
.xterm-viewport {
    overscroll-behavior: contain;
}

.app-layout {
    display: flex;
    flex-grow: 1;
    height: 0;
    /* Allow flex child to scroll */
    width: 100%;
    min-width: 0;
    /* Allow shrinking */
    overflow: hidden;
    /* Force children to fit */
    /* border-bottom removed, moved to virtual-keys */
}

.sidebar {
    display: flex;
    flex-direction: column;
    width: 200px;
    flex-shrink: 0;
    background-color: var(--bg-base);
    padding: 10px;
    padding-left: max(10px, env(safe-area-inset-left));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    border-right: 1px solid var(--border-color);
}

/* Sidebar Toggle */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    margin-right: 10px;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    color: var(--text-highlight);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 800;
    /* Below sidebar (900/1000), above content */
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    transition: opacity 0.3s;
    opacity: 0;
    pointer-events: none;
}

.sidebar-overlay.open {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Mobile Sidebar Logic (Layout only) */
@media (max-width: 767px) {
    .sidebar-toggle {
        display: block;
    }

    .sidebar {
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        width: 240px;
        /* Slightly wider for touch */
        z-index: 900;
        transform: translateX(-100%);
        /* Hide off-screen */
        /* Toggle visibility to remove shadow artifact when closed */
        visibility: hidden;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.3s;
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.5);
        border-right: 1px solid var(--border-color);
    }

    .sidebar.open {
        transform: translateX(0);
        visibility: visible;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s;
    }

    .tab-item {
        min-height: 80px !important;
    }
}

.compact-workspace-mode .sidebar-toggle {
    display: block;
}

.compact-workspace-mode .sidebar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 240px;
    z-index: 900;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        visibility 0s linear 0.3s;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.5);
    border-right: 1px solid var(--border-color);
}

.compact-workspace-mode .sidebar.open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        visibility 0s;
}

.compact-workspace-mode .tab-item {
    min-height: 80px !important;
}

/* Touch Device Typography Adjustments (Fonts only) */
@media (pointer: coarse) {
    .system-status-bar {
        /* Font size stays 12px (global) */
        padding-top: max(6px, env(safe-area-inset-top));
        /* More breathing room */
        /* padding-bottom is handled by global style now */
    }

    .virtual-keys button {
        font-size: 14px;
        min-width: 40px;
        /* Slightly wider touch target */
    }
}

.tab-list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex-grow: 1;
    overflow-y: auto;
    position: relative;
    /* Context for sticky */
}

.tab-item {
    position: relative;
    margin-bottom: 8px;
    border-radius: 6px;
    cursor: pointer;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    transition: background-color 0.2s ease, border-color 0.2s ease;
    overflow: hidden;
    /* Clip content to rounded corners */
    min-height: 0;
    display: flex;
    flex-direction: column;
    /* padding-left removed to keep layout stable */
}

/* ... (keep existing styles) ... */

.new-tab-item {
    position: sticky;
    bottom: 0;
    background-color: var(--bg-base);
    /* Match sidebar bg to hide content behind */
    padding-top: 8px;
    padding-bottom: 10px;
    /* Add some bottom padding */
    z-index: 100;
    margin-top: auto;
    /* Push to bottom if flex container? No, sticky handles it. */
}

.new-tab-button {
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: transparent;
    color: var(--text-highlight);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.server-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

@media (max-height: 600px) {
    .new-tab-item {
        max-height: 112px;
        overflow-y: auto;
        overflow-x: hidden;
        touch-action: pan-y;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
}

.server-row {
    display: flex;
    position: relative;
    align-items: stretch;
    min-width: 0;
}

.server-main-button {
    flex: 1 1 auto;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: transparent;
    color: var(--text-highlight);
    font-size: 12px;
    text-align: left;
    padding: 8px 10px;
    min-height: 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.server-row.has-auth-sessions .server-main-button {
    padding-right: 48px;
}

.server-main-button:hover {
    background-color: var(--bg-surface);
}

.server-main-button.needs-login {
    border-color: #dc322f;
    color: #dc322f;
}

.server-delete-button {
    position: absolute;
    top: 4px;
    left: 4px;
    right: auto;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: var(--text-highlight);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
    line-height: 1;
}

.server-row:hover .server-delete-button,
.server-row:focus-within .server-delete-button {
    opacity: 1;
    pointer-events: auto;
}

.server-delete-button svg {
    width: 16px;
    height: 16px;
}

.server-delete-button:hover {
    background-color: rgba(220, 50, 47, 0.8);
    border-color: rgba(220, 50, 47, 1);
    color: white;
}

.server-delete-button:active {
    background-color: rgba(220, 50, 47, 1);
    transform: translateY(1px);
}

.server-auth-button {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: var(--text-highlight);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0.72;
    z-index: 10;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    line-height: 1;
}

.server-auth-button svg {
    width: 15px;
    height: 15px;
}

.server-row:hover .server-auth-button,
.server-row:focus-within .server-auth-button {
    opacity: 1;
}

.server-auth-button:hover {
    background-color: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.4);
    color: var(--text-highlight);
}

.server-auth-button:active {
    transform: translateY(1px);
}

.server-action-text {
    display: block;
    color: var(--text-muted);
    font-weight: normal;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.server-metrics {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.server-latency-group {
    display: inline-flex;
    align-items: center;
    color: #859900;
    min-width: 44px;
    flex-shrink: 0;
}

.server-latency-group.offline {
    color: #dc322f;
}

.server-latency-value {
    font-size: 10px;
    color: currentColor;
    line-height: 1;
}

.server-heartbeat-dot {
    width: 7px;
    height: 7px;
    margin-right: 4px;
    flex-shrink: 0;
}

.server-latency-value.offline {
    color: #dc322f;
}

.server-heartbeat-canvas {
    flex: 1 1 auto;
    height: 12px;
    min-width: 24px;
    display: block;
    background-color: transparent;
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.server-main-button.needs-login .server-latency-value {
    color: #dc322f;
}

/* Desktop Hover Effects */
@media (pointer: fine) {
    .tab-item:hover {
        background-color: rgba(88, 110, 117, 0.2);
    }
}

.tab-item:hover .close-tab-button,
.tab-item:hover .toggle-editor-btn {
    opacity: 1;
}

.tab-item:hover .tab-info-overlay {
    transform: translateY(100%);
    /* Slide down out of view */
}

/* Disable slide on mobile since there is no preview underneath */
@media (max-width: 767px) {
    .tab-item:hover .tab-info-overlay {
        transform: none !important;
    }
}

.compact-workspace-mode .tab-item:hover .tab-info-overlay {
    transform: none !important;
}

/* Only pin toggle button if editor is open */
.tab-item.editor-open .toggle-editor-btn {
    opacity: 1;
}

.tab-item.agent-open .toggle-editor-btn {
    opacity: 1;
}

.tab-item.active {
    border-color: var(--accent-color);
    background-color: rgba(38, 139, 210, 0.15);
}

.tab-item.agent-managed-session {
    border-color: rgba(42, 161, 152, 0.55);
    background-color: rgba(42, 161, 152, 0.08);
}

.tab-item.agent-managed-session.active {
    border-color: rgba(42, 161, 152, 0.9);
    background-color: rgba(42, 161, 152, 0.16);
}

.close-tab-button {
    position: absolute;
    top: 4px;
    left: 4px;
    /* Left side */
    right: auto;
    width: 28px;
    /* Same size as toggle btn */
    height: 28px;
    border-radius: 4px;
    /* Square with rounded corners */
    background-color: rgba(0, 0, 0, 0.6);
    /* Darker for visibility */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: var(--text-highlight);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
    font-size: 18px;
    line-height: 1;
    padding: 0;
}

.close-tab-button:hover {
    background-color: rgba(220, 50, 47, 0.8);
    /* Red hover */
    border-color: rgba(220, 50, 47, 1);
    color: white;
    opacity: 1;
}

.close-tab-button:active {
    background-color: rgba(220, 50, 47, 1);
    transform: translateY(1px);
}

/* Ensure buttons are visible on active tab (Mobile/Touch Friendly) */
.tab-item.active .close-tab-button,
.tab-item.active .toggle-editor-btn {
    opacity: 1;
}

.preview-container {
    background-color: var(--bg-base);
    position: relative;
    /* Center the scaled terminal */
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    min-height: 0;
}

.preview-container .xterm-viewport {
    overflow: hidden !important;
    /* Hide scrollbars in preview */
}

/* Scale the preview terminal to fit */
.preview-terminal-wrapper {
    transform-origin: top left;
    pointer-events: none;
    /* Disable interaction, allow clicks to pass through */
}

.tab-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 6px 8px;
    background: rgba(0, 43, 54, 0.75);
    /* Semi-transparent background */
    backdrop-filter: blur(4px);
    /* Frosted glass effect */
    border-top: 1px solid rgba(88, 110, 117, 0.3);
    pointer-events: none;
    /* Allow clicks to pass through */
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: transform 0.3s ease;
    /* Smooth slide transition */
}

/* Overlay hover logic moved to main media query block */

.tab-info-overlay .meta {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.tab-info-overlay .meta.meta-managed {
    color: #6ed36e;
    font-weight: 600;
}

.tab-info-overlay .meta.meta-progress {
    font-weight: 600;
}

.tab-info-overlay .meta.meta-progress[data-tone="running"] {
    color: #2aa198;
}

.tab-info-overlay .meta.meta-progress[data-tone="warning"] {
    color: #b58900;
}

.tab-info-overlay .meta.meta-progress[data-tone="error"] {
    color: #dc322f;
}

.tab-info-overlay .title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-highlight);
    font-weight: normal;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    margin-bottom: 2px;
}

.tab-status-icon,
.agent-editor-tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    line-height: 1;
}

.tab-status-icon svg,
.agent-editor-tab-icon svg {
    display: block;
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
}

.tab-title-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.new-tab-button:hover {
    background-color: var(--bg-surface);
}

.terminal-container {
    flex-grow: 1;
    position: relative;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Allow shrinking */
    overflow: hidden;
    /* Force children to fit */
}

.system-status-bar {
    display: flex;
    gap: 0;
    /* Remove default gap, control via child containers */
    padding: 0 8px;
    /* Reduce padding slightly */
    padding-top: max(6px, env(safe-area-inset-top));
    /* Balanced top padding */
    padding-bottom: 6px;
    /* Balanced bottom padding */
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
    background-color: rgba(0, 43, 54, 0.9);
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    /* Unified font size */
    color: var(--text-muted);
    flex-shrink: 0;
    align-items: center;
    width: 100%;
    overflow: hidden;
    /* Prevent scrollbar if canvas is added */
}

.status-text-group {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-shrink: 0;
    white-space: nowrap;
    padding-right: 0;
}

.desktop-heartbeat-canvas {
    flex-grow: 1;
    height: 12px;
    /* Match 12px text height perfectly */
    min-width: 50px;
    display: none;
    /* Managed by JS */
    opacity: 1;
    margin-left: 5px;
    align-self: center;
    background-color: transparent;
    /* Fade edges */
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-label {
    color: var(--text-muted);
}

.status-value {
    color: var(--text-highlight);
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 6px;
}

.host-emphasis {
    color: var(--text-highlight);
    font-weight: bold;
    display: inline;
}

.progress-bar {
    width: 50px;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
}

.progress-fill {
    height: 100%;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

#terminal {
    width: 100%;
    height: 100%;
    flex-grow: 1;
    touch-action: none;
    overflow: hidden;
    /* Ensure xterm canvas doesn't overflow */
    /* margin-top removed since we have padding now */
}

/* Virtual Keyboard Bar */
.virtual-keys {
    height: 38px;
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    /* The main bottom divider */
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Default safe area padding (Mobile) */
    padding-top: 0;
    padding-bottom: 0;
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
    gap: 6px;
    overflow-x: auto;
    flex-shrink: 0;
    z-index: 20;
    /* Hide scrollbar */
    scrollbar-width: none;
}

.virtual-keys::-webkit-scrollbar {
    display: none;
}

/* Larger padding for Tablet/Desktop */
@media (min-width: 768px) {
    .virtual-keys {
        padding-left: max(40px, env(safe-area-inset-left));
        padding-right: max(40px, env(safe-area-inset-right));
    }
}

/* Only show on touch devices */
@media (pointer: coarse) {
    .virtual-keys {
        display: flex !important;
    }
}

.virtual-keys button {
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    color: var(--text-base);
    border-radius: 4px;
    height: 28px;
    min-width: 36px;
    padding: 0 4px;
    font-size: 11px;
    font-family: inherit;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.virtual-keys button:active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: translateY(1px);
}

.virtual-keys button.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    /* No transform for toggled state to keep alignment */
}

.soft-keyboard {
    position: absolute;
    bottom: 38px;
    left: 0;
    width: 100%;
    background: rgba(0, 43, 54, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    padding: 6px 2px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 100;
}

.soft-keyboard .row {
    display: flex;
    justify-content: center;
    /* Center rows */
    gap: 2px;
    padding: 0 2px;
}

/* Row offsets removed for centered layout */

.soft-key {
    flex: 0 0 calc((100% - 24px) / 12);
    height: 40px;
    /* Taller for 2 chars */
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-highlight);
    position: relative;
    /* For absolute positioning */
    min-width: 0;
}

.key-main {
    position: absolute;
    top: 4px;
    left: 5px;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1;
}

.key-shift {
    position: absolute;
    bottom: 4px;
    right: 5px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: normal;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1;
}

/* Shift Mode: Swap Emphasis */
.soft-keyboard.shift-mode .key-main {
    opacity: 0.4;
    transform: scale(0.8);
}

.soft-keyboard.shift-mode .key-shift {
    opacity: 1;
    color: var(--accent-color);
    /* Highlight shift char */
    font-size: 14px;
    font-weight: bold;
    transform: scale(1.3) translate(-2px, -2px);
    /* Pop out */
}

.modifier-key.active,
.soft-key.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Override color in active state */
.soft-key.active .key-shift {
    color: rgba(255, 255, 255, 0.8);
}

/* Adjust terminal container to accommodate keys */
.terminal-container {
    /* ... existing ... */
}

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--bg-surface);
    padding: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.modal-content h2 {
    margin-top: 0;
    color: var(--text-highlight);
}

.modal-content p {
    color: var(--text-base);
    margin-bottom: 1.5rem;
}

.modal-content input {
    width: 100%;
    padding: 10px;
    margin-bottom: 1rem;
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-highlight);
    font-family: inherit;
    font-size: 1rem;
}

.modal-content input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.modal-content button {
    width: 100%;
    padding: 10px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.modal-content button:hover {
    background-color: #2aa198;
}

.modal-content button.secondary-button {
    background-color: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border-color);
}

.modal-content button.secondary-button:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.modal-content button.danger-button {
    background-color: #dc322f;
}

.modal-content button.danger-button:hover {
    background-color: #c1272d;
}

.confirm-modal-content {
    max-width: 420px;
    text-align: left;
}

.confirm-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.confirm-modal-note {
    margin: 0.5rem 0 0;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.confirm-modal-actions button {
    width: auto;
    min-width: 120px;
}

.auth-sessions-content {
    max-width: 620px;
    text-align: left;
}

.auth-sessions-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: min(50vh, 420px);
    overflow-y: auto;
    margin: 1rem 0;
    padding-right: 0.25rem;
}

.auth-session-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.03);
}

.auth-session-row.current {
    border-color: var(--accent-color);
}

.auth-session-info {
    min-width: 0;
}

.auth-session-title {
    color: var(--text-highlight);
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.auth-session-meta,
.auth-session-empty {
    color: var(--text-dim);
    font-size: 0.82rem;
    line-height: 1.45;
}

.auth-session-revoke {
    width: auto !important;
    min-width: 92px;
    flex: 0 0 auto;
}

.auth-sessions-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

.auth-sessions-actions button {
    width: auto;
    min-width: 130px;
}

.agent-setup-content {
    max-width: 520px;
    text-align: left;
}

.agent-setup-form {
    margin: 0;
}

.agent-setup-section {
    display: grid;
    gap: 0.5rem;
}

.agent-setup-section label {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.agent-setup-checkbox {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0.25rem 0;
}

.agent-setup-checkbox input {
    width: auto;
    margin: 0;
}

.agent-setup-note,
.agent-setup-feedback {
    color: var(--text-dim);
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    white-space: pre-wrap;
}

.agent-setup-feedback.error {
    color: #dc322f;
}

.agent-setup-feedback.success {
    color: #2aa198;
}

.agent-setup-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.agent-setup-actions button {
    width: auto;
    min-width: 120px;
}

#add-server-form {
    margin: 0;
}

#add-server-cancel {
    margin-top: 0.75rem;
}

.error-message {
    color: #dc322f;
    margin-top: 1rem;
    font-size: 0.9rem;
    min-height: 1.2em;
}

/* Shortcuts Modal Specifics */
#shortcuts-modal {
    background-color: rgba(0, 0, 0, 0.2);
    /* Subtle dimming only */
    backdrop-filter: none;
}

.shortcuts-content {
    max-width: 500px;
    text-align: left;
    background-color: rgba(0, 43, 54, 0.85);
    /* Semi-transparent base */
    backdrop-filter: blur(12px);
    /* Strong blur on the panel itself */
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    color: var(--text-base);
}

.shortcuts-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.shortcuts-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-base);
}

.shortcuts-list li:last-child {
    border-bottom: none;
}

kbd {
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Monaspace Neon', monospace;
    font-size: 0.85em;
    color: var(--text-highlight);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
}

/* Editor & Split View Styles */

.terminal-wrapper {
    flex: 1 1 0%;
    /* Strictly 1 part */
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    min-width: 0;
    /* Prevent overflow */
    overflow: visible;
    /* Allow search bar to protrude */
    background-color: #002b36;
    /* Padding ensures terminal text doesn't touch edges */
    padding: 0 0 10px 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 5;
    /* Lower than editor */
}

.terminal-wrapper.maximized {
    padding-top: 10px;
}

.terminal-layout-button {
    position: absolute;
    top: 8px;
    right: 14px;
    z-index: 95;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background-color: rgba(7, 54, 66, 0.72);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition:
        border-color 0.16s ease,
        background-color 0.16s ease,
        color 0.16s ease,
        transform 0.16s ease,
        box-shadow 0.16s ease;
}

.terminal-layout-button:hover {
    border-color: rgba(38, 139, 210, 0.9);
    background-color: rgba(7, 54, 66, 0.9);
    color: var(--text-highlight);
}

.terminal-layout-button:active {
    transform: translateY(1px);
}

.terminal-layout-button.active {
    border-color: rgba(38, 139, 210, 0.9);
    color: var(--text-highlight);
}

.terminal-layout-button svg {
    display: block;
}

.editor-pane {
    flex: 2 1 0%;
    /* Strictly 2 parts */
    display: flex;
    flex-direction: column;
    background-color: var(--bg-base);
    min-height: 100px;
    min-width: 0;
    /* Prevent overflow */
    position: relative;
    overflow: hidden;
    z-index: 10;
    /* Higher than terminal */
}

.editor-resizer {
    height: 10px;
    background-color: transparent;
    cursor: row-resize;
    width: 100%;
    flex-shrink: 0;
    z-index: 20;
    /* Highest */
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    border: none;
}

.editor-resizer::before {
    content: '';
    width: 100%;
    height: 1px;
    background-color: var(--border-color);
}

.editor-resizer:hover::before {
    background-color: var(--accent-color);
    height: 2px;
}

.editor-layout {
    display: flex;
    flex-grow: 1;
    height: 0;
    /* Allow scrolling */
}

.file-tree-container {
    width: 220px;
    background-color: var(--bg-base);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.file-tree-resizer {
    width: 5px;
    background-color: var(--border-color);
    cursor: col-resize;
    height: 100%;
    flex-shrink: 0;
    border-left: 4px solid transparent;
    border-right: 0;
    background-clip: content-box;
}

.file-tree-resizer:hover {
    background-color: var(--accent-color);
}

.file-tree {
    flex-grow: 1;
    overflow: auto;
    /* Allow both scroll */
    padding: 8px 0;
    font-size: 12px;
}

.file-tree ul {
    list-style: none;
    padding-left: 14px;
    /* Indentation for nested levels */
    margin: 0;
}

.file-tree>ul {
    padding-left: 0;
    /* No indentation for root level */
}

.file-tree li {
    padding: 0;
    margin: 0;
}

.file-tree-item {
    padding: 2px 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-base);
    white-space: nowrap;
    min-width: 100%;
    /* Ensure background covers full width */
    width: fit-content;
    /* Allow width to grow */
}

.file-tree-item:hover {
    background-color: rgba(88, 110, 117, 0.2);
    color: var(--text-highlight);
}

.file-tree-item.selected {
    background-color: rgba(88, 110, 117, 0.26);
    color: var(--text-highlight);
}

.file-tree-item.active {
    background-color: rgba(38, 139, 210, 0.15);
    color: var(--accent-color);
}

.file-tree-item.selected.active {
    background-color: rgba(38, 139, 210, 0.22);
}

.file-tree-item .icon {
    width: 16px;
    text-align: center;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.file-tree-item.is-dir {
    font-weight: bold;
}

.file-tree-name {
    min-width: 0;
}

.file-tree-rename-btn,
.file-tree-delete-btn,
.file-tree-new-folder-btn,
.file-tree-new-file-btn {
    display: none;
    border: 1px solid rgba(38, 139, 210, 0.28);
    border-radius: 999px;
    background: rgba(38, 139, 210, 0.12);
    color: var(--text-highlight);
    width: 20px;
    height: 20px;
    padding: 0;
    margin: 0;
    cursor: pointer;
}

.file-tree-item:hover .file-tree-rename-btn,
.file-tree-item.selected .file-tree-rename-btn,
.file-tree-item:focus-within .file-tree-rename-btn,
.file-tree-item:hover .file-tree-delete-btn,
.file-tree-item.selected .file-tree-delete-btn,
.file-tree-item:focus-within .file-tree-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.file-tree-delete-btn {
    border-color: rgba(220, 50, 47, 0.28);
    background: rgba(220, 50, 47, 0.12);
    color: #dc322f;
}

.file-tree-rename-btn:disabled,
.file-tree-delete-btn:disabled,
.file-tree-new-folder-btn:disabled,
.file-tree-new-file-btn:disabled {
    display: none;
}

.file-tree-create-entry {
    list-style: none;
    padding: 0;
    margin: 0;
}

.file-tree-create-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px 3px 28px;
}

.file-tree-create-actions .file-tree-new-folder-btn,
.file-tree-create-actions .file-tree-new-file-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.file-tree-rename-input {
    min-width: 0;
    flex: 1 1 auto;
    padding: 1px 4px;
    border: 1px solid rgba(38, 139, 210, 0.5);
    border-radius: 4px;
    background: rgba(0, 43, 54, 0.9);
    color: var(--text-highlight);
    font: inherit;
}

.editor-workspace {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-base);
    min-width: 0;
    /* Prevent flex overflow */
}

.editor-tabs {
    display: flex;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    height: 36px;
    flex-shrink: 0;
}

.editor-tab {
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-right: 1px solid var(--border-color);
    cursor: pointer;
    min-width: 80px;
    max-width: none;
    width: auto;
    background-color: var(--bg-surface);
    flex-shrink: 0;
}

.agent-editor-tab {
    gap: 6px;
}

.agent-editor-tab .agent-editor-tab-icon {
    color: var(--text-highlight);
}

.agent-editor-tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.file-editor-tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.file-editor-tab-icon .file-icon {
    width: 16px;
    height: 16px;
}

.tab-status-icon.is-attention,
.agent-editor-tab-icon.is-attention,
.toggle-agent-btn.is-attention {
    color: #cb4b16;
}

.tab-status-icon.is-running,
.agent-editor-tab-icon.is-running,
.toggle-agent-btn.is-running {
    color: var(--accent-color);
}

.tab-status-icon.is-running svg,
.agent-editor-tab-icon.is-running svg,
.toggle-agent-btn.is-running svg {
    animation: tabminal-spin 0.95s linear infinite;
    transform-origin: center;
}

@keyframes tabminal-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.editor-tab:hover {
    background-color: var(--bg-base);
}

.editor-tab.active {
    background-color: var(--bg-base);
    color: var(--text-highlight);
    border-top: 2px solid var(--accent-color);
}

.editor-tab.bound-tab-primary {
    border-right: 0;
}

.editor-tab.bound-tab-secondary {
    min-width: 0;
    padding-left: 10px;
    padding-right: 12px;
}

.markdown-preview-tab {
    color: rgba(229, 237, 239, 0.76);
}

.editor-tab.is-split {
    border-top-color: rgba(38, 139, 210, 0.55);
}

.editor-tab .tab-action-btn {
    margin-left: 8px;
    color: rgba(229, 237, 239, 0.72);
    border-radius: 6px;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 20px;
    opacity: 0.78;
    cursor: pointer;
}

.editor-tab:hover .tab-action-btn,
.editor-tab.active .tab-action-btn {
    opacity: 1;
}

.editor-tab .tab-action-btn:hover {
    background-color: rgba(38, 139, 210, 0.16);
    color: var(--text-highlight);
}

.markdown-split-btn,
.markdown-unsplit-btn {
    margin-left: auto;
}

.markdown-unsplit-btn + .close-btn {
    margin-left: 6px;
}

.editor-tab .close-btn {
    margin-left: auto;
    font-size: 14px;
    opacity: 0;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.editor-tab:hover .close-btn {
    opacity: 1;
}

.editor-tab .close-btn:hover {
    background-color: rgba(220, 50, 47, 0.8);
    color: white;
}

.editor-tab.readonly {
    background-image: repeating-linear-gradient(-45deg,
            transparent,
            transparent 5px,
            rgba(220, 50, 47, 0.15) 5px,
            rgba(220, 50, 47, 0.15) 10px);
}

.editor-tab.readonly span {
    text-decoration: none;
    opacity: 0.8;
    font-style: normal;
}

.editor-content {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
}

.editor-content.markdown-split-active {
    position: absolute;
    inset: 36px 0 0;
    flex: 1 1 0%;
    height: auto;
    min-height: 0;
    display: flex;
    align-items: stretch;
    gap: 0;
}

.terminal-tab-host {
    position: absolute;
    inset: 0;
    display: none;
    background-color: var(--bg-base);
}

.terminal-wrapper.workspace-tab-active {
    flex: 1 1 auto;
    min-height: 0;
}

.agent-panel {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-base);
    font-size: 12px;
    line-height: 1.4;
}

.agent-panel-top-button {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    flex: 0 0 34px;
}

.agent-usage-hud {
    --agent-usage-details-width: 528px;
    --agent-usage-label-width: 86px;
    --agent-usage-progress-width: 200px;
    --agent-usage-value-width: 68px;
    --agent-usage-meta-width: 144px;
    --agent-usage-column-gap: 10px;
    position: absolute;
    top: 8px;
    right: 56px;
    z-index: 94;
    display: flex;
    align-items: stretch;
    gap: 0;
    min-height: 34px;
    box-sizing: border-box;
    width: auto;
    padding: 0 8px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 17px;
    overflow: hidden;
    background-color: rgba(7, 54, 66, 0.54);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition:
        border-radius 0.16s cubic-bezier(0.22, 1, 0.36, 1),
        padding 0.16s cubic-bezier(0.22, 1, 0.36, 1),
        gap 0.16s cubic-bezier(0.22, 1, 0.36, 1),
        background-color 0.16s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

.agent-usage-hud:hover,
.agent-usage-hud:focus-within,
.agent-usage-hud.is-expanded {
    gap: 8px;
    border-radius: 9px;
    padding: 10px 12px;
    min-height: 0;
    background-color: rgba(7, 54, 66, 0.72);
}

.agent-usage-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    min-height: 34px;
    max-width: 420px;
    opacity: 1;
    overflow: hidden;
    transition:
        max-width 0.16s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.14s ease,
        margin-right 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

.agent-usage-hud:hover .agent-usage-compact,
.agent-usage-hud:focus-within .agent-usage-compact,
.agent-usage-hud.is-expanded .agent-usage-compact {
    max-width: 0;
    opacity: 0;
    margin-right: -2px;
    pointer-events: none;
}

.agent-usage-pill {
    position: relative;
    min-width: 58px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 0 0 auto;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--text-highlight);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

.agent-usage-pill::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        linear-gradient(
            90deg,
            rgba(38, 139, 210, 0.3) 0%,
            rgba(38, 139, 210, 0.3) calc(var(--agent-usage-progress, 0) * 1%),
            rgba(255, 255, 255, 0.06) calc(var(--agent-usage-progress, 0) * 1%),
            rgba(255, 255, 255, 0.06) 100%
        );
    transition: background 0.32s ease;
}

.agent-usage-pill[data-tone="critical"]::before {
    background:
        linear-gradient(
            90deg,
            rgba(220, 50, 47, 0.38) 0%,
            rgba(220, 50, 47, 0.38) calc(var(--agent-usage-progress, 0) * 1%),
            rgba(255, 255, 255, 0.06) calc(var(--agent-usage-progress, 0) * 1%),
            rgba(255, 255, 255, 0.06) 100%
        );
}

.agent-usage-pill.is-highlighted {
    transform: translateY(-1px);
    box-shadow:
        0 0 0 1px rgba(38, 139, 210, 0.46),
        0 0 14px rgba(38, 139, 210, 0.2);
    background-color: rgba(255, 255, 255, 0.1);
}

.agent-usage-pill[data-tone="critical"].is-highlighted {
    box-shadow:
        0 0 0 1px rgba(220, 50, 47, 0.5),
        0 0 14px rgba(220, 50, 47, 0.18);
}

.agent-usage-pill-value,
.agent-usage-pill-label {
    position: relative;
    z-index: 1;
    font-size: 10px;
    line-height: 1;
    color: var(--text-highlight);
}

.agent-usage-pill-value {
    white-space: nowrap;
}

.agent-usage-pill-label {
    color: var(--text-muted);
}

.agent-usage-details {
    flex: 0 0 auto;
    width: var(--agent-usage-details-width);
    min-width: 0;
    max-width: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateX(-4px);
    transition:
        max-width 0.16s cubic-bezier(0.22, 1, 0.36, 1),
        max-height 0.16s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.14s ease,
        transform 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

.agent-usage-hud:hover .agent-usage-details,
.agent-usage-hud:focus-within .agent-usage-details,
.agent-usage-hud.is-expanded .agent-usage-details {
    max-width: var(--agent-usage-details-width);
    max-height: 320px;
    opacity: 1;
    transform: translateX(0);
}

.agent-usage-session-row + .agent-usage-detail-row,
.agent-usage-detail-row + .agent-usage-detail-row,
.agent-usage-detail-row + .agent-usage-session-row,
.agent-usage-session-row + .agent-usage-session-row,
.agent-usage-detail-row + .agent-usage-details-meta,
.agent-usage-details-meta + .agent-usage-detail-row,
.agent-usage-details-meta + .agent-usage-session-row,
.agent-usage-details-meta + .agent-usage-details-meta {
    margin-top: 9px;
}

.agent-usage-details-meta,
.agent-usage-details-reset {
    font-size: 10px;
    line-height: 1.35;
    color: var(--text-muted);
}

.agent-usage-details-meta.primary {
    color: var(--text-highlight);
    opacity: 0.92;
}

.agent-usage-session-row,
.agent-usage-detail-row {
    display: grid;
    grid-template-columns:
        var(--agent-usage-label-width)
        var(--agent-usage-progress-width)
        var(--agent-usage-value-width)
        var(--agent-usage-meta-width);
    gap: 10px var(--agent-usage-column-gap);
    align-items: start;
}

.agent-usage-session-label,
.agent-usage-detail-label {
    font-size: 11px;
    line-height: 1.35;
    color: var(--text-highlight);
    white-space: nowrap;
}

.agent-usage-session-value {
    grid-column: 2 / 5;
    font-size: 11px;
    line-height: 1.35;
    color: var(--text-highlight);
    opacity: 0.92;
}

.agent-usage-detail-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.agent-usage-progress {
    position: relative;
    width: 100%;
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background:
        repeating-linear-gradient(
            -45deg,
            rgba(255, 255, 255, 0.14) 0,
            rgba(255, 255, 255, 0.14) 2px,
            rgba(255, 255, 255, 0.04) 2px,
            rgba(255, 255, 255, 0.04) 4px
        );
}

.agent-usage-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: rgba(238, 232, 213, 0.92);
    transition: width 0.32s ease, background-color 0.2s ease;
}

.agent-usage-progress[data-tone="critical"] .agent-usage-progress-fill {
    background: rgba(220, 50, 47, 0.92);
}

.agent-usage-detail-value {
    font-size: 11px;
    line-height: 1.35;
}

.agent-usage-detail-value {
    color: var(--text-highlight);
    white-space: nowrap;
    text-align: right;
    justify-self: end;
}

.agent-usage-details-reset {
    white-space: nowrap;
    text-align: right;
    justify-self: end;
}

@media (max-width: 767px) {
    .agent-usage-hud {
        display: none !important;
    }
}

.compact-workspace-mode .agent-usage-hud {
    display: none !important;
}

.agent-panel-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(7, 54, 66, 0.55);
}

.agent-panel-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.agent-panel-header-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.agent-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-highlight);
}

.agent-panel-title:empty {
    display: none;
}

.agent-panel-meta {
    font-size: 10px;
    color: var(--text-muted);
}

.agent-panel-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.agent-panel-mode-select {
    min-width: 112px;
    max-width: 180px;
    padding: 8px 32px 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: rgba(7, 54, 66, 0.45);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='12' height='12' stroke='%2393a1a1' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-position: calc(100% - 10px) center;
    background-repeat: no-repeat;
    background-size: 12px 12px;
    color: var(--text-highlight);
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.45;
    appearance: none;
    -webkit-appearance: none;
}

.agent-panel-select-shell {
    display: inline-flex;
    align-items: center;
    position: relative;
    flex: 0 0 auto;
}

.agent-panel-select-shell-icon {
    display: none;
}

@media (max-width: 1408px) {
    .agent-panel-select-shell[data-selector-role="mode"],
    .agent-panel-select-shell[data-selector-role="model"],
    .agent-panel-select-shell[data-selector-role="thought_level"] {
        width: 36px;
        height: 36px;
        justify-content: center;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background-color: rgba(7, 54, 66, 0.45);
        overflow: hidden;
    }

    .agent-panel-select-shell[data-selector-role="mode"]
        .agent-panel-select-shell-icon,
    .agent-panel-select-shell[data-selector-role="model"]
        .agent-panel-select-shell-icon,
    .agent-panel-select-shell[data-selector-role="thought_level"]
        .agent-panel-select-shell-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: var(--text-highlight);
        pointer-events: none;
    }

    .agent-panel-select-shell[data-selector-role="mode"]
        .agent-panel-mode-select,
    .agent-panel-select-shell[data-selector-role="model"]
        .agent-panel-mode-select,
    .agent-panel-select-shell[data-selector-role="thought_level"]
        .agent-panel-mode-select {
        position: absolute;
        inset: 0;
        width: 100%;
        min-width: 0;
        max-width: none;
        padding: 0;
        border: 0;
        background: transparent;
        background-image: none;
        opacity: 0;
    }
}

.agent-panel-tools,
.agent-panel-permissions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px 0;
}

.agent-plan-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px 0;
}

.agent-plan-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(131, 148, 150, 0.18);
    border-radius: 10px;
    background-color: rgba(7, 54, 66, 0.24);
}

.agent-plan-history-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.agent-plan-header,
.agent-plan-terminal-row {
    color: var(--text-highlight);
    font-size: 12px;
    font-weight: 600;
}

.agent-plan-terminal-row.agent-panel-activity {
    gap: 8px;
    padding: 0;
    min-height: 0;
    font-size: 10px;
    font-weight: 400;
}

.agent-plan-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.agent-plan-entry {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--text-base);
    font-size: 11px;
    line-height: 1.45;
}

.agent-plan-entry.completed {
    color: var(--text-muted);
    text-decoration: line-through;
}

.agent-plan-entry.in-progress .agent-plan-entry-marker {
    color: var(--accent-color);
}

.agent-plan-entry.completed .agent-plan-entry-marker {
    color: #6ed36e;
}

.agent-plan-entry.pending .agent-plan-entry-marker {
    color: var(--text-muted);
}

.agent-plan-entry-marker {
    flex: 0 0 auto;
    width: 12px;
    text-align: center;
}

.agent-plan-entry-body {
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.agent-plan-entry-text {
    min-width: 0;
    flex: 1 1 auto;
}

.agent-plan-entry-priority {
    flex: 0 0 auto;
    padding: 1px 6px;
    border-radius: 999px;
    border: 1px solid rgba(131, 148, 150, 0.24);
    color: var(--text-muted);
    font-size: 9px;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.agent-plan-entry-priority.high {
    color: #ffb26b;
    border-color: rgba(203, 75, 22, 0.35);
    background-color: rgba(203, 75, 22, 0.12);
}

.agent-plan-entry-priority.medium {
    color: var(--text-muted);
    border-color: rgba(131, 148, 150, 0.22);
}

.agent-plan-entry-priority.low {
    color: #83d07c;
    border-color: rgba(80, 170, 80, 0.28);
    background-color: rgba(80, 170, 80, 0.10);
}

.agent-plan-terminal-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid rgba(131, 148, 150, 0.12);
    border-radius: 10px;
    background-color: rgba(7, 54, 66, 0.18);
}

.agent-plan-terminal-entry {
    display: block;
    width: 100%;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font: inherit;
    font-size: 10px;
    line-height: 1.4;
    text-align: left;
    word-break: break-word;
}

.agent-plan-terminal-entry:hover,
.agent-plan-terminal-entry:focus-visible {
    color: var(--text-base);
    border-color: rgba(38, 139, 210, 0.32);
    background-color: rgba(38, 139, 210, 0.08);
    outline: none;
}

.agent-panel-commands {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

@media (max-width: 1408px) {
    .agent-panel-commands {
        display: none !important;
    }
}

.compact-workspace-mode .agent-panel-commands {
    display: none !important;
}

.agent-tool-call,
.agent-permission-card {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-left-width: 3px;
    border-radius: 8px;
    background-color: rgba(7, 54, 66, 0.4);
    color: var(--text-base);
    font-size: 11px;
}

.agent-tool-call.state-pending,
.agent-permission-card.state-pending {
    border-color: rgba(181, 137, 0, 0.34);
    background-color: rgba(181, 137, 0, 0.08);
}

.agent-tool-call.state-running,
.agent-permission-card.state-running {
    border-color: rgba(38, 139, 210, 0.36);
    background-color: rgba(38, 139, 210, 0.09);
}

.agent-tool-call.state-error,
.agent-permission-card.state-error {
    border-color: rgba(220, 80, 80, 0.34);
    background-color: rgba(220, 80, 80, 0.08);
}

.agent-tool-call {
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-left-color: rgba(38, 139, 210, 0.46);
}

.agent-permission-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-left-color: rgba(181, 137, 0, 0.52);
}

.agent-tool-call-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.agent-tool-call-title,
.agent-permission-title {
    color: var(--text-highlight);
    font-weight: 600;
    font-size: 12px;
    min-width: 0;
    flex: 1 1 auto;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.agent-tool-call-meta {
    color: var(--text-muted);
    font-size: 10px;
    margin-top: 4px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.agent-path-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

.agent-path-link {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(38, 139, 210, 0.3);
    background-color: rgba(38, 139, 210, 0.1);
    color: var(--text-highlight);
    font-size: 10px;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-path-link:hover,
.agent-path-link:focus-visible {
    border-color: rgba(38, 139, 210, 0.5);
    background-color: rgba(38, 139, 210, 0.16);
}

.agent-path-link.more {
    border-color: rgba(131, 148, 150, 0.26);
    background-color: rgba(88, 110, 117, 0.12);
    color: var(--text-muted);
}

.agent-tool-call-summary {
    color: var(--text-base);
    font-size: 11px;
    line-height: 1.45;
    opacity: 0.94;
    white-space: pre-wrap;
    word-break: break-word;
}

.agent-tool-call-body {
    margin: 6px 0 0;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-base);
    font: inherit;
    font-size: 11px;
    opacity: 0.92;
}

.agent-tool-call-sections {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.agent-tool-call-section {
    border: 1px solid rgba(131, 148, 150, 0.18);
    border-radius: 8px;
    background-color: rgba(0, 43, 54, 0.28);
    overflow: hidden;
}

.agent-tool-call-section > summary {
    list-style: none;
    cursor: pointer;
    padding: 6px 9px;
    color: var(--text-muted);
    font-size: 10px;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.agent-tool-call-section > summary::-webkit-details-marker {
    display: none;
}

.agent-tool-call-summary-label {
    color: var(--text-muted);
    flex: 0 0 auto;
}

.agent-tool-call-summary-preview {
    color: var(--text-base);
    opacity: 0.75;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-tool-call-section[open] > summary {
    border-bottom: 1px solid rgba(131, 148, 150, 0.12);
}

.agent-tool-call-section .agent-tool-call-body {
    margin: 0;
    padding: 8px 9px;
}

.agent-tool-call-code-host,
.agent-tool-call-diff-host {
    margin: 0;
    padding: 8px 9px;
}

.agent-tool-call-terminal-host {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 8px 9px;
}

.agent-tool-call-terminal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.agent-tool-call-terminal-meta {
    color: var(--text-muted);
    font-size: 10px;
    line-height: 1.4;
    word-break: break-word;
}

.agent-tool-call-terminal-open {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: rgba(42, 161, 152, 0.18);
    color: var(--text-highlight);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 11px;
    line-height: 1.4;
    flex: 0 0 auto;
}

.agent-tool-call-terminal-open:hover {
    background-color: rgba(42, 161, 152, 0.28);
}

.agent-tool-call-terminal-output {
    margin: 0;
    border: 1px solid rgba(131, 148, 150, 0.18);
    border-radius: 8px;
    background-color: rgba(0, 43, 54, 0.32);
    color: var(--text-base);
    overflow: hidden;
    max-height: 280px;
}

.agent-tool-call-terminal-output .xterm {
    height: 100%;
    padding: 8px 10px;
}

.agent-tool-call-terminal-output .xterm-viewport {
    overflow-y: auto;
}

.agent-tool-call-editor {
    width: 100%;
    border: 1px solid rgba(131, 148, 150, 0.18);
    border-radius: 6px;
    overflow: hidden;
}

.agent-tool-call-editor.diff {
    min-height: 180px;
}

.agent-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    font-size: 10px;
    color: var(--text-muted);
    background-color: rgba(88, 110, 117, 0.18);
}

.agent-status-pill.ready {
    color: var(--text-highlight);
    border-color: rgba(131, 148, 150, 0.32);
    background-color: rgba(88, 110, 117, 0.14);
}

.agent-status-pill.pending {
    color: #f6d56a;
    border-color: rgba(181, 137, 0, 0.42);
    background-color: rgba(181, 137, 0, 0.12);
}

.agent-status-pill.running {
    color: var(--accent-primary);
    border-color: rgba(38, 139, 210, 0.5);
    background-color: rgba(38, 139, 210, 0.14);
}

.agent-status-pill.completed {
    color: #6ed36e;
    border-color: rgba(110, 211, 110, 0.45);
    background-color: rgba(80, 170, 80, 0.14);
}

.agent-status-pill.cancelled,
.agent-status-pill.error {
    color: #ff9b9b;
    border-color: rgba(220, 80, 80, 0.45);
    background-color: rgba(220, 80, 80, 0.12);
}

.agent-permission-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.agent-permission-option,
.agent-panel-button,
.agent-dropdown-item,
.agent-command-chip {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: rgba(38, 139, 210, 0.12);
    color: var(--text-highlight);
    padding: 8px 12px;
    cursor: pointer;
    font-size: 11px;
    line-height: 1.45;
}

.agent-panel-button {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-weight: 400;
}

.agent-panel-button.icon-only {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    flex: 0 0 auto;
}

.agent-panel-button.icon-only svg {
    display: block;
}

.agent-panel-button:disabled,
.agent-panel-mode-select:disabled {
    cursor: not-allowed;
    color: var(--text-muted);
    border-color: rgba(131, 148, 150, 0.18);
    background-color: rgba(88, 110, 117, 0.12);
    box-shadow: none;
    opacity: 0.72;
}

.agent-panel-button:disabled:hover,
.agent-panel-button:disabled:focus-visible,
.agent-panel-mode-select:disabled:hover,
.agent-panel-mode-select:disabled:focus-visible {
    color: var(--text-muted);
    border-color: rgba(131, 148, 150, 0.18);
    background-color: rgba(88, 110, 117, 0.12);
    outline: none;
}

.agent-permission-option.secondary,
.agent-panel-button.secondary {
    background-color: rgba(88, 110, 117, 0.2);
    color: var(--text-base);
}

.agent-permission-option.primary {
    background-color: rgba(38, 139, 210, 0.24);
    border-color: rgba(38, 139, 210, 0.55);
}

.agent-permission-option.danger {
    background-color: rgba(220, 80, 80, 0.14);
    border-color: rgba(220, 80, 80, 0.42);
    color: #ffb0b0;
}

.agent-panel-transcript {
    flex: 1 1 auto;
    overflow: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.agent-empty-state {
    border: 1px dashed rgba(131, 148, 150, 0.22);
    border-radius: 10px;
    padding: 14px 16px;
    background-color: rgba(7, 54, 66, 0.24);
    color: var(--text-base);
}

.agent-empty-state-title {
    color: var(--text-highlight);
    font-size: 13px;
    font-weight: 600;
}

.agent-empty-state-body {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.45;
}

.agent-empty-state-actions {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.agent-empty-state-action {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: rgba(38, 139, 210, 0.1);
    color: var(--text-highlight);
    padding: 8px 10px;
    cursor: pointer;
    font: inherit;
    font-size: 11px;
}

.agent-message {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 9px 11px;
    background-color: rgba(7, 54, 66, 0.35);
}

.agent-turn-start {
    margin-top: 8px;
}

.agent-message.user {
    border-color: rgba(38, 139, 210, 0.45);
}

.agent-message.assistant.thought {
    border-style: dashed;
}

.agent-message-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
}

.agent-message-role {
    font-size: 10px;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    min-width: 0;
}

.agent-message-time {
    font-size: 10px;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    opacity: 0.88;
    text-align: right;
    white-space: nowrap;
    flex: 0 0 auto;
}

.agent-message-body {
    margin: 0;
    font: inherit;
    font-size: 12px;
    color: var(--text-base);
}

.agent-message-body.plain {
    white-space: pre-wrap;
    word-break: break-word;
}

.agent-message-body.markdown {
    line-height: 1.55;
}

.agent-message-body.markdown > :first-child {
    margin-top: 0;
}

.agent-message-body.markdown > :last-child {
    margin-bottom: 0;
}

.agent-message-body.markdown p,
.agent-message-body.markdown ul,
.agent-message-body.markdown pre {
    margin: 0 0 8px;
}

.agent-message-body.markdown h1,
.agent-message-body.markdown h2,
.agent-message-body.markdown h3,
.agent-message-body.markdown h4,
.agent-message-body.markdown h5,
.agent-message-body.markdown h6 {
    margin: 0 0 10px;
    color: var(--text-highlight);
    line-height: 1.35;
}

.agent-message-body.markdown ul {
    padding-left: 18px;
}

.agent-message-body.markdown blockquote {
    margin: 0 0 10px;
    padding: 2px 0 2px 12px;
    border-left: 3px solid rgba(38, 139, 210, 0.34);
    color: var(--text-muted);
}

.agent-message-body.markdown p,
.agent-message-body.markdown li,
.agent-message-body.markdown blockquote,
.agent-message-body.markdown h1,
.agent-message-body.markdown h2,
.agent-message-body.markdown h3,
.agent-message-body.markdown h4,
.agent-message-body.markdown h5,
.agent-message-body.markdown h6,
.markdown-preview-sheet.markdown-body p,
.markdown-preview-sheet.markdown-body li,
.markdown-preview-sheet.markdown-body blockquote,
.markdown-preview-sheet.markdown-body h1,
.markdown-preview-sheet.markdown-body h2,
.markdown-preview-sheet.markdown-body h3,
.markdown-preview-sheet.markdown-body h4,
.markdown-preview-sheet.markdown-body h5,
.markdown-preview-sheet.markdown-body h6 {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.agent-message-body.markdown code {
    font: inherit;
    font-size: 11px;
    background-color: rgba(0, 43, 54, 0.38);
    border: 1px solid rgba(131, 148, 150, 0.18);
    border-radius: 6px;
    padding: 1px 4px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.agent-message-body.markdown pre {
    overflow: auto;
    background-color: rgba(0, 43, 54, 0.34);
    border: 1px solid rgba(131, 148, 150, 0.16);
    border-radius: 8px;
    padding: 8px 10px;
    white-space: pre-wrap;
    word-break: break-word;
}

.agent-message-body.markdown pre code {
    border: 0;
    padding: 0;
    background: transparent;
}

.agent-message-body.markdown a {
    color: var(--accent-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.agent-message-body.markdown img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 0 10px;
    border-radius: 8px;
}

.agent-message-body.markdown table {
    display: block;
    width: max-content;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 0 0 10px;
}

.agent-message-body.markdown th,
.agent-message-body.markdown td {
    border: 1px solid rgba(131, 148, 150, 0.2);
    padding: 6px 8px;
    text-align: left;
}

.agent-message-body.markdown hr {
    border: 0;
    border-top: 1px solid rgba(131, 148, 150, 0.18);
    margin: 10px 0;
}

.agent-message-body.markdown .task-list-item {
    list-style: none;
}

.agent-message-body.markdown .task-list-item input {
    margin-right: 8px;
}

.agent-message-body.markdown .katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    margin: 0 0 10px;
}

.agent-message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.agent-message-attachment {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    max-width: 100%;
    padding: 6px 8px;
    border: 1px solid rgba(131, 148, 150, 0.24);
    border-radius: 8px;
    background-color: rgba(0, 43, 54, 0.28);
}

.agent-message-attachment-name {
    color: var(--text-highlight);
    font-size: 11px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-message-attachment-detail {
    color: var(--text-muted);
    font-size: 10px;
    line-height: 1.3;
}

.agent-panel-composer {
    position: relative;
    overflow: visible;
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.agent-panel-composer.drag-over {
    border-radius: 10px;
    background-color: rgba(38, 139, 210, 0.08);
    outline: 1px dashed rgba(38, 139, 210, 0.4);
    outline-offset: -1px;
}

.agent-panel-file-input {
    display: none;
}

.agent-attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.agent-attachment-chip {
    display: inline-flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 100%;
    padding: 7px 8px;
    border: 1px solid rgba(131, 148, 150, 0.24);
    border-radius: 8px;
    background-color: rgba(0, 43, 54, 0.24);
}

.agent-attachment-chip-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.agent-attachment-chip-name {
    color: var(--text-highlight);
    font-size: 11px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-attachment-chip-detail {
    color: var(--text-muted);
    font-size: 10px;
    line-height: 1.3;
}

.agent-attachment-chip-remove {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
}

.agent-attachment-chip-remove:hover,
.agent-attachment-chip-remove:focus-visible {
    color: var(--text-highlight);
}

.agent-attachment-chip-remove:disabled {
    cursor: not-allowed;
    color: rgba(88, 110, 117, 0.7);
}

.agent-panel-input {
    width: 100%;
    resize: vertical;
    min-height: 68px;
    padding: 9px 11px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background-color: rgba(7, 54, 66, 0.45);
    color: var(--text-highlight);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
}

.agent-panel-input::placeholder {
    color: var(--text-muted);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    opacity: 1;
}

.agent-command-menu {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: calc(100% - 4px);
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: min(320px, 40vh);
    overflow: auto;
    padding: 6px;
    border: 1px solid rgba(131, 148, 150, 0.2);
    border-radius: 10px;
    background-color: rgba(0, 43, 54, 0.92);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
    overscroll-behavior: contain;
    scroll-padding-block: 8px;
}

.agent-command-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    width: 100%;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text-base);
    padding: 7px 9px;
    cursor: pointer;
    text-align: left;
    scroll-margin-block: 8px;
}

.agent-command-option:hover,
.agent-command-option.active {
    border-color: rgba(38, 139, 210, 0.34);
    background-color: rgba(38, 139, 210, 0.12);
}

.agent-command-option-name {
    color: var(--text-highlight);
    font-size: 11px;
}

.agent-command-option-meta {
    color: var(--text-muted);
    font-size: 10px;
}

.agent-panel-actions {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.agent-panel-fixed-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
    margin-left: auto;
    flex-wrap: wrap;
}

.agent-panel-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 18px;
    font-size: 10px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.agent-panel-activity {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 8px;
    min-height: 26px;
    font-size: 10px;
    color: var(--text-muted);
}

.agent-activity-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    min-width: 15px;
    min-height: 15px;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    color: inherit;
    flex: 0 0 auto;
    line-height: 1;
    border-radius: 4px;
    cursor: default;
}

.agent-activity-action svg {
    display: block;
}

.agent-activity-action:disabled {
    opacity: 1;
}

.agent-activity-action.cancelable {
    cursor: pointer;
}

.agent-activity-action-stop {
    display: none;
}

.agent-activity-action.cancelable:hover .agent-activity-action-primary,
.agent-activity-action.cancelable:focus-visible .agent-activity-action-primary {
    display: none;
}

.agent-activity-action.cancelable:hover .agent-activity-action-stop,
.agent-activity-action.cancelable:focus-visible .agent-activity-action-stop {
    display: inline-flex;
}

.agent-panel-activity.running {
    color: var(--text-base);
}

.agent-panel-activity.tool {
    color: var(--accent-color);
}

.agent-panel-activity.pending {
    color: var(--warning-color);
}

.agent-panel-activity.error {
    color: var(--danger-color);
}

.agent-panel-activity-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
}

.agent-panel-activity-icon.is-spinning svg {
    animation: tabminal-spin 0.95s linear infinite;
    transform-origin: center;
}

.agent-panel-activity-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-panel-queue {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 12px 4px;
}

.agent-queue-item {
    position: relative;
    border: 1px solid rgba(131, 148, 150, 0.22);
    border-radius: 10px;
    padding: 9px 44px 10px 11px;
    background-color: rgba(7, 54, 66, 0.24);
}

.agent-queue-remove {
    position: absolute;
    top: 8px;
    right: 8px;
}

.agent-panel-hint-summary {
    color: var(--text-muted);
}

.agent-panel-hint-hotkey {
    color: var(--text-muted);
    opacity: 0.85;
    margin-left: auto;
}

.agent-dropdown {
    position: absolute;
    z-index: 1200;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background-color: rgba(0, 43, 54, 0.96);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    scroll-padding-block: 6px;
}

.agent-dropdown-item:disabled,
.agent-dropdown-item.unavailable {
    opacity: 0.55;
    cursor: help;
}

.agent-dropdown-entry {
    position: relative;
}

.agent-dropdown-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    text-align: left;
    width: 100%;
    padding-right: 38px;
    scroll-margin-block: 6px;
}

.agent-dropdown-item:hover,
.agent-dropdown-item:focus-visible,
.agent-dropdown-item.is-active {
    border-color: rgba(38, 139, 210, 0.42);
    background-color: rgba(38, 139, 210, 0.2);
    outline: none;
}

.agent-dropdown-label {
    font-size: 12px;
    color: var(--text-highlight);
}

.agent-dropdown-meta {
    font-size: 10px;
    color: var(--text-muted);
}

.agent-dropdown-info {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 22px;
    height: 22px;
    border: 1px solid rgba(131, 148, 150, 0.28);
    background: rgba(7, 54, 66, 0.82);
    color: var(--text-muted);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 11px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.agent-dropdown-info span {
    transform: translateY(-0.5px);
}

.agent-dropdown-info:hover {
    color: var(--text-highlight);
    border-color: rgba(38, 139, 210, 0.42);
    background-color: rgba(38, 139, 210, 0.18);
}

.agent-dropdown-empty {
    padding: 8px 12px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.agent-dropdown-footer {
    margin-top: 2px;
    padding: 8px 12px 2px;
    border-top: 1px solid rgba(131, 148, 150, 0.14);
    color: var(--text-muted);
    font-size: 10px;
    line-height: 1.45;
}

.agent-dropdown-footer-link {
    color: var(--accent-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.agent-dropdown-footer-link:hover,
.agent-dropdown-footer-link:focus-visible {
    color: var(--text-highlight);
}

.monaco-container {
    width: 100%;
    height: 100%;
    min-width: 0;
}

.editor-content.markdown-split-active > .monaco-container {
    position: relative;
    flex: 1 1 0;
    width: auto;
    height: 100%;
    min-width: 0;
    min-height: 0;
    border-right: 1px solid rgba(148, 163, 184, 0.14);
}

.image-preview-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    background-color: #073642;
    background-image:
        linear-gradient(45deg, #0b3f4b 25%, transparent 25%),
        linear-gradient(-45deg, #0b3f4b 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #0b3f4b 75%),
        linear-gradient(-45deg, transparent 75%, #0b3f4b 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.image-preview-container img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.pdf-preview-container {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    background:
        linear-gradient(180deg, rgba(7, 54, 66, 0.98), rgba(0, 36, 46, 0.98));
}

.markdown-preview-container {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    background:
        linear-gradient(180deg, rgba(7, 54, 66, 0.98), rgba(0, 36, 46, 0.98));
}

.editor-content.markdown-split-active > .markdown-preview-container {
    position: relative;
    inset: auto;
    flex: 1 1 0;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

.markdown-preview-scroll {
    flex: 1;
    overflow: auto;
    min-height: 0;
    padding: 18px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y pinch-zoom;
}

.markdown-preview-sheet.markdown-body {
    box-sizing: border-box;
    width: min(960px, 100%);
    min-height: 100%;
    margin: 0 auto;
    padding: 28px 32px 40px;
    background: #0d1117;
    color: #c9d1d9;
    border: 1px solid rgba(229, 237, 239, 0.08);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

.editor-content.markdown-split-active
    > .markdown-preview-container
    .markdown-preview-scroll {
    padding: 14px;
}

.editor-content.markdown-split-active
    > .markdown-preview-container
    .markdown-preview-sheet.markdown-body {
    width: min(100%, 860px);
    padding: 22px 24px 28px;
    border-radius: 0;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    box-shadow: none;
}

.markdown-preview-sheet.markdown-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.markdown-preview-sheet.markdown-body pre {
    overflow: auto;
}

.markdown-preview-sheet.markdown-body .task-list-item {
    list-style: none;
}

.markdown-preview-sheet.markdown-body .task-list-item input {
    margin-right: 8px;
}

.markdown-preview-error {
    color: #fca5a5;
    font-size: 13px;
}

@media (max-width: 767px) {
    .agent-command-menu {
        max-height: 152px;
    }

    .markdown-preview-scroll {
        padding: 12px;
    }

    .markdown-preview-sheet.markdown-body {
        padding: 18px 16px 28px;
        border-radius: 10px;
    }
}

.pdf-preview-status {
    padding: 14px 18px;
    color: var(--text-muted);
    min-height: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.pdf-preview-status.is-empty {
    display: none;
}

.pdf-preview-status-primary,
.pdf-preview-status-secondary {
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
}

.pdf-preview-status-primary {
    color: var(--text-muted);
    font-weight: 600;
}

.pdf-preview-status-secondary {
    color: rgba(229, 237, 239, 0.68);
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
}

.pdf-preview-pages {
    flex: 1;
    overflow: auto;
    min-height: 0;
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y pinch-zoom;
}

.pdf-preview-page {
    width: 100%;
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
}

.pdf-preview-sheet {
    position: relative;
    width: fit-content;
    max-width: 100%;
}

.pdf-preview-page canvas {
    width: auto;
    max-width: 100%;
    height: auto;
    display: block;
    background: #ffffff;
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.28),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

.pdf-preview-page .textLayer {
    position: absolute;
    text-align: initial;
    inset: 0;
    overflow: clip;
    opacity: 1;
    line-height: 1;
    text-size-adjust: none;
    forced-color-adjust: none;
    transform-origin: 0 0;
    caret-color: CanvasText;
    z-index: 1;
    user-select: text;
    -webkit-user-select: text;
}

.pdf-preview-page .textLayer:is(.highlighting) {
    touch-action: none;
}

.pdf-preview-page .textLayer :is(span, br) {
    color: transparent;
    position: absolute;
    white-space: pre;
    cursor: text;
    transform-origin: 0 0;
}

.pdf-preview-page .textLayer {
    --min-font-size: 1;
    --text-scale-factor:
        calc(var(--total-scale-factor) * var(--min-font-size));
    --min-font-size-inv: calc(1 / var(--min-font-size));
}

.pdf-preview-page .textLayer > :not(.markedContent),
.pdf-preview-page .textLayer .markedContent span:not(.markedContent) {
    z-index: 1;
    --font-height: 0;
    font-size: calc(var(--text-scale-factor) * var(--font-height));
    --scale-x: 1;
    --rotate: 0deg;
    transform:
        rotate(var(--rotate))
        scaleX(var(--scale-x))
        scale(var(--min-font-size-inv));
}

.pdf-preview-page .textLayer .markedContent {
    display: contents;
}

.pdf-preview-page .textLayer span[role="img"] {
    user-select: none;
    cursor: default;
}

.empty-editor-state {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-style: italic;
}

/* Toggle Editor Button Style */
.toggle-editor-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    /* Fixed right */
    width: 28px;
    /* Larger touch target */
    height: 28px;
    border-radius: 4px;
    /* Square with rounded corners */
    background-color: rgba(0, 0, 0, 0.6);
    /* Darker for visibility */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: var(--text-highlight);
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* Stronger border */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    /* Default Hidden */
    transition: all 0.2s ease;
    z-index: 10;
    font-size: 14px;
    padding: 0;
    line-height: 1;
}

.toggle-agent-btn {
    position: absolute;
    top: 4px;
    right: 36px;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: var(--text-highlight);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
    font-size: 14px;
    padding: 0;
    line-height: 1;
}

.tab-item:hover .toggle-agent-btn,
.tab-item.active .toggle-agent-btn {
    opacity: 1;
}

.toggle-agent-btn:hover {
    background-color: rgba(0, 0, 0, 0.8) !important;
    border-color: rgba(255, 255, 255, 0.4);
}

.toggle-agent-btn:active {
    transform: translateY(1px);
}

/* Show when hovering the tab */
.tab-item:hover .toggle-editor-btn {
    opacity: 1;
    /* Fully visible on hover */
}

/* Hovering the button itself */
.toggle-editor-btn:hover {
    background-color: rgba(0, 0, 0, 0.8) !important;
    border-color: rgba(255, 255, 255, 0.4);
}

/* Active/Pinned State (Editor is Open) */
.tab-item.editor-open .toggle-editor-btn {
    opacity: 1;
    background-color: rgba(38, 139, 210, 0.5);
    /* Stronger blue */
    border-color: rgba(38, 139, 210, 0.8);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
    color: white;
}

.tab-item.agent-open .toggle-editor-btn {
    opacity: 1;
}

/* Show on active tab (for mobile discoverability) */
.tab-item.active .toggle-editor-btn {
    opacity: 1;
    /* Always visible on active tab */
}

.tab-item.active:hover .toggle-editor-btn {
    opacity: 0.8;
}

.toggle-editor-btn:active {
    transform: translateY(1px);
}

.tab-item.editor-open .toggle-agent-btn {
    opacity: 1;
}

.tab-item.agent-open .toggle-agent-btn {
    opacity: 1;
    background-color: rgba(38, 139, 210, 0.5);
    border-color: rgba(38, 139, 210, 0.8);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
    color: white;
}

.tab-file-tree {
    flex-grow: 1;
    overflow: auto;
    padding: 4px 0;
    font-size: 12px;
    border-bottom: none;
    display: none;
    background-color: transparent;
    margin: 0;
    border-radius: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease;
}

.tab-item:not(.active) .tab-file-tree {
    max-height: 65px;
    /* Approx 3 items */
    pointer-events: none;
    opacity: 0.6;
    overflow: hidden;
}

.tab-item.active .tab-file-tree {
    max-height: 600px;
    /* Approx 30 items */
    pointer-events: auto;
    opacity: 1;
    overflow: auto;
}

.tab-item.editor-open .tab-file-tree {
    display: block;
}

.tab-file-tree ul {
    list-style: none;
    padding-left: 12px;
    margin: 0;
}

.tab-file-tree>ul {
    padding-left: 0;
}

.tab-file-tree li {
    padding: 0;
    margin: 0;
}

/* Heartbeat Animation */
@keyframes heartbeat-pulse {
    0% {
        transform: scale(0.8);
        opacity: 0.6;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(0.8);
        opacity: 0.6;
    }
}

.heartbeat-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    background-color: currentColor;
    animation: heartbeat-pulse 1.5s infinite ease-in-out;
    vertical-align: middle;
}

/* Toast Notifications */
.notification-container {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 40px);
    /* Move down to avoid status bar */
    right: 10px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

#heartbeat-canvas {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: max(env(safe-area-inset-bottom, 0px), 60px);
    /* Taller area */
    z-index: 100;
    pointer-events: none;
    opacity: 0.5;
    /* Optional: Add gradient to blend with terminal */
    mask-image: linear-gradient(to top, black 50%, transparent 100%);
    -webkit-mask-image: linear-gradient(to top, black 50%, transparent 100%);
}

.toast {
    background-color: var(--bg-surface);
    color: var(--text-base);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-color);
    padding: 12px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    width: 250px;
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    opacity: 0;
    transform: translateY(-20px);
    animation: toast-slide-in 0.5s forwards;
    transition: opacity 0.5s, transform 0.5s, max-height 0.5s, margin-bottom 0.5s, padding 0.5s;
    overflow: hidden;
    max-height: 0;
    /* Start collapsed */
}

.toast.error {
    border-left-color: #dc322f;
}

.toast.success {
    border-left-color: #859900;
}

.toast.warning {
    border-left-color: #b58900;
}

.toast-content {
    flex-grow: 1;
    min-width: 0;
    /* Allow text wrap */
}

.toast-title {
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 0.9rem;
    color: var(--text-highlight);
}

.toast-message {
    font-size: 0.85rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--text-highlight);
}

.toast.hiding {
    animation: toast-slide-out 0.5s forwards;
}

@keyframes toast-slide-in {
    0% {
        opacity: 0;
        transform: translateY(-20px);
        max-height: 0;
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
    }

    100% {
        opacity: 1;
        transform: translateY(0);
        max-height: 200px;
        margin-bottom: 10px;
        padding-top: 12px;
        padding-bottom: 12px;
    }
}

@keyframes toast-slide-out {
    0% {
        opacity: 1;
        transform: translateX(0);
        max-height: 200px;
        margin-bottom: 10px;
        padding-top: 12px;
        padding-bottom: 12px;
        border-width: 1px;
    }

    60% {
        opacity: 0;
        transform: translateX(20px);
        max-height: 200px;
        margin-bottom: 10px;
        padding-top: 12px;
        padding-bottom: 12px;
        border-width: 1px;
    }

    100% {
        opacity: 0;
        transform: translateX(20px);
        max-height: 0;
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
}

/* Landscape Optimization for Mobile */
@media (orientation: landscape) and (max-height: 600px) {
    .soft-key {
        height: 22px !important;
        font-size: 11px;
    }

    /* Adjust internal labels */
    .key-main {
        top: 0px;
        left: 4px;
        font-size: 11px;
    }

    .key-shift {
        bottom: 0px;
        right: 4px;
        font-size: 8px;
    }
}
