:root {
    --bg-primary: #05060f; /* Bleu-noir très sombre */
    --bg-sidebar: #080914; /* Bleu encore plus sombre pour la sidebar */
    --bg-card: rgba(13, 16, 31, 0.85); /* Fond de carte bleu sombre */
    --border-color: rgba(139, 92, 246, 0.12); /* Bordures légèrement violettes */
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --color-accent: #a855f7; /* Violet néon uni */
    --color-pink: #d946ef; /* Magenta de secours */
    --color-accent-glow: rgba(168, 85, 247, 0.15);
    --color-success: #10b981;
    --color-error: #ef4444;
    --color-info: #a855f7;
    
    --font-main: 'Outfit', sans-serif;
    --radius-lg: 16px;
    --radius-md: 12px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-main);
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Lueur néon double : Bleu sombre et Violet */
.glow-bg {
    position: absolute;
    top: -10%;
    left: 20%;
    width: 900px;
    height: 900px;
    background: radial-gradient(circle at 30% 30%, rgba(37, 99, 235, 0.1) 0%, transparent 60%),
                radial-gradient(circle at 70% 70%, rgba(168, 85, 247, 0.12) 0%, transparent 60%);
    z-index: -1;
    pointer-events: none;
    filter: blur(80px);
    animation: pulse 10s infinite alternate;
}

@keyframes pulse {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(5%, 5%) scale(1.1); }
}

/* Container Global */
.dashboard-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 2rem;
    z-index: 10;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100vh;
    overflow-y: auto;
    box-sizing: border-box;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 3rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-accent);
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.3);
}

.logo .icon {
    font-size: 1.5rem;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 12px 16px;
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 600;
    text-align: left;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition-smooth);
}

.nav-item:hover, .nav-item.active {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    background: linear-gradient(90deg, var(--color-accent-glow) 0%, transparent 100%);
    border-left: 3px solid var(--color-accent);
}

.sidebar-footer {
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    padding: 2rem;
    width: calc(100% - 280px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.top-bar h2 {
    font-weight: 700;
    font-size: 1.8rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: rgba(255, 255, 255, 0.04);
    padding: 6px 16px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
}

/* Tabs */
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

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

/* Cards (Glassmorphism) */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.card h3 {
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1.3rem;
}

.card-hero {
    background: linear-gradient(135deg, rgba(0, 242, 254, 0.08) 0%, rgba(255, 0, 127, 0.04) 100%);
    border: 1px solid rgba(0, 242, 254, 0.2);
}

.card-hero p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 1.1rem;
}

/* Layouts */
.grid-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

/* Boutons */
.btn {
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--text-primary);
    box-shadow: 0 4px 14px 0 rgba(168, 85, 247, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(168, 85, 247, 0.45);
    background-color: #9333ea;
}

.btn-secondary {
    background-color: rgba(168, 85, 247, 0.12);
    color: var(--text-primary);
    border: 1px solid rgba(168, 85, 247, 0.35);
}

.btn-secondary:hover {
    background-color: rgba(168, 85, 247, 0.25);
    border-color: var(--color-accent);
}

/* Status Widget */
.status-indicator-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 1.5rem 0;
}

.status-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background-color: var(--color-success);
    box-shadow: 0 0 12px var(--color-success);
}

.status-dot.offline {
    background-color: var(--color-error);
    box-shadow: 0 0 12px var(--color-error);
}

.status-dot.sleeping {
    background-color: #f59e0b;
    box-shadow: 0 0 12px #f59e0b;
}

.status-text {
    font-weight: 700;
    font-size: 1.2rem;
}

