/* Mini-Tools global layout styles. Extracted from src/views/layout.php. */
/* ============================================
           MOBILE-FIRST APP DESIGN
           ============================================ */
        :root {
            --primary-gradient: linear-gradient(135deg, #1e90ff 0%, #0066cc 100%);
            --accent-gradient: linear-gradient(135deg, #00bfff 0%, #0099cc 100%);
            --primary-color: #1e90ff;
            --primary-dark: #0066cc;
            --card-bg: rgba(255, 255, 255, 0.08);
            --card-bg-hover: rgba(255, 255, 255, 0.12);
            --border-color: rgba(255, 255, 255, 0.1);
            --text-primary: #ffffff;
            --text-secondary: rgba(255, 255, 255, 0.7);
            --text-muted: rgba(255, 255, 255, 0.5);
            
            /* App Layout */
            --app-header-height: 56px;
            --app-bottom-nav-height: 65px;
            --safe-area-top: env(safe-area-inset-top, 0px);
            --safe-area-bottom: env(safe-area-inset-bottom, 0px);
            
            /* Spacing */
            --space-xs: 0.25rem;
            --space-sm: 0.5rem;
            --space-md: 1rem;
            --space-lg: 1.5rem;
            --space-xl: 2rem;
        }
        
        * {
            -webkit-tap-highlight-color: transparent;
        }
        
        html {
            scroll-behavior: smooth;
        }
        
        body {
            min-height: 100vh;
            min-height: 100dvh;
            background: linear-gradient(160deg, #0a1628 0%, #0d1f3c 40%, #0f2847 100%);
            background-attachment: fixed;
            padding-bottom: calc(var(--app-bottom-nav-height) + var(--safe-area-bottom));
            -webkit-font-smoothing: antialiased;
        }
        
        /* ============================================
           MOBILE HEADER (Compact)
           ============================================ */
        .navbar {
            background: rgba(15, 20, 40, 0.85) !important;
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border-bottom: 1px solid var(--border-color);
            padding: var(--space-sm) var(--space-md);
            height: var(--app-header-height);
            padding-top: calc(var(--space-sm) + var(--safe-area-top));
        }
        
        .navbar-brand {
            font-weight: 700;
            font-size: 1.25rem;
            background: var(--primary-gradient);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        .navbar-brand i {
            background: var(--accent-gradient);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        /* ============================================
           BOTTOM NAVIGATION (Mobile App Style)
           ============================================ */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: calc(var(--app-bottom-nav-height) + var(--safe-area-bottom));
            background: rgba(15, 20, 40, 0.95);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border-top: 1px solid var(--border-color);
            display: flex;
            justify-content: space-around;
            align-items: flex-start;
            padding-top: var(--space-sm);
            padding-bottom: var(--safe-area-bottom);
            z-index: 1050;
        }
        
        .bottom-nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            text-decoration: none;
            color: var(--text-muted);
            font-size: 0.65rem;
            padding: var(--space-xs) var(--space-sm);
            border-radius: 12px;
            transition: all 0.2s ease;
            min-width: 60px;
        }
        
        .bottom-nav-item i {
            font-size: 1.4rem;
            margin-bottom: 2px;
            transition: transform 0.2s ease;
        }
        
        .bottom-nav-item:hover,
        .bottom-nav-item.active {
            color: var(--text-primary);
        }
        
        .bottom-nav-item.active i {
            background: var(--primary-gradient);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            transform: scale(1.1);
        }
        
        .bottom-nav-item:active {
            transform: scale(0.95);
        }
        
        .bottom-nav-item.logout-btn {
            color: #ff6b6b;
        }
        
        .bottom-nav-item.logout-btn:hover {
            color: #ff8787;
        }
        
        /* Hide bottom nav on desktop */
        @media (min-width: 992px) {
            .bottom-nav {
                display: none;
            }
            
            body {
                padding-bottom: 0;
            }
        }
        
        /* ============================================
           CARD STYLES (Glassmorphism)
           ============================================ */
        .card {
            background: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            overflow: hidden;
        }
        
        .card:hover {
            background: var(--card-bg-hover);
            transform: translateY(-4px) scale(1.01);
            box-shadow: 0 20px 40px rgba(30, 144, 255, 0.15);
            border-color: rgba(30, 144, 255, 0.3);
        }
        
        .card:active {
            transform: translateY(-2px) scale(0.99);
        }
        
        .tool-card {
            cursor: pointer;
        }
        
        .tool-card .card-body {
            padding: var(--space-lg);
        }
        
        .tool-card .card-title {
            color: var(--text-primary);
            font-weight: 600;
            font-size: 1rem;
            margin-bottom: var(--space-xs);
        }
        
        .tool-card .card-text {
            color: var(--text-secondary);
            font-size: 0.85rem;
            line-height: 1.4;
        }
        
        /* ============================================
           TOOL ICON
           ============================================ */
        .tool-icon {
            width: 48px;
            height: 48px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 14px;
            background: var(--primary-gradient);
            color: #fff;
            font-size: 1.3rem;
            margin-bottom: var(--space-md);
            box-shadow: 0 8px 20px rgba(30, 144, 255, 0.3);
        }
        
        /* ============================================
           BUTTONS
           ============================================ */
        .btn-primary {
            background: var(--primary-gradient);
            border: none;
            border-radius: 12px;
            padding: var(--space-md) var(--space-lg);
            font-weight: 600;
            transition: all 0.2s ease;
        }
        
        .btn-primary:hover {
            opacity: 0.9;
            transform: scale(1.02);
            box-shadow: 0 8px 25px rgba(30, 144, 255, 0.4);
        }
        
        .btn-primary:active {
            transform: scale(0.98);
        }
        
        .btn-outline-light {
            border-radius: 10px;
            border-width: 1.5px;
        }
        
        /* ============================================
           CONTENT WRAPPER
           ============================================ */
        .content-wrapper {
            min-height: calc(100vh - var(--app-header-height));
            min-height: calc(100dvh - var(--app-header-height));
            padding: 0.5rem;
            padding-top: var(--space-md);
        }
        
        @media (min-width: 576px) {
            .content-wrapper {
                padding: var(--space-md);
                padding-top: var(--space-lg);
            }
        }
        
        @media (min-width: 992px) {
            .content-wrapper {
                padding: var(--space-xl) 0;
            }
        }
        
        /* ============================================
           TOOL TOPBAR (compact header)
           ============================================ */
        .tool-topbar {
            background: rgba(255, 255, 255, 0.04);
            border-bottom: 1px solid var(--border-color);
            border-radius: 8px;
            min-height: 36px;
        }

        /* ============================================
           BACK BUTTON
           ============================================ */
        .back-btn {
            color: var(--text-secondary);
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            gap: var(--space-sm);
            margin-bottom: var(--space-md);
            padding: var(--space-sm) var(--space-md);
            border-radius: 10px;
            transition: all 0.2s ease;
            font-size: 0.9rem;
        }
        
        .back-btn:hover {
            color: var(--text-primary);
            background: var(--card-bg);
        }
        
        /* ============================================
           SEARCH BOX (Pill Style)
           ============================================ */
        .search-box {
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid var(--border-color);
            border-radius: 25px;
            padding: 0.75rem 1.25rem;
            color: var(--text-primary);
            font-size: 0.95rem;
            transition: all 0.2s ease;
        }
        
        .search-box:focus {
            background: rgba(255, 255, 255, 0.12);
            border-color: rgba(30, 144, 255, 0.5);
            box-shadow: 0 0 0 3px rgba(30, 144, 255, 0.15);
            color: var(--text-primary);
        }
        
        .search-box::placeholder {
            color: var(--text-muted);
        }
        
        /* ============================================
           MOBILE-FIRST GRID
           ============================================ */
        @media (max-width: 575.98px) {
            .row.g-4 {
                --bs-gutter-y: 0.75rem;
                --bs-gutter-x: 0.75rem;
            }
            
            .tool-card .card-body {
                padding: var(--space-md);
            }
            
            .tool-icon {
                width: 40px;
                height: 40px;
                font-size: 1.1rem;
                border-radius: 12px;
            }
        }
        
        /* ============================================
           OFFCANVAS (Drawer Menu)
           ============================================ */
        .offcanvas {
            background: rgba(15, 20, 40, 0.98) !important;
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
        }
        
        .offcanvas-header {
            padding-top: calc(var(--space-md) + var(--safe-area-top));
        }
        
        .list-group-item {
            padding: var(--space-md) var(--space-lg);
            border-radius: 0 !important;
        }
        
        .list-group-item:active {
            background: rgba(255, 255, 255, 0.1) !important;
        }
        
        /* ============================================
           ANIMATIONS
           ============================================ */
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .tool-item {
            animation: fadeInUp 0.4s ease forwards;
            opacity: 0;
        }
        
        .tool-item:nth-child(1) { animation-delay: 0.05s; }
        .tool-item:nth-child(2) { animation-delay: 0.1s; }
        .tool-item:nth-child(3) { animation-delay: 0.15s; }
        .tool-item:nth-child(4) { animation-delay: 0.2s; }
        .tool-item:nth-child(5) { animation-delay: 0.25s; }
        .tool-item:nth-child(6) { animation-delay: 0.3s; }
        .tool-item:nth-child(7) { animation-delay: 0.35s; }
        .tool-item:nth-child(8) { animation-delay: 0.4s; }
        .tool-item:nth-child(9) { animation-delay: 0.45s; }
        .tool-item:nth-child(10) { animation-delay: 0.5s; }
        
        /* ============================================
           iOS-STYLE APP GRID
           ============================================ */
        .app-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 1.5rem;
            margin-bottom: 1.5rem;
        }
        
        .app-icon {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.5rem;
            cursor: pointer;
            user-select: none;
            -webkit-user-select: none;
            -webkit-tap-highlight-color: transparent;
            transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            text-decoration: none;
        }
        
        .app-icon:active {
            transform: scale(0.95);
        }
        
        .app-icon .icon {
            width: 60px;
            height: 60px;
            border-radius: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.75rem;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3),
                        0 2px 4px rgba(0, 0, 0, 0.2);
            transition: all 0.2s ease;
        }
        
        .app-icon:hover .icon {
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4),
                        0 3px 6px rgba(0, 0, 0, 0.3);
        }
        
        .app-name {
            color: var(--text-primary);
            font-size: 0.75rem;
            text-align: center;
            text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
            font-weight: 500;
            line-height: 1.2;
        }
        
        /* Icon Gradient Variations */
        .icon-gradient-1 { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
        .icon-gradient-2 { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
        .icon-gradient-3 { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
        .icon-gradient-4 { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
        .icon-gradient-5 { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
        .icon-gradient-6 { background: linear-gradient(135deg, #30cfd0 0%, #330867 100%); }
        .icon-gradient-7 { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); }
        .icon-gradient-8 { background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%); }
        .icon-gradient-9 { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }
        .icon-gradient-10 { background: linear-gradient(135deg, #ff6e7f 0%, #bfe9ff 100%); }
        .icon-gradient-11 { background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%); }
        .icon-gradient-12 { background: linear-gradient(135deg, #f77062 0%, #fe5196 100%); }
        
        /* Responsive App Grid */
        @media (max-width: 575.98px) {
            .app-grid {
                grid-template-columns: repeat(4, 1fr);
                gap: 1.25rem;
            }
            
            .app-icon .icon {
                width: 56px;
                height: 56px;
                font-size: 1.5rem;
                border-radius: 13px;
            }
            
            .app-name {
                font-size: 0.7rem;
            }
        }
        
        @media (min-width: 576px) and (max-width: 991.98px) {
            .app-grid {
                grid-template-columns: repeat(5, 1fr);
            }
        }
        
        @media (min-width: 992px) {
            .app-grid {
                grid-template-columns: repeat(6, 1fr);
                gap: 2rem;
            }
            
            .app-icon .icon {
                width: 70px;
                height: 70px;
                font-size: 2rem;
                border-radius: 16px;
            }
            
            .app-name {
                font-size: 0.8rem;
            }
        }
        
        /* ============================================
           ENHANCED CARD ANIMATIONS
           ============================================ */
        .card {
            animation: fadeInUp 0.4s ease forwards;
        }
        
        .card:hover {
            transform: translateY(-6px) scale(1.02);
        }
        
        .card:active {
            transform: translateY(-3px) scale(1.01);
        }
        
        /* ============================================
           SCROLLBAR (Webkit)
           ============================================ */
        ::-webkit-scrollbar {
            width: 6px;
        }
        
        ::-webkit-scrollbar-track {
            background: transparent;
        }
        
        ::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.2);
            border-radius: 3px;
        }
        
        ::-webkit-scrollbar-thumb:hover {
            background: rgba(255, 255, 255, 0.3);
        }

/* Ollama chat tool styles. Extracted from src/tools/ollama_chat.php. */
/* === THEME VARIABLES === */
.olm-container {
    --olm-bg-card: rgba(255, 255, 255, 0.06);
    --olm-bg-card-hover: rgba(255, 255, 255, 0.1);
    --olm-bg-input: rgba(255, 255, 255, 0.08);
    --olm-border: rgba(255, 255, 255, 0.12);
    --olm-border-hover: rgba(13, 110, 253, 0.5);
    --olm-text-primary: rgba(255, 255, 255, 0.9);
    --olm-text-secondary: rgba(255, 255, 255, 0.55);
    --olm-text-muted: rgba(255, 255, 255, 0.4);
    --olm-user-bg: rgba(13, 110, 253, 0.22);
    --olm-user-border: rgba(13, 110, 253, 0.4);
    --olm-bot-bg: rgba(255, 255, 255, 0.06);
    --olm-success-bg: rgba(25, 135, 84, 0.15);
    --olm-success-text: #75b798;
    --olm-success-border: rgba(25, 135, 84, 0.3);
    --olm-error-bg: rgba(220, 53, 69, 0.15);
    --olm-error-text: #ea868f;
    --olm-error-border: rgba(220, 53, 69, 0.3);
    --olm-info-bg: rgba(13, 202, 240, 0.12);
    --olm-info-text: #6edff6;
    --olm-info-border: rgba(13, 202, 240, 0.25);
    max-width: 1100px;
    margin: 0 auto;
}

.olm-container h5,
.olm-container h6 { color: var(--olm-text-primary); }
.olm-container .text-muted { color: var(--olm-text-muted) !important; }

/* === STATUS BAR === */
.olm-status {
    padding: 0.6rem 0.75rem;
    border-radius: 0.375rem;
    margin-bottom: 0.75rem;
    display: none;
    font-size: 0.9rem;
}
.olm-status.show { display: block; }
.olm-status.success { background: var(--olm-success-bg); color: var(--olm-success-text); border: 1px solid var(--olm-success-border); }
.olm-status.error   { background: var(--olm-error-bg);   color: var(--olm-error-text);   border: 1px solid var(--olm-error-border); }
.olm-status.info    { background: var(--olm-info-bg);    color: var(--olm-info-text);    border: 1px solid var(--olm-info-border); }

/* === CARD / INPUT === */
.olm-card {
    background: var(--olm-bg-card);
    border: 1px solid var(--olm-border);
    border-radius: 0.5rem;
}
.olm-input {
    background: var(--olm-bg-input);
    border: 1px solid var(--olm-border);
    color: var(--olm-text-primary);
}
.olm-input:focus {
    background: var(--olm-bg-input);
    border-color: var(--olm-border-hover);
    color: var(--olm-text-primary);
    box-shadow: none;
}
.olm-input::placeholder { color: var(--olm-text-muted); }

/* === CHAT AREA === */
.olm-chat-area {
    height: 52vh;
    min-height: 320px;
    overflow-y: auto;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--olm-border);
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.olm-msg {
    max-width: 82%;
    padding: 0.65rem 0.9rem;
    border-radius: 0.75rem;
    line-height: 1.5;
    word-wrap: break-word;
    color: var(--olm-text-primary);
    animation: olmFadeIn 0.25s ease;
}
.olm-msg.user {
    align-self: flex-end;
    background: var(--olm-user-bg);
    border: 1px solid var(--olm-user-border);
    border-bottom-right-radius: 0.2rem;
}
.olm-msg.bot {
    align-self: flex-start;
    background: var(--olm-bot-bg);
    border: 1px solid var(--olm-border);
    border-bottom-left-radius: 0.2rem;
}
.olm-msg .olm-role {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--olm-text-muted);
    margin-bottom: 0.25rem;
}
.olm-msg pre {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--olm-border);
    border-radius: 0 0 0.4rem 0.4rem;
    padding: 0.6rem;
    overflow-x: auto;
    margin: 0;
}
.olm-msg code {
    background: rgba(0, 0, 0, 0.35);
    padding: 0.1rem 0.3rem;
    border-radius: 0.25rem;
    font-size: 0.88em;
}
.olm-msg pre code { background: none; padding: 0; }
.olm-code-block {
    margin: 0.4rem 0;
}
.olm-code-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--olm-border);
    border-bottom: 0;
    border-radius: 0.4rem 0.4rem 0 0;
    padding: 0.28rem 0.45rem 0.28rem 0.6rem;
}
.olm-code-lang {
    color: var(--olm-text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
}
.olm-copy-code {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border: 1px solid var(--olm-border);
    border-radius: 0.3rem;
    background: rgba(255, 255, 255, 0.08);
    color: var(--olm-text-secondary);
    font-size: 0.75rem;
    line-height: 1;
    padding: 0.25rem 0.4rem;
}
.olm-copy-code:hover {
    background: rgba(255, 255, 255, 0.14);
    color: var(--olm-text-primary);
}

/* === RICH MARKDOWN (bot replies) === */
.olm-msg .olm-p { margin: 0 0 0.55rem; }
.olm-msg .olm-p:last-child { margin-bottom: 0; }
.olm-msg .olm-h {
    color: var(--olm-text-primary);
    font-weight: 600;
    line-height: 1.3;
    margin: 0.85rem 0 0.45rem;
}
.olm-msg .olm-h:first-child { margin-top: 0; }
.olm-msg .olm-h1 { font-size: 1.18rem; }
.olm-msg .olm-h2 { font-size: 1.08rem; border-bottom: 1px solid var(--olm-border); padding-bottom: 0.25rem; }
.olm-msg .olm-h3 { font-size: 1rem; }
.olm-msg .olm-h4,
.olm-msg .olm-h5,
.olm-msg .olm-h6 { font-size: 0.92rem; color: var(--olm-text-secondary); }
.olm-msg .olm-list { margin: 0.2rem 0 0.6rem; padding-left: 1.35rem; }
.olm-msg .olm-list li { margin: 0.18rem 0; }
.olm-msg .olm-list:last-child { margin-bottom: 0; }
.olm-msg .olm-quote {
    margin: 0.4rem 0 0.6rem;
    padding: 0.45rem 0.75rem;
    border-left: 3px solid var(--olm-info-border);
    background: var(--olm-info-bg);
    color: var(--olm-text-secondary);
    border-radius: 0 0.35rem 0.35rem 0;
}
.olm-msg .olm-quote:last-child { margin-bottom: 0; }
.olm-msg .olm-hr {
    border: 0;
    border-top: 1px solid var(--olm-border);
    margin: 0.85rem 0;
}
.olm-msg .olm-table-wrap { overflow-x: auto; margin: 0.4rem 0 0.7rem; }
.olm-msg .olm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.olm-msg .olm-table th,
.olm-msg .olm-table td {
    border: 1px solid var(--olm-border);
    padding: 0.4rem 0.55rem;
    text-align: left;
    vertical-align: top;
}
.olm-msg .olm-table thead th {
    background: rgba(255, 255, 255, 0.08);
    color: var(--olm-text-primary);
    font-weight: 600;
    white-space: nowrap;
}
.olm-msg .olm-table tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.03); }
.olm-msg a { color: var(--olm-info-text); text-decoration: underline; }
.olm-msg em { font-style: italic; }

.olm-empty {
    margin: auto;
    text-align: center;
    color: var(--olm-text-muted);
}

/* === TASK LIFECYCLE EVENTS === */
.olm-event {
    align-self: center;
    max-width: 92%;
    margin: 0.15rem 0;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--olm-text-secondary);
    background: var(--olm-bg-card);
    border: 1px solid var(--olm-border);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.olm-event .olm-event-label {
    font-weight: 700;
    letter-spacing: 0.4px;
    font-size: 0.7rem;
    text-transform: uppercase;
}
.olm-event-status {
    color: var(--olm-info-text, #6ea8fe);
    background: var(--olm-info-bg, rgba(13, 110, 253, 0.12));
    border-color: var(--olm-info-border, rgba(13, 110, 253, 0.3));
}
.olm-event-error {
    color: var(--olm-error-text, #ea868f);
    background: var(--olm-error-bg, rgba(220, 53, 69, 0.15));
    border-color: var(--olm-error-border, rgba(220, 53, 69, 0.3));
}

/* === TYPING INDICATOR === */
.olm-typing { align-self: flex-start; }
.olm-typing .dot {
    display: inline-block;
    width: 7px; height: 7px;
    margin: 0 2px;
    border-radius: 50%;
    background: var(--olm-text-secondary);
    animation: olmBlink 1.2s infinite both;
}
.olm-typing .dot:nth-child(2) { animation-delay: 0.2s; }
.olm-typing .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes olmBlink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }
@keyframes olmFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* === HISTORY ITEM === */
.olm-history-item {
    border: 1px solid var(--olm-border);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.6rem;
    background: var(--olm-bg-card);
    transition: all 0.2s ease;
    cursor: pointer;
}
.olm-history-item:hover {
    border-color: var(--olm-border-hover);
    background: var(--olm-bg-card-hover);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.olm-badge {
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--olm-info-bg);
    color: var(--olm-info-text);
    border: 1px solid var(--olm-info-border);
    padding: 0.1rem 0.5rem;
    border-radius: 0.4rem;
}
.olm-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}
.olm-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    padding: 0.22rem 0.5rem;
    border-radius: 0.4rem;
    border: 1px solid var(--olm-border);
    background: rgba(0, 0, 0, 0.18);
    color: var(--olm-text-secondary);
    font-size: 0.78rem;
}
.olm-attachment-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.olm-attachment-chip button {
    border: 0;
    background: transparent;
    color: var(--olm-text-muted);
    padding: 0;
    line-height: 1;
}
.olm-generated-preview {
    margin-top: 0.7rem;
}
.olm-generated-preview img {
    display: block;
    max-width: 100%;
    height: auto;
    border: 1px solid var(--olm-border);
    border-radius: 0.5rem;
    background: #ffffff;
}
.olm-generated-files {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.75rem;
}
.olm-file-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid var(--olm-info-border);
    border-radius: 0.4rem;
    background: var(--olm-info-bg);
    color: var(--olm-info-text);
    padding: 0.32rem 0.55rem;
    font-size: 0.78rem;
    text-decoration: none;
}
.olm-file-btn:hover {
    color: var(--olm-text-primary);
    border-color: var(--olm-border-hover);
    background: var(--olm-bg-card-hover);
}

