/* v3.0 - Minimal elegant design inspired by ChatGPT/Claude */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background: #f9fafb;
    color: #1f2937;
    height: 90vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Custom tag for red X in TJX */
red {
    color: #FE0000;
}

/* Login Screen Styles */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.login-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 48px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e5e7eb;
    width: 90%;
    max-width: 420px;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h2 {
    color: #111827;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-header p {
    color: #6b7280;
    font-size: 0.875rem;
}

.login-card .form-group {
    margin-bottom: 20px;
}

.login-card .form-group label {
    display: block;
    color: #4a5568;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.login-card .form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s;
    font-family: inherit;
    background: #ffffff;
}

.login-card .form-group input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.login-card .form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s;
    font-family: inherit;
    background: #ffffff;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.login-card .form-group select:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.login-card .form-group select optgroup {
    font-weight: 600;
    color: #374151;
    background: #f9fafb;
}

.login-card .form-group select option {
    padding: 8px;
    color: #4b5563;
}

.login-button {
    width: 100%;
    padding: 10px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.login-button:hover {
    background: #059669;
}

.login-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.login-error {
    color: #991b1b;
    background: #fee2e2;
    border: 1px solid #ef4444;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 15px;
    font-size: 0.875rem;
    display: none;
}

.login-error.show {
    display: block;
}

.login-footer {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.login-footer p {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 5px 0;
}

.container {
    height: 95vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
}

.main-content {
    display: grid;
    grid-template-columns: 280px 1fr 480px;
    gap: 0;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0;
    max-width: 2060px;
    margin: 0 auto;
    width: 100%;
    height: 100vh;
    box-sizing: border-box;
}

/* Adjust grid when left sidebar is collapsed */
.main-content:has(.sidebar-card.collapsed) {
    grid-template-columns: 60px 1fr 480px;
}

/* Adjust grid when right sidebar is collapsed */
.main-content:has(.right-sidebar-card.collapsed) {
    grid-template-columns: 280px 1fr 60px;
}

/* Adjust grid when left sidebar is collapsed */
.main-content:has(.sidebar-card.collapsed):not(:has(.right-sidebar-card.collapsed)) {
    grid-template-columns: 60px 1fr 480px;
}

/* Adjust grid when both sidebars are collapsed */
.main-content:has(.sidebar-card.collapsed):has(.right-sidebar-card.collapsed) {
    grid-template-columns: 60px 1fr 60px;
}

.sidebar-card {
    width: 280px;
    transition: width 0.3s ease, opacity 0.3s ease;
    position: relative;
    overflow: hidden;
    height: 100%;
    min-height: 0; /* Allow flex shrinking */
    display: flex;
    flex-direction: column;
}

.right-sidebar-card {
    width: 480px;
    transition: opacity 0.3s ease;
    position: relative;
    overflow: hidden;
    height: 100%;
    min-height: 0; /* Allow flex shrinking */
    display: flex;
    flex-direction: column;
    border-right: none;
    border-left: 1px solid #e5e7eb;
}

/* Right sidebar resize handle */
.sidebar-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    width: 6px;
    height: 100%;
    cursor: ew-resize;
    background: transparent;
    z-index: 100;
    transition: background-color 0.2s ease;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.active {
    background: rgba(34, 132, 121, 0.3);
}

.sidebar-resize-handle::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 40px;
    background: #d1d5db;
    border-radius: 1px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sidebar-resize-handle:hover::after,
.sidebar-resize-handle.active::after {
    opacity: 1;
    background: #228479;
}

/* Hide resize handle when sidebar is collapsed */
.right-sidebar-card.collapsed .sidebar-resize-handle {
    display: none;
}

/* Disable transitions while resizing for smooth dragging */
.right-sidebar-card.resizing {
    transition: none !important;
}

body.sidebar-resizing {
    cursor: ew-resize !important;
    user-select: none;
}

body.sidebar-resizing * {
    cursor: ew-resize !important;
}

.sidebar-card.collapsed {
    width: 60px;
    background: #ffffff;
    border-left: 2px solid #d1d5db;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f3f4f6;
    position: relative;
    flex-shrink: 0;
}

.sidebar-header h3 {
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.toggle-btn {
    background: transparent;
    color: #374151;
    border: 1.5px solid #9ca3af;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative;
    padding: 0;
    line-height: 1;
    left: 0%;
}

.toggle-btn span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 0;
}

.toggle-icon {
    width: 12px;
    height: 12px;
    object-fit: contain;
    display: block;
    opacity: 50%;
}

.toggle-btn:hover {
    border-color: #374151;
    color: #111827;
    background: #f9fafb;
}

/* Right sidebar header layout */
.right-sidebar-header {
    flex-direction: row;
    justify-content: flex-start;
}

.right-sidebar-header .toggle-btn {
    position: relative;
    right: auto;
    left: 0;
    top: auto;
    transform: none;
    margin-right: 12px;
}

.right-sidebar-header .toggle-btn:hover {
    transform: scale(1.1);
}

.sidebar-card.collapsed .toggle-btn {
    position: absolute;
    left: 50%;
    right: auto;
    top: 30%;
    transform: translateX(-50%);
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    background: white;
    border-color: #d1d5db;
}

.sidebar-card.collapsed .toggle-btn:hover {
    transform: translateX(-50%) scale(1.1);
}

.sidebar-content {
    transition: opacity 0.3s ease;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.sidebar-scrollable {
    overflow-y: scroll;
    flex: 1;
    min-height: 0;

    /* Firefox scrollbar */
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

.sidebar-scrollable:hover {
    scrollbar-color: #9ca3af #f1f1f1;
}

/* Webkit browsers scrollbar */
.sidebar-scrollable::-webkit-scrollbar {
    width: 6px;
}

.sidebar-scrollable::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.sidebar-scrollable::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 3px;
}

.sidebar-scrollable:hover::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar-scrollable:hover::-webkit-scrollbar-thumb {
    background: #9ca3af;
}

.sidebar-scrollable:hover::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}


.sidebar-card.collapsed .sidebar-content {
    display: none;
}

/* Hide header content but keep toggle button visible */
.sidebar-card.collapsed .sidebar-header {
    padding: 8px;
    min-height: auto;
    border-bottom: none;
}

.sidebar-card.collapsed .sidebar-header h3,
.sidebar-card.collapsed .sidebar-header .ai-status,
.sidebar-card.collapsed .sidebar-header img:not(.toggle-icon),
.sidebar-card.collapsed .sidebar-header > span:not(:has(.toggle-icon)) {
    display: none;
}

.sidebar-card.collapsed .sidebar-header > div:first-child {
    justify-content: center;
}

.sidebar-card.collapsed .sidebar-header > div:first-child > div:first-child {
    display: none;
}

.right-sidebar-card.collapsed {
    width: 60px;
    background: #ffffff;
    border-left: 2px solid #d1d5db;
}

.right-sidebar-card.collapsed .toggle-btn {
    position: absolute;
    left: 50%;
    right: auto;
    top: 30%;
    transform: translate(-50%, -50%);
    margin-right: 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    background: white;
    border-color: #d1d5db;
}

.right-sidebar-card.collapsed .toggle-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.right-sidebar-card.collapsed .sidebar-content {
    display: none;
}

/* Hide header content but keep toggle button visible */
.right-sidebar-card.collapsed .sidebar-header {
    padding: 8px;
    min-height: auto;
    border-bottom: none;
}

.right-sidebar-card.collapsed .sidebar-header h3 {
    display: none;
}

.card {
    background: #ffffff;
    border-radius: 0;
    padding: 16px;
    box-shadow: none;
    border: none;
    border-right: 1px solid #e5e7eb;
    height: 100%;
    min-height: 0; /* Allow flex shrinking */
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.chat-section {
    height: 100%;
    min-height: 0; /* Allow flex shrinking */
    min-width: 480px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    overflow: hidden; /* Prevent section from expanding */
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f3f4f6;
    flex-shrink: 0;
}

.chat-header h2 {
    color: #111827;
    font-weight: 500;
    font-size: 1rem;
    flex-grow: 1;
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: #6b7280;
}

.history-btn {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
}

.history-btn:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    color: #374151;
}

.conversation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid #e5e7eb;
}

.conversation-item:hover {
    background: #f3f4f6;
}

/* Other users' conversations - amber/yellow tint */
.conversation-item.other-user {
    background: #fffbeb;
    border-left: 3px solid #f59e0b;
}

.conversation-item.other-user:hover {
    background: #fef3c7;
}

.conversation-item.other-user .conversation-preview strong {
    color: #b45309;
}

.conversation-info {
    flex: 1;
    min-width: 0;
}

.conversation-preview {
    font-size: 0.85rem;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.conversation-summary {
    font-size: 0.8rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
    font-style: italic;
}

.conversation-meta {
    font-size: 0.75rem;
    color: #9ca3af;
}

.conversation-delete-btn {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 1rem;
    transition: background 0.2s;
}

.conversation-delete-btn:hover {
    background: #fee2e2;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #374151;
    padding: 6px 12px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.user-info-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.875rem;
    color: #374151;
    padding: 10px;
    margin-top: 10px;
    background: #f9fafb;
    border-radius: 6px;
    border: none;
    flex-shrink: 0;
    width: 96%;
    box-sizing: border-box;
}

/* Multi-User Status Panel (simplified) */
.multi-user-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: #6b7280;
    padding: 8px 10px;
    background: #f0fdf4;
    border-radius: 6px;
    flex-shrink: 0;
    width: 96%;
    box-sizing: border-box;
    border: 1px solid #bbf7d0;
}

.multi-user-status.locked {
    background: #fef3c7;
    border-color: #fcd34d;
}

.multi-user-status.locked-by-other {
    background: #fee2e2;
    border-color: #fca5a5;
}

.lock-status-compact {
    flex-shrink: 0;
    font-size: 0.85rem;
}

.active-users-compact {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.7rem;
}

.lock-btn-compact {
    flex-shrink: 0;
    padding: 2px 6px;
    font-size: 0.75rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.lock-btn-compact:hover {
    background: #2563eb;
}

.lock-btn-compact.release {
    background: #f59e0b;
}

.lock-btn-compact.release:hover {
    background: #d97706;
}

.lock-btn-compact:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.user-role-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-role-badge.admin {
    background: #f59e0b;
    color: white;
}

.user-role-badge.operator {
    background: #3b82f6;
    color: white;
}

.logout-btn {
    padding: 4px 10px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background 0.2s;
    margin-left: 4px;
}

.logout-btn:hover {
    background: #dc2626;
}

/* Lock button states (uses logout-btn as base) */
#lockReactorBtn {
    background: #3b82f6;
    margin-left: 0;
    margin-right: 4px;
}

#lockReactorBtn:hover {
    background: #2563eb;
}