.status-details {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* Éditeur Style Profile */
.style-card {
    height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.editor-container {
    flex-grow: 1;
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

#style-editor {
    width: 100%;
    height: 100%;
    background-color: #060913;
    color: #e2e8f0;
    font-family: 'Consolas', 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    padding: 1.5rem;
    border: none;
    resize: none;
    outline: none;
    line-height: 1.5;
}

/* Alertes */
.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin: 1.5rem 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

/* Veille Steps */
.info-steps {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2rem 0;
}

.step {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.step-num {
    background-color: var(--color-accent);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.step h4 {
    margin-bottom: 4px;
}

.step p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Premium Top-Center Toast Notification */
.toast-container {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translate(-50%, -30px);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.4s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.toast-container.show {
    transform: translate(-50%, 0);
    opacity: 1;
    pointer-events: auto;
}

.toast-container.hide-drift {
    transform: translate(-50%, 15px);
    opacity: 0;
    pointer-events: none;
}

.toast-border-wrap {
    position: relative;
    padding: 2px; /* Border thickness */
    border-radius: 30px;
    background: #0d101f;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(168, 85, 247, 0.25);
    display: inline-flex;
}

/* Conic gradient rotating background for the liseret */
.toast-border-wrap::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
    background: conic-gradient(from 0deg, transparent 30%, #00d2fe, #a855f7, transparent 70%);
    animation: toast-border-spin 3s linear infinite;
    z-index: 1;
}

/* Error-specific liseret */
.toast-border-wrap.toast-error::before {
    background: conic-gradient(from 0deg, transparent 30%, #f87171, #ef4444, transparent 70%);
}

@keyframes toast-border-spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.toast-inner-content {
    position: relative;
    z-index: 2;
    background: #0d101f;
    color: var(--text-primary);
    padding: 10px 24px;
    border-radius: 28px;
    font-weight: 600;
    font-size: 0.88rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Responsive (Mobile/Tablette) */
@media (max-width: 900px) {
    .dashboard-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 1.5rem;
    }
    
    .logo {
        margin-bottom: 1.5rem;
    }
    
    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 5px;
    }
    
    .main-content {
        width: 100%;
        padding: 1.5rem;
    }
    
    .grid-layout {
        grid-template-columns: 1fr;
    }
    
    .style-card {
        height: 60vh;
    }
    
    .card-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .card-header .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Requêtes Dev Styles */
.requests-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 1rem;
}

.request-item {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    transition: var(--transition-smooth);
}

.request-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(139, 92, 246, 0.3);
}

.request-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.request-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.request-text {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.status-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.status-badge.pending {
    background-color: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.completed {
    background-color: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Chat Dev Styles */
.chat-messages {
    scroll-behavior: smooth;
}

.message-bubble {
    max-width: 80%;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    line-height: 1.5;
    font-size: 0.95rem;
    word-break: break-word;
}

.message-bubble.user {
    align-self: flex-end;
    background-color: var(--color-accent);
    color: var(--text-primary);
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

.message-bubble.model {
    align-self: flex-start;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.message-bubble pre {
    background-color: #060913;
    padding: 12px;
    border-radius: 6px;
    margin: 8px 0;
    overflow-x: auto;
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
}

.message-bubble code {
    font-family: 'Consolas', monospace;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.typing-indicator {
    align-self: flex-start;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

/* Switch styling */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #1e293b;
  transition: .4s;
  border: 1px solid var(--border-color);
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--color-success);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.slider.round {
  border-radius: 24px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Styles pour le Flux RSS */
#rss-news-feed {
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    padding-right: 5px;
}

.news-tile-card {
    display: flex;
    gap: 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    transition: var(--transition-smooth);
    align-items: flex-start;
}

.news-tile-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--color-accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.1);
}

.news-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #ffffff;
    flex-shrink: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.news-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.news-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.news-source-tag {
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    background: var(--color-accent-glow);
    color: var(--color-accent);
    padding: 2px 6px;
    border-radius: 4px;
}

.news-date {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.news-title {
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.35;
}

.news-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition-smooth);
}

.news-title a:hover {
    color: var(--color-pink);
}

.news-summary {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.45;
}


/* Styles pour les Scripts */
.script-list-item {
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: var(--transition-smooth);
    text-align: left;
}
.script-list-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--color-accent);
}
.script-list-item.active {
    background: rgba(168, 85, 247, 0.08);
    border-color: var(--color-accent);
}
.script-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.script-item-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Styles pour les Agents */
.agents-grid-col {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1 1 300px;
    min-width: 280px;
}
.agent-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: var(--transition-smooth);
    backdrop-filter: blur(10px);
    user-select: none;
    -webkit-user-select: none;
    position: relative; /* Permet la gestion du z-index */
    break-inside: avoid; /* Évite de couper la carte entre deux colonnes */
    margin-bottom: 1.5rem; /* Espace vertical entre les cartes */
}
.agent-card.compact {
    padding: 10px 14px;
    flex-direction: column;
    gap: 0;
    margin-bottom: 0;
    border-radius: var(--radius-md);
    cursor: default;
    box-sizing: border-box;
}
.agent-card.compact:not(.expanded) {
    height: 62px;
    overflow: hidden;
    display: flex;
    justify-content: center;
}
.agent-card.compact .agent-header {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    padding-right: 18px;
}
.agent-card.compact .agent-icon {
    font-size: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.agent-card.compact .agent-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    flex-grow: 1;
}
.agent-card.compact .agent-info h4 {
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.2;
    font-weight: 600;
}
.agent-card.compact .agent-info p {
    display: none;
}
.agent-card.compact.expanded {
    grid-column: 1 / -1;
    height: auto;
    padding: 1.5rem;
}
.agent-card.compact.expanded .agent-info p {
    display: block;
    font-size: 0.74rem;
}
.agent-card.compact.expanded .agent-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 10px;
}
.agent-card.compact:hover {
    transform: translateY(-2px);
    border-color: var(--color-accent);
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.2);
}
.agent-card:has(.agent-custom-select.open) {
    z-index: 100; /* Passe au-dessus des autres cartes */
}
.agent-textarea {
    user-select: text;
    -webkit-user-select: text;
}
.agent-card:hover {
    border-color: var(--color-accent);
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.1);
}
.agent-header {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    position: relative;
    padding-right: 24px;
    user-select: none;
}
.agent-header::after {
    content: "▼";
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.72rem;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}
.agent-card.expanded .agent-header::after {
    transform: translateY(-50%) rotate(180deg);
    color: var(--color-accent);
}
.agent-details {
    display: none;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}
.agent-card.expanded .agent-details {
    display: flex;
}
.agent-icon {
    font-size: 1.6rem;
}
.agent-info h4 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--text-primary);
}
.agent-info p {
    margin: 3px 0 0 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.agent-textarea {
    flex-grow: 1;
    min-height: 180px;
    background: #060913;
    color: #e2e8f0;
    font-family: 'Consolas', monospace;
    font-size: 0.8rem;
    line-height: 1.4;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    resize: vertical;
    outline: none;
    transition: var(--transition-smooth);
}
.agent-textarea:focus {
    border-color: var(--color-accent);
}

/* ===== Custom Agent Model Dropdown (replaces native <select>) ===== */
.agent-custom-select {
    position: relative;
    flex-grow: 1;
    font-size: 0.74rem;
    user-select: none;
    -webkit-user-select: none;
}

.agent-custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #0d101f;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-height: 30px;
}