/* === OLLAMA AGENT WORKSPACE LAYOUT === */
.content-wrapper .container:has(.olm-agent-shell) {
    max-width: 100%;
}

.olm-agent-shell {
    --olm-bg-page: #0f2038;
    --olm-panel: rgba(31, 51, 80, 0.82);
    --olm-panel-strong: rgba(35, 57, 88, 0.94);
    --olm-border: rgba(149, 171, 205, 0.18);
    --olm-border-hover: rgba(43, 149, 255, 0.55);
    --olm-bg-input: rgba(61, 80, 112, 0.78);
    --olm-text-primary: rgba(245, 249, 255, 0.94);
    --olm-text-secondary: rgba(221, 230, 243, 0.72);
    --olm-text-muted: rgba(213, 222, 235, 0.5);
    --olm-info-text: #64d7ff;
    max-width: none;
    min-height: calc(100dvh - var(--app-header-height) - 2rem);
    margin: 0;
}

.olm-agent-kicker {
    color: var(--olm-text-muted);
    font-size: 1rem;
    margin: 0 0 1.25rem;
}

.olm-agent-grid {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 1.25rem;
    min-height: calc(100dvh - var(--app-header-height) - 5rem);
}

.olm-sidebar,
.olm-main-panel {
    background: var(--olm-panel);
    border: 1px solid var(--olm-border);
    border-radius: 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 18px 45px rgba(0, 0, 0, 0.18);
}

