/* workbenchstyles.css */
@font-face {
    font-family: 'LucideIcons';
    src: url('https://cdn.jsdelivr.net/npm/lucide-static@0.473.0/font/lucide.ttf') format('truetype');
}

.lucide {
    font-family: 'LucideIcons';
    font-size: 1.25rem;
    /* Adjust icon size as needed */
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-style: normal;
    font-weight: normal;
    speak: none;
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.75rem;
    /* Add space between icon and text */
}

/* Basic styles for active tab */
.sidebar-link.active {
    background-color: #2a2a3a;
    /* Slightly lighter background for active tab */
    color: #ffffff;
    font-weight: 600;
}

/* Ensure sidebar links take full width so ml-auto works for external link icons */
.sidebar-link {
    width: 100%;
}

/* Ensure body takes full height and prevents scrolling */
html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    /* overflow: hidden; */
    /* This was causing the issue, so I'm removing it. */
    background-color: #101017;
    /* Match homepage background */
    color: #e5e7eb;
    /* Default text color */
    font-family: Inter, sans-serif;
    /* Consistent font */
}

.content-section {
    height: 100%;
    overflow-y: auto;
}

#dashboard.content-section {
    overflow-y: hidden;
}

/* Style for Tier Labels (Example) */
.tier-label {
    background-color: #4a5568;
    /* Gray background */
    color: #e2e8f0;
    /* Light text */
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.tier-label-enterprise {
    background-color: #667eea;
}

/* Indigo for Enterprise */
.tier-label-team {
    background-color: #38a169;
}

/* Green for Team */

/* Connection button styling */
.connection-button {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border: 1px solid #4b5563;
    border-radius: 0.375rem;
    background-color: #2d3748;
    color: #e2e8f0;
    transition: background-color 0.2s;
    cursor: pointer;
    margin-right: 0.75rem;
    margin-bottom: 0.75rem;
}

.connection-button:hover {
    background-color: #4a5568;
}

.connection-button img {
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
}

/* Playground element styling */
.playground-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #9ca3af;
}

.playground-input,
.playground-output-step {
    width: 100%;
    min-height: 80px;
    background-color: #1f2937;
    border: 1px solid #4b5563;
    border-radius: 0.375rem;
    padding: 0.75rem;
    color: #e5e7eb;
    font-family: monospace;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.playground-output-step {
    background-color: #111827;
    white-space: pre-wrap;
}

.playground-output-step h4 {
    color: #9ca3af;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-family: Inter, sans-serif;
}

.playground-metadata input {
    background-color: #374151;
    border: 1px solid #4b5563;
    border-radius: 0.25rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    margin-right: 0.5rem;
    color: #e5e7eb;
}

.playground-token-info {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

/* Memory Template Styling */
.memory-item {
    background-color: #1f2937;
    border: 1px solid #4b5563;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.memory-item h3 {
    font-weight: 600;
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    color: #ffffff;
}

.memory-item p {
    font-size: 0.875rem;
    /* equivalent to text-sm */
    color: #9ca3af;
    /* approximate value for text-gray-400 */
}

.memory-item code {
    background-color: #111827;
    padding: 0.1rem 0.3rem;
    border-radius: 0.2rem;
    font-size: 0.8rem;
}

.token-toggle-btn.active {
    /* Example active style: using a brighter blue and ensuring contrast */
    background-color: #2563eb;
    /* Brighter blue */
    font-weight: bold;
    cursor: default;
}

.token-toggle-btn:not(.active) {
    opacity: 0.7;
}

.pricing-table .price-note {
    display: block;
    font-size: 0.75rem;
    /* text-xs */
    color: #9ca3af;
    /* gray-400 */
    font-weight: normal;
    margin-top: 2px;
}

.pricing-table th span.block {
    /* Style the API name under the Engine title */
    color: #d1d5db;
    /* gray-300 */
    margin-top: 2px;
}

.research-col {
    /* Specific styling for the research column if needed */
    background-color: rgba(75, 85, 99, 0.2);
    /* Example: slightly different background */
}

.sidebar-link span,
#logo-text,
#sidebar-bottom-nav {
    transition: opacity 0.3s ease-in-out;
}

.sidebar-link.active {
    background-color: #2a2a3a;
    color: white;
}

.connection-button {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    margin: 4px;
    background-color: #2a2a3a;
    color: #e5e7eb;
    /* text-gray-200 */
    border: 1px solid #4b5563;
    /* border-gray-600 */
    border-radius: 8px;
    /* rounded-lg */
    transition: background-color 0.2s;
    font-weight: 500;
    /* font-medium */
}

.connection-button:hover {
    background-color: #374151;
    /* hover:bg-gray-700 */
}

.connection-button img,
.connection-button span.lucide {
    margin-right: 8px;
    width: 20px;
    height: 20px;
}

.playground-label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.875rem;
    /* text-sm */
    font-weight: 500;
    /* font-medium */
    color: #d1d5db;
    /* text-gray-300 */
}