.agent-custom-select-trigger:hover,
.agent-custom-select.open .agent-custom-select-trigger {
    border-color: var(--color-accent);
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.15);
}

.agent-custom-select-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}

.agent-custom-select-arrow {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.agent-custom-select.open .agent-custom-select-arrow {
    transform: rotate(180deg);
    color: var(--color-accent);
}

.agent-custom-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #0d101f;
    border: 1px solid rgba(168, 85, 247, 0.35);
    border-radius: 8px;
    overflow: hidden;
    z-index: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(168, 85, 247, 0.1);
    animation: dropdownSlide 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.agent-custom-select.open .agent-custom-select-dropdown {
    display: block;
}

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

.agent-dropdown-item {
    padding: 8px 12px;
    font-size: 0.74rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.agent-dropdown-item:last-child {
    border-bottom: none;
}

.agent-dropdown-item:hover {
    background: rgba(168, 85, 247, 0.12);
    color: var(--text-primary);
}

/* ===== Options d'agents personnalisées ===== */
.agent-options-group {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px 12px;
}

.option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.option-row:last-child {
    margin-bottom: 0;
}

.option-row-vertical {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
}

.option-row-vertical:last-child {
    margin-bottom: 0;
}

.option-row label,
.option-row-vertical label,
.agent-options-group label {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.agent-select {
    background-color: #060913;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.74rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.agent-select:focus {
    border-color: var(--color-accent);
}

.agent-input {
    background-color: #060913;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.74rem;
    outline: none;
    transition: border-color 0.2s;
}

.agent-input:focus {
    border-color: var(--color-accent);
}

/* Sliders premium */
.agent-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--border-color);
    outline: none;
    margin: 6px 0;
}

.agent-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.agent-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Tags de thèmes d'humour */
.subjects-list-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 28px;
}

.subject-tag {
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: var(--text-primary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-delete-subject,
.btn-delete-catchphrase {
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: bold;
    line-height: 1;
    transition: color 0.15s;
}

.btn-delete-subject:hover,
.btn-delete-catchphrase:hover {
    color: #ef4444;
}

.catchphrase-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    padding: 3px 0;
}

.catchphrase-item:last-child {
    border-bottom: none;
}

.agent-dropdown-item.selected {
    background: rgba(168, 85, 247, 0.18);
    color: var(--color-accent);
    font-weight: 600;
}

/* Gridstack Surcharges pour look Glassmorphism */
.grid-stack-item-content {
    background: var(--bg-card) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg);
    padding: 1.5rem !important;
    box-sizing: border-box !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
}