#lockReactorBtn.release {
    background: #10b981;
}

#lockReactorBtn.release:hover {
    background: #059669;
}

#lockReactorBtn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Language selector in chat header */
.lang-selector-header {
    padding: 4px 8px;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.lang-selector-header:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.lang-selector-header:focus {
    outline: none;
    border-color: #228479;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chat-messages {
    flex: 1;
    overflow-y: scroll;
    padding: 15px;
    border: none;
    border-radius: 0;
    margin-bottom: 20px;
    background: #ffffff;
    min-height: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.95rem;

    /* Firefox scrollbar */
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

.chat-messages:hover {
    scrollbar-color: #9ca3af #f1f1f1;
}

/* Webkit browsers (Chrome, Safari, Edge) scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
}

.chat-messages:hover::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages:hover::-webkit-scrollbar-thumb {
    background: #9ca3af;
}

.chat-messages:hover::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

.message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 8px;
    max-width: 85%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Code blocks within messages should use monospace */
.message pre,
.message code {
    font-family: 'SF Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
}

.message pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.4;
}

.message code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.message.user {
    background: #f3f4f6;
    color: #1f2937;
    margin-left: auto;
    text-align: right;
    border: 1px solid #e5e7eb;
}

.message.ai {
    background: #f9fafb;
    color: #1f2937;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

/* Broadcast messages from other users (read-only notifications) */
.message.broadcast {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
    border-left: 4px solid #f59e0b;
    font-size: 0.9rem;
    opacity: 0.9;
}

.message.broadcast .broadcast-user {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.message.broadcast.broadcast-response {
    background: #ecfdf5;
    color: #065f46;
    border-color: #10b981;
    border-left-color: #10b981;
}

/* System announcement messages (admin notices shown after greeting) */
.message.system-announcement {
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    color: #1e40af;
    border: 1px solid #93c5fd;
    border-left: 4px solid #3b82f6;
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 8px;
}

.system-announcement-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.system-announcement-icon {
    font-size: 1.2rem;
}

.system-announcement-type {
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.system-announcement-text {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 8px;
}

.system-announcement-meta {
    font-size: 0.75rem;
    color: #6b7280;
    opacity: 0.8;
}

.message-time {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 5px;
}

.input-section {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
}

.query-input {
    flex-grow: 1;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
    resize: none; /* Disable resize to prevent layout issues */
    min-height: 80px;
    max-height: 200px;
    height: 80px; /* Fixed height */
    line-height: 1.5;
    overflow-y: scroll;
}

.query-input::-webkit-scrollbar {
    width: 6px;
}

.query-input::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.query-input::-webkit-scrollbar-thumb {
    background: #9ca3af;
    border-radius: 3px;
}

.query-input::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

.query-input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.send-button {
    padding: 12px 20px;
    background: #228479;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s;
    align-self: flex-end;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-button:hover {
    background: #1a6961;
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #9ca3af;
}

.system-status {
    margin-bottom: 20px;
}

/* Bioreactor Real-Time Data */
.bioreactor-data {
    background: #f3f4f6;
    border-radius: 8px;
    padding: 0px;
    margin-bottom: 20px;
    color: #111827;
    border: 1px solid #e5e7eb;
}

.bioreactor-data h3 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

/* Bioreactor data section with horizontal scroll */
.bioreactor-data {
    overflow-x: auto;
    margin-bottom: 10px;
    max-width: 100%; /* Prevent overflow beyond sidebar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.bioreactor-data::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.bioreactor-data:hover {
    scrollbar-width: thin; /* Firefox */
    -ms-overflow-style: auto; /* IE and Edge */
}

.bioreactor-data:hover::-webkit-scrollbar {
    display: block; /* Chrome, Safari, Opera */
    height: 8px;
}

.bioreactor-data:hover::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.bioreactor-data:hover::-webkit-scrollbar-thumb {
    background: #9ca3af;
    border-radius: 4px;
}

.bioreactor-data:hover::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

.realtime-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    table-layout: fixed; /* Fixed layout for consistent column widths */
    margin-bottom: 5px;
}

.realtime-data-table th,
.realtime-data-table td {
    padding: 8px 12px;
    text-align: center;
    border: 1px solid #e5e7eb;
    max-width: 0; /* Force truncation with table-layout: fixed */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.realtime-data-table th {
    background: #f3f4f6;
    font-weight: 600;
    color: #374151;
}

/* Removed first-child styling since Type column was removed */
/* .realtime-data-table td:first-child {
    font-weight: 600;
    background: rgba(0, 0, 0, 0.15);
    position: sticky;
    left: 0;
    z-index: 1;
} */

.realtime-data-table tbody tr:nth-child(odd) {
    background: #f9fafb;
}

.data-update-time {
    text-align: right;
    font-size: 0.75rem;
    color: #6b7280;
    vertical-align: middle;
    font-style: italic;
    margin-right: 8px;
}

/* Carousel Indicators */
.carousel-indicators {
    display: flex;
    gap: 8px;
    align-items: center;
    vertical-align: middle;
    margin-left: 8px;   
}

.carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    cursor: pointer;
    transition: all 0.2s ease;
}

.carousel-indicator.active {
    background: #6b7280;
    width: 10px;
    height: 10px;
}

.carousel-indicator:hover {
    background: #9ca3af;
}

/* System Status Mini at bottom */
.system-status-mini {
    background: #f9fafb;
    border-radius: 8px;
    padding: 12px 15px;
    margin-top: 20px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    border: 1px solid #e5e7eb;
}

.status-mini-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
}

.status-mini-label {
    color: #718096;
    font-weight: 500;
}

.status-mini-value {
    color: #2D3748;
    font-weight: 600;
}

.status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.status-item {
    background: #f9fafb;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    border-left: 3px solid #10b981;
}

.status-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2d3748;
}

.status-label {
    font-size: 0.9rem;
    color: #718096;
    margin-top: 5px;
}

.quick-actions {
    margin-top: 0;
}

.quick-actions h3 {
    margin-bottom: 8px;
    color: #6b7280;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.recent-queries {
    margin-top: 10px;
    margin-bottom: 10px;
}

.recent-queries h3 {
    margin-bottom: 12px;
    color: #111827;
    font-size: 1rem;
    font-weight: 600;
}

.recent-query-btn {
    background: #f9fafb !important;
    border-color: #d1d5db !important;
    font-style: italic;
}

.recent-query-btn:hover {
    background: #f3f4f6 !important;
    border-color: #10b981 !important;
}

.horizontal-buttons {
    display: flex;
    gap: 10px;
}

.action-buttons {
    display: grid;
    gap: 4px;
}

.action-button {
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    font-size: 0.8rem;
    color: #374151;
}

.action-button:hover {
    background: #f3f4f6;
}

.emergency-button {
    background: #ef4444;
    color: white;
    border: none;
    font-weight: 500;
    margin-top: 4px;
}

.emergency-button:hover {
    background: #dc2626;
}

.analytics-panel {
    margin-top: 16px;
}

.analytics-panel h3 {
    margin-bottom: 8px;
    color: #6b7280;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.analytics-chart {
    background: #f9fafb;
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
    text-align: center;
    color: #6b7280;
    font-style: italic;
    border: 1px solid #e5e7eb;
}

.control-loops {
    background: transparent;
    padding: 0;
    border-radius: 0;
    margin-top: 10px;
    border: none;
}

.loop-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 6px;
    max-height: 200px;
    overflow: hidden;
}

.loop-description {
    font-size: 0.85rem;
    color: #718096;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 3.9em; /* ~3 lines at 1.3 line-height */
    line-height: 1.3;
}

.loop-item:last-child {
    margin-bottom: 0;
}

.loading {
    display: none;
    text-align: center;
    color: #6b7280;
    font-style: italic;
    flex-shrink: 0;
    margin-top: 10px;
}

.loading.show {
    display: block;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal[style*="display: block"] {
    display: flex !important;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    background-color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    color: #111827;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #000;
}

.reactor-context-bar {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border-bottom: 1px solid #d1fae5;
    padding: 8px 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
}

.reactor-context-bar .reactor-name {
    font-weight: 600;
    color: #065f46;
}

.reactor-context-bar .reactor-id {
    color: #6b7280;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.8rem;
    background: rgba(255,255,255,0.6);
    padding: 2px 8px;
    border-radius: 4px;
}

.reactor-context-bar:empty {
    display: none;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Scrollbar styles for modal body */
.modal-body {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

.modal-body:hover {
    scrollbar-color: #9ca3af #f1f1f1;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
}

.modal-body:hover::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.modal-body:hover::-webkit-scrollbar-thumb {
    background: #9ca3af;
}

.modal-body:hover::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Subtle notice at bottom of modal */
.modal-notice {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
    font-size: 0.75rem;
    color: #9ca3af;
    text-align: center;
}

.rules-section {
    margin-bottom: 20px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 16px;
}

.rules-section h3 {
    color: #374151;
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    color: #4a5568;
    font-weight: 500;
    margin-bottom: 5px;
}

.form-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    min-height: 80px;
    resize: vertical;
    transition: border-color 0.2s;
}

.form-textarea:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.rules-list {
    max-height: 400px;
    overflow-y: auto;
}

.rules-list {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

.rules-list:hover {
    scrollbar-color: #9ca3af #f1f1f1;
}

.rules-list::-webkit-scrollbar {
    width: 8px;
}

.rules-list::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

.rules-list::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
}

.rules-list:hover::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.rules-list:hover::-webkit-scrollbar-thumb {
    background: #9ca3af;
}

.rule-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.rule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.rule-priority {
    background: #6b7280;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.rule-body {
    color: #2d3748;
    margin-bottom: 10px;
    line-height: 1.5;
}

.rule-params {
    color: #718096;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.rule-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.rule-stats {
    color: #718096;
    font-size: 0.85rem;
}

.rule-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    margin-left: 8px;
}

.rule-btn.enabled {
    background: #48bb78;
    color: white;
}

.rule-btn.disabled {
    background: #cbd5e0;
    color: #4a5568;
}

.rule-btn.delete {
    background: #f56565;
    color: white;
}

.rule-btn:hover {
    opacity: 0.9;
}

.edit-button {
    padding: 5px 10px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    color: #374151;
    transition: all 0.2s;
}

.edit-button:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* Consistent modal action buttons */
.modal-action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.modal-action-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.modal-action-btn:active {
    transform: translateY(0);
}

.delete-button {
    padding: 5px 10px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    color: #374151;
    transition: all 0.2s;
}

.delete-button:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    margin-left: 8px;
    display: inline-block;
}

@media (max-width: 768px) {
    body {
        height: 100vh;
        overflow-x: hidden;
    }

    .container {
        padding: 5px;
        height: 100vh;
        overflow-x: hidden;
    }

    .main-content {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 5px;
        height: 100%;
        overflow-x: hidden;
    }

    /* Sidebars at top when collapsed on mobile */
    .sidebar-card {
        order: 1;
        width: 100%;
        height: auto;
        max-height: none;
        flex-shrink: 0;
        margin-bottom: 0;
    }

    .right-sidebar-card {
        order: 2;
        width: 100%;
        height: auto;
        max-height: none;
        flex-shrink: 0;
        margin-bottom: 0;
    }

    .sidebar-card.collapsed {
        margin-bottom: 5px;
    }

    .right-sidebar-card.collapsed {
        margin-bottom: 10px;
    }

    /* Chat section stays at bottom on mobile */
    .chat-section {
        order: 3;
        flex: 1;
        min-height: 0;
        min-width: 0;
        display: flex;
        flex-direction: column;
    }

    /* Collapsed state on mobile */
    .sidebar-card.collapsed, .right-sidebar-card.collapsed {
        width: 100%;
        height: 50px;
        min-height: 50px;
        max-height: 50px;
        overflow: hidden;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        display: flex;
        align-items: center;
        padding: 0 !important;
        cursor: pointer;
        transition: background-color 0.2s ease, border-color 0.2s ease;
        background-color: #ffffff;
    }

    .sidebar-card.collapsed:active,
    .right-sidebar-card.collapsed:active {
        background-color: #f9fafb;
        border-color: #228479;
    }

    .sidebar-card.collapsed .sidebar-header,
    .right-sidebar-card.collapsed .sidebar-header {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0 15px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: none;
        position: relative;
        pointer-events: none;
    }

    .sidebar-card.collapsed .toggle-btn,
    .right-sidebar-card.collapsed .toggle-btn {
        pointer-events: auto;
    }

    .sidebar-card.collapsed .sidebar-content,
    .right-sidebar-card.collapsed .sidebar-content {
        display: none;
    }

    /* Expanded state on mobile - overlay style */
    .sidebar-card:not(.collapsed), .right-sidebar-card:not(.collapsed) {
        position: fixed;
        top: 10px;
        left: 10px;
        right: 10px;
        bottom: 10px;
        width: calc(100% - 20px);
        height: auto;
        max-height: calc(100vh - 20px);
        z-index: 1001;
        box-shadow: 0 4px 20px rgba(0,0,0,0.3);
        border: 2px solid #228479;
        animation: slideInMobile 0.3s ease-out;
    }

    @keyframes slideInMobile {
        from {
            opacity: 0;
            transform: translateY(-20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Toggle button positioning on mobile */
    .sidebar-card.collapsed .toggle-btn,
    .right-sidebar-card.collapsed .toggle-btn {
        position: relative;
        right: auto;
        left: auto;
        top: auto;
        transform: none;
        margin: 0;
        box-shadow: none;
        flex-shrink: 0;
    }

    /* Left sidebar in collapsed mobile mode */
    .sidebar-card.collapsed .sidebar-header {
        flex-direction: row !important;
        align-items: center !important;
        gap: 10px;
        padding: 8px 12px;
    }

    .sidebar-card.collapsed .sidebar-header > div:first-child {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .sidebar-card.collapsed .ai-status {
        display: none;
    }

    .sidebar-card.collapsed h3 {
        font-size: 0.85rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sidebar-card.collapsed .toggle-btn {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        transform: none !important;
        flex-shrink: 0;
    }

    /* Right sidebar button on right side when collapsed */
    .right-sidebar-card.collapsed .sidebar-header {
        flex-direction: row;
        justify-content: space-between;
        gap: 10px;
    }

    .right-sidebar-card.collapsed h3 {
        order: 1;
        max-width: calc(100% - 50px);
    }

    .right-sidebar-card.collapsed .toggle-btn {
        order: 2;
        margin-right: 0;
    }

    /* Toggle buttons in expanded state on mobile */
    .sidebar-card:not(.collapsed) .toggle-btn {
        position: absolute;
        right: 15px;
        top: 15px;
        transform: none;
        margin: 0;
    }

    .right-sidebar-card:not(.collapsed) .toggle-btn {
        position: absolute;
        right: 15px;
        top: 15px;
        left: auto;
        margin: 0;
        transform: none;
    }

    /* Header adjustments on mobile */
    .sidebar-header {
        min-height: 50px;
        display: flex;
        align-items: center;
        padding: 0 15px;
        position: relative;
    }

    .sidebar-card.collapsed .sidebar-header h3,
    .right-sidebar-card.collapsed .sidebar-header h3 {
        opacity: 1;
        font-size: 0.95rem;
        font-weight: 600;
        margin: 0;
        padding: 0 10px 0 0;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        color: #111827;
    }

    .right-sidebar-card.collapsed .sidebar-header h3 {
        padding: 0 10px 0 0;
    }

    /* Expanded state headers */
    .sidebar-card:not(.collapsed) .sidebar-header,
    .right-sidebar-card:not(.collapsed) .sidebar-header {
        padding: 15px 50px 15px 15px;
        flex-direction: row;
        justify-content: flex-start;
    }

    .sidebar-card:not(.collapsed) .sidebar-header h3,
    .right-sidebar-card:not(.collapsed) .sidebar-header h3 {
        opacity: 1;
    }

    /* Sidebar content scrolling on mobile */
    .sidebar-card:not(.collapsed) .sidebar-content,
    .right-sidebar-card:not(.collapsed) .sidebar-content {
        overflow-y: auto;
        max-height: calc(100vh - 90px);
    }

    /* Chat input adjustments */
    .query-input {
        min-height: 60px;
        height: 60px;
        font-size: 0.9rem;
    }

    .send-button {
        min-height: 60px;
        padding: 10px 15px;
        font-size: 0.85rem;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    /* Adjust chat messages for mobile */
    .message {
        max-width: 95%;
        font-size: 0.9rem;
    }

    .chat-header h2 {
        font-size: 1rem;
    }

    /* Make action buttons more touch-friendly */
    .action-button {
        padding: 12px 14px;
        font-size: 0.9rem;
    }

    /* Mobile alert positioning */
    .alert-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .alert-popup {
        min-width: auto;
        width: 100%;
    }
}

/* Mobile sidebar backdrop */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

/* Alert and Alarm Popup Styles */
.alert-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    pointer-events: none;
}

.alert-popup {
    pointer-events: auto;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    min-width: 350px;
    max-width: 400px;
    border: 2px solid;
    backdrop-filter: blur(10px);
}

.alert-popup.alert-yellow {
    background: rgba(255, 243, 205, 0.98);
    border-color: #f59e0b;
    color: #1f2937;
}

.alert-popup.alert-red {
    background: rgba(220, 38, 38, 0.95);
    border-color: #fbbf24;
    color: #fef3c7;
}

.alert-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 10px;
    font-weight: 600;
    border-bottom: 1px solid;
}

.alert-popup.alert-yellow .alert-header {
    background: rgba(245, 158, 11, 0.2);
    border-bottom-color: #f59e0b;
}

.alert-popup.alert-red .alert-header {
    background: rgba(185, 28, 28, 0.3);
    border-bottom-color: #fbbf24;
}

.alert-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.alert-type {
    flex: 1;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.alert-close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.alert-popup.alert-yellow .alert-close {
    color: #92400e;
}

.alert-popup.alert-yellow .alert-close:hover {
    background: rgba(245, 158, 11, 0.3);
}

.alert-popup.alert-red .alert-close {
    color: #fef3c7;
}

.alert-popup.alert-red .alert-close:hover {
    background: rgba(185, 28, 28, 0.4);
}

.alert-body {
    padding: 16px;
}

.alert-message {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 8px;
    font-weight: 500;
}

.alert-popup.alert-yellow .alert-message {
    color: #1f2937;
}

.alert-popup.alert-red .alert-message {
    color: #fef3c7;
    font-weight: 600;
}

.alert-time {
    font-size: 12px;
    opacity: 0.8;
    font-style: italic;
}

.alert-popup.alert-yellow .alert-time {
    color: #78716c;
}

.alert-popup.alert-red .alert-time {
    color: #fde68a;
}

@keyframes slideInRight {
    from {
        transform: translateX(450px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(450px);
        opacity: 0;
    }
}

/* Tab Buttons */
.tab-button {
    background: none;
    border: none;
    padding: 10px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    color: #6b7280;
    font-weight: 400;
}

.tab-button:hover {
    color: #374151;
    background: #f9fafb;
}

.tab-button.active {
    color: #111827;
    border-bottom-color: #374151;
    font-weight: 500;
}

.alert-tab-panel {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== Reactor Info & Parameter Manager Styles ==================== */

.form-section {
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    padding: 16px;
    margin-bottom: 16px;
}

.form-section h3 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    font-weight: 500;
    color: #374151;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 5px;
}

.form-group input,
.form-group textarea {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 400;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover,
.btn-secondary:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.btn-primary:active,
.btn-secondary:active {
    background: #e5e7eb;
}

.btn-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.btn-danger:hover {
    background: #fee2e2;
    border-color: #f87171;
}

.btn-danger:active {
    background: #fecaca;
}

.btn-sm {
    padding: 4px 10px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 400;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.btn-sm:active {
    background: #e5e7eb;
}

.parameter-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
}

.parameter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

.parameter-header strong {
    font-size: 1rem;
    color: #1f2937;
}

.parameter-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 10px;
}

.parameter-details strong {
    color: #374151;
}

.status-message {
    display: none;
    padding: 12px;
    border-radius: 6px;
    margin-top: 15px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Header Icon Buttons (Chat/Trends/History) */
.header-icon-btn {
    background: transparent;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
}

.header-icon-btn:hover {
    background: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
}

.header-icon-btn.active {
    background: #228479;
    color: white;
    border-color: #228479;
}

.header-icon-btn.active:hover {
    background: #1a6b62;
    border-color: #1a6b62;
}

/* Time Range Buttons for Trends */
.time-range-btn {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 6px 0;
    min-width: 42px;
    font-size: 0.75rem;
    cursor: pointer;
    color: #6b7280;
    border-radius: 4px;
    transition: all 0.15s ease;
    text-align: center;
}

.time-range-btn:hover {
    background: #e5e7eb;
}

.time-range-btn.active {
    background: #228479;
    color: white;
    font-weight: 600;
    border-color: #228479;
}

/* Y-Axis Legend Items (editable) */
.y-axis-legend-item {
    padding: 2px 6px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.y-axis-legend-item:hover {
    background-color: #e5e7eb;
}

.y-axis-legend-item .y-min,
.y-axis-legend-item .y-max {
    font-weight: 600;
    text-decoration: underline;
    text-decoration-style: dotted;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group[style*="grid-column: span 2"] {
        grid-column: span 1 !important;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group button {
        width: 100%;
    }
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top-color: #10b981;
    border-radius: 50%;
    animation: spinner-spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

.loading-spinner-lg {
    width: 24px;
    height: 24px;
    border-width: 3px;
}

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

/* Data Logger Button Styles */
.logger-btn:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.logger-btn:active:not(:disabled) {
    background: #e5e7eb;
}

/* Parameter Selector Toggle Button */
#paramSelectorToggle:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

#paramSelectorToggle:active {
    background: #e5e7eb;
}

/* uPlot chart container needs position relative for legend positioning */
#trendChartContainer {
    position: relative;
    overflow: visible;
}

/* uPlot legend - show crosshair values inline at top of chart */
#trendChartContainer .u-legend.u-inline.u-live {
    position: absolute;
    top: 5px !important;
    left: 50%;
    transform: translateX(-50%);
    bottom: auto !important;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 4px;
    padding: 4px 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-size: 0.75rem;
    white-space: nowrap;
    max-width: 95%;
    overflow-x: auto;
}

#trendChartContainer .u-legend {
    max-height: none;
    overflow-y: visible;
}

/* Style legend series markers */
#trendChartContainer .u-legend .u-series {
    display: inline-block;
    margin: 0 6px;
}

#trendChartContainer .u-legend .u-marker {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 3px;
}

#trendChartContainer .u-legend .u-value {
    font-weight: 500;
}

/* ========================================
   Portrait Mode (Mobile) - Floating Toggle Buttons
   ======================================== */
@media (max-width: 768px) and (orientation: portrait) {
    /* Hide the collapsed sidebar banners in portrait mode */
    .sidebar-card.collapsed,
    .right-sidebar-card.collapsed {
        display: none !important;
    }

    /* Show the floating toggle buttons container */
    .portrait-toggle-buttons {
        display: flex !important;
    }

    /* Chat section takes full height when sidebars collapsed */
    .chat-section {
        order: 1 !important;
        flex: 1;
        position: relative;
    }

    /* Hide CPU_ID:UNIT label — reactor name is enough */
    .cpu-unit-label {
        display: none !important;
    }

    /* Compact header: single line, truncate run info */
    .chat-header {
        flex-wrap: nowrap;
        gap: 4px;
    }
    .chat-header h2 {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.9rem !important;
        min-width: 0;
        flex-shrink: 1;
    }
    /* Keep tab buttons from being clipped */
    .chat-header > div:last-child {
        flex-shrink: 0;
    }

    /* Hide send button — Enter key sends */
    .send-button {
        display: none !important;
    }

    /* Bottom safe area for phone navigation bar */
    .input-section {
        margin-bottom: 40px;
    }
}

/* Portrait mode floating toggle buttons */
.portrait-toggle-buttons {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 4px;
    right: 4px;
    z-index: 100;
    justify-content: space-between;
    pointer-events: none;
}

.portrait-toggle-btn {
    pointer-events: auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(34, 132, 121, 0.5);
    background: rgba(255, 255, 255, 0.7);
    color: #228479;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.portrait-toggle-btn:hover {
    background: rgba(34, 132, 121, 0.8);
    border-color: #228479;
}

.portrait-toggle-btn:hover img {
    filter: brightness(0) invert(1);
}

.portrait-toggle-btn:active {
    transform: scale(0.9);
    background: rgba(34, 132, 121, 0.9);
}

.portrait-toggle-btn img {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

/* When sidebar is expanded in portrait, hide the corresponding floating button */
@media (max-width: 768px) and (orientation: portrait) {
    .portrait-toggle-btn-left.hidden,
    .portrait-toggle-btn-right.hidden {
        opacity: 0;
        pointer-events: none;
    }
}

/* Markdown content styles for chat messages */
.markdown-content {
    line-height: 1.6;
}

.markdown-content p {
    margin: 0 0 0.75em 0;
}

.markdown-content p:last-child {
    margin-bottom: 0;
}

.markdown-content code {
    background: rgba(0, 0, 0, 0.06);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

.markdown-content pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 12px 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.75em 0;
}

.markdown-content pre code {
    background: none;
    padding: 0;
    font-size: 0.85em;
    color: inherit;
}

.markdown-content ul,
.markdown-content ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.markdown-content li {
    margin: 0.25em 0;
}

.markdown-content blockquote {
    border-left: 3px solid #228479;
    margin: 0.75em 0;
    padding-left: 1em;
    color: #4b5563;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
    margin: 1em 0 0.5em 0;
    font-weight: 600;
    line-height: 1.3;
}

.markdown-content h1:first-child,
.markdown-content h2:first-child,
.markdown-content h3:first-child {
    margin-top: 0;
}

.markdown-content table {
    border-collapse: collapse;
    margin: 0.75em 0;
    width: 100%;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid #e5e7eb;
    padding: 8px 12px;
    text-align: left;
}

.markdown-content th {
    background: #f9fafb;
    font-weight: 600;
}

.markdown-content a {
    color: #228479;
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

/* KaTeX math styles */
.markdown-content .katex-display {
    margin: 0.75em 0;
    overflow-x: auto;
    overflow-y: hidden;
}

.markdown-content .katex {
    font-size: 1.1em;
}

/* Multi-user badges */
.task-user-badge {
    font-size: 0.65rem;
    background: #e0f2fe;
    color: #0369a1;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
    font-weight: normal;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

.active-user-badge {
    display: inline-block;
    font-size: 0.75rem;
    background: #dcfce7;
    color: #166534;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 4px;
    font-weight: 500;
}

/* Control Panel Table */
.control-panel-table {
    width: 100%;
    border-collapse: collapse;
}

.control-panel-table th {
    background: #f3f4f6;
    padding: 10px 8px;
    font-weight: 600;
    font-size: 0.8rem;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}

.control-panel-table td {
    padding: 8px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
    height: 36px;  /* Fixed: 20px content + 8px*2 padding */
    box-sizing: border-box;
}

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

.control-panel-table .param-name {
    font-weight: 500;
}

.control-panel-table .pv-value {
    text-align: right;
    color: #6b7280;
}

.control-panel-table .sp-input {
    width: 80px;
    padding: 4px 6px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    text-align: right;
    font-size: 0.9rem;
}

.control-panel-table .sp-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.control-panel-table .source-select {
    width: 120px;
    padding: 4px 6px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.85rem;
    background: white;
}

.control-panel-table .source-select:focus {
    outline: none;
    border-color: #667eea;
}

/* Sliding Toggle Switch */
.slide-toggle {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.slide-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slide-toggle .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 20px;
}

.slide-toggle .slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.slide-toggle input:checked + .slider {
    background-color: #228479;
}

.slide-toggle input:checked + .slider:before {
    transform: translateX(16px);
}

.slide-toggle input:disabled + .slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading state for toggles and actuators */
.slide-toggle.loading .slider {
    background-color: #e5e7eb;
    animation: toggle-pulse 1s ease-in-out infinite;
}

.actuator-checkbox.loading .actuator-symbol {
    opacity: 0.4;
    animation: toggle-pulse 1s ease-in-out infinite;
}

@keyframes toggle-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

/* Unavailable state - keeps structure but grayed out with tooltip visible */
.slide-toggle.unavailable {
    opacity: 0.3;
    cursor: help;
}

.slide-toggle.unavailable input {
    pointer-events: none;
}

.btn-config-mini.unavailable {
    opacity: 0.3;
    cursor: help;
    pointer-events: auto;
}

/* Highlight changed values */
.control-panel-changed {
    background-color: #fef3c7 !important;
}

.slide-toggle.changed .slider {
    box-shadow: 0 0 0 2px #f59e0b;
}

/* AUTO + Actuator group */
.auto-actuator-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 20px;  /* Fixed height to prevent shrinking */
}

.actuator-group {
    display: inline-flex;
    gap: 2px;
    margin-left: 4px;
    height: 20px;  /* Fixed height to prevent shrinking */
}

.actuator-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
}

.actuator-checkbox input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.actuator-checkbox .actuator-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    background: #f1f5f9;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.actuator-checkbox input:checked + .actuator-symbol {
    background: #228479;
    border-color: #228479;
    color: white;
}

.actuator-checkbox:hover .actuator-symbol {
    border-color: #228479;
}

.actuator-checkbox.changed .actuator-symbol {
    box-shadow: 0 0 0 2px #f59e0b;
}

/* Submit button spinner */
.submit-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

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

/* ==================== Profile Configuration Styles ==================== */

/* Profile Editor Modal - Full Height Layout */
#profileEditorModal .modal-content {
    height: 85vh;
    max-height: 700px;
    display: flex;
    flex-direction: column;
}

#profileEditorModal .modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding-bottom: 0;
}

#profileEditorContent {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Profile Editor Layout */
.profile-editor-container {
    display: flex;
    gap: 16px;
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    align-items: stretch;
}

.profile-table-panel {
    width: 280px;
    flex-shrink: 0;  /* Don't shrink width */
    min-height: 0;
    height: 480px;  /* Fixed height - enables scrolling */
    overflow-x: hidden;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.profile-chart-panel {
    flex: 1;
    min-width: 0;
    max-width: calc(100% - 300px);
    height: 480px;  /* Match table panel */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#profileChartContainer {
    flex: 1;
    min-height: 0;
    width: 100%;
    height: 100%;
}

/* Profile Data Table */
#profileDataTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

#profileDataTable th,
#profileDataTable td {
    padding: 3px 6px;
    border: 1px solid #e5e7eb;
    text-align: right;
}

#profileDataTable th {
    background: #f3f4f6;
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 1;
}

#profileDataTable .row-num {
    background: #f9fafb;
    color: #6b7280;
    font-size: 0.75rem;
    text-align: center;
    width: 30px;
}