.playground-input,
.playground-metadata,
#playground-model-select {
    width: 100%;
    padding: 8px 12px;
    background-color: #1f2937;
    /* bg-gray-800 or similar dark bg */
    border: 1px solid #4b5563;
    /* border-gray-600 */
    border-radius: 4px;
    /* rounded */
    color: white;
    margin-bottom: 12px;
}

.playground-metadata {
    margin-right: 8px;
    display: inline-block;
    width: calc(50% - 4px);
}

.playground-token-info {
    margin-top: 12px;
    font-size: 0.75rem;
    /* text-xs */
    color: #9ca3af;
    /* text-gray-400 */
}

.playground-output-step {
    margin-top: 16px;
    padding: 12px;
    background-color: #1f2937;
    border: 1px solid #4b5563;
    border-radius: 4px;
}

.playground-output-step h4 {
    font-weight: 600;
    /* font-semibold */
    color: #e5e7eb;
    /* text-gray-200 */
    margin-bottom: 8px;
}

.playground-output-step p {
    font-family: monospace;
    white-space: pre-wrap;
    color: #d1d5db;
    /* text-gray-300 */
    font-size: 0.875rem;
}

.memory-item {
    background-color: #181820;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #4b5563;
    /* border-gray-700 */
}

.pricing-table {
    border-collapse: collapse;
    margin-top: 1rem;
    border-style: hidden;
    /* Remove outer table border */
}

.pricing-table th,
.pricing-table td {
    border: 1px solid #9ca3af;
    /* border-gray-400 */
    padding: 12px 16px;
    text-align: center;
    vertical-align: middle;
    color: #d1d5db;
    /* text-gray-300 */
    font-size: 0.875rem;
    /* text-sm */
    background-color: transparent;
    /* Remove background */
}

.pricing-table th {
    color: #f3f4f6;
    /* text-gray-100 */
    font-weight: 600;
    /* font-semibold */
}

.pricing-table td.feature-col {
    text-align: left;
    font-weight: 500;
    /* font-medium */
    color: #e5e7eb;
    /* text-gray-200 */
}

.pricing-table td.price {
    font-family: monospace;
    font-size: 0.95rem;
    color: white;
}

.pricing-table td.research-col,
.pricing-table th.research-col {
    border-left: 2px solid #9ca3af;
    /* Slightly stronger border, gray-400 */
}

.pricing-table .price-note {
    display: block;
    font-size: 0.75rem;
    /* text-xs */
    color: #9ca3af;
    /* text-gray-400 */
    font-style: italic;
    margin-top: 4px;
}

.tier-label {
    display: inline-block;
    margin-left: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 1px 5px;
    border-radius: 4px;
    vertical-align: middle;
}

.tier-label-team {
    background-color: #1d4ed8;
    color: white;
}

/* Blue */
.tier-label-enterprise {
    background-color: #7e22ce;
    color: white;
}

/* Purple */
.tier-label-deep {
    background-color: #b91c1c;
    color: white;
}

/* Red */

.sidebar-link .tier-label {
    margin-left: auto;
}

/* workbenchstyles.css */

/* Add transition and rotation origin to the logo */
#logo-image {
    transition: transform 0.3s ease-in-out;
    /* Smooth transition for rotation */
    transform-origin: center;
    /* Rotate around the center */
}

/* Add a class to the sidebar when it's collapsed */
/* We will toggle this class using JavaScript */
#sidebar.sidebar-collapsed #logo-image {
    transform: rotate(90deg);
    /* Rotate the logo 90 degrees when collapsed */
    /* You might want to adjust margins slightly if needed */
    /* margin: 0 auto; Example adjustment */
}

/* Optional: Ensure other elements are hidden smoothly via opacity controlled by the new class */
#sidebar.sidebar-collapsed #logo-text,
#sidebar.sidebar-collapsed .sidebar-text {
    opacity: 0;
    /* display: none; /* Keep hidden class toggle in JS for now */
}

/* Ensure bottom nav is hidden cleanly when collapsed */
#sidebar.sidebar-collapsed #sidebar-bottom-nav {
    opacity: 0;
    pointer-events: none;
    /* Prevent interaction when hidden */
    /* display: none; /* Keep hidden class toggle in JS for now */
}

/* Ensure toggle button is visible when collapsed */
#sidebar.sidebar-collapsed #sidebar-toggle {
    opacity: 1;
}