.grid-stack-item {
    margin-bottom: 0 !important;
}

/* Rendre les poignées de redimensionnement invisibles mais pleinement fonctionnelles */
.ui-resizable-handle {
    background-image: none !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    filter: none !important;
    transition: none !important;
}
.ui-resizable-handle:hover {
    transform: none !important;
    filter: none !important;
}

/* Actions interactives sur les tuiles d'actualités (dismiss & view) */
.btn-news-action {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    opacity: 0.5;
    transition: var(--transition-smooth);
    padding: 3px 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.btn-news-action:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.08);
}

.btn-dismiss-news {
    color: #ef4444 !important; /* Croix rouge */
}

.btn-view-news {
    color: var(--color-accent) !important; /* Flèche violette */
}

/* Modal Glassmorphism */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.25s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: #0d101f;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 440px;
    padding: 1.5rem;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.7), 0 0 25px rgba(168, 85, 247, 0.15);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition-smooth);
}

.modal-close:hover {
    color: #ef4444;
}

.modal-input {
    width: 100%;
    background-color: #060913;
    color: #e2e8f0;
    font-family: var(--font-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    outline: none;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
}

.modal-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.15);
}

.keyword-badge {
    background: rgba(168, 85, 247, 0.1);
    color: var(--color-accent);
    border: 1px solid rgba(168, 85, 247, 0.25);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    position: relative;
    gap: 5px;
}

.keyword-badge:hover {
    background: rgba(168, 85, 247, 0.25);
    border-color: var(--color-accent);
    color: #ffffff;
}

.keyword-badge.selected {
    background: var(--color-accent) !important;
    color: #ffffff !important;
    border-color: var(--color-accent) !important;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

.keyword-badge .keyword-dismiss {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    font-size: 0.6rem;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-left: 2px;
    flex-shrink: 0;
}

.keyword-badge .keyword-dismiss:hover {
    background: rgba(239, 68, 68, 0.5);
    color: #ffffff;
    transform: scale(1.15);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.btn-not-interested {
    color: var(--text-secondary) !important;
    opacity: 0.75;
    font-size: 0.74rem !important;
    font-weight: 600 !important;
    font-family: var(--font-main), sans-serif;
    gap: 4px;
}

.btn-not-interested:hover {
    opacity: 1;
    color: #f43f5e !important;
    background: rgba(244, 63, 94, 0.08) !important;
}

/* YouTube Studio Widget */
.yt-video-card:hover {
    background: rgba(255, 0, 0, 0.05) !important;
    border-color: rgba(255, 0, 0, 0.25) !important;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.1);
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.6; }
}

/* YouTube Sub Tabs styling */
.yt-sub-tab {
    transition: all 0.2s ease;
}
.yt-sub-tab:hover {
    color: var(--text-primary) !important;
}
.yt-sub-tab.active {
    border-bottom-color: #ff0000 !important;
    color: var(--text-primary) !important;
}

/* YouTube Comments styling */
.yt-comment-card {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.72rem;
    transition: border-color 0.2s;
}
.yt-comment-card:hover {
    border-color: rgba(255, 0, 0, 0.15);
}
.yt-comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
}
.yt-comment-author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}
.yt-comment-author-name {
    font-weight: 700;
    color: var(--text-primary);
}
.yt-comment-time {
    color: var(--text-muted);
    font-size: 0.65rem;
}
.yt-comment-text {
    color: var(--text-secondary);
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
}
.yt-comment-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2px;
}
.btn-yt-comment-reply {
    background: none;
    border: none;
    color: var(--color-accent);
    cursor: pointer;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.2s;
    outline: none;
}
.btn-yt-comment-reply:hover {
    background: rgba(168, 85, 247, 0.1);
}

/* Local persistent replies styling */
.yt-nested-reply {
    margin-left: 10px;
    padding-left: 10px;
    border-left: 2px solid var(--color-accent);
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.02);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    margin-top: 6px;
}

/* Reply input slide down area */
.yt-reply-input-area {
    display: none;
    margin-top: 6px;
    gap: 6px;
    border-top: 1px dashed var(--border-color);
    padding-top: 6px;
}
.yt-reply-input {
    flex-grow: 1;
    background: #020617;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.7rem;
    padding: 4px 8px;
    outline: none;
    font-family: var(--font-main);
}
.yt-reply-input:focus {
    border-color: #ff0000;
}
.btn-yt-reply-send {
    background: #ff0000;
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    cursor: pointer;
    font-size: 0.68rem;
    font-weight: bold;
    padding: 4px 10px;
    transition: background 0.2s;
    outline: none;
}
.btn-yt-reply-send:hover {
    background: #cc0000;
}