.olm-sidebar {
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    min-height: 0;
}

.olm-section-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--olm-text-primary);
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.65rem;
}

.olm-sidebar .olm-input,
.olm-composer .olm-input {
    min-height: 48px;
    border-radius: 6px;
    border-color: rgba(191, 207, 230, 0.14);
    background: var(--olm-bg-input);
}

.olm-sidebar .form-select {
    color: var(--olm-text-primary);
}

.olm-new-chat-btn {
    width: 100%;
    min-height: 64px;
    margin-top: 0.75rem;
    border-radius: 14px;
    font-weight: 700;
    background: linear-gradient(180deg, #279aff 0%, #0875d9 100%);
}

.olm-dropzone {
    min-height: 130px;
    border: 2px dashed rgba(191, 207, 230, 0.22);
    border-radius: 12px;
    background: rgba(27, 42, 66, 0.55);
    color: var(--olm-text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.olm-dropzone i {
    font-size: 1.35rem;
}

.olm-dropzone span {
    font-weight: 650;
}

.olm-dropzone small {
    font-size: 0.78rem;
}

.olm-dropzone:hover,
.olm-dropzone:focus {
    border-color: var(--olm-border-hover);
    background: rgba(44, 70, 108, 0.68);
    color: var(--olm-text-secondary);
    outline: none;
}

.olm-history-panel {
    min-height: 0;
    overflow: hidden;
}

.olm-history-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--olm-text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0;
    margin: 0 0 0.65rem;
    font-weight: 800;
    font-size: 1.05rem;
    text-align: left;
}

.olm-history-toggle span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.olm-history-toggle-text {
    flex: 0 0 auto;
    border: 1px solid rgba(43, 149, 255, 0.48);
    border-radius: 999px;
    color: var(--olm-info-text);
    padding: 0.16rem 0.55rem;
    font-size: 0.74rem;
    font-weight: 700;
}

.olm-history-toggle:hover .olm-history-toggle-text,
.olm-history-toggle:focus .olm-history-toggle-text {
    border-color: var(--olm-border-hover);
    background: rgba(43, 149, 255, 0.12);
}

#olmHistoryList {
    max-height: 34vh;
    overflow-y: auto;
    padding-right: 0.15rem;
}

.olm-history-item {
    border-radius: 8px;
    background: rgba(61, 80, 112, 0.42);
    padding: 0.95rem;
}

.olm-main-panel {
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.olm-main-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.olm-main-header h5 {
    margin: 0 0 0.25rem;
    font-size: 1.08rem;
    font-weight: 800;
}

.olm-main-header .btn {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
}

.olm-agent-shell .olm-status {
    flex: 0 0 auto;
}

.olm-agent-shell .olm-chat-area {
    flex: 1 1 auto;
    height: auto;
    min-height: 440px;
    border-radius: 12px;
    background: rgba(37, 58, 89, 0.72);
    padding: 1.25rem;
}

.olm-agent-shell .olm-empty {
    margin: 0;
    text-align: left;
    align-self: stretch;
    color: var(--olm-text-muted);
    font-size: 1.05rem;
}

.olm-agent-shell .olm-empty h5 {
    color: var(--olm-text-primary);
    font-size: 1.12rem;
    font-weight: 800;
    margin-bottom: 0.45rem;
}

.olm-agent-shell .olm-empty p {
    margin: 0;
}

.olm-agent-shell .olm-msg {
    max-width: min(880px, 88%);
    border-radius: 10px;
}

.olm-agent-shell .olm-msg.bot {
    background: rgba(20, 34, 54, 0.72);
}

.olm-composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 58px;
    gap: 0.75rem;
    margin-top: 1rem;
}

.olm-composer textarea {
    min-height: 58px;
    padding: 0.95rem 1rem;
    font-size: 0.98rem;
}

.olm-composer .btn {
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

@media (max-width: 991.98px) {
    .content-wrapper:has(.olm-agent-shell) {
        padding: 0.5rem;
    }

    .content-wrapper .container:has(.olm-agent-shell) {
        padding-left: 0;
        padding-right: 0;
    }

    .olm-agent-shell {
        min-height: auto;
    }

    .olm-agent-kicker {
        margin: 0 0 0.65rem;
        padding: 0 0.2rem;
        font-size: 0.9rem;
        line-height: 1.35;
    }

    .olm-agent-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        min-height: auto;
    }

    .olm-sidebar,
    .olm-main-panel {
        border-radius: 12px;
    }

    .olm-sidebar {
        padding: 0.75rem;
        gap: 0.7rem;
    }

    .olm-sidebar .olm-sidebar-section:first-child {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.55rem;
        align-items: stretch;
    }

    .olm-sidebar .olm-sidebar-section:first-child .olm-section-title,
    .olm-workspace-input,
    .olm-title-input {
        display: none;
    }

    .olm-model-row {
        margin-top: 0 !important;
        min-width: 0;
        width: 100%;
    }

    .olm-model-row .form-select {
        min-width: 0;
    }

    .olm-model-row .btn {
        width: 46px;
        flex: 0 0 46px;
        padding-left: 0;
        padding-right: 0;
    }

    .olm-sidebar .form-select,
    .olm-sidebar .btn {
        min-height: 42px;
        font-size: 0.9rem;
    }

    .olm-new-chat-btn {
        width: auto;
        min-height: 42px;
        margin-top: 0;
        padding-left: 0.85rem;
        padding-right: 0.85rem;
        border-radius: 10px;
        white-space: nowrap;
    }

    .olm-dropzone {
        min-height: 58px;
        flex-direction: row;
        gap: 0.55rem;
        padding: 0.65rem 0.8rem;
        text-align: left;
    }

    .olm-dropzone i {
        font-size: 1.15rem;
    }

    .olm-dropzone small {
        display: none;
    }

    .olm-sidebar > .olm-sidebar-section:nth-of-type(2) {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.55rem;
    }

    .olm-sidebar > .olm-sidebar-section:nth-of-type(2) .btn {
        margin-top: 0 !important;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    #olmSystemWrap {
        grid-column: 1 / -1;
    }

    #olmHistoryList {
        max-height: 150px;
    }

    .olm-history-item {
        padding: 0.65rem;
        margin-bottom: 0.45rem;
    }

    .olm-main-panel {
        padding: 0.85rem;
    }

    .olm-main-header {
        align-items: center;
        margin-bottom: 0.65rem;
    }

    .olm-main-header h5 {
        font-size: 1rem;
    }

    .olm-main-header small {
        display: none;
    }

    .olm-main-header .btn {
        width: 38px;
        height: 38px;
        flex: 0 0 auto;
    }

    .olm-agent-shell .olm-chat-area {
        min-height: 48dvh;
        max-height: 58dvh;
        padding: 0.85rem;
        gap: 0.55rem;
    }

    .olm-agent-shell .olm-empty {
        font-size: 0.95rem;
    }

    .olm-agent-shell .olm-msg {
        max-width: 94%;
        padding: 0.55rem 0.7rem;
        font-size: 0.92rem;
    }

    .olm-composer {
        grid-template-columns: minmax(0, 1fr) 48px;
        gap: 0.55rem;
        margin-top: 0.7rem;
    }

    .olm-composer textarea {
        min-height: 50px;
        padding: 0.78rem 0.85rem;
        font-size: 0.94rem;
    }

    .olm-composer .btn {
        min-height: 50px;
        font-size: 1.15rem;
    }
}