#profileDataTable input {
    width: 60px;
    padding: 2px 4px;
    border: 1px solid transparent;
    text-align: right;
    background: transparent;
    font-size: 0.8rem;
}

#profileDataTable input:focus {
    border-color: #667eea;
    background: white;
    outline: none;
    border-radius: 2px;
}

#profileDataTable input.cell-changed {
    background: #fef3c7;
}

/* Profiles List Table */
.profiles-table {
    width: 100%;
    border-collapse: collapse;
}

.profiles-table th,
.profiles-table td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.profiles-table th {
    background: #f3f4f6;
    font-weight: 500;
}

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

/* Configure button for profiles */
.btn-config {
    padding: 4px 12px;
    font-size: 0.75rem;
    border: 1px solid #667eea;
    border-radius: 4px;
    background: white;
    color: #667eea;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-config:hover {
    background: #667eea;
    color: white;
}

/* Mini config button for Control Panel PROFILE column */
.btn-config-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 20px;  /* Same height as slide-toggle */
    padding: 0 8px;  /* Horizontal padding for click area */
    font-size: 20px;  /* Gear fills the height */
    line-height: 1;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-config-mini:hover {
    color: #667eea;
}

.btn-config-mini.loading {
    opacity: 0.4;
}

/* Profile toggle group (toggle + config button) */
.profile-toggle-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 20px;  /* Fixed height to prevent shrinking */
}