/* Post-it Notes custom styles */
#notes-status-badge {
    background: rgba(168, 85, 247, 0.08);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}
#notes-editor {
    transition: var(--transition-smooth);
}
#notes-editor:focus {
    background-color: #030409 !important;
}
#quick-note-editor:focus {
    border-color: var(--color-accent) !important;
    background-color: #030409 !important;
}
#quick-note-status {
    transition: var(--transition-smooth);
}
#dashboard-notes-textarea:focus {
    border-color: var(--color-accent) !important;
    background-color: #030409 !important;
}
#btn-quick-note {
    background-color: rgba(168, 85, 247, 0.08);
    color: var(--text-primary);
    border: 1px solid rgba(168, 85, 247, 0.25);
    transition: var(--transition-smooth);
}
#btn-quick-note:hover {
    background-color: rgba(168, 85, 247, 0.2);
    border-color: var(--color-accent);
    transform: translateY(-1px);
}
#btn-dashboard-go-to-notes {
    transition: var(--transition-smooth);
}
#btn-dashboard-go-to-notes:hover {
    background-color: var(--color-accent) !important;
    color: #ffffff !important;
}

/* Actions Masquer/Réafficher sur les vidéos YouTube */
.btn-hide-video:hover {
    background-color: rgba(239, 68, 68, 0.2) !important;
    color: #ef4444 !important;
    transform: scale(1.1);
}
.btn-restore-video:hover {
    background-color: rgba(16, 185, 129, 0.2) !important;
    color: #10b981 !important;
    transform: scale(1.1);
}

/* Animation de rotation pour le rafraîchissement */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.spinning svg {
    animation: spin 1s linear infinite;
    color: var(--color-accent) !important;
}
#btn-header-restart-bot:hover {
    color: var(--color-accent) !important;
    transform: scale(1.15);
}
#btn-header-restart-bot:active {
    transform: scale(0.95);
}

/* Suggestion de Curateur IA */
.curator-suggestion-card {
    display: flex;
    gap: 14px;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.05) 0%, rgba(6, 182, 212, 0.05) 100%);
    border: 1px dashed rgba(168, 85, 247, 0.4);
    border-radius: var(--radius-md);
    padding: 14px;
    transition: var(--transition-smooth);
    align-items: flex-start;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.05);
    margin-bottom: 14px;
}

.curator-suggestion-card:hover {
    border-color: #a855f7;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.08) 0%, rgba(6, 182, 212, 0.08) 100%);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.15);
    transform: translateY(-1px);
}

.btn-interested {
    color: var(--color-success) !important;
}
.btn-interested:hover {
    background: rgba(16, 185, 129, 0.12) !important;
}

.btn-not-interested {
    color: var(--color-error) !important;
}
.btn-not-interested:hover {
    background: rgba(239, 68, 68, 0.12) !important;
}

.btn-curator-follow {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
}

.btn-curator-follow:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
}

.btn-curator-ignore {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-curator-ignore:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
}

.hidden {
    display: none !important;
}

#actus-iframe {
    background: #ffffff;
}

#actus-iframe.forced-dark {
    filter: invert(0.9) hue-rotate(180deg) !important;
    background: #000000 !important;
}

/* Drag and drop premium feel for Agents */
.agent-header * {
    pointer-events: none;
}
.agent-card {
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.agent-card.dragging {
    opacity: 0.4;
    transform: scale(0.98);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border: 2px dashed var(--color-accent) !important;
}

/* Styles pour les sous-onglets d'Actus */
.active-subtab {
    background-gradient: linear-gradient(90deg, var(--color-accent-glow) 0%, transparent 100%) !important;
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: var(--text-primary) !important;
    border-color: var(--color-accent) !important;
    border-bottom: 2px solid var(--color-accent) !important;
}

/* Sidebar pliée (collapsed) */
.sidebar.collapsed {
    width: 80px !important;
    padding: 2rem 0.5rem !important;
}
.sidebar.collapsed .logo h1 {
    display: none !important;
}
.sidebar.collapsed .logo {
    justify-content: center !important;
    margin-bottom: 2.5rem !important;
}
.sidebar.collapsed #btn-toggle-sidebar {
    right: 50% !important;
    transform: translateX(50%) !important;
}
.sidebar.collapsed .nav-item {
    font-size: 0 !important;
    gap: 0 !important;
    justify-content: center !important;
    padding: 12px 0 !important;
}
.sidebar.collapsed .nav-item .nav-icon {
    font-size: 1.3rem !important;
    margin-right: 0 !important;
}
.sidebar.collapsed .sidebar-footer {
    display: none !important;
}
.sidebar.collapsed ~ .main-content {
    width: calc(100% - 80px) !important;
}