/* Add this if you haven't already - helps target the collapsed state */
#sidebar.sidebar-collapsed {
    /* Styles specific to the collapsed sidebar itself, if any */
    /* Example: align-items: center; */
}

/* --- Mpalo Workbench UI Tweak: align logo/text & reduce gap --- */
/* Reduce top padding of sidebar to move logo + first tab upwards */
#sidebar {
    padding-top: 1rem;
    /* was Tailwind p-6 (1.5rem) originally */
}

/* Tighten space between logo block and first navigation link */
#logo-container {
    margin-bottom: 0.5rem;
    /* reduce from mb-4 (1rem) to 0.5rem */
}

/* Vertically nudge the wordmark so it sits centred relative to the logo graphic */
#logo-text {
    position: relative;
    top: 4px;
    /* move text down ~4px to align with logo */
}

/* --- Color Variables --- */
:root {
    /* === Unified Color Palette === */
    --palette-background: #2D2D39;
    /* overall page background */
    --palette-sidebar-bg: #1C1B23;
    /* sidebar background */
    --palette-sidebar-text: #DEE7E7;
    /* sidebar default text */
    --palette-card-bg: #24242D;
    /* cards & panels background */
    --palette-card-border: transparent;
    /* subtle borders for cards */
    --palette-headline: #F8F4E3;
    /* h1-h3 & highlighted text */
    --palette-text: #F4FAFF;
    /* regular body text */
    --palette-accent: #000000;
    /* primary accent (buttons, active states) */
    --palette-accent-light: #F4FAFF;
    /* lighter accent (secondary buttons etc.) */
    --palette-error: #f87171;
    /* error / destructive */
    --palette-accent-hover: #444055;
    /* accent hover (update as desired) */

    /* === Existing variables mapped to palette (for legacy CSS rules) === */
    --color-primary: var(--palette-accent-light);
    --color-secondary-blue: var(--palette-accent);

    --color-text-light: var(--palette-text);
    --color-text-medium: var(--palette-text);
    --color-text-dark: var(--palette-headline);
    --color-text-error: var(--palette-error);
    --color-text-transparent: transparent;

    --color-bg-darkest: var(--palette-sidebar-bg);
    --color-bg-darker: var(--palette-card-bg);
    --color-bg-dark: #323252;
    /* still distinct but can be swapped */
    --color-bg-medium: #263554;
    --color-bg-transparent: rgba(13, 27, 42, 0.7);

    --color-border-primary: var(--palette-card-border);
    --color-border-dark: rgba(249, 237, 237, 0.05);
    --color-border-error: var(--palette-error);

    --color-shimmer-light: rgba(255, 255, 255, 0.10);
    --color-shimmer-dark: rgba(255, 255, 255, 0.08);

    /* Code-block theme (kept explicit) */
    --bg-code-block-specific: #282c34;
    --text-code-block-specific: #abb2bf;

    --font-body: "Martel", serif;
}

/* === Utility overrides for Tailwind arbitrary colour classes === */
/* Base color overrides */
.bg-\[\#FFE5D9\] {
    background-color: var(--palette-accent-light) !important;
}

.text-\[\#FFE5D9\] {
    color: var(--palette-accent-light) !important;
}

.bg-\[\#abb3ed\] {
    background-color: var(--palette-accent) !important;
}

.text-\[\#abb3ed\] {
    color: var(--palette-accent) !important;
}

.bg-\[\#c1c7f1\] {
    background-color: var(--palette-accent) !important;
}

