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

html, body { height: 100%; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    background: #14121e;
    color: #e0def4;
    overflow: hidden;
}

/* ============ TOPBAR (global HUD) ============ */
#topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 52px;
    background: linear-gradient(180deg, #1f1d2e 0%, #1a1726 100%);
    border-bottom: 1px solid #26233a;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 24px;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
#topbar h1 {
    font-size: 14px;
    color: #f6c177;
    letter-spacing: 0.15em;
    font-weight: 700;
    flex-shrink: 0;
}

#global-usage {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
    flex-wrap: wrap;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
}
.hud-pill {
    padding: 6px 10px;
    background: #26233a;
    border: 1px solid #393552;
    border-radius: 5px;
    color: #e0def4;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
}
.hud-pill b { color: #f6c177; font-weight: 600; font-variant-numeric: tabular-nums; }
.hud-icon { color: #908caa; font-size: 11px; }

.hud-budget { gap: 10px; min-width: 180px; }
.hud-bar {
    display: inline-block;
    width: 100px;
    height: 6px;
    background: #393552;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}
.hud-bar-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #84d57d 0%, #f6c177 60%, #eb6f92 100%);
    transition: width 0.5s ease;
}

.user-info {
    font-size: 13px;
    color: #908caa;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.user-info a {
    color: #c4a7e7;
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid #393552;
    border-radius: 4px;
    transition: all 0.15s;
}
.user-info a:hover { color: #eb6f92; border-color: #eb6f92; }

/* ============ APP / GAME canvas ============ */
#app {
    position: fixed;
    top: 52px; left: 0; right: 0; bottom: 0;
    display: flex;
}
#office-sidebar {
    width: 300px;
    flex-shrink: 0;
    background: #1f1d2e;
    border-right: 1px solid #26233a;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
#game {
    flex: 1;
    height: 100%;
    overflow: hidden;
    background: #14121e;
}
#game canvas {
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ============ CHAT MODAL ============ */
#chat-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}
#chat-overlay.hidden { display: none; }
#chat-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}
#chat-modal {
    position: relative;
    z-index: 1;
    width: min(1100px, 94vw);
    height: min(880px, 90vh);
    background: #1f1d2e;
    border: 2px solid #f6c177;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
    animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

#chat-header {
    background: #26233a;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid #393552;
}
.chat-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
#chat-team-name {
    font-weight: 700;
    color: #f6c177;
    font-size: 16px;
}
#chat-team-role {
    font-size: 11px;
    color: #908caa;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
#chat-usage {
    display: flex;
    gap: 8px;
    font-family: monospace;
    font-size: 11px;
    color: #e0def4;
}
#chat-usage span {
    padding: 3px 8px;
    background: #393552;
    border-radius: 4px;
    display: inline-flex;
    gap: 4px;
    align-items: center;
}
#chat-usage b { color: #f6c177; font-variant-numeric: tabular-nums; }
#chat-close {
    background: none;
    border: 1px solid #393552;
    color: #e0def4;
    font-size: 20px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 5px;
    line-height: 1;
    transition: all 0.15s;
}
#chat-close:hover { background: #eb6f92; color: #fff; border-color: #eb6f92; }

#chat-history {
    flex: 1;
    padding: 20px 22px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 420px;
    background: #181725;
}
#chat-history::-webkit-scrollbar { width: 8px; }
#chat-history::-webkit-scrollbar-track { background: transparent; }
#chat-history::-webkit-scrollbar-thumb { background: #393552; border-radius: 4px; }
#chat-history::-webkit-scrollbar-thumb:hover { background: #4d4570; }

.bubble {
    padding: 10px 14px;
    border-radius: 10px;
    max-width: 88%;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.5;
    animation: bubbleIn 0.2s ease;
}
@keyframes bubbleIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
.bubble-user {
    background: #3e8fb0;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 3px;
}
.bubble-assistant {
    background: #26233a;
    color: #e0def4;
    align-self: flex-start;
    border: 1px solid #393552;
    border-bottom-left-radius: 3px;
}
.bubble-system {
    background: rgba(235, 111, 146, 0.2);
    color: #eb6f92;
    align-self: center;
    font-style: italic;
    font-size: 12px;
    border: 1px solid #eb6f92;
}

#chat-form {
    padding: 12px;
    display: flex;
    gap: 8px;
    border-top: 1px solid #393552;
    background: #1f1d2e;
    border-radius: 0 0 8px 8px;
}
#chat-input {
    flex: 1;
    background: #26233a;
    color: #e0def4;
    border: 1px solid #393552;
    border-radius: 6px;
    padding: 10px 12px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
    min-height: 48px;
    max-height: 180px;
}
#chat-input:focus {
    outline: none;
    border-color: #f6c177;
    box-shadow: 0 0 0 3px rgba(246, 193, 119, 0.15);
}
#chat-send {
    background: #f6c177;
    color: #191724;
    border: none;
    padding: 0 22px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.15s;
    align-self: stretch;
}
#chat-send:hover { background: #eb6f92; color: #fff; transform: translateY(-1px); }