@media (max-width: 575.98px) {
    .content-wrapper:has(.olm-agent-shell) {
        padding: 0.3rem;
    }

    .olm-agent-kicker {
        display: none;
    }

    .olm-agent-grid {
        gap: 0.45rem;
    }

    .olm-sidebar,
    .olm-main-panel {
        border-radius: 10px;
    }

    .olm-sidebar {
        padding: 0.55rem;
        gap: 0.45rem;
    }

    .olm-sidebar .olm-sidebar-section:first-child {
        display: block;
        grid-template-columns: none;
        gap: 0.45rem;
    }

    .olm-model-row .btn {
        width: 42px;
        flex-basis: 42px;
    }

    .olm-new-chat-btn {
        width: 100%;
        min-height: 42px;
        margin-top: 0.45rem;
        padding: 0.55rem 0.75rem;
        font-size: 0.92rem;
        border-radius: 9px;
    }

    .olm-new-chat-btn i {
        font-size: 1rem;
        margin-right: 0.25rem;
    }

    .olm-dropzone {
        min-height: 42px;
        padding: 0.45rem 0.65rem;
        justify-content: flex-start;
    }

    .olm-dropzone span {
        font-size: 0.84rem;
    }

    .olm-attachments {
        margin-top: 0;
        gap: 0.3rem;
    }

    .olm-attachment-chip {
        max-width: 100%;
        font-size: 0.72rem;
    }

    .olm-sidebar > .olm-sidebar-section:nth-of-type(2) {
        grid-template-columns: 1fr 1fr;
        gap: 0.45rem;
    }

    .olm-sidebar > .olm-sidebar-section:nth-of-type(2) .btn {
        min-height: 38px;
        font-size: 0.78rem;
        white-space: nowrap;
    }

    .olm-section-title {
        font-size: 0.9rem;
        margin-bottom: 0.35rem;
    }

    #olmHistoryList {
        max-height: 82px;
    }

    .olm-history-item {
        padding: 0.5rem 0.6rem;
        margin-bottom: 0.35rem;
    }

    .olm-history-item small {
        display: none;
    }

    .olm-history-item .olm-badge {
        display: none;
    }

    .olm-main-panel {
        padding: 0.55rem;
    }

    .olm-agent-shell .olm-chat-area {
        min-height: 30dvh;
        max-height: 35dvh;
        border-radius: 9px;
        padding: 0.7rem;
    }

    .olm-agent-shell .olm-empty h5 {
        font-size: 1rem;
        margin-bottom: 0.35rem;
    }

    .olm-agent-shell .olm-empty {
        font-size: 0.9rem;
        line-height: 1.45;
    }

    .olm-agent-shell .olm-msg {
        max-width: 98%;
    }

    .olm-composer {
        position: sticky;
        bottom: calc(var(--app-bottom-nav-height) + var(--safe-area-bottom) + 0.35rem);
        grid-template-columns: minmax(0, 1fr) 46px;
        gap: 0.45rem;
        margin-top: 0.55rem;
        padding-top: 0.35rem;
        background: linear-gradient(180deg, rgba(31, 51, 80, 0), var(--olm-panel) 34%);
        z-index: 3;
    }

    .olm-composer textarea {
        min-height: 46px;
        padding: 0.68rem 0.75rem;
        font-size: 0.9rem;
    }

    .olm-composer .btn {
        min-height: 46px;
        font-size: 1.05rem;
    }
}

@media (max-width: 430px) {
    .olm-sidebar {
        gap: 0.38rem;
    }

    .olm-sidebar .form-select,
    .olm-sidebar .btn {
        min-height: 38px;
    }

    .olm-dropzone {
        min-height: 38px;
    }

    .olm-history-panel .olm-section-title {
        margin-bottom: 0.25rem;
    }

    #olmHistoryList {
        max-height: 64px;
    }

    .olm-main-header {
        margin-bottom: 0.45rem;
    }

    .olm-main-header h5 {
        font-size: 0.95rem;
    }

    .olm-main-header .btn {
        width: 34px;
        height: 34px;
    }

    .olm-agent-shell .olm-chat-area {
        min-height: 28dvh;
        max-height: 32dvh;
    }

    .olm-composer {
        grid-template-columns: minmax(0, 1fr) 44px;
    }

    .olm-composer textarea,
    .olm-composer .btn {
        min-height: 44px;
    }
}