/* Hover color overrides */
.hover\:bg-\[\#FFE5D9\]:hover,
.hover\:bg-\[\#abb3ed\]:hover,
.hover\:bg-\[\#c1c7f1\]:hover {
    background-color: var(--palette-accent-hover) !important;
}

/* Structural overrides */
#sidebar {
    background-color: var(--palette-sidebar-bg) !important;
    color: var(--palette-sidebar-text);
}

.border-gray-400.bg-transparent {
    background-color: var(--palette-card-bg) !important;
}

.bg-\[\#FFE5D9\],
.hover\:bg-\[\#FFE5D9\]:hover {
    background-color: var(--palette-accent-light) !important;
}

.text-\[\#FFE5D9\] {
    color: var(--palette-accent-light) !important;
}

.bg-\[\#abb3ed\],
.hover\:bg-\[\#abb3ed\]:hover {
    background-color: var(--palette-accent) !important;
}

.text-\[\#abb3ed\] {
    color: var(--palette-accent) !important;
}

.bg-\[\#c1c7f1\],
.hover\:bg-\[\#c1c7f1\]:hover {
    background-color: var(--palette-accent) !important;
}

.border-gray-400 {
    border-color: var(--palette-card-border) !important;
}

/* Sidebar & card helpers (optional – add these classes to HTML to theme quickly) */
.sidebar-theme {
    background-color: var(--palette-sidebar-bg);
    color: var(--palette-sidebar-text);
}

.card-theme {
    background-color: var(--palette-card-bg);
    border: 1px solid var(--palette-card-border);
}

.headline-theme {
    color: var(--palette-headline);
}


/* Base font size reduction for dashboard elements */
.sidebar-text,
.form-label,
.playground-label,
.form-input,
.playground-input,
.playground-metadata,
.playground-output-step h4,
.playground-output-step p,
.pricing-table th,
.pricing-table td,
.team-list-item,
.usage-view-button,
.form-section,
.radio-button-group label,
.selectable-list-item,
.contextual-help-tooltip .tooltiptext,
.filter-search-input {
    font-size: 1rem !important;
}

/* Smaller text for specific elements */
.tier-label {
    font-size: 0.6rem;
}

.price-note {
    font-size: 0.7rem;
}

.token-unit-label {
    font-size: 0.75rem;
}

.error-message {
    font-size: 0.75rem;
}

.playground-token-info {
    font-size: 0.75rem;
}

.metadata-label {
    font-size: 0.75rem;
}

/* Rest of existing styles remain unchanged */
.tier-label {
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    margin-left: 0.5rem;
    font-weight: 600;
    vertical-align: middle;
    display: inline-block;
}

/* Carousel Styles */
.carousel-container {
    position: relative;
    overflow: hidden;
    height: 100%;
    padding-bottom: 8px;
}

.carousel-item {
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
    height: 100%;
}

.carousel-item.hidden {
    display: none;
    opacity: 0;
}

.carousel-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--color-primary);
    transition: width 5s linear;
    width: 0%;
    border-radius: 1px;
    opacity: 0.7;
}

.carousel-nav-btn {
    cursor: pointer;
    transition: color 0.2s ease-in-out;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-nav-btn:hover {
    color: var(--color-primary);
    background-color: rgba(255, 229, 217, 0.1);
    /* Explicit rgba for hover background as it's transparent */
}

.carousel-nav-btn:focus {
    outline: none;
    color: var(--color-primary);
}

.carousel-nav-btn:active {
    transform: scale(0.95);
}

/* Provider Button Grid Styles */
.provider-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* 4 columns for Palo engines */
    gap: 0.75rem;
    /* 12px gap */
}

.provider-grid .connection-button {
    width: 100%;
    /* Make buttons fill grid cells */
    justify-content: center;
    /* Center content within button */
}

/* Rest of existing styles */
.connection-button {
    display: inline-flex;
    align-items: center;
    background-color: var(--color-bg-darker);
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    border: 1px solid var(--color-border-primary);
    /* margin: 5px;  <-- REMOVE THIS LINE */
    transition: background-color 0.2s;
    font-size: 0.9rem;
    /* Optional: To make them stretch evenly within rows, if desired in flex */
    flex-grow: 1;
    /* This will make them grow to fill available space */
    flex-basis: 200px;
    /* This will make them at least 200px wide before wrapping */
}

.connection-button:hover {
    background-color: var(--color-bg-medium);
}

.connection-button img,
.connection-button span.lucide {
    margin-right: 8px;
}

.form-label {
    display: block;
    margin-bottom: 4px;
    color: var(--color-text-medium);
    font-size: 0.9rem;
    font-weight: 500;
}

.form-input,
.form-textarea {
    width: 100%;
    background-color: var(--color-bg-darker);
    border: 1px solid var(--color-border-primary);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    ring: 1px;
    ring-color: var(--color-primary);
}

.form-input.error,
.form-textarea.error {
    border-color: var(--color-border-error);
}

.error-message {
    color: var(--color-text-error);
    font-size: 0.8rem;
    margin-top: -6px;
    margin-bottom: 10px;
}

.playground-label {
    display: block;
    margin-bottom: 4px;
    color: var(--color-text-medium);
    font-size: 0.9rem;
    font-weight: 500;
}

.playground-input,
.playground-metadata {
    width: 100%;
    background-color: var(--color-bg-darker);
    border: 1px solid var(--color-border-primary);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.playground-token-info {
    font-size: 0.8rem;
    color: var(--color-text-dark);
    margin-top: 8px;
}

.playground-output-step {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed var(--color-border-primary);
}

.playground-output-step h4 {
    font-weight: 600;
    color: var(--color-text-light);
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.playground-output-step p {
    font-size: 0.85rem;
    color: var(--color-text-medium);
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* This rule provides the desired border and no background for API items */
.memory-item,
.api-item {
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--color-border-primary);
}

.pricing-table th,
.pricing-table td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border-primary);
    text-align: center;
}

.pricing-table th {
    color: var(--color-text-light);
    font-weight: 600;
}

.pricing-table td {
    color: var(--color-text-medium);
}

.pricing-table .feature-col {
    text-align: left;
    font-weight: 500;
    color: var(--color-text-light);
}

.price-note {
    font-size: 0.75rem;
    color: var(--color-text-dark);
    display: block;
    margin-top: 2px;
}

.token-unit-label {
    display: block;
    font-weight: normal;
}

.team-list-item {
    cursor: pointer;
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border-primary);
    color: var(--color-text-medium);
}

.team-list-item:hover {
    color: white;
}

/* Keeping white for now, as it's a specific hover effect */
.team-list-item.selected-team {
    color: white;
    font-weight: bold;
    background-color: var(--color-bg-medium);
}

.team-list-item .update-team-button,
.team-list-item .delete-team-button {
    opacity: 0.6;
    transition: opacity 0.2s;
}

.team-list-item:hover .update-team-button,
.team-list-item:hover .delete-team-button {
    opacity: 1;
}

.hidden {
    display: none !important;
}

label.hidden {
    display: none;
}

/* This rule provides the desired border and no background for Vector Store items */
.vector-store-item {
    padding: 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid var(--color-border-primary);
}

.form-section {
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--color-border-primary);
    margin-bottom: 1.5rem;
}