/* ============ Chat attachments ============ */
#chat-attach-btn {
    background: #26233a;
    color: #908caa;
    border: 1px solid #393552;
    border-radius: 6px;
    padding: 0 14px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.15s;
    align-self: stretch;
}
#chat-attach-btn:hover {
    background: #393552;
    color: #f6c177;
    border-color: #f6c177;
}
#chat-attachments-preview {
    padding: 8px 12px 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    background: #1f1d2e;
    border-top: 1px solid #393552;
}
#chat-attachments-preview.hidden { display: none; }
.att-chip {
    position: relative;
    background: #26233a;
    border: 1px solid #393552;
    border-radius: 6px;
    padding: 6px 26px 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #e0def4;
    font-size: 12px;
    max-width: 220px;
}
.att-chip-img {
    padding: 0;
    overflow: hidden;
    width: 72px;
    height: 72px;
}
.att-chip-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.att-chip-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}
.att-chip i.fa-solid:not(.fa-xmark) { color: #6aa9ff; font-size: 16px; }
.att-chip-x {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(20, 18, 30, 0.85);
    color: #eb6f92;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.att-chip-x:hover { background: #eb6f92; color: #fff; }
.att-chip-loading {
    color: #908caa;
    font-style: italic;
}

/* Bubble attachments (dans les messages user/assistant) */
.bubble-attachments {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.bubble-att-item.bubble-att-img img {
    max-width: 280px;
    max-height: 200px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.15s, border-color 0.15s;
}
.bubble-att-item.bubble-att-img img:hover {
    transform: scale(1.02);
    border-color: #f6c177;
}
.bubble-att-item.bubble-att-file a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.25);
    color: #e0def4;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 13px;
    max-width: 280px;
}
.bubble-att-item.bubble-att-file a:hover {
    background: rgba(0, 0, 0, 0.4);
    border-color: #f6c177;
}
.bubble-att-item.bubble-att-file i { color: #6aa9ff; font-size: 16px; }
.bubble-att-item.bubble-att-file .att-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    flex: 1;
}
.bubble-att-item.bubble-att-file .att-size {
    color: #908caa;
    font-size: 11px;
}

/* Drop overlay */
#chat-drop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(20, 18, 30, 0.85);
    border: 3px dashed #f6c177;
    border-radius: 8px;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    backdrop-filter: blur(4px);
}
#chat-drop-overlay.hidden { display: none; }
#chat-drop-overlay .drop-inner {
    color: #f6c177;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    line-height: 1.6;
}
#chat-drop-overlay .drop-inner i { font-size: 56px; display: block; margin-bottom: 12px; }
#chat-modal { position: relative; }

/* ============ Pages d auth (django-two-factor-auth) ============ */
.auth-page { max-width: 480px; margin: 60px auto; padding: 0 24px; }
.auth-card {
    background: #1f1d2e;
    border: 1px solid #26233a;
    border-radius: 8px;
    padding: 32px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}