/* Form controls (YouTube Downloader Inputs & others) in dark mode */
.form-control {
    background-color: #060913 !important;
    color: #e2e8f0 !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.6;
}

.form-control:focus {
    border-color: var(--color-accent) !important;
    background-color: #080d1a !important;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.2) !important;
}

/* Eviter le blanchissement des champs texte lors de l'autofill du navigateur */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active,
input:-internal-autofill-previewed,
input:-internal-autofill-selected {
    -webkit-box-shadow: 0 0 0 1000px #060913 inset !important;
    -webkit-text-fill-color: #e2e8f0 !important;
    color: #e2e8f0 !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Styling for agent model select dropdown to match the dark theme */
.agent-model-select,
.agent-model-select option {
    background-color: #0d101f !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

/* Hover style for interactive budget widget */
#cost-badge:hover {
    background: rgba(168, 85, 247, 0.1) !important;
    border-color: rgba(168, 85, 247, 0.4) !important;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.15);
}

/* --- Premium Script Editor Styles --- */
.editor-toolbar {
    background: rgba(8, 9, 20, 0.95) !important;
    backdrop-filter: blur(10px);
}

.editor-group {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.02);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.editor-separator {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0 4px;
}

.editor-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.editor-btn svg {
    transition: transform 0.2s ease;
}

.editor-btn:hover {
    background: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.3);
    color: var(--text-primary);
}

.editor-btn:hover svg {
    transform: scale(1.08);
}

.editor-btn.active {
    background: rgba(168, 85, 247, 0.25);
    border-color: var(--color-accent);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.2);
}

/* Color Presets as circular dots */
.editor-btn.color-preset {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-value);
    border: 1px solid rgba(255, 255, 255, 0.15);
    margin: 0 6px;
    position: relative;
    padding: 0;
    transition: all 0.2s ease;
}

.editor-btn.color-preset::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2.5px solid transparent;
    border-radius: 50%;
    transition: all 0.2s ease;
    pointer-events: none;
}

.editor-btn.color-preset:hover {
    transform: scale(1.2);
    border-color: #ffffff;
}

.editor-btn.color-preset:hover::after {
    border-color: var(--color-value);
    opacity: 0.5;
}

/* Paragraph Dropdown Select */
.editor-select {
    background: rgba(13, 16, 31, 0.7);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0 28px 0 12px;
    font-size: 0.8rem;
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    outline: none;
    height: 32px;
    line-height: 30px;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
}

.editor-select-wrapper {
    position: relative;
    display: inline-block;
}

.editor-select-wrapper::after {
    content: '▼';
    font-size: 0.6rem;
    color: var(--text-secondary);
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    transition: color 0.2s ease;
}

.editor-select-wrapper:hover::after {
    color: var(--color-accent);
}

.editor-select:hover {
    border-color: var(--color-accent);
    background: rgba(13, 16, 31, 0.95);
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.15);
}

.editor-select option {
    background-color: #0d101f;
    color: var(--text-primary);
    padding: 10px;
}

/* Custom selection styling inside script editor */
#script-editor-content::selection {
    background: rgba(0, 210, 254, 0.3);
    color: white;
}

/* Custom styling for list layout inside document */
#script-editor-content ul,
#script-editor-content ol {
    padding-left: 20px;
    margin: 10px 0;
}

#script-editor-content li {
    margin-bottom: 5px;
}

/* Headings style inside document */
#script-editor-content h1 {
    font-size: 1.8rem;
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

#script-editor-content h2 {
    font-size: 1.45rem;
    margin-top: 15px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

#script-editor-content h3 {
    font-size: 1.2rem;
    margin-top: 12px;
    margin-bottom: 6px;
    color: var(--text-primary);
}

#script-editor-content p {
    margin-bottom: 12px;
}

/* Custom placeholder inside contenteditable script editor */
#script-editor-content[contenteditable=true]:empty:before{
  content: attr(placeholder);
  color: var(--text-muted);
  font-style: italic;
  pointer-events: none;
}

/* --- Styles pour la Gestion des Équipes --- */

.team-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    backdrop-filter: blur(10px);
}

.team-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 12px;
}

