/**
 * AICC Agents Module Styles
 */

/* ==================== MAIN NAVIGATION TABS ==================== */

/* Make ai-interface the positioning context for tabs */
.ai-interface {
    position: relative;
}

/* Tab bar positioned absolutely above the right panel, centered */
.main-nav-tabs {
    display: flex;
    justify-content: center;
    gap: 0;
    position: absolute;
    top: -42px;
    /* Center within the right panel: start at 40% + gap, span 60% width */
    left: calc(40% + 2rem);
    right: 0;
    z-index: 5;
}

/* Main panel layout - fills grid cell completely */
.main-panel {
    gap: 0 !important;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.nav-tab {
    padding: 10px 24px;
    background: #fff;  /* White when not selected */
    color: #666;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 10px 10px 0 0;
    border: 1px solid var(--border-color, #dee2e6);
    border-bottom: none;
    transition: background 0.2s, color 0.2s;
}

.nav-tab:hover:not(.active) {
    background: #f0f0f0;
    color: #444;
}

.nav-tab.active {
    background: #dbeafe;  /* Light blue when selected */
    color: #1d4ed8;
    border-color: var(--border-color, #dee2e6);
}

.nav-tab i {
    font-size: 14px;
}

/* Main Tab Content - show/hide */
.main-tab-content {
    display: none;
}

.main-tab-content.active {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1;
    overflow: hidden;
    height: 100%;
}

/* ==================== AGENTS CONTAINER PANEL ==================== */

.agents-container-panel {
    background: var(--secondary-bg, #f8f9fa);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* Agent Tab Bar */
.agents-tab-bar {
    display: flex;
    background: var(--secondary-bg, #f1f5f9);
    border-bottom: 1px solid var(--border-color, #dee2e6);
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    margin: -1.5rem -1.5rem 1rem -1.5rem;
}
.agents-tab {
    all: unset;
    flex: 1;
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    text-align: center;
    border-right: 1px solid var(--border-color, #dee2e6);
    box-sizing: border-box;
}
.agents-tab:last-child { border-right: none; }
.agents-tab:hover { background: rgba(0,0,0,0.03); color: #334155; }
.agents-tab.active {
    color: #1565c0;
    background: var(--card-bg, #fff);
    box-shadow: inset 0 -2px 0 #1565c0;
}
.agents-tab i { margin-right: 5px; }

.agents-tab-panel { display: none; }
.agents-tab-panel.active { display: block; }

.agents-inventory-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 4px 0 8px;
}
#agents-tpl-toggle.active {
    background: #2563eb !important;
}
#agents-tpl-toggle.active::after {
    transform: translateX(14px) !important;
}

.agents-build-form {
    padding: 4px 0;
    overflow-y: auto;
    max-height: calc(100vh - 280px);
}

.agents-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color, #dee2e6);
}

.agents-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #333);
}

.btn-icon-square {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #1976D2;
    background: #2196F3;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-icon-square:hover {
    transform: scale(1.05);
    background: #1976D2;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.4);
}

.agents-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
    overflow-y: auto;
}

/* Individual Agent Card */
.agent-card-simple {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: all 0.2s;
}

.agent-card-simple:hover {
    border-color: #2196F3;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.15);
}

.agent-card-simple.selected {
    background: #dbeafe;
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

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

.agent-card-info h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #333);
}

.agent-card-info p {
    margin: 0;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.agent-card-info .agent-meta {
    margin-top: 6px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.agent-card-actions {
    display: flex;
    gap: 6px;
    margin-left: 1rem;
    flex-shrink: 0;
}

.agent-card-actions .btn-action {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border-color, #dee2e6);
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 13px;
    transition: all 0.2s;
}

.agent-card-actions .btn-action:hover {
    background: #f0f0f0;
    color: #333;
}

.agent-card-actions .btn-action.btn-chat {
    background: #2196F3;
    border-color: #1976D2;
    color: #fff;
}

.agent-card-actions .btn-action.btn-chat:hover {
    background: #1976D2;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.4);
}

/* Empty state for agents */
.agents-empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #888;
}

.agents-empty-state i {
    font-size: 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.agents-empty-state p {
    margin: 0 0 1rem 0;
    font-size: 14px;
}

/* ==================== AGENTS LIST (legacy - can be removed later) ==================== */

.agents-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    height: calc(100vh - 200px);
    min-height: 500px;
}

.agents-sidebar {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.agents-sidebar-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.agents-sidebar-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

#agents-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.agent-card {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
    border: 1px solid transparent;
}

.agent-card:hover {
    background: #f5f5f5;
}

.agent-card.selected {
    background: #e3f2fd;
    border-color: #2196f3;
}

.agent-card.active .agent-avatar {
    border-color: #4caf50;
}

.agent-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #2196F3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    flex-shrink: 0;
    border: 2px solid transparent;
    overflow: hidden;
}

.agent-avatar.large {
    width: 64px;
    height: 64px;
    font-size: 28px;
}

.agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.agent-info {
    flex: 1;
    margin-left: 12px;
    min-width: 0;
}

.agent-info h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-info p {
    margin: 0;
    font-size: 12px;
    color: #666;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.agent-meta {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.agent-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.agent-card:hover .agent-actions {
    opacity: 1;
}

/* ==================== BADGES ==================== */

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    background: #e0e0e0;
    color: #666;
}

.badge-draft { background: #fff3e0; color: #e65100; }
.badge-active { background: #e8f5e9; color: #2e7d32; }
.badge-paused { background: #fce4ec; color: #c2185b; }
.badge-archived { background: #f5f5f5; color: #757575; }
.badge-info { background: #e3f2fd; color: #1565c0; }

.model-badge {
    font-size: 10px;
    color: #888;
}

/* ==================== AGENT DETAIL ==================== */

#agent-detail {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 20px;
    display: none;
}

.agent-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.agent-title {
    flex: 1;
}

.agent-title h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
}

.agent-title p {
    margin: 0 0 12px 0;
    color: #666;
}

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

.agent-conversations {
    margin-top: 20px;
}

.agent-conversations h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: #666;
}

/* ==================== CONVERSATIONS LIST ==================== */

.conversation-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

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

.conversation-item.active {
    background: #e3f2fd;
}

.conv-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    flex-shrink: 0;
}

.conv-info {
    flex: 1;
    margin-left: 10px;
    min-width: 0;
}

.conv-info h5 {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-time {
    font-size: 11px;
    color: #888;
}

/* ==================== CHAT PANEL ==================== */

.chat-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 450px;
    height: calc(100vh - 120px);
    max-height: 800px;
    background: #fff;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    border-radius: 10px;
    display: none;
    flex-direction: column;
    z-index: 10050;
    overflow: hidden;
}

.chat-panel.open {
    display: flex;
}

.chat-panel.dragging {
    user-select: none;
    cursor: grabbing;
}

.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    cursor: grab;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.chat-agent-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-agent-info .agent-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
}

.chat-agent-info h4 {
    margin: 0;
    font-size: 16px;
}

.chat-agent-info .model-info {
    font-size: 12px;
    opacity: 0.8;
}

.chat-header .btn-icon {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.chat-header .btn-icon:hover {
    background: rgba(255,255,255,0.2);
}

/* ==================== CHAT MESSAGES ==================== */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    animation: messageIn 0.3s ease;
}

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

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.message.user .message-avatar {
    background: #2196f3;
    color: #fff;
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.message.system .message-avatar {
    background: #ff9800;
    color: #fff;
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;
}

.message.user .message-content {
    background: #2196f3;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message.system .message-content {
    background: #fff3e0;
    color: #e65100;
    font-size: 13px;
}

.message-content code {
    background: rgba(0,0,0,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
}

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

.message-content pre code {
    background: transparent;
    padding: 0;
}

/* Typing indicator */
.typing-indicator .message-content {
    padding: 16px 20px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingDot {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ==================== CHAT INPUT ==================== */

.chat-input-container {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    background: #fff;
}

.chat-input-container textarea {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    resize: none;
    max-height: 150px;
    line-height: 1.4;
    font-family: inherit;
}

.chat-input-container textarea:focus {
    outline: none;
    border-color: #667eea;
}

.chat-input-container button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, opacity 0.2s;
}

.chat-input-container button:hover {
    transform: scale(1.05);
}

.chat-input-container button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ==================== MODALS ==================== */

/* Agent modals - use specific IDs to avoid conflicts with other modals */
#create-agent-modal,
#edit-agent-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#create-agent-modal > .modal,
#edit-agent-modal > .modal,
#schedule-modal > .modal {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    margin: 0;
    position: relative;
}

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

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* ==================== CREATE AGENT OPTIONS ==================== */

.create-agent-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.option-card {
    padding: 30px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.option-card:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.option-card i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 16px;
}

.option-card h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
}

.option-card p {
    margin: 0;
    font-size: 13px;
    color: #666;
}

/* ==================== TEMPLATES GRID ==================== */

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.template-card {
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.template-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.template-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    color: #fff;
    font-size: 24px;
}

.template-card h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
}

.template-card p {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: #666;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==================== FORMS ==================== */

#agent-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    font-size: 11px;
    color: #888;
}

.form-group input[type="range"] {
    width: 100%;
}

#temp-value {
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
}

/* ==================== TOOLS CHECKBOXES ==================== */

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    padding: 10px;
    background: #f9fafb;
    border-radius: 6px;
}

.tool-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.tool-checkbox:hover {
    background: #fff;
}

.tool-checkbox input {
    margin-top: 3px;
}

.tool-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tool-info i {
    color: #667eea;
    margin-right: 6px;
}

.tool-info strong {
    font-size: 13px;
}

.tool-info small {
    font-size: 11px;
    color: #888;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tool-info small:hover {
    -webkit-line-clamp: unset;
    line-clamp: unset;
    overflow: visible;
}

/* ==================== FORM ACTIONS ==================== */

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
    margin-top: 8px;
}