/* =============================================================================
   UDF Generator Panel
   ============================================================================= */

#udfPanel {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 85%;
    max-width: 900px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.udf-panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
}

.udf-panel-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

.udf-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.udf-close-btn:hover {
    color: #111827;
}

.udf-panel-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.udf-code-container {
    max-height: 350px;
    overflow-y: auto;
    margin-bottom: 12px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.udf-code-container pre {
    margin: 0;
    border-radius: 8px;
    font-size: 0.85rem;
}

.udf-code-container code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.udf-validation-status {
    padding: 8px 12px;
    margin-bottom: 12px;
    font-size: 0.85rem;
}

.udf-status-ok {
    color: #059669;
    font-weight: 500;
}

.udf-status-warning {
    color: #d97706;
    font-weight: 500;
}

.udf-status-error {
    color: #dc2626;
    font-weight: 500;
}

.udf-status-info {
    color: #6b7280;
    font-size: 0.8rem;
}

.udf-errors {
    color: #dc2626;
}

.udf-warnings {
    color: #d97706;
}

.udf-params-section {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.udf-params-col {
    flex: 1;
    background: #f9fafb;
    border-radius: 8px;
    padding: 12px;
}

.udf-params-col h4 {
    margin: 0 0 8px 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}

.udf-params-list {
    font-size: 0.85rem;
}

.udf-param-item {
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.udf-param-name {
    font-family: 'Consolas', 'Monaco', monospace;
    color: #1f2937;
}

.udf-param-pos {
    color: #9ca3af;
    font-size: 0.75rem;
}

.udf-param-none {
    color: #9ca3af;
    font-style: italic;
}

.udf-actions {
    border-top: 1px solid #e5e7eb;
    padding-top: 16px;
}

.udf-actions-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.udf-actions-row label {
    font-size: 0.85rem;
    color: #374151;
    min-width: 100px;
}

.udf-actions-row input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
}

.udf-actions-row input[type="text"]:focus {
    outline: none;
    border-color: #228479;
    box-shadow: 0 0 0 2px rgba(34, 132, 121, 0.1);
}

.udf-actions-row input[type="checkbox"] {
    margin-right: 6px;
}

.udf-actions-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}

.udf-loading {
    text-align: center;
    padding: 40px;
    color: #6b7280;
    font-size: 0.9rem;
}

/* Responsive: Hide button text on narrow screens */
@media (max-width: 768px) {
    #deepThinkContainer .btn-text {
        display: none;
    }
}