.team-name-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.btn-delete-team {
    background: transparent;
    border: none;
    color: var(--color-error);
    cursor: pointer;
    font-size: 0.9rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.btn-delete-team:hover {
    opacity: 1;
}

.team-roles-workspace {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
    margin-top: 10px;
}

.role-slot-box {
    background: rgba(0, 0, 0, 0.2);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    padding: 1rem;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: var(--transition-smooth);
}
.role-slot-box.dragover {
    border-color: var(--color-accent);
    background: rgba(168, 85, 247, 0.05);
}

.role-slot-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.drag-handle-agent {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: grab;
    transition: var(--transition-smooth);
}
.drag-handle-agent:active {
    cursor: grabbing;
}
.drag-handle-agent:hover {
    border-color: var(--color-accent);
    background: rgba(255, 255, 255, 0.08);
}

.drag-handle-agent-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.drag-handle-agent-icon {
    font-size: 1.2rem;
}
.drag-handle-agent-name {
    font-weight: 600;
    font-size: 0.86rem;
    color: var(--text-primary);
}

/* Workflow Sequencer styling */
.workflow-sequencer-wrapper {
    margin-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1rem;
}

.workflow-steps-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 12px;
    background: rgba(0,0,0,0.15);
    border-radius: var(--radius-md);
    min-height: 60px;
}

.workflow-step-node {
    background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: grab;
    transition: var(--transition-smooth);
}
.workflow-step-node:hover {
    border-color: var(--color-accent);
    background: rgba(168, 85, 247, 0.05);
}
.workflow-step-arrow {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.btn-remove-step {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    line-height: 1;
}
.btn-remove-step:hover {
    color: var(--color-error);
}

/* Tab Agents Grouped Styling */
.agents-team-section {
    width: 100%;
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.agents-team-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding-bottom: 10px;
    justify-content: space-between;
}

.agents-team-members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    transition: max-height 0.3s ease-out, opacity 0.3s ease;
}

.leader-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 8px;
    display: inline-block;
}

.btn-collapse-team {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 6px;
    transition: var(--transition-smooth);
}
.btn-collapse-team:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-accent);
}

/* Fix dropdown menu option background to match the dark theme */
select option {
    background-color: #0d101f;
    color: var(--text-primary);
}

/* Custom styles for stacked team roles and right-hand side agent editing panel */
.team-body-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 992px) {
    .team-body-layout {
        grid-template-columns: 1fr;
    }
}

.team-agents-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.team-agent-editor-panel {
    background: rgba(13, 16, 31, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    justify-content: flex-start;
    align-self: stretch;
    transition: var(--transition-smooth);
    /* Allow full-height stretching */
    overflow: hidden;
}

/* Highlight style for actively edited agent */
.agent-card.active-editing-card {
    border-color: var(--color-accent) !important;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.25);
    background: rgba(168, 85, 247, 0.04) !important;
}

.agent-card.active-editing-card:hover {
    border-color: var(--color-accent) !important;
}

/* Unified styling inside the editor panel */
.team-agent-editor-panel h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.team-agent-editor-panel .agent-textarea {
    width: 100%;
    flex: 1 1 0;
    min-height: 80px;
    background: #060913;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 10px;
    font-family: inherit;
    font-size: 0.85rem;
    resize: none;
    outline: none;
    box-sizing: border-box;
}
.team-agent-editor-panel .agent-textarea:focus {
    border-color: var(--color-accent);
}

/* ══════════════════════════════════════════════════════════════════════════════
   ONGLET : AGENT WEB VIRTUEL (SANDBOX PLAYWRIGHT + OLLAMA VLM)
══════════════════════════════════════════════════════════════════════════════ */

/* Layout principal : sidebar gauche + écran droit */
.browser-agent-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1.25rem;
    height: calc(100vh - 80px);
    overflow: hidden;
}

/* ── Panneau de contrôle gauche ── */
.browser-agent-sidebar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    padding-right: 4px;
    padding-bottom: 16px;
}

.browser-agent-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background: rgba(56, 189, 248, 0.04);
    border: 1px solid rgba(56, 189, 248, 0.15);
    border-radius: var(--radius-md);
}

.browser-agent-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Badges de statut */
.ba-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    width: fit-content;
    transition: all 0.3s;
}
.ba-badge-idle {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(100, 116, 139, 0.3);
}
.ba-badge-running {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
    animation: ba-pulse 1.5s ease-in-out infinite;
}
.ba-badge-done {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.4);
}
.ba-badge-error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