.radio-button-group label {
    display: inline-flex;
    align-items: center;
    background-color: var(--color-bg-darker);
    color: var(--color-text-medium);
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--color-border-primary);
    margin: 1px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    font-size: 0.8rem;
    min-height: 28px;
    min-width: 38px;
    justify-content: center;
}

.radio-button-group input[type="radio"] {
    display: none;
}

.radio-button-group input[type="radio"]:checked+label {
    background-color: var(--color-secondary-blue);
    border-color: var(--color-secondary-blue);
    color: white;
}

.radio-button-group input[type="radio"]:disabled+label {
    opacity: 0.5;
    cursor: not-allowed;
}

.radio-button-group input[type="radio"]:disabled+label:hover {
    background-color: var(--color-bg-darker);
    border-color: var(--color-border-primary);
}

.radio-button-group label:hover {
    background-color: var(--color-bg-medium);
}

.selectable-list-item {
    cursor: pointer;
    padding: 8px 12px;
    border: 1px solid var(--color-border-primary);
    border-radius: 4px;
    margin-bottom: 5px;
    transition: background-color 0.2s, border-color 0.2s;
}

.selectable-list-item:hover {
    background-color: var(--color-bg-medium);
}

.selectable-list-item.selected {
    background-color: var(--color-secondary-blue);
    border-color: var(--color-secondary-blue);
    color: white;
}

.usage-view-button {
    background-color: var(--color-bg-darker);
    color: var(--color-text-medium);
    border: 1px solid var(--color-border-primary);
    padding: 8px 14px;
    border-radius: 6px;
    margin: 2px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.usage-view-button.active {
    background-color: var(--color-secondary-blue);
    border-color: var(--color-secondary-blue);
    color: white;
}

.usage-view-button:hover:not(.active) {
    background-color: var(--color-bg-medium);
}

.sortable-header {
    cursor: pointer;
    position: relative;
    padding-right: 20px;
    /* Make space for arrow */
}

.sortable-header::after {
    content: '';
    position: absolute;
    right: 5px;
    top: 50%;
    border: 4px solid transparent;
    opacity: 0.5;
}

.sortable-header.sort-asc::after {
    border-bottom-color: currentColor;
    /* Arrow up */
    margin-top: -6px;
    opacity: 1;
}

.sortable-header.sort-desc::after {
    border-top-color: currentColor;
    /* Arrow down */
    margin-top: -2px;
    opacity: 1;
}

#advanced-chevron.expanded {
    transform: rotate(180deg);
}

.selector-btn:focus-visible {
    outline: 2px solid rgba(113, 165, 229, 0.679);
    /* Tailwind blue-400 with opacity - Keeping as hardcoded as it's a specific outline */
    outline-offset: 2px;
    z-index: 11;
    /* Ensure focus outline is on top */
}

.contextual-help-tooltip {
    position: relative;
    display: inline-block;
}

.contextual-help-tooltip .tooltiptext {
    visibility: hidden;
    width: 220px;
    background-color: var(--color-bg-darker);
    color: #fff;
    /* Keeping white for tooltip text */
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 10;
    bottom: 125%;
    /* Position above the icon */
    left: 50%;
    margin-left: -110px;
    /* Center the tooltip */
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.75rem;
    line-height: 1.25;
}