.auth-card h1, .auth-card h2 { color: #f6c177; margin-bottom: 12px; font-size: 22px; font-weight: 600; }
.auth-card p { margin-bottom: 14px; color: #908caa; line-height: 1.5; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card form p { margin-bottom: 0; color: #e0def4; }
.auth-card label, .auth-card .form-label {
    display: block; color: #c4a7e7; font-weight: 600; font-size: 13px;
    margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em;
}
.auth-card input[type="text"], .auth-card input[type="password"],
.auth-card input[type="number"], .auth-card input[type="email"] {
    width: 100%; background: #26233a; color: #e0def4;
    border: 1px solid #393552; border-radius: 4px;
    padding: 10px 12px; font-size: 15px; font-family: inherit;
}
.auth-card input:focus { outline: none; border-color: #f6c177; }
.auth-card button, .auth-card input[type="submit"], .auth-card .btn {
    background: #f6c177; color: #191724; border: none;
    padding: 10px 20px; border-radius: 4px; cursor: pointer;
    font-weight: bold; font-family: inherit; font-size: 14px;
    text-decoration: none; display: inline-block;
}
.auth-card button:hover, .auth-card input[type="submit"]:hover, .auth-card .btn:hover { background: #eb6f92; color: #fff; }
.auth-card button[disabled], .auth-card .btn[disabled] { background: #393552; color: #6e6a86; cursor: not-allowed; }
.auth-card .btn-link { background: transparent; color: #c4a7e7; padding: 10px 8px; font-weight: normal; }
.auth-card .btn-link:hover { background: transparent; color: #eb6f92; }
.auth-card .float-right { float: right; }
.auth-card .button-group, .auth-card .form-actions { display: flex; gap: 12px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.auth-card a { color: #c4a7e7; text-decoration: none; }
.auth-card a:hover { color: #eb6f92; }
.auth-card ul.errorlist {
    list-style: none; background: rgba(235, 111, 146, 0.15);
    border: 1px solid #eb6f92; border-radius: 4px;
    padding: 8px 12px; color: #eb6f92; font-size: 13px;
}
.auth-card img { max-width: 100%; height: auto; }
.auth-card table { width: 100%; border-collapse: collapse; }
.auth-card table td { padding: 6px 8px; vertical-align: top; }
.auth-card .mb-3 { margin-bottom: 16px; }

[hidden] { display: none !important; }


/* ============ FLOW EDITOR ============ */
#topbar-nav { display: flex; gap: 8px; }
#topbar-nav .nav-link {
    padding: 6px 12px;
    color: #908caa;
    text-decoration: none;
    border-radius: 5px;
    border: 1px solid transparent;
    font-size: 13px;
    transition: all 0.15s;
}
#topbar-nav .nav-link:hover { color: #e0def4; border-color: #393552; }
#topbar-nav .nav-link.active { color: #f6c177; border-color: #f6c177; background: rgba(246,193,119,0.1); }

#flow-app {
    position: fixed;
    top: 52px; left: 0; right: 0; bottom: 0;
    display: flex;
}

#flow-sidebar {
    width: 230px;
    background: #1f1d2e;
    border-right: 1px solid #26233a;
    padding: 16px 14px;
    overflow-y: auto;
    flex-shrink: 0;
}
.sb-h3 {
    font-size: 11px;
    color: #908caa;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 14px 0 8px;
    font-weight: 600;
}
.sb-h3:first-child { margin-top: 0; }
.sb-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: #26233a;
    border: 1px solid #393552;
    color: #e0def4;
    border-radius: 5px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
}
.sb-btn:hover { background: #393552; border-color: #c4a7e7; }
.sb-btn-primary { background: #f6c177; color: #191724; border-color: #f6c177; font-weight: 600; }
.sb-btn-primary:hover { background: #eb6f92; color: #fff; border-color: #eb6f92; }
.sb-icon { font-size: 14px; }
.sb-agent-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 12px;
}
.sb-agent-dot { width: 8px; height: 8px; border-radius: 50%; }
.sb-agent-name { flex: 1; color: #e0def4; }
.sb-agent-state { color: #84d57d; font-family: monospace; font-size: 10px; }
.sb-mini {
    background: #393552; color: #f6c177; border: none;
    width: 22px; height: 22px; border-radius: 4px; cursor: pointer;
    font-weight: bold; line-height: 1;
}
.sb-mini:hover { background: #f6c177; color: #191724; }
.sb-help { font-size: 11px; color: #908caa; }
.sb-help p { margin-bottom: 4px; }
.sb-help b { color: #f6c177; }
#flow-status {
    margin-top: 14px;
    padding: 6px 10px;
    font-size: 11px;
    border-radius: 4px;
    text-align: center;
    background: #26233a;
    color: #908caa;
}
#flow-status.dirty { background: rgba(246, 193, 119, 0.2); color: #f6c177; }
#flow-status.saving { background: rgba(106, 169, 255, 0.2); color: #6aa9ff; }
#flow-status.saved { background: rgba(132, 213, 125, 0.2); color: #84d57d; }
#flow-status.error { background: rgba(235, 111, 146, 0.2); color: #eb6f92; }

#flow-canvas-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #14121e;
    cursor: grab;
}
#flow-canvas-wrap.panning { cursor: grabbing; }
#flow-pan-zoom {
    position: absolute;
    top: 0; left: 0;
    width: 4000px;
    height: 3000px;
    transform-origin: 0 0;
    transform: translate(0px, 0px) scale(1);
    will-change: transform;
}
#flow-edges {
    position: absolute;
    top: 0; left: 0;
    width: 4000px;
    height: 3000px;
    pointer-events: none;
}
#flow-controls {
    position: absolute;
    bottom: 16px; right: 16px;
    display: flex;
    gap: 4px;
    align-items: center;
    background: #1f1d2e;
    border: 1px solid #393552;
    border-radius: 6px;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    z-index: 5;
}
.zoom-btn {
    background: #26233a;
    border: 1px solid #393552;
    color: #e0def4;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.12s;
    font-size: 13px;
}
.zoom-btn:hover { background: #393552; border-color: #f6c177; color: #f6c177; }
#zoom-pct {
    padding: 0 10px;
    font-family: monospace;
    font-size: 12px;
    color: #f6c177;
    min-width: 50px;
    text-align: center;
}
#flow-edges .flow-edge-g { pointer-events: auto; }
#flow-nodes {
    position: absolute;
    top: 0; left: 0;
    width: 4000px;
    height: 3000px;
    pointer-events: none;  /* laisse passer les clics vers le SVG edges en dessous */
}
.flow-node { pointer-events: auto; }
.node-handle { pointer-events: auto; }

.flow-edge {
    fill: none;
    stroke: #f6c177;
    stroke-width: 2.4;
    stroke-linecap: round;
    pointer-events: none;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
    transition: stroke 0.15s, stroke-width 0.15s;
}
.flow-edge-g:hover .flow-edge { stroke-width: 3.5; }
.flow-edge-hit {
    fill: none;
    stroke: transparent;
    stroke-width: 14;
    cursor: pointer;
}
.flow-edge-preview {
    fill: none;
    stroke: #c4a7e7;
    stroke-width: 2;
    stroke-dasharray: 5 4;
    pointer-events: none;
    opacity: 0.8;
}
.flow-edge-g.selected .flow-edge { stroke: #eb6f92 !important; stroke-width: 3.5; filter: drop-shadow(0 2px 8px rgba(235,111,146,0.5)); }
.flow-edge-label-bg {
    fill: #26233a;
    stroke: #393552;
    stroke-width: 1;
    cursor: pointer;
}
.flow-edge-g.selected .flow-edge-label-bg { stroke: #eb6f92; }
.flow-edge-label {
    fill: #e0def4;
    font-family: monospace;
    font-size: 11px;
    pointer-events: none;
}

.flow-node {
    position: absolute;
    background: #1f1d2e;
    border: 2px solid #393552;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: move;
    user-select: none;
    color: #e0def4;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    transition: box-shadow 0.15s, transform 0.05s;
}
.flow-node:hover { box-shadow: 0 6px 14px rgba(0,0,0,0.5); }
.flow-node.selected {
    border-color: #f6c177 !important;
    box-shadow: 0 0 0 3px rgba(246, 193, 119, 0.25), 0 6px 14px rgba(0,0,0,0.6);
}
.flow-node-broadcast { background: linear-gradient(135deg, #2b1f3a, #1f1d2e); border-color: #eb6f92; }
.flow-node-schedule  { background: linear-gradient(135deg, #1f2a3a, #1f1d2e); border-color: #6aa9ff; }
.flow-node-filter    { background: linear-gradient(135deg, #1f2f1f, #1f1d2e); border-color: #84d57d; }
.flow-node-action    { background: linear-gradient(135deg, #3a2f1f, #1f1d2e); border-color: #ffb86c; }

.node-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #f6c177;
}
.node-emoji { font-size: 18px; }
.node-title { font-size: 14px; }
.node-role { font-size: 11px; color: #908caa; margin-top: 3px; }

.node-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    cursor: crosshair;
    border: 2px solid #14121e;
}
.handle-in { left: -8px; top: 50%; transform: translateY(-50%); background: #c4a7e7; }
.handle-out { right: -8px; top: 50%; transform: translateY(-50%); background: #84d57d; }
.handle-out:hover { background: #f6c177; transform: translateY(-50%) scale(1.2); }

#flow-props {
    width: 280px;
    background: #1f1d2e;
    border-left: 1px solid #26233a;
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
#flow-props.hidden { display: none; }
#flow-props header {
    padding: 14px;
    border-bottom: 1px solid #26233a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#flow-props-title {
    font-size: 12px;
    color: #f6c177;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}
#flow-props-close {
    background: none; border: none; color: #e0def4;
    font-size: 22px; cursor: pointer; line-height: 1;
}
#flow-props-close:hover { color: #eb6f92; }
#flow-props-content {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
#flow-props-content label {
    display: flex; flex-direction: column; gap: 4px;
    font-size: 11px; color: #908caa; text-transform: uppercase; letter-spacing: 0.05em;
    font-weight: 600;
}
#flow-props-content input,
#flow-props-content select {
    background: #26233a; color: #e0def4;
    border: 1px solid #393552; border-radius: 4px;
    padding: 8px 10px; font-size: 13px; font-family: inherit;
    text-transform: none; letter-spacing: 0;
}
#flow-props-content input:focus,
#flow-props-content select:focus { outline: none; border-color: #f6c177; }
.props-edge-path {
    padding: 8px 10px;
    background: #26233a;
    border-radius: 5px;
    color: #e0def4;
    font-family: monospace;
    font-size: 12px;
    text-align: center;
}
.props-edge-path span { color: #f6c177; margin: 0 6px; }
.props-delete {
    margin-top: 8px;
    background: rgba(235, 111, 146, 0.15);
    color: #eb6f92;
    border: 1px solid #eb6f92;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
}
.props-delete:hover { background: #eb6f92; color: #fff; }


/* Flow edge labels in foreignObject (avec FA icons) */
.flow-edge-fo { overflow: visible; cursor: pointer; }
.flow-edge-fo > div { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.flow-edge-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 12px;
    background: #1f1d2e;
    border: 1.5px solid #393552;
    border-radius: 14px;
    color: #e0def4;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 3px 8px rgba(0,0,0,0.45), 0 0 0 1px rgba(0,0,0,0.5);
    transition: all 0.12s;
}
.flow-edge-label:hover { transform: scale(1.08); background: #26233a; }
.flow-edge-label i { font-size: 11px; }
.flow-edge-g.selected .flow-edge-label {
    border-color: #eb6f92;
    background: #2b1f3a;
    color: #eb6f92;
}
.flow-edge-g.selected .flow-edge-label i { color: #eb6f92; }
.node-emoji i { font-size: 16px; color: #f6c177; }
.flow-node-broadcast .node-emoji i { color: #eb6f92; }
.flow-node-schedule .node-emoji i { color: #6aa9ff; }
.flow-node-filter .node-emoji i { color: #84d57d; }
.flow-node-action .node-emoji i { color: #ffb86c; }
.sb-icon i { color: inherit; }


/* Force pointer events sur SVG foreignObject + labels (sinon clic rate) */
.flow-edge-fo, .flow-edge-label { pointer-events: auto !important; cursor: pointer; }
.flow-edge-fo * { pointer-events: auto; }


/* Props panel ameliore */
.props-sep { border: none; border-top: 1px solid #393552; margin: 14px 0 4px; }
.props-section {
    font-size: 10px;
    color: #f6c177;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    margin-bottom: 2px;
}
#flow-props-content textarea {
    background: #26233a; color: #e0def4;
    border: 1px solid #393552; border-radius: 4px;
    padding: 8px 10px; font-size: 13px; font-family: inherit;
    resize: vertical; min-height: 80px;
}
#flow-props-content textarea:focus { outline: none; border-color: #f6c177; }

.sb-btn-add-agent {
    margin-top: 4px;
    background: rgba(132, 213, 125, 0.15);
    border-color: #84d57d;
    color: #84d57d;
    font-weight: 600;
}
.sb-btn-add-agent:hover { background: #84d57d; color: #191724; }


/* ============ AGENTS PAGE ============ */
#agents-app {
    position: fixed;
    top: 52px; left: 0; right: 0; bottom: 0;
    display: flex;
}
#agents-list-pane {
    width: 320px;
    background: #1f1d2e;
    border-right: 1px solid #26233a;
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
.al-header {
    padding: 16px;
    border-bottom: 1px solid #26233a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}
.al-header h2 {
    font-size: 14px;
    color: #f6c177;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
#agents-list { padding: 8px; flex: 1; overflow-y: auto; }
.al-empty { padding: 24px; color: #908caa; text-align: center; font-size: 13px; }
.al-group-head {
    padding: 12px 8px 6px;
    color: #908caa;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}
.al-group-head .al-group-count {
    margin-left: auto;
    background: #26233a;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 10px;
    color: #f6c177;
}
.al-item {
    display: block;
    width: 100%;
    text-align: left;
    background: #26233a;
    border: 1px solid #393552;
    color: #e0def4;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.al-item:hover { background: #393552; border-color: #c4a7e7; }
.al-item.selected { background: #393552; border-color: #f6c177; box-shadow: 0 0 0 1px #f6c177; }
.al-item-name { display: block; font-weight: 600; color: #f6c177; margin-bottom: 4px; font-size: 13px; }
.al-item-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.al-model-pill {
    font-family: monospace;
    font-size: 10px;
    border: 1px solid;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(0,0,0,0.3);
}
.al-item-role { font-size: 11px; color: #908caa; }

#agent-editor {
    flex: 1;
    overflow-y: auto;
    background: #14121e;
    padding: 28px 32px;
}
.ae-empty {
    color: #908caa;
    text-align: center;
    padding: 80px 20px;
    font-size: 14px;
}
.ae-empty i { display: block; font-size: 28px; margin-bottom: 12px; color: #393552; }
.ae-form { display: flex; flex-direction: column; gap: 20px; }
.ae-form.hidden { display: none; }
.ae-form-head {
    display: flex; align-items: flex-start; gap: 16px;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid #26233a;
}
.ae-form-head > div:first-child {
    flex: 1;
    display: flex; flex-direction: column; gap: 6px;
}
.ae-display-name {
    background: transparent; border: none; color: #f6c177;
    font-size: 24px; font-weight: 700; padding: 4px 0;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s;
}
.ae-display-name:hover { border-bottom-color: #393552; }
.ae-display-name:focus { outline: none; border-bottom-color: #f6c177; }
.ae-description {
    background: transparent; border: none; color: #908caa;
    font-size: 14px; padding: 2px 0;
    border-bottom: 1px solid transparent;
}
.ae-description:hover { border-bottom-color: #393552; }
.ae-description:focus { outline: none; border-bottom-color: #c4a7e7; color: #e0def4; }
.ae-actions { display: flex; align-items: center; gap: 12px; }
.ae-status {
    padding: 6px 10px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
    background: #26233a;
    color: #908caa;
}
.ae-status.saved { background: rgba(132, 213, 125, 0.2); color: #84d57d; }
.ae-status.saving { background: rgba(106, 169, 255, 0.2); color: #6aa9ff; }
.ae-status.dirty { background: rgba(246, 193, 119, 0.2); color: #f6c177; }
.ae-status.error { background: rgba(235, 111, 146, 0.2); color: #eb6f92; }
.ae-delete {
    background: rgba(235, 111, 146, 0.15);
    color: #eb6f92;
    border: 1px solid #eb6f92;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
}
.ae-delete:hover { background: #eb6f92; color: #fff; }

.ae-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.ae-field { display: flex; flex-direction: column; gap: 6px; }
.ae-field-full { grid-column: 1 / -1; }
.ae-label {
    color: #c4a7e7;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    display: flex; align-items: center; gap: 6px;
}
.ae-label i { color: #908caa; }
.ae-field input[type=text], .ae-field select, .ae-field textarea {
    background: #1f1d2e;
    color: #e0def4;
    border: 1px solid #393552;
    border-radius: 5px;
    padding: 9px 12px;
    font-family: inherit;
    font-size: 13px;
    width: 100%;
}
.ae-field input:focus, .ae-field select:focus, .ae-field textarea:focus {
    outline: none; border-color: #f6c177;
    box-shadow: 0 0 0 3px rgba(246, 193, 119, 0.12);
}
.ae-field textarea { resize: vertical; min-height: 160px; line-height: 1.5; font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 12px; }
.ae-hint { color: #6e6a86; font-size: 11px; font-style: italic; }
#ae-model-custom { margin-top: 4px; }

.ae-field-stats .ae-stats {
    display: flex; gap: 8px; align-items: center;
    padding: 9px 12px;
    background: #1f1d2e;
    border: 1px solid #393552;
    border-radius: 5px;
    font-family: monospace;
    font-size: 12px;
    color: #e0def4;
}
.ae-stats span { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; }
.ae-stats i { color: #908caa; }

@media (max-width: 800px) {
    .ae-grid { grid-template-columns: 1fr; }
    #agents-list-pane { width: 220px; }
}


/* Chat header model pill */
.chat-model-pill {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    font-family: monospace;
    font-size: 10px;
    border: 1px solid #f6c177;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.3);
    color: #f6c177;
}

/* Flow props : agent summary card + lien Agents */
.props-agent-summary {
    background: #26233a;
    border: 1px solid #393552;
    border-radius: 6px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.props-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    font-size: 11px;
}
.ps-label { color: #908caa; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; font-size: 10px; }
.ps-value { color: #e0def4; font-family: monospace; text-align: right; word-break: break-all; }
.props-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    padding: 8px 12px;
    background: rgba(106, 169, 255, 0.12);
    border: 1px solid #6aa9ff;
    border-radius: 5px;
    color: #6aa9ff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    justify-content: center;
}
.props-link:hover { background: #6aa9ff; color: #fff; }


/* Sidebar flow : lien vers /agents/ */
.sb-manage-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
    padding: 8px 12px;
    color: #908caa;
    text-decoration: none;
    font-size: 11px;
    border: 1px dashed #393552;
    border-radius: 5px;
    transition: all 0.15s;
}
.sb-manage-link:hover { color: #c4a7e7; border-color: #c4a7e7; }


/* Cascade bubbles (rules engine) */
.bubble-cascade-meta {
    background: rgba(196, 167, 231, 0.12);
    color: #c4a7e7;
    align-self: stretch;
    text-align: center;
    font-size: 11px;
    font-family: monospace;
    padding: 6px 10px;
    border-top: 1px dashed #393552;
    border-bottom: 1px dashed #393552;
    border-radius: 0;
}
.bubble-cascade-meta i { color: #c4a7e7; margin: 0 4px; }
.bubble-cascade-meta b { color: #f6c177; font-weight: 600; }
.bubble-cascade-meta .cascade-rule { color: #908caa; font-size: 10px; margin-left: 6px; }

.bubble-cascade {
    background: #1f1d2e;
    color: #e0def4;
    align-self: flex-start;
    border-left: 3px solid #c4a7e7;
    border-top: 1px solid #393552;
    border-right: 1px solid #393552;
    border-bottom: 1px solid #393552;
    border-radius: 4px 10px 10px 4px;
    max-width: 90%;
    padding: 8px 12px;
}
.bubble-cascade .cascade-head {
    font-size: 11px;
    color: #c4a7e7;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.bubble-cascade .cascade-head i { color: #c4a7e7; }
.bubble-cascade .cascade-head b { color: #f6c177; }
.bubble-cascade .cascade-body { white-space: pre-wrap; word-wrap: break-word; font-size: 14px; line-height: 1.45; }


/* ============ Cascade — reply persistante (chargee depuis history) ============ */
.bubble-cascade-reply {
    align-self: stretch;
    background: linear-gradient(135deg, #1f1d2e 0%, #26233a 100%);
    border-left: 3px solid #c4a7e7;
    border-top: 1px solid #393552;
    border-right: 1px solid #393552;
    border-bottom: 1px solid #393552;
    border-radius: 4px 10px 10px 4px;
    padding: 10px 14px;
    max-width: 95%;
    color: #e0def4;
    animation: bubbleIn 0.2s ease;
}
.bubble-cascade-reply .cascade-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #c4a7e7;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    padding-bottom: 6px;
    border-bottom: 1px dashed #393552;
}
.bubble-cascade-reply .cascade-head .cr-from { color: #c4a7e7; }
.bubble-cascade-reply .cascade-head .cr-arrow { color: #908caa; }
.bubble-cascade-reply .cascade-head .cr-target { color: #f6c177; }
.bubble-cascade-reply .cascade-head .cr-rule {
    margin-left: auto;
    font-size: 10px;
    color: #908caa;
    text-transform: none;
    letter-spacing: 0;
    background: rgba(196, 167, 231, 0.12);
    padding: 2px 6px;
    border-radius: 3px;
}
.bubble-cascade-reply .cascade-body {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.55;
}

/* ============ Bubble cascade live (en cours) — amelioree ============ */
.bubble-cascade {
    background: linear-gradient(135deg, #1f1d2e 0%, #26233a 100%);
    border-left: 3px solid #c4a7e7;
    border-top: 1px solid #393552;
    border-right: 1px solid #393552;
    border-bottom: 1px solid #393552;
    border-radius: 4px 10px 10px 4px;
    align-self: stretch;
    max-width: 95%;
    padding: 10px 14px;
    color: #e0def4;
    animation: bubbleIn 0.2s ease;
    position: relative;
}
.bubble-cascade.thinking::before {
    content: '';
    position: absolute;
    left: -3px; top: 0; bottom: 0;
    width: 3px;
    background: #c4a7e7;
    animation: cascadePulse 1.4s ease-in-out infinite;
}
@keyframes cascadePulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; box-shadow: 0 0 10px #c4a7e7; }
}
.bubble-cascade .cascade-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #c4a7e7;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    padding-bottom: 6px;
    border-bottom: 1px dashed #393552;
}
.bubble-cascade .cascade-head b { color: #f6c177; }
.bubble-cascade .cascade-head .cascade-status {
    margin-left: auto;
    font-size: 10px;
    color: #908caa;
    text-transform: none;
    letter-spacing: 0;
}
.bubble-cascade .cascade-head .cascade-status.thinking {
    color: #c4a7e7;
}
.bubble-cascade .cascade-head .cascade-status.done {
    color: #84d57d;
}
.bubble-cascade .cascade-body {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.55;
    min-height: 18px;
}
.bubble-cascade .cascade-body .cascade-typing {
    display: inline-block;
    color: #c4a7e7;
    font-style: italic;
}
.bubble-cascade .cascade-body .cascade-typing::after {
    content: '...';
    display: inline-block;
    animation: ellipsisLoop 1.4s steps(4, end) infinite;
}
@keyframes ellipsisLoop {
    0%   { content: '';     }
    25%  { content: '.';    }
    50%  { content: '..';   }
    75%  { content: '...';  }
    100% { content: '....'; }
}


/* ============ Assistant typing indicator (en attente du 1er chunk) ============ */
.assistant-typing {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #c4a7e7;
    font-style: italic;
    font-size: 13px;
    opacity: 0.9;
}
.assistant-typing i {
    color: #c4a7e7;
    animation: brainPulse 1.2s ease-in-out infinite;
}
.assistant-typing::after {
    content: '...';
    display: inline-block;
    width: 24px;
    text-align: left;
    animation: ellipsisLoop 1.4s steps(4, end) infinite;
    color: #c4a7e7;
}
@keyframes brainPulse {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.15); opacity: 1; }
}
.bubble-empty {
    opacity: 0.55;
    font-style: italic;
    color: #908caa;
}


/* ============ Markdown body (bulles assistant + cascade) ============ */
.markdown-body {
    line-height: 1.55;
    word-wrap: break-word;
}
.markdown-body p {
    margin: 0 0 8px 0;
}
.markdown-body p:last-child { margin-bottom: 0; }

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    color: #f6c177;
    font-weight: 700;
    margin: 16px 0 8px 0;
    line-height: 1.3;
}
.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child { margin-top: 0; }
.markdown-body h1 { font-size: 18px; border-bottom: 1px solid #393552; padding-bottom: 4px; }
.markdown-body h2 { font-size: 16px; }
.markdown-body h3 { font-size: 14px; }
.markdown-body h4 { font-size: 13px; color: #c4a7e7; }

.markdown-body strong, .markdown-body b {
    color: #f6c177;
    font-weight: 700;
}
.markdown-body em, .markdown-body i { color: #c4a7e7; font-style: italic; }

.markdown-body ul,
.markdown-body ol {
    margin: 6px 0 10px 0;
    padding-left: 24px;
}
.markdown-body li { margin: 3px 0; }
.markdown-body li > p { margin: 0; }

.markdown-body blockquote {
    border-left: 3px solid #c4a7e7;
    padding: 4px 12px;
    margin: 8px 0;
    color: #908caa;
    background: rgba(196, 167, 231, 0.06);
    font-style: italic;
}

.markdown-body code {
    background: #14121e;
    color: #f6c177;
    padding: 1px 6px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.88em;
    border: 1px solid #26233a;
}
.markdown-body pre {
    background: #14121e;
    border: 1px solid #26233a;
    border-radius: 6px;
    padding: 12px 14px;
    overflow-x: auto;
    margin: 10px 0;
    font-size: 12px;
    line-height: 1.45;
}
.markdown-body pre code {
    background: transparent;
    border: none;
    padding: 0;
    color: #e0def4;
    font-size: 12px;
}

.markdown-body a {
    color: #6aa9ff;
    text-decoration: underline;
    text-decoration-color: rgba(106,169,255,0.3);
}
.markdown-body a:hover { text-decoration-color: #6aa9ff; }

.markdown-body hr {
    border: none;
    border-top: 1px solid #393552;
    margin: 14px 0;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 12px;
}
.markdown-body table th {
    background: #26233a;
    padding: 6px 10px;
    text-align: left;
    color: #f6c177;
    font-weight: 600;
    border: 1px solid #393552;
}
.markdown-body table td {
    padding: 5px 10px;
    border: 1px solid #393552;
}
.markdown-body table tr:nth-child(2n) { background: rgba(38,35,58,0.4); }

.markdown-body img { max-width: 100%; border-radius: 4px; }

/* Override pour bubbles : on n'utilise plus pre-wrap puisque on rend du HTML */
.bubble.markdown-body { white-space: normal; }
.bubble-user.markdown-body { color: #fff; }
.bubble-user.markdown-body strong { color: #fff; text-shadow: 0 0 1px rgba(0,0,0,0.4); }
.bubble-user.markdown-body code { background: rgba(0,0,0,0.25); color: #fff; border-color: rgba(255,255,255,0.15); }


/* ============ OFFICE SIDEBAR (recap agents + activite) ============ */
.osb-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding-bottom: 6px;
    border-bottom: 1px solid #26233a;
}
.osb-header h2 {
    font-size: 13px;
    color: #f6c177;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 700;
    margin: 0;
}
.osb-count {
    font-size: 11px;
    color: #908caa;
    font-family: monospace;
}
.osb-h3 {
    font-size: 10px;
    color: #908caa;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    margin: 6px 0 6px 0;
}

.osb-agents {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.osb-card {
    background: linear-gradient(135deg, #26233a 0%, #1f1d2e 100%);
    border: 1px solid #393552;
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all 0.15s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.osb-card:hover { border-color: #c4a7e7; transform: translateX(2px); }
.osb-card.thinking {
    border-color: #6aa9ff;
    box-shadow: 0 0 0 1px #6aa9ff, 0 0 14px rgba(106, 169, 255, 0.25);
}
.osb-card.thinking::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(106,169,255,0.08) 0%, transparent 60%);
    pointer-events: none;
}
.osb-card.cascading {
    border-color: #eb6f92;
}
.osb-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.osb-card-name {
    font-size: 13px;
    font-weight: 700;
    color: #e0def4;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.osb-card-status {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 3px;
    font-family: monospace;
    white-space: nowrap;
}
.osb-card-status.inactif  { color: #6e6a86; background: rgba(110,106,134,0.15); }
.osb-card-status.travaille{ color: #84d57d; background: rgba(132,213,125,0.15); }
.osb-card-status.reflechit{ color: #6aa9ff; background: rgba(106,169,255,0.18); }
.osb-card-status.cascade  { color: #eb6f92; background: rgba(235,111,146,0.18); }

.osb-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #908caa;
}
.osb-card-role { flex: 1; }
.osb-card-model {
    font-family: monospace;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    border: 1px solid;
}
.osb-card-model.opus   { color: #f6c177; border-color: #f6c177; }
.osb-card-model.sonnet { color: #6aa9ff; border-color: #6aa9ff; }
.osb-card-model.haiku  { color: #84d57d; border-color: #84d57d; }
.osb-card-model.other  { color: #c4a7e7; border-color: #c4a7e7; }

.osb-card-time {
    font-size: 10px;
    color: #6e6a86;
    font-family: monospace;
}

.osb-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    background: #14121e;
    border: 1px solid #26233a;
    border-radius: 6px;
    padding: 10px;
}
.osb-legend-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #908caa;
}
.osb-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.osb-activity {
    background: #14121e;
    border: 1px solid #26233a;
    border-radius: 6px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 80px;
    max-height: 240px;
    overflow-y: auto;
}
.osb-activity-empty {
    text-align: center;
    color: #6e6a86;
    font-size: 11px;
    font-style: italic;
    padding: 14px 4px;
}
.osb-activity-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #e0def4;
    padding: 4px 4px;
    border-radius: 4px;
    animation: slideInL 0.25s ease;
}
@keyframes slideInL {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}
.osb-activity-row .osb-dot {
    width: 6px;
    height: 6px;
}
.osb-activity-name {
    color: #f6c177;
    font-weight: 600;
}
.osb-activity-msg {
    color: #c4a7e7;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
}
.osb-activity-time {
    color: #6e6a86;
    font-family: monospace;
    font-size: 9px;
    flex-shrink: 0;
}


/* ============ PROJECT SWITCHER (dropdown topbar) ============ */
.project-switcher {
    position: relative;
    margin-left: 10px;
}
.project-switcher-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #26233a;
    border: 1px solid #393552;
    border-left: 3px solid var(--proj-color, #f6c177);
    color: #e0def4;
    border-radius: 5px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.12s;
}
.project-switcher-btn:hover { background: #393552; border-color: #c4a7e7; }
.project-switcher-btn .proj-name { font-weight: 600; }
.project-switcher-btn i.fa-chevron-down { font-size: 9px; color: #908caa; }
.project-switcher-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    background: #1f1d2e;
    border: 1px solid #393552;
    border-radius: 6px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.55);
    z-index: 50;
    overflow: hidden;
}
.project-switcher-menu .proj-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: #e0def4;
    text-decoration: none;
    font-size: 13px;
    border-bottom: 1px solid #26233a;
    transition: background 0.1s;
}
.project-switcher-menu .proj-item:hover { background: #26233a; }
.project-switcher-menu .proj-item.active { color: #f6c177; }
.project-switcher-menu .proj-item .proj-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.project-switcher-menu .proj-item.proj-manage {
    color: #c4a7e7;
    font-size: 11px;
    border-top: 2px solid #26233a;
    border-bottom: none;
}
.proj-dot {
    width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}

/* HUD bar sous topbar (separate) */
#hud-bar {
    position: fixed;
    top: 52px;
    left: 300px;
    right: 0;
    height: 36px;
    background: linear-gradient(180deg, #1a1828 0%, #1f1d2e 100%);
    border-bottom: 1px solid #26233a;
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 10px;
    z-index: 9;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    overflow-x: auto;
}
#app { top: 88px !important; }

/* ============ KANBAN ============ */
#kanban-app {
    position: fixed;
    top: 52px; left: 0; right: 0; bottom: 0;
    background: #14121e;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.kanban-header {
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #26233a;
}
.kanban-header h2 {
    font-size: 18px;
    color: #e0def4;
    font-weight: 600;
}
.kanban-board {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 20px;
    overflow: hidden;
}
.kanban-column {
    background: #1f1d2e;
    border: 1px solid #393552;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.kanban-column header {
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #f6c177;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid #393552;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #26233a;
}
.kanban-column[data-status="todo"] header { color: #908caa; }
.kanban-column[data-status="doing"] header { color: #6aa9ff; }
.kanban-column[data-status="done"] header { color: #84d57d; }
.kanban-count {
    margin-left: auto;
    background: #14121e;
    color: #e0def4;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}
.kanban-col-body {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: background 0.15s;
}
.kanban-col-body.drag-over { background: rgba(196, 167, 231, 0.08); }
.kanban-card {
    background: linear-gradient(135deg, #26233a, #1f1d2e);
    border: 1px solid #393552;
    border-radius: 6px;
    padding: 12px;
    cursor: grab;
    transition: all 0.15s;
    user-select: none;
}
.kanban-card:hover { border-color: #c4a7e7; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
.kanban-card.dragging { opacity: 0.5; cursor: grabbing; }
.kc-title { font-size: 13px; font-weight: 600; color: #e0def4; margin-bottom: 6px; }
.kc-desc { font-size: 11px; color: #908caa; margin-bottom: 8px; line-height: 1.4; }
.kc-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: #6e6a86;
}
.kc-assignee {
    background: rgba(106, 169, 255, 0.15);
    color: #6aa9ff;
    padding: 2px 8px;
    border-radius: 3px;
    font-family: monospace;
}
.kc-no-assignee {
    color: #6e6a86;
    font-style: italic;
}
.kc-delete {
    background: transparent;
    border: none;
    color: #6e6a86;
    cursor: pointer;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
}
.kc-delete:hover { color: #eb6f92; background: rgba(235, 111, 146, 0.1); }

/* Projects page : reuse agents page styles avec #projects-* */
#projects-app {
    position: fixed;
    top: 52px; left: 0; right: 0; bottom: 0;
    display: flex;
}
#projects-list-pane {
    width: 320px;
    background: #1f1d2e;
    border-right: 1px solid #26233a;
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
#projects-list { padding: 8px; flex: 1; overflow-y: auto; }
#project-editor {
    flex: 1;
    overflow-y: auto;
    background: #14121e;
    padding: 28px 32px;
}
.pe-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #26233a;
}
.pe-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #26233a;
    border: 1px solid #393552;
    color: #e0def4;
    border-radius: 5px;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.15s;
}
.pe-link:hover { background: #393552; border-color: #c4a7e7; color: #f6c177; }


/* Colonne Approved : verte plus marquee */
.kanban-column[data-status="approved"] header { color: #84d57d; background: rgba(132,213,125,0.10); }
.kanban-column[data-status="approved"] { border-color: rgba(132,213,125,0.3); }

/* Animation : cards en doing pulsent legerement (l'agent travaille dessus) */
.kanban-column[data-status="doing"] .kanban-card {
    border-left: 3px solid #6aa9ff;
}
@keyframes doingPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(106, 169, 255, 0.0); }
    50% { box-shadow: 0 0 0 4px rgba(106, 169, 255, 0.15); }
}
.kanban-column[data-status="done"] .kanban-card { border-left: 3px solid #c4a7e7; }
.kanban-column[data-status="approved"] .kanban-card { border-left: 3px solid #84d57d; opacity: 0.85; }


/* ============ TASK MODAL ============ */
.task-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
}
.task-modal.hidden { display: none; }
.task-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}
.task-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(620px, 92vw);
    max-height: 90vh;
    background: #1f1d2e;
    border: 1px solid #393552;
    border-radius: 10px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.task-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #26233a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #26233a;
}
.task-modal-header h3 {
    margin: 0;
    font-size: 15px;
    color: #f6c177;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.task-modal-close {
    background: none;
    border: 1px solid #393552;
    color: #e0def4;
    width: 28px; height: 28px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.12s;
}
.task-modal-close:hover { background: #eb6f92; color: #fff; border-color: #eb6f92; }
.task-modal-body {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.tm-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tm-label {
    font-size: 11px;
    color: #c4a7e7;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tm-label i { color: #908caa; }
.tm-field input[type="text"],
.tm-field select,
.tm-field textarea {
    background: #14121e;
    border: 1px solid #393552;
    color: #e0def4;
    padding: 10px 12px;
    border-radius: 5px;
    font-family: inherit;
    font-size: 14px;
    width: 100%;
}
.tm-field input:focus, .tm-field select:focus, .tm-field textarea:focus {
    outline: none;
    border-color: #f6c177;
    box-shadow: 0 0 0 3px rgba(246, 193, 119, 0.15);
}
.tm-field textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}
.tm-hint {
    font-size: 11px;
    color: #6e6a86;
    font-style: italic;
}
.tm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px solid #26233a;
    margin-top: 4px;
}
.tm-btn {
    padding: 10px 18px;
    border-radius: 5px;
    border: 1px solid #393552;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.12s;
}
.tm-btn-cancel {
    background: transparent;
    color: #908caa;
}
.tm-btn-cancel:hover { color: #e0def4; border-color: #c4a7e7; }
.tm-btn-primary {
    background: #f6c177;
    color: #191724;
    border-color: #f6c177;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tm-btn-primary:hover { background: #eb6f92; color: #fff; border-color: #eb6f92; }
.tm-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }


/* Badge priorite sur les cards Kanban */
.kc-priority {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 3px;
    color: #14121e;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
    font-family: monospace;
}
.kanban-card[data-priority="3"] {
    border-left: 3px solid #eb6f92 !important;
    box-shadow: 0 0 0 1px rgba(235, 111, 146, 0.3);
}
.kanban-card[data-priority="2"] {
    border-left: 3px solid #f6c177 !important;
}