@keyframes ba-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ── Champs de formulaire ── */
.ba-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ba-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.ba-select,
.ba-textarea {
    background: rgba(5, 6, 15, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 8px 12px;
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}
.ba-select:focus,
.ba-textarea:focus {
    border-color: rgba(56, 189, 248, 0.6);
}
.ba-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

/* ── Console des actions ── */
.ba-console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    padding: 0 2px;
}
.ba-console {
    flex: 1;
    min-height: 160px;
    max-height: 280px;
    overflow-y: auto;
    background: rgba(5, 6, 15, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-family: 'Courier New', monospace;
}
.ba-log {
    font-size: 0.73rem;
    line-height: 1.5;
    padding: 4px 8px;
    border-radius: 4px;
    border-left: 2px solid transparent;
    word-break: break-word;
}
.ba-log-info {
    color: var(--text-secondary);
    border-left-color: rgba(56, 189, 248, 0.4);
    background: rgba(56, 189, 248, 0.03);
}
.ba-log-action {
    color: #c084fc;
    border-left-color: rgba(168, 85, 247, 0.5);
    background: rgba(168, 85, 247, 0.05);
}
.ba-log-done {
    color: #34d399;
    border-left-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.05);
}
.ba-log-error {
    color: #f87171;
    border-left-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.05);
}

/* ── Box d'information prérequis ── */
.ba-info-box {
    font-size: 0.73rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 12px;
    line-height: 1.7;
}
.ba-info-box code {
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.7rem;
}

/* ── Colonne droite : Écran virtuel ── */
.browser-agent-screen-container {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid rgba(56, 189, 248, 0.15);
    background: #0a0b14;
    box-shadow:
        0 0 0 1px rgba(56, 189, 248, 0.05),
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Barre d'outils type macOS */
.ba-screen-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(15, 17, 28, 0.95);
    border-bottom: 1px solid rgba(56, 189, 248, 0.1);
    flex-shrink: 0;
}
#ba-toolbar-dots {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.ba-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: block;
}
.ba-dot-red    { background: #ff5f57; }
.ba-dot-yellow { background: #febc2e; }
.ba-dot-green  { background: #28c840; }

.ba-url-bar {
    flex: 1;
    background: rgba(5, 6, 15, 0.8);
    border: 1px solid rgba(56, 189, 248, 0.12);
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 0.73rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

/* Zone d'affichage de l'image du navigateur */
.ba-screen-wrapper {
    position: relative;
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(56, 189, 248, 0.03) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 80%, rgba(129, 140, 248, 0.03) 0%, transparent 60%),
        #070810;
}

/* Overlay de l'état idle */
.ba-idle-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    pointer-events: none;
}

/* Frame du navigateur */
.ba-screen {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: opacity 0.15s ease;
}

/* Barre d'action en bas de l'écran */
.ba-action-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(15, 17, 28, 0.95);
    border-top: 1px solid rgba(56, 189, 248, 0.1);
    font-size: 0.78rem;
    color: var(--text-secondary);
    min-height: 38px;
    flex-shrink: 0;
}

/* Animation de scan sur l'écran quand l'agent tourne */
.ba-screen-running::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #38bdf8, #818cf8, transparent);
    animation: ba-scan 2s linear infinite;
    z-index: 3;
    pointer-events: none;
}
@keyframes ba-scan {
    0%   { transform: translateY(0); }
    100% { transform: translateY(calc(100vh - 120px)); }
}

/* Responsive — tablette portrait */
@media (max-width: 900px) {
    .browser-agent-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: auto;
    }
    .browser-agent-screen-container {
        min-height: 400px;
    }
}

/* Responsive supplémentaires (Mobile & Tablettes) */
@media (max-width: 900px) {
    .nav-item {
        white-space: nowrap;
        padding: 10px 14px;
        gap: 8px;
        font-size: 0.9rem;
    }
    
    .nav-item.active {
        border-left: none;
        border-bottom: 3px solid var(--color-accent);
        background: linear-gradient(0deg, var(--color-accent-glow) 0%, transparent 100%);
    }

    .team-roles-workspace {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding-bottom: 0.8rem;
        margin-bottom: 1.5rem;
    }
    
    .top-bar > div {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 8px;
    }

    .top-bar #weather-widget {
        width: 100%;
        box-sizing: border-box;
        justify-content: center;
    }
    
    .widget-header h3 {
        font-size: 0.95rem !important;
    }
    
    .modal-content {
        width: 95% !important;
        margin: 10px auto !important;
        padding: 1.2rem !important;
    }
    
    .table-container, .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