.contextual-help-tooltip .tooltiptext::after {
    /* Arrow */
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--color-bg-darker) transparent transparent transparent;
}

.contextual-help-tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

.filter-search-input {
    background-color: var(--color-bg-darker);
    border: 1px solid var(--color-border-primary);
    color: white;
    /* Keeping white for filter search input text */
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-bottom: 8px;
    width: calc(100% - 20px);
    /* Adjust width as needed */
}

.logo-rotated {
    transform: rotate(90deg);
}

#sidebar::-webkit-scrollbar {
    display: none;
}

#sidebar {
    -ms-overflow-style: none;
    scrollbar-width: none;
    overflow-y: auto;
}

#conversation-container {
    background: var(--color-text-transparent);
    /* This was transparent, mapped to a variable */
}

#playground-chat-form {
    border-top: 1px solid var(--color-border-dark);
    background: var(--color-text-transparent);
    /* This was transparent, mapped to a variable */
}

#playground-prompt {
    background: var(--color-text-transparent);
    /* This was transparent, mapped to a variable */
    border: none;
    outline: none;
    box-shadow: none;
    color: #fff;
    /* Keeping white for playground prompt text */
    font-size: 1rem;
    min-height: 42px;
    max-height: 120px;
    resize: none;
    border-radius: 1rem !important;
    /* or 16px, or whatever matches your outer box */
}

#playground-prompt:focus {
    outline: none;
    box-shadow: none;
}

#run-palo-button {
    height: 42px;
    border-radius: 1rem !important;
    margin-left: 0.5rem;
}

/* Modern input style for config panel */
.config-input {
    background-color: #232336;
    /* This was a specific dark grey, keeping it for now */
    border: 1px solid var(--color-bg-medium);
    /* Re-used a color variable for border */
    color: var(--color-text-light);
    border-radius: 0.5rem;
    padding: 0.4rem 0.8rem;
    font-size: 0.9em;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    box-shadow: none;
}

.config-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(255, 229, 217, 0.2);
    /* Adjusted to use primary color with transparency */
    background-color: #232336;
    /* Keeping for consistency with non-focus background */
}

/* Remove number input spinners (Chrome, Safari, Edge) */
.config-input[type=number]::-webkit-inner-spin-button,
.config-input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Remove number input spinners (Firefox) */
.config-input[type=number] {
    -moz-appearance: textfield;
}

.memory-toggle-row {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.memory-recalls-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.memory-recalls-row .radio-button-group {
    margin-right: 0.5rem;
}

.memory-recalls-row input[type="number"] {
    width: 48px;
    margin-left: 0.5rem;
}

.metadata-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
}

.metadata-label {
    min-width: 60px;
    color: var(--color-text-medium);
    font-size: 0.8rem;
    font-weight: 500;
}

.metadata-input {
    margin-top: 0.2rem;
}

.radio-button-group label,
.memory-recalls-row input[type="number"] {
    min-height: 32px;
    height: 32px;
    font-size: 0.9rem;
}

.memory-recalls-row .radio-button-group label {
    min-width: 38px;
    width: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.memory-recalls-row input[type="number"] {
    width: 48px;
    margin-left: 0.5rem;
}

.memory-recalls-or {
    color: var(--color-text-dark);
    font-size: 0.9rem;
    margin: 0 0.2rem;
}

/* Config Panel Small Variant */
.config-panel-small {
    font-size: 0.82rem;
}

.config-panel-small .form-label,
.config-panel-small .config-label,
.config-panel-small label,
.config-panel-small .radio-button-group label {
    font-size: 0.78rem !important;
    padding: 2px 6px;
}

.config-panel-small .form-input,
.config-panel-small .config-input,
.config-panel-small input,
.config-panel-small select {
    font-size: 0.78rem !important;
    padding: 4px 8px !important;
    min-height: 28px !important;
    height: 28px !important;
}

.config-panel-small .radio-button-group {
    display: flex;
    flex-direction: row;
    gap: 4px;
}

.config-panel-small .radio-button-group label {
    min-height: 24px;
    height: 24px;
    min-width: 44px;
    width: 44px;
    font-size: 0.78rem !important;
    padding: 2px 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.config-panel-small .metadata-label {
    font-size: 0.75rem;
}

.config-panel-small .memory-recalls-row input[type="number"] {
    width: 36px;
    min-width: 0;
    font-size: 0.78rem;
}

.config-panel-small .memory-recalls-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.config-panel-small #advanced-options-panel {
    font-size: 0.78rem;
}

.config-panel-small .memory-recalls-row {
    margin-bottom: 0.5rem;
}

.config-panel-small #advanced-options-panel {
    gap: 0.5rem;
}