/* ==================== BUTTONS ==================== */

.btn {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-danger {
    background: #fff;
    color: #f44336;
    border: 1px solid #f44336;
}

.btn-danger:hover {
    background: #f44336;
    color: #fff;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #f5f5f5;
    color: #333;
}

.btn-icon.small {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

/* ==================== EMPTY STATE ==================== */

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    margin: 0 0 20px 0;
}

.empty-state.small {
    padding: 20px;
}

.empty-state.small i {
    font-size: 32px;
}

/* ==================== SWARM DISSENT PANEL ==================== */

.swarm-dissent-panel {
    margin-top: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    font-size: 12px;
    overflow: hidden;
}

.swarm-dissent-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
    background: #f1f5f9;
    border-bottom: 1px solid transparent;
    transition: background 0.15s;
}

.swarm-dissent-toggle:hover {
    background: #e2e8f0;
}

.swarm-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.swarm-status-badge.approved { background: #d1fae5; color: #065f46; }
.swarm-status-badge.dissent  { background: #fef3c7; color: #92400e; }
.swarm-status-badge.warning  { background: #fef3c7; color: #92400e; }
.swarm-status-badge.rejected { background: #fee2e2; color: #991b1b; }

.swarm-tier-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: #dbeafe;
    color: #1e40af;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.swarm-summary {
    flex: 1;
    color: #64748b;
    font-size: 11px;
}

.swarm-toggle-icon {
    color: #94a3b8;
    transition: transform 0.2s;
}

.swarm-dissent-content {
    padding: 8px 12px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}

.swarm-vote {
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
}

.swarm-vote:last-child {
    border-bottom: none;
}

.swarm-vote-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.swarm-vote-role {
    font-weight: 600;
    color: #334155;
    text-transform: capitalize;
    min-width: 140px;
}

.swarm-vote-vendor {
    color: #64748b;
    font-family: monospace;
    font-size: 11px;
    flex: 1;
    min-width: 200px;
}

.swarm-vote-decision {
    font-weight: 600;
    font-size: 11px;
    text-transform: capitalize;
    padding: 2px 6px;
    border-radius: 3px;
}

.swarm-vote-decision.approve { background: #d1fae5; color: #065f46; }
.swarm-vote-decision.reject  { background: #fee2e2; color: #991b1b; }
.swarm-vote-decision.flag    { background: #fef3c7; color: #92400e; }
.swarm-vote-decision.error   { background: #f3f4f6; color: #6b7280; }

.swarm-vote-latency {
    color: #94a3b8;
    font-size: 11px;
    font-family: monospace;
}

.swarm-vote-reason {
    margin-top: 4px;
    margin-left: 4px;
    color: #475569;
    font-size: 11px;
    line-height: 1.4;
    font-style: italic;
}

.swarm-vote-reason.swarm-vote-error {
    color: #991b1b;
    font-style: normal;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
    .agents-container {
        grid-template-columns: 1fr;
    }

    .chat-panel {
        width: calc(100vw - 20px);
        max-width: 100%;
        left: 10px;
        right: 10px;
        top: 60px;
        height: calc(100vh - 80px);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .create-agent-options {
        grid-template-columns: 1fr;
    }

    .modal {
        width: 95%;
        max-height: 95vh;
    }
}
/* ==================== EMAIL PANEL ==================== */

.email-container-panel {
    background: var(--secondary-bg, #f8f9fa);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.email-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color, #dee2e6);
}

.email-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #333);
}

.email-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
}

.email-form .form-group {
    margin-bottom: 1rem;
}

.email-form .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
}

.email-form .form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.email-form .form-control:focus {
    outline: none;
    border-color: #667eea;
}

.email-form textarea.form-control {
    resize: vertical;
    min-height: 150px;
}

.email-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, #dee2e6);
    margin-top: auto;
}

.email-model-select {
    display: flex;
    align-items: center;
    gap: 8px;
}

.email-model-select label {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
}

.email-model-select .form-select {
    width: auto;
    min-width: 150px;
}

/* ==================== SCHEDULE MODAL ==================== */

.schedules-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

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

.schedule-item.inactive {
    opacity: 0.6;
    background: #f5f5f5;
}

.schedule-info h5 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
}

.schedule-details {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #666;
}

.schedule-details span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.schedule-actions-inline {
    display: flex;
    gap: 4px;
}

.schedule-actions-inline .btn-icon {
    padding: 6px;
    border-radius: 4px;
}

.schedule-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.schedule-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.schedule-picker select {
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    min-width: 120px;
}

.output-options {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: all 0.2s;
}

.radio-option:has(input:checked) {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.radio-option input {
    margin: 0;
}

.radio-option span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

#schedule-form .form-group {
    margin-bottom: 16px;
}

#schedule-form label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #333;
}

#schedule-form input[type="text"],
#schedule-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

#schedule-form input:focus,
#schedule-form textarea:focus,
#schedule-form select:focus {
    outline: none;
    border-color: #667eea;
}

#schedule-form small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #888;
}

#schedule-form .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid #e0e0e0;
}