.dashboard-sidebox-sync {
    display: flex;
    flex-direction: column;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    position: relative;
    overflow-y: auto;
}

.dashboard-sidebox-stack {
    display: flex;
    flex-direction: column;
    height: auto !important;
    min-height: 0 !important;
    gap: 1.5rem;
}

#dashboard-sidebox-stack>.dashboard-sidebox-sync {
    flex-grow: 1;
    flex-basis: 0;
}

.global-app-loader {
    display: none !important;
}

body.loading-active::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--color-bg-transparent);
    z-index: 9998;
    /* Below the loader but above everything else */
}

/* Dynamic responsive grid for dashboard cards */
.dynamic-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    /* Equivalent to Tailwind gap-6 */
}

/* Global font scaling */
html {
    font-size: 14px;
    /* Reduce base size from default 16px */
}

/* Sidebar width tweaks for more content density */
#sidebar:not(.sidebar-collapsed) {
    width: 14rem !important;
    /* Shrink expanded width (Tailwind w-56) */
}

#sidebar.sidebar-collapsed {
    width: 5rem !important;
    /* Keep collapsed width roughly Tailwind w-20 */
}

/* Compact sidebar nav padding */
#sidebar nav a {
    padding-top: 0.5rem !important;
    /* Tailwind pt-2 */
    padding-bottom: 0.5rem !important;
    /* Tailwind pb-2 */
}

/* Hide section headings when sidebar collapsed but keep spacing */
#sidebar.sidebar-collapsed .sidebar-section-title {
    visibility: hidden;
    /* keeps element in flow to maintain gap */
}

/* Skeleton loading placeholders */
.skeleton {
    position: relative;
    background-color: var(--color-bg-darker);
    overflow: hidden;
    border-radius: 6px;
}

.skeleton::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    /* start fully off-screen */
    height: 100%;
    width: 100%;
    /* span entire width so it never disappears early */
    background: linear-gradient(90deg, var(--color-text-transparent) 0%, var(--color-shimmer-light) 50%, var(--color-text-transparent) 100%);
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* Chart skeleton (static, no shimmer) */
.chart-skeleton {
    position: relative;
    background-color: var(--color-bg-darker);
    overflow: hidden;
    border-radius: 6px;
}

.chart-skeleton::after {
    /* override shimmer */
    content: none;
}

/* Inline text loading skeleton */
.loading-skeleton {
    position: relative;
    color: var(--color-text-transparent) !important;
    /* hide text until loaded */
    background-color: var(--color-bg-darker);
    border-radius: 2px;
    overflow: hidden;
}

.loading-skeleton::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--color-text-transparent) 0%, var(--color-shimmer-light) 50%, var(--color-text-transparent) 100%);
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

/* Dash skeleton (for -- placeholders) */
.dash-skeleton {
    position: relative;
    color: var(--color-text-transparent) !important;
    background-color: rgb(27, 34, 43);
    /* This was a specific dark grey, keeping it for now */
    border-radius: 0.25rem;
    /* more rounding */
    display: inline-block;
    /* shrink to content */
    padding: 0 0.35rem;
    /* slight horizontal padding */
    min-width: 2rem;
    /* keep reasonable width */
    margin-bottom: 0.5rem;
    /* bigger gap below */
    overflow: hidden;
}

.dash-skeleton::after {
    content: "";
    position: absolute;
    top: 0;
    left: -120px;
    /* smaller stripe for tiny dash */
    height: 100%;
    width: 120px;
    background: linear-gradient(90deg, var(--color-text-transparent), var(--color-shimmer-dark), var(--color-text-transparent));
    animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

/* Disable old full-page loader */
.global-app-loader {
    display: none !important;
}

body.loading-active::before {
    display: none !important;
}

.bg-\[\#101017\] {
    background-color: var(--palette-background) !important;
}

/* Custom unified <select> styling */
select {
    background-color: var(--color-bg-darker);
    border: 1px solid var(--color-border-primary);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
}

select:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* ===== Accessibility: Reduced-motion support ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /* Stop shimmer effects */
    .skeleton::after,
    .loading-skeleton::after,
    .dash-skeleton::after {
        animation: none !important;
    }

    /* Pause carousel progress bars */
    .carousel-progress {
        transition: none !important;
        width: 0 !important;
    }
}

/* === Mpalo Workbench: Consistent Selection Highlights & Select Styling === */
/* 1. Consistent highlight for selectable list items (API Keys etc.) on every tab */
#memory-template-api-key-list .selectable-list-item.selected,
#playground-api-key-list .selectable-list-item.selected,
#api-key-llm-list .selectable-list-item.selected,
#api-key-vector-store-list .selectable-list-item.selected,
.selectable-list-item.selected {
    /* Accent colour is already mapped to black in the palette */
    background-color: var(--palette-accent) !important;
    border-color: var(--palette-accent) !important;
    color: #fff !important;
}

/* 2. Theme-aware styling for native <select> drop-downs across Workbench */
select,
select.form-input,
select.config-input {
    background-color: var(--color-bg-darker);
    border: 1px solid var(--color-border-primary);
    color: var(--color-text-light);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    /* Remove default platform styling for a consistent look */
    appearance: none;
    /* Custom arrow using existing chevron asset */
    background-image: url('/assets/chevron_down_icon.svg');
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 14px 14px;
    padding-right: 2.5rem;
    /* space for the arrow */
}

select:focus,
select.form-input:focus,
select.config-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(255, 229, 217, 0.25);
}

/* Hide the default arrow for Firefox, which ignores appearance: none; */
select::-ms-expand {
    display: none;
}

/* 3. Styled radio controls for standalone `.form-radio` inputs (e.g., Token Style and other settings) */
input[type="radio"].form-radio {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-border-primary);
    border-radius: 9999px;
    background-color: var(--color-bg-darker);
    position: relative;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

input[type="radio"].form-radio:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

input[type="radio"].form-radio:checked {
    border-color: var(--color-secondary-blue);
    background-color: var(--color-secondary-blue);
}

input[type="radio"].form-radio:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    transform: translate(-50%, -50%);
    background-color: #ffffff;
    border-radius: 9999px;
}

/* Align inline radio/label pairs nicely */
.inline-flex.items-center input.form-radio {
    margin-right: 6px;
}

/* === Palo Marketplace Styles === */
.mp-card {
    border: 1px solid var(--color-border-primary, #4b5563);
    background-color: rgba(255, 255, 255, 0.02);
    padding: 1rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease;
}

.mp-card:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.mp-tag {
    font-size: 0.75rem;
    background-color: rgba(255, 255, 255, 0.1);
    color: #d1d5db;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.mp-tag:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

/* === Sidebar UX Fixes === */
#sidebar {
    overflow-x: hidden;
}

#sidebar.sidebar-collapsed {
    overflow-x: hidden;
    /* Prevent horizontal scroll */
}

#sidebar.sidebar-collapsed nav {
    overflow-x: hidden;
}

#sidebar.sidebar-collapsed .sidebar-link {
    justify-content: center;
    /* center icon */
}

#sidebar.sidebar-collapsed .sidebar-link img,
#sidebar.sidebar-collapsed .sidebar-link .lucide {
    margin-right: 0 !important;
    /* remove extra gap preventing horizontal width */
}

/* Hide logo text and bottom nav entirely when collapsed to avoid external link previews */
#sidebar.sidebar-collapsed #sidebar-bottom-nav {
    display: none !important;
}

/* Disable native Safari link preview in collapsed state by preventing pointer events on bottom nav (fallback) */
#sidebar.sidebar-collapsed a {
    pointer-events: auto;
    /* keep sidebar icon links */
}

/* === End Sidebar UX Fixes === */

.refresh-button {
    padding: 0.5rem;
    border-radius: 9999px;
    /* circle */
    background-color: transparent;
    transition: background-color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
}

.refresh-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.refresh-button.refreshing img {
    animation: spin-ease 1.2s ease-in-out;
}

@keyframes spin-ease {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* === Multi-line Skeleton Placeholders === */
.skeleton-line {
    height: 12px;
    background-color: var(--color-bg-darker);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    margin-bottom: 6px;
}

.skeleton-line:last-child {
    margin-bottom: 0;
}

.skeleton-line.shorter {
    width: 40%;
}

.skeleton-line.short {
    width: 55%;
}

.skeleton-line.medium {
    width: 70%;
}

.skeleton-line.long {
    width: 100%;
}

.skeleton-line::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--color-text-transparent) 0%, var(--color-shimmer-light) 50%, var(--color-text-transparent) 100%);
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

/* Allow vertical scrolling in the main content area */
#main-content {
    overflow-y: auto !important;
}

/* Dashboard layout tweaks */
#audit-panel-container {
    min-height: 450px;
}

.dashboard-sidebox-sync {
    flex: 1 1 auto;
}

.service-health-flower {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.pro-tip-box {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background-color: rgba(59, 130, 246, 0.1);
    border-left: 3px solid rgba(59, 130, 246, 0.7);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--color-text-medium, #9ca3af);
}

.pro-tip-box strong {
    font-weight: 600;
    color: var(--color-text-light, #e5e7eb);
}