/* ── Code Agent — split layout ───────────────────────────────────────────── */

.nd-code-layout {
    display: flex;
    flex-direction: row;
    height: 100%;
    width: 100%;
    overflow: hidden;
    gap: 0;
}

.nd-code-layout[hidden] { display: none; }

/* When code agent is active, the main resets its padding */
.nd-code-layout ~ * { display: none; }

/* ── Left panel: file explorer ───────────────────────────────────────────── */
.nd-code-explorer {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: rgba(10, 10, 14, 0.6);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
}


/* ── Tree area ────────────────────────────────────────────────────────────── */
.nd-code-tree {
    flex: 1;
    overflow-y: auto;
    padding: 0.4rem 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
    display: flex;
    flex-direction: column;
}

/* ── File/folder items ────────────────────────────────────────────────────── */
.nd-tree-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.22rem 0.6rem;
    border-radius: 0.4rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    font-size: 0.75rem;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}
.nd-tree-item:hover { background: rgba(255, 255, 255, 0.05); }
.nd-tree-item--selected { background: rgba(255, 255, 255, 0.08); }

/* Indent line */
.nd-tree-item__line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
}
.nd-tree-item:hover .nd-tree-item__line { background: rgba(255, 255, 255, 0.2); }

/* Chevron (folders) */
.nd-tree-chevron {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.3);
    transition: transform 0.15s ease, color 0.15s;
}
.nd-tree-chevron--open { transform: rotate(90deg); }
.nd-tree-item:hover .nd-tree-chevron { color: rgba(255, 255, 255, 0.6); }

/* File/folder icon */
.nd-tree-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
}

/* Name */
.nd-tree-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.55);
    transition: color 0.15s;
}
.nd-tree-item--folder > .nd-tree-name { color: rgba(255, 255, 255, 0.75); }
.nd-tree-item:hover .nd-tree-name { color: rgba(255, 255, 255, 0.9); }

/* Hover dot */
.nd-tree-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(165, 180, 252, 0.7);
    flex-shrink: 0;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.15s, transform 0.15s;
}
.nd-tree-item:hover .nd-tree-dot {
    opacity: 1;
    transform: scale(1);
}

/* Children container */
.nd-tree-children {
    overflow: hidden;
    transition: max-height 0.2s ease, opacity 0.2s ease;
}
.nd-tree-children--closed {
    max-height: 0 !important;
    opacity: 0;
}

/* ── Drop zone — centré verticalement dans le tree quand vide ─────────────── */
.nd-code-drop {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    margin: 0.5rem;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    color: rgba(255, 255, 255, 0.25);
    text-align: center;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    cursor: default;
}

.nd-code-drop--active {
    border-color: rgba(165, 180, 252, 0.5);
    background: rgba(99, 102, 241, 0.07);
    color: rgba(165, 180, 252, 0.8);
}

.nd-code-drop__label {
    font-size: 0.68rem;
    line-height: 1.4;
}

.nd-code-drop__btns {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.nd-code-drop__btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.68rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.4rem;
    padding: 0.25rem 0.65rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font: inherit;
}
.nd-code-drop__btn:hover {
    background: rgba(255, 255, 255, 0.09);
    color: rgba(255, 255, 255, 0.85);
}

.nd-code-drop__btn--folder {
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}
.nd-code-drop__btn--folder:hover {
    background: rgba(255, 255, 255, 0.09);
    color: rgba(255, 255, 255, 0.85);
}

/* ── Center panel: code viewer ──────────────────────────────────────────── */
.nd-code-viewer {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 420px;
    min-width: 180px;
    max-width: calc(100% - 240px - 280px); /* leave at least 280px for chat */
    flex-shrink: 0;
    background: rgba(8, 8, 12, 0.7);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
}
.nd-code-viewer[hidden] { display: none; }

.nd-code-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.65rem 0.4rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    gap: 0.5rem;
    min-width: 0;
}

.nd-code-viewer-filename {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    overflow: hidden;
}

.nd-code-viewer-icon {
    font-size: 10px;
    line-height: 1;
    flex-shrink: 0;
}

.nd-code-viewer-filename span:last-child {
    font-size: 0.72rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: rgba(255, 255, 255, 0.55);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nd-code-viewer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    background: none;
    border: none;
    border-radius: 0.35rem;
    color: rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}
.nd-code-viewer-close:hover {
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.7);
}

.nd-code-viewer-body {
    display: flex;
    flex: 1;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
    position: relative;
}

.nd-code-viewer-lines {
    position: sticky;
    left: 0;
    padding: 0.75rem 0;
    min-width: 64px;
    flex-shrink: 0;
    align-self: flex-start;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.7rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.18);
    user-select: none;
    background: rgba(8, 8, 12, 0.85);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1;
}

.nd-code-viewer-pre {
    flex: 1;
    margin: 0;
    padding: 0.75rem 0;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.7rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.72);
    white-space: pre;
    overflow: visible;
    background: none;
    min-width: 0;
}

/* Each diff line fills full width including sign prefix */
.nd-diff-line--add,
.nd-diff-line--del,
.nd-diff-line--ctx {
    display: block;
    padding: 0 1rem 0 0;
    min-width: 100%;
}

.nd-code-viewer-pre code {
    font: inherit;
    background: none;
    color: inherit;
}

/* Resize handle on right edge */
.nd-code-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    cursor: col-resize;
    background: transparent;
    transition: background 0.15s;
    z-index: 10;
}
.nd-code-resize-handle:hover,
.nd-code-resize-handle--dragging {
    background: rgba(255, 255, 255, 0.12);
}

/* ── Right panel: chat ───────────────────────────────────────────────────── */
.nd-code-chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 280px;
}

/* Agent header bar */
.nd-code-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.nd-code-agent-badge {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.75rem;
    font-weight: 500;
}

.nd-code-agent-badge svg { color: rgba(165, 180, 252, 0.7); }

.nd-code-back-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.5rem;
    padding: 0.3rem 0.65rem;
    font: inherit;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.nd-code-back-btn:hover {
    color: rgba(255, 255, 255, 0.75);
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.04);
}

/* Chat slot — the .nd-chat-embedded is moved here */
#nd-code-chat-slot {
    flex: 1.3;          /* Chat un peu plus large que la preview */
    min-width: 460px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#nd-code-chat-slot .nd-chat-embedded {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1.5rem 1.25rem;
    max-width: 720px;   /* Le chat respire au lieu de s'étaler */
    width: 100%;
    margin: 0 auto;
    height: 100%;
    box-sizing: border-box;
}

#nd-code-chat-slot .hero-chat-stack {
    margin-top: auto;
}

/* ── Viewer actions & diff button ────────────────────────────────────────── */
.nd-code-viewer-actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
}

.nd-code-viewer-diff-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font: inherit;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.35rem;
    padding: 0.2rem 0.5rem;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.nd-code-viewer-diff-btn:hover {
    color: rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.08);
}
.nd-code-viewer-diff-btn[hidden] { display: none; }

.nd-code-viewer-apply-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.6rem;
    background: rgba(74,222,128,0.12);
    border: 1px solid rgba(74,222,128,0.25);
    border-radius: 0.35rem;
    color: rgba(134,239,172,0.9);
    font-size: 0.68rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.nd-code-viewer-apply-btn:hover:not(:disabled) {
    background: rgba(74,222,128,0.2);
    color: rgba(187,247,208,1);
}
.nd-code-viewer-apply-btn:disabled { opacity: 0.5; cursor: default; }
.nd-code-viewer-apply-btn--done {
    background: rgba(74,222,128,0.18);
    color: rgba(187,247,208,1);
}
.nd-code-viewer-apply-btn[hidden] { display: none; }

.nd-code-viewer-mode-badge {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 0.3rem;
    padding: 0.1rem 0.5rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
}
.nd-code-viewer-mode-badge .nd-diff-add-count { color: rgba(74,222,128,0.9); }
.nd-code-viewer-mode-badge .nd-diff-del-count { color: rgba(248,113,113,0.9); }
.nd-code-viewer-mode-badge[hidden] { display: none; }

/* ── Diff hunk navigation ────────────────────────────────────────────────── */
.nd-diff-hunk-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-right: 0.25rem;
}
.nd-diff-hunk-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 0.3rem;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.nd-diff-hunk-btn:hover:not(:disabled) {
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.1);
}
.nd-diff-hunk-btn:disabled {
    opacity: 0.3;
    cursor: default;
}
.nd-diff-hunk-counter {
    font-size: 0.6rem;
    font-weight: 600;
    color: rgba(74,222,128,0.8);
    min-width: 2.2rem;
    text-align: center;
    letter-spacing: 0.02em;
}

/* ── Diff input overlay ──────────────────────────────────────────────────── */
.nd-diff-input-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    background: rgba(8, 8, 12, 0.97);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
}
.nd-diff-input-overlay[hidden] { display: none; }

.nd-diff-input-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.5);
}

.nd-diff-input-cancel {
    font: inherit;
    font-size: 0.68rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: color 0.15s;
}
.nd-diff-input-cancel:hover { color: rgba(255, 255, 255, 0.7); }

.nd-diff-input-area {
    flex: 1;
    resize: none;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.7rem;
    line-height: 1.6;
    padding: 0.75rem;
    outline: none;
    transition: border-color 0.15s;
}
.nd-diff-input-area:focus { border-color: rgba(255, 255, 255, 0.15); }

.nd-diff-input-apply {
    font: inherit;
    font-size: 0.72rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.45rem;
    color: rgba(255, 255, 255, 0.65);
    padding: 0.4rem 1rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    align-self: flex-end;
}
.nd-diff-input-apply:hover {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.9);
}

/* ── Diff viewer — Cursor-style ──────────────────────────────────────────── */

/* Gutter: two columns (old line / new line) */
.nd-diff-gutter--add,
.nd-diff-gutter--del,
.nd-diff-gutter--ctx {
    display: flex;
    gap: 0;
    padding: 0 0.5rem;
    line-height: 1.6;
    font-size: 0.7rem;
}
.nd-diff-gutter-old,
.nd-diff-gutter-new {
    display: inline-block;
    width: 26px;
    text-align: right;
    padding-right: 4px;
}
.nd-diff-gutter--add .nd-diff-gutter-old { opacity: 0; }
.nd-diff-gutter--del .nd-diff-gutter-new { opacity: 0; }

.nd-diff-gutter--add { background: rgba(74, 222, 128, 0.08); color: rgba(74,222,128,0.6) !important; }
.nd-diff-gutter--del { background: rgba(248, 113, 113, 0.08); color: rgba(248,113,113,0.6) !important; }
.nd-diff-gutter--ctx { color: rgba(255,255,255,0.2) !important; }

/* Code lines */
.nd-diff-line--add,
.nd-diff-line--del,
.nd-diff-line--ctx { display: block; }

.nd-diff-line--add {
    background: rgba(74, 222, 128, 0.1);
    border-left: 2px solid rgba(74, 222, 128, 0.7);
}
.nd-diff-line--del {
    background: rgba(248, 113, 113, 0.1);
    border-left: 2px solid rgba(248, 113, 113, 0.65);
    opacity: 0.75;
}

/* +/- sign column embedded in code */
.nd-diff-sign {
    display: inline-block;
    width: 1.1rem;
    user-select: none;
    font-weight: 700;
    flex-shrink: 0;
}
.nd-diff-sign--add { color: rgba(74,222,128,0.9); }
.nd-diff-sign--del { color: rgba(248,113,113,0.9); }

/* "Applied" badge */
.nd-diff-applied {
    color: rgba(74,222,128,0.8);
    font-size: 0.6rem;
    font-weight: 600;
    margin-left: 4px;
}
.nd-diff-applied--mem { color: rgba(147,197,253,0.85); }

/* Modified file indicator in tree (yellow) */
.nd-tree-modified {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(251,191,36,0.85);
    flex-shrink: 0;
    margin-right: 1px;
}

/* Generated file indicator in tree (green) */
.nd-tree-generated {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(52,199,89,0.9);
    flex-shrink: 0;
    margin-right: 1px;
}

/* ── Cyber tasks panel ───────────────────────────────────────────────────── */
.nd-cyber-tasks {
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    background: rgba(255,255,255,0.015);
}
.nd-cyber-tasks[hidden] { display: none; }

.nd-cyber-tasks-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.45rem 1rem;
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    color: rgba(255,255,255,0.45);
    transition: color 0.15s;
}
.nd-cyber-tasks-bar:hover { color: rgba(255,255,255,0.7); }

.nd-cyber-tasks-bar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nd-cyber-tasks-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(96,165,250,0.8);
    box-shadow: 0 0 6px rgba(96,165,250,0.4);
    animation: nd-ct-pulse 1.4s ease-in-out infinite;
    flex-shrink: 0;
}
.nd-cyber-tasks-indicator--done { background: rgba(74,222,128,0.85); box-shadow: none; animation: none; }

.nd-cyber-tasks-label {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.nd-cyber-tasks-chevron {
    color: rgba(255,255,255,0.22);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.nd-cyber-tasks-chevron--open { transform: rotate(90deg); }

.nd-cyber-tasks-body {
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.07) transparent;
    padding: 0.3rem 0.75rem 0.75rem;
}
.nd-cyber-tasks-body[hidden] { display: none; }

.nd-cyber-tasks-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

/* ── Task row ─────────────────────────────────────────────────────────────── */
.nd-ct-task { border-radius: 0.4rem; overflow: hidden; }

.nd-ct-task-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.42rem 0.5rem;
    cursor: pointer;
    border-radius: 0.4rem;
    transition: background 0.12s;
}
.nd-ct-task-row:hover { background: rgba(255,255,255,0.05); }

/* SVG icon */
.nd-ct-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}
.nd-ct-icon--sm { width: 14px; height: 14px; }
.nd-ct-icon svg { display: block; }

.nd-ct-icon--pending svg { color: rgba(255,255,255,0.22); }
.nd-ct-icon--running svg { color: rgba(96,165,250,1); }
.nd-ct-icon--done svg    { color: rgba(74,222,128,0.9); }
.nd-ct-icon--warning svg { color: rgba(251,191,36,0.9); }
.nd-ct-icon--error svg   { color: rgba(248,113,113,0.9); }

.nd-ct-spin { animation: nd-ct-spin 1.5s linear infinite; }

@keyframes nd-ct-pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
@keyframes nd-ct-spin  { to { transform: rotate(360deg); } }

.nd-ct-title {
    flex: 1;
    font-size: 0.8rem;
    font-weight: 450;
    color: rgba(255,255,255,0.6);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.15s;
}
.nd-ct-task-row:hover .nd-ct-title { color: rgba(255,255,255,0.88); }
.nd-ct-title--running { color: rgba(255,255,255,0.9) !important; }
.nd-ct-title--done    { color: rgba(255,255,255,0.28) !important; text-decoration: line-through; }

/* Right side: dep badges + status badge */
.nd-ct-row-right {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
}

.nd-ct-dep-badge {
    font-size: 0.62rem;
    font-weight: 500;
    padding: 0.1rem 0.38rem;
    border-radius: 0.25rem;
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.4);
    border: 1px solid rgba(255,255,255,0.08);
}

.nd-ct-badge {
    font-size: 0.62rem;
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    border-radius: 0.3rem;
    white-space: nowrap;
}
.nd-ct-badge--pending  { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.4); }
.nd-ct-badge--running  { background: rgba(96,165,250,0.12);  color: rgba(147,197,253,0.9); border: 1px solid rgba(96,165,250,0.2); }
.nd-ct-badge--done     { background: rgba(74,222,128,0.1);   color: rgba(134,239,172,0.85); border: 1px solid rgba(74,222,128,0.18); }
.nd-ct-badge--warning  { background: rgba(251,191,36,0.1);   color: rgba(253,224,71,0.85);  border: 1px solid rgba(251,191,36,0.18); }
.nd-ct-badge--error    { background: rgba(248,113,113,0.1);  color: rgba(252,165,165,0.85); border: 1px solid rgba(248,113,113,0.18); }

/* ── Subtasks ─────────────────────────────────────────────────────────────── */
.nd-ct-subtasks {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.25s ease, opacity 0.2s ease;
}
.nd-ct-subtasks--open { opacity: 1; }

.nd-ct-subtask-list {
    list-style: none;
    margin: 0.1rem 0 0.4rem 0.85rem;
    padding: 0;
    border-left: 1.5px dashed rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}

.nd-ct-subtask-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.28rem 0.4rem 0.28rem 0.75rem;
    border-radius: 0.3rem;
    transition: background 0.12s;
    cursor: default;
}
.nd-ct-subtask-row:hover { background: rgba(255,255,255,0.03); }

.nd-ct-subtask-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
    min-width: 0;
}

.nd-ct-subtask-title {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s;
}
.nd-ct-subtask-title--running { color: rgba(255,255,255,0.75) !important; }
.nd-ct-subtask-title--done    { color: rgba(255,255,255,0.2) !important; text-decoration: line-through; }

.nd-ct-snippet {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.28);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nd-ct-tools {
    display: flex;
    gap: 0.2rem;
    flex-wrap: wrap;
    margin-top: 0.1rem;
}
.nd-ct-tool-tag {
    font-size: 0.58rem;
    padding: 0.05rem 0.32rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 0.2rem;
    color: rgba(255,255,255,0.25);
    white-space: nowrap;
}

/* ── Main layout override when code agent is active ──────────────────────── */
.nd-code-agent-active .nd-chat-inner       { display: none; }
.nd-code-agent-active .nd-code-layout      { display: flex; }
.nd-code-agent-active .nd-agents-row       { display: none !important; }

/* When iOS preview is open, constrain chat panel width */
.nd-ios-active .nd-code-chat-panel {
    flex: 0 0 380px;
    min-width: 0;
}

/* When web preview is open, constrain chat panel width */
.nd-web-active .nd-code-chat-panel {
    flex: 0 0 380px;
    min-width: 0;
}

.nd-chat-main.nd-code-agent-active {
    padding: 0;
    overflow: hidden;
}

/* ── iOS Phone Preview Panel ─────────────────────────────────────────────── */
.nd-ios-preview {
    flex: 1;
    min-width: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 30%, #0f0f18 0%, #06060a 70%);
    border-left: 1px solid rgba(255,255,255,0.06);
    padding: 20px 24px;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
}
/* Hidden by default — shown via CSS class, not JS hidden attribute */
.nd-ios-preview { display: none !important; }
.nd-ios-active .nd-ios-preview { display: flex !important; }

.nd-iphone-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* iPhone 17 Pro frame */
.nd-iphone-frame {
    position: relative;
    width: 348px;
    height: 754px;          /* 348 × 874/402 ≈ 756 (iPhone 17 Pro) */
    background: linear-gradient(160deg, #2e2e33 0%, #1c1c1f 55%, #101012 100%);
    border-radius: 62px;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.13),
        inset 0 1px 0 rgba(255,255,255,0.22),
        inset 0 -1px 0 rgba(0,0,0,0.5),
        0 0 0 1px rgba(0,0,0,0.85),
        0 0 0 2.5px #0a0a0c,
        0 0 0 4.5px rgba(255,255,255,0.055),
        0 50px 120px rgba(0,0,0,0.98),
        0 16px 40px rgba(0,0,0,0.75);
}

/* Volume buttons (left) */
.nd-iphone-frame::before {
    content: '';
    position: absolute;
    left: -3.5px;
    top: 124px;
    width: 3.5px;
    height: 38px;
    background: linear-gradient(90deg, #1c1c1f, #2e2e33);
    border-radius: 3px 0 0 3px;
    box-shadow: 0 56px 0 #2e2e33, 0 112px 0 #2e2e33;
}

/* Power button (right) */
.nd-iphone-frame::after {
    content: '';
    position: absolute;
    right: -3.5px;
    top: 180px;
    width: 3.5px;
    height: 80px;
    background: linear-gradient(270deg, #1c1c1f, #2e2e33);
    border-radius: 0 3px 3px 0;
}

/* Screen bezel area */
.nd-iphone-screen-area {
    position: absolute;
    top: 14px;
    left: 7px;
    right: 7px;
    bottom: 12px;
    border-radius: 50px;
    overflow: hidden;
    background: #000;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 0 .5px rgba(255,255,255,0.05);
}

/* Dynamic Island */
.nd-iphone-dynamic-island {
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    width: 110px;
    height: 34px;
    background: #000;
    border-radius: 24px;
    z-index: 10;
    box-shadow:
        0 0 0 1.5px rgba(255,255,255,0.06),
        inset 0 1px 3px rgba(0,0,0,0.9);
    pointer-events: none;
}

/* Status bar */
.nd-iphone-status-bar {
    height: 60px;
    padding: 0 28px 10px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
}

.nd-iphone-time {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: -0.4px;
}

.nd-iphone-status-icons {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* App content area */
.nd-iphone-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #f2f2f7;
}

.nd-iphone-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: #f2f2f7;
}

/* Empty state */
.nd-iphone-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: rgba(60,60,67,0.4);
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12px;
    text-align: center;
    padding: 24px;
    line-height: 1.6;
    background: #f2f2f7;
}

/* Home indicator bar */
.nd-iphone-home-bar {
    height: 34px;
    background: rgba(0,0,0,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nd-iphone-home-indicator {
    width: 120px;
    height: 5px;
    background: rgba(255,255,255,0.24);
    border-radius: 3px;
}

/* Preview label below phone */
.nd-ios-preview-label {
    font-size: 10px;
    color: rgba(255,255,255,0.18);
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* ── Web Browser Preview Panel ───────────────────────────────────────────── */
.nd-web-preview {
    flex: 2;
    min-width: 520px;
    display: none;
    flex-direction: column;
    background: #0d0d0d;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
}
.nd-web-active .nd-web-preview { display: flex !important; }

/* ── HyperFrames Live Preview Panel ──────────────────────────────────────── */
.nd-hf-preview {
    flex: 2;
    min-width: 480px;
    display: none;
    flex-direction: column;
    background: #0d0d0d;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
}
.nd-hf-active .nd-hf-preview { display: flex !important; }

.nd-hf-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.nd-hf-preview-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.01em;
}
.nd-hf-preview-badge svg { color: rgba(255, 255, 255, 0.25); flex-shrink: 0; }

.nd-hf-play-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    font-family: inherit;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.nd-hf-play-btn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

.nd-hf-preview-body {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.nd-hf-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.15);
    text-align: center;
}
.nd-hf-empty svg { opacity: 0.4; }
.nd-hf-empty p { font-size: 12.5px; line-height: 1.6; }

.nd-hf-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
}

/* Player officiel HyperFrames (web component) */
.nd-hf-player {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: block;
}
.nd-hf-player[hidden] { display: none; }

/* Quand le player ou l'iframe sont visibles, on cache complètement le placeholder */
.nd-hf-preview-body:has(.nd-hf-player:not([hidden])),
.nd-hf-preview-body:has(.nd-hf-iframe:not([hidden])) {
    align-items: stretch;
    justify-content: stretch;
}
.nd-hf-preview-body:has(.nd-hf-player:not([hidden])) .nd-hf-empty,
.nd-hf-preview-body:has(.nd-hf-iframe:not([hidden])) .nd-hf-empty {
    display: none;
}

/* Browser frame wrapper */
.nd-browser-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 16px;
    gap: 10px;
}

/* Main browser chrome */
.nd-browser-frame {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #111;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 0 .5px rgba(255,255,255,0.04);
}

/* Top chrome bar */
.nd-browser-chrome {
    height: 44px;
    background: #1a1a1a;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    flex-shrink: 0;
}

/* Window controls — neutral (no colors per DA) */
.nd-browser-controls {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.nd-browser-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
}

/* URL bar */
.nd-browser-url-bar {
    flex: 1;
    height: 28px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 11px;
    max-width: 480px;
    margin: 0 auto;
    cursor: default;
}
.nd-browser-url-icon {
    font-size: 11px;
    opacity: 0.4;
    flex-shrink: 0;
}
.nd-browser-url-text {
    font-size: 12.5px;
    color: rgba(255,255,255,0.45);
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

/* Action buttons (refresh) */
.nd-browser-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.nd-browser-btn {
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.3);
    font-size: 15px;
    cursor: pointer;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.nd-browser-btn:hover {
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.7);
}

/* Page tabs strip */
.nd-browser-tabs {
    height: 34px;
    background: #161616;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: flex-end;
    padding: 0 12px;
    gap: 2px;
    flex-shrink: 0;
}
.nd-browser-tab {
    height: 28px;
    padding: 0 14px;
    font-size: 12px;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: center;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nd-browser-tab:hover { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.6); }
.nd-browser-tab.active { background: #111; color: rgba(255,255,255,0.8); }

/* Page content area */
.nd-browser-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #0a0a0a;
}
.nd-browser-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Empty state */
.nd-browser-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: rgba(255,255,255,0.2);
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    text-align: center;
    line-height: 1.5;
}
.nd-browser-empty svg {
    opacity: 0.25;
}

/* Multi-page navigation */
.nd-web-screens-nav {
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-shrink: 0;
    padding: 0 16px;
}
.nd-web-prev,
.nd-web-next {
    width: 26px;
    height: 26px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: rgba(255,255,255,0.6);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, opacity 0.15s;
    padding: 0;
    line-height: 1;
}
.nd-web-prev:hover, .nd-web-next:hover {
    background: rgba(255,255,255,0.1);
}
.nd-web-dots {
    display: flex;
    gap: 5px;
    align-items: center;
}
.nd-web-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}
.nd-web-dot.active {
    background: rgba(255,255,255,0.65);
    transform: scale(1.3);
}

/* Preview label */
.nd-web-preview-label {
    font-size: 10px;
    color: rgba(255,255,255,0.18);
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: center;
    padding-bottom: 8px;
}

/* ── 21st.dev Magic bar ──────────────────────────────────────────────────── */
.nd-21st-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    height: 36px;
    flex-shrink: 0;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.015);
}
.nd-21st-logo {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.01em;
}
.nd-21st-logo svg {
    color: rgba(255,255,255,0.35);
    flex-shrink: 0;
}
.nd-21st-key-input {
    flex: 1;
    height: 24px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 5px;
    color: rgba(255,255,255,0.7);
    font-size: 11px;
    font-family: inherit;
    padding: 0 8px;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
    min-width: 0;
}
.nd-21st-key-input:focus {
    border-color: rgba(59,130,246,0.5);
    background: rgba(59,130,246,0.05);
}
.nd-21st-key-input::placeholder {
    color: rgba(255,255,255,0.2);
    font-size: 11px;
}
.nd-21st-status {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    white-space: nowrap;
}
.nd-21st-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
    flex-shrink: 0;
    transition: background 0.3s;
}
.nd-21st-status-label {
    font-size: 10.5px;
    color: rgba(255,255,255,0.3);
    font-weight: 500;
}
.nd-21st-fetching-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    color: rgba(59,130,246,0.8);
    white-space: nowrap;
    flex-shrink: 0;
}
.nd-21st-spin {
    animation: nd21stSpin 0.8s linear infinite;
}
@keyframes nd21stSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ── Workflow agent — hide file tree ─────────────────────────────────────── */
.nd-workflow-active .nd-code-explorer { display: none !important; }

/* ── Workflow Agent Preview Panel ────────────────────────────────────────── */
.nd-workflow-preview {
    flex: 2;
    min-width: 480px;
    display: none;
    flex-direction: column;
    background: #0d0d0d;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
}
.nd-workflow-active .nd-workflow-preview { display: flex !important; }
.nd-workflow-active .nd-code-chat-panel  { flex: 0 0 380px; min-width: 0; }

.nd-wf-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    padding: 10px 12px 0 12px;
    gap: 8px;
}

/* Top bar */
.nd-wf-topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    height: 36px;
}
.nd-wf-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: rgba(139,92,246,.15);
    border: 1px solid rgba(139,92,246,.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8b5cf6;
    font-size: 13px;
    flex-shrink: 0;
}
.nd-wf-meta {
    flex: 1;
    min-width: 0;
}
.nd-wf-name {
    font-family: Inter, system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nd-wf-count {
    font-family: Inter, system-ui, sans-serif;
    font-size: 11px;
    color: rgba(255,255,255,.3);
}
.nd-wf-export-btn {
    height: 28px;
    padding: 0 10px;
    background: rgba(139,92,246,.12);
    border: 1px solid rgba(139,92,246,.25);
    border-radius: 6px;
    color: rgba(139,92,246,.9);
    font-family: Inter, system-ui, sans-serif;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.nd-wf-export-btn:hover { background: rgba(139,92,246,.22); border-color: rgba(139,92,246,.5); }
.nd-wf-export-btn:disabled { opacity: 0.3; cursor: default; }

/* Canvas area */
.nd-wf-canvas {
    flex: 1;
    min-height: 0;
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 10px;
    background: #1a1924;
    overflow: hidden;
    margin-bottom: 10px;
}
.nd-wf-canvas-content {
    position: relative;
    min-height: 100%;
    min-width: 100%;
    padding: 20px;
    box-sizing: border-box;
}
/* Empty state */
.nd-wf-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: rgba(255,255,255,.2);
    font-size: 13px;
    font-family: Inter, system-ui, sans-serif;
    text-align: center;
    line-height: 1.6;
    padding: 40px;
}
.nd-wf-empty svg { opacity: .2; }

/* Label */
.nd-wf-label { display: none; }

/* ── Slides Agent Preview Panel ──────────────────────────────────────────── */
.nd-slides-preview {
    flex: 2;
    min-width: 480px;
    display: none;
    flex-direction: column;
    border-left: 1px solid rgba(255,255,255,0.06);
    background: #0d0d14;
    overflow: hidden;
}
.nd-slides-active .nd-slides-preview  { display: flex !important; flex: 1; }
.nd-slides-active .nd-code-chat-panel { display: none !important; }
.nd-slides-active .nd-code-explorer   { display: none !important; }

.nd-slides-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 10px 12px 0;
    gap: 8px;
}

/* Top bar */
.nd-slides-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    padding: 0 2px;
    position: relative;
    z-index: 10;
}
.nd-slides-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}
.nd-slides-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.6);
    flex-shrink: 0;
}
.nd-slides-title {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    line-height: 1.2;
}
.nd-slides-count {
    font-size: 10px;
    color: rgba(255,255,255,0.3);
    line-height: 1.2;
}
.nd-slides-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.nd-slides-drive-btn,
.nd-slides-export-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.55);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    white-space: nowrap;
}
.nd-slides-drive-btn:not([disabled]):hover,
.nd-slides-export-btn:not([disabled]):hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.85);
    border-color: rgba(255,255,255,0.18);
}
.nd-slides-drive-btn:not([disabled]) {
    border-color: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.75);
    background: rgba(255,255,255,0.06);
}
.nd-slides-drive-btn:not([disabled]):hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.22);
    color: rgba(255,255,255,0.95);
}
.nd-slides-drive-btn[disabled],
.nd-slides-export-btn[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Generation form */
.nd-slides-gen {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding-bottom: 10px;
}

.nds-prompt-block {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}
.nds-prompt-header { display: flex; align-items: center; }
.nds-nslides-wrap { position: relative; }
.nds-nslides-btn {
    display: flex; align-items: center; gap: 5px;
    background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.85); border: 1px solid rgba(255,255,255,0.12); border-radius: 100px;
    padding: 5px 12px; font-size: 11px; font-weight: 500; cursor: pointer;
    font-family: inherit; transition: background 0.15s;
}
.nds-nslides-btn:hover { background: rgba(255,255,255,0.15); }
.nds-nslides-dropdown {
    position: absolute; top: calc(100% + 4px); left: 0; z-index: 100;
    background: #1a1a2e; border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; overflow: hidden; min-width: 80px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.nds-nslides-dropdown button {
    display: block; width: 100%; padding: 8px 16px; text-align: left;
    background: none; border: none; color: rgba(255,255,255,0.8);
    font-size: 12px; cursor: pointer; font-family: inherit;
}
.nds-nslides-dropdown button:hover { background: rgba(99,102,241,0.15); color: #fff; }
.nds-prompt-textarea {
    width: 100%; min-height: 72px; resize: vertical;
    background: transparent; border: none; outline: none;
    color: rgba(255,255,255,0.85); font-size: 12px; font-family: inherit;
    line-height: 1.6; placeholder-color: rgba(255,255,255,0.25);
}
.nds-prompt-textarea::placeholder { color: rgba(255,255,255,0.25); }
.nds-prompt-actions { display: flex; justify-content: flex-end; }
.nds-btn-generate {
    background: rgba(255,255,255,0.92);
    color: #0d0d14; border: none; border-radius: 100px;
    padding: 7px 20px; font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: inherit; transition: opacity 0.15s;
}
.nds-btn-generate:hover { opacity: 0.82; }
.nds-btn-generate:disabled { opacity: 0.3; cursor: not-allowed; }

.nds-upload-zone {
    border: 1.5px dashed rgba(255,255,255,0.1); border-radius: 10px;
    padding: 16px 12px; display: flex; align-items: center; gap: 12px;
    cursor: pointer; transition: border-color 0.15s; flex-shrink: 0;
}
.nds-upload-zone:hover { border-color: rgba(99,102,241,0.4); }
.nds-upload-icon {
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: rgba(255,255,255,0.5); flex-shrink: 0; line-height: 1;
}
.nds-upload-zone p {
    margin: 0; font-size: 11px; color: rgba(255,255,255,0.3);
}

.nds-settings-block {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px; overflow: hidden; flex-shrink: 0;
}
.nds-stabs {
    display: flex; border-bottom: 1px solid rgba(255,255,255,0.06);
    overflow-x: auto;
}
.nds-stab {
    flex-shrink: 0; padding: 9px 14px; font-size: 11px; font-weight: 500;
    color: rgba(255,255,255,0.4); background: none; border: none;
    cursor: pointer; font-family: inherit; transition: color 0.15s;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.nds-stab:hover { color: rgba(255,255,255,0.7); }
.nds-stab--active { color: rgba(255,255,255,0.9) !important; border-bottom-color: rgba(255,255,255,0.7); }
.nds-spanel { padding: 10px 12px; }
.nds-spanel[hidden] { display: none; }
.nds-srow {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.nds-srow:last-child { border-bottom: none; }
.nds-srow span { font-size: 11px; color: rgba(255,255,255,0.5); }
.nds-srow select {
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px; color: rgba(255,255,255,0.8); font-size: 11px;
    padding: 4px 8px; font-family: inherit; cursor: pointer; outline: none;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.4)' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center;
    padding-right: 24px;
}
.nds-srow select option { background: #1a1a2e; }
.nds-instruction-textarea {
    width: 100%; height: 80px; resize: vertical;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; padding: 8px 10px; color: rgba(255,255,255,0.8);
    font-size: 11px; font-family: inherit; outline: none; box-sizing: border-box;
}
.nds-instruction-textarea::placeholder { color: rgba(255,255,255,0.25); }

/* Toggle switch */
.nds-toggle { position: relative; display: inline-block; width: 32px; height: 18px; cursor: pointer; }
.nds-toggle input { opacity: 0; width: 0; height: 0; }
.nds-toggle-slider {
    position: absolute; inset: 0; background: rgba(255,255,255,0.1);
    border-radius: 18px; transition: background 0.2s;
}
.nds-toggle-slider:before {
    content: ''; position: absolute; height: 12px; width: 12px;
    left: 3px; bottom: 3px; background: rgba(255,255,255,0.5);
    border-radius: 50%; transition: transform 0.2s;
}
.nds-toggle input:checked + .nds-toggle-slider { background: rgba(255,255,255,0.25); }
.nds-toggle input:checked + .nds-toggle-slider:before { transform: translateX(14px); background: #fff; }

/* Template picker (kept inside Theme tab) */
.nd-slides-tpl-hint {
    margin: 0 0 8px;
    font-size: 11px;
    color: rgba(255,255,255,0.3);
}
.nd-slides-tpl-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}
.nds-tpl-card {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    text-align: left;
    overflow: hidden;
    padding: 0;
}
.nds-tpl-card:hover {
    border-color: rgba(99,102,241,0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.nds-tpl-card--active {
    border-color: rgba(99,102,241,0.7) !important;
    box-shadow: 0 0 0 2px rgba(99,102,241,0.25) !important;
}
.nds-tpl-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #1a1a2e;
    flex-shrink: 0;
}
.nds-tpl-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s;
}
.nds-tpl-card:hover .nds-tpl-thumb img {
    transform: scale(1.03);
}
.nds-tpl-info {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nds-tpl-name {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    line-height: 1.2;
    text-align: left;
}
.nds-tpl-desc {
    font-size: 10px;
    color: rgba(255,255,255,0.3);
    line-height: 1.2;
    text-align: left;
}
.nds-tpl-thumb--blank {
    background: rgba(255,255,255,0.03);
    border: 1.5px dashed rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
}
.nds-tpl-plus {
    font-size: 30px;
    font-weight: 200;
    color: rgba(255,255,255,0.25);
    line-height: 1;
    transition: color 0.2s;
    font-family: -apple-system, sans-serif;
}
.nds-tpl-card--blank:hover .nds-tpl-plus {
    color: rgba(99,102,241,0.7);
}
.nds-tpl-card--blank:hover {
    border-color: rgba(99,102,241,0.3);
}

/* ── Aperçu template sélectionnée ────────────────────────────────────────── */
.nds-selected-preview {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 24px;
    box-sizing: border-box;
}
.nds-selected-preview img {
    width: 100%;
    max-width: 520px;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.nds-selected-preview--blank {
    gap: 12px;
}
.nds-selected-blank-icon {
    width: 100%;
    max-width: 520px;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.03);
    border: 1.5px dashed rgba(255,255,255,0.1);
    border-radius: 8px;
    color: rgba(255,255,255,0.2);
}
.nds-selected-label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    font-family: -apple-system, sans-serif;
}
.nds-selected-hint {
    margin: 0;
    font-size: 11px;
    color: rgba(255,255,255,0.3);
    font-family: -apple-system, sans-serif;
}

/* Carousel */
.nd-slides-carousel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 10px;
}
.nd-slides-carousel[hidden] { display: none; }

.nd-slides-stage {
    flex: 1;
    min-height: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.07);
    background: #0f0f17;
    position: relative;
}
.nd-slides-stage .nds-slide {
    width: 100% !important;
    height: 100% !important;
}

.nd-slides-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-shrink: 0;
    padding: 0 4px 4px;
}
.nd-slides-prev,
.nd-slides-next {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.5);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}
.nd-slides-prev:hover,
.nd-slides-next:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.85);
}
.nd-slides-dots {
    display: flex;
    align-items: center;
    gap: 5px;
}
.nds-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    transition: all 0.15s;
}
.nds-dot--active {
    background: rgba(99,102,241,0.9);
    width: 14px;
    border-radius: 3px;
}

/* Label */
.nd-slides-label { display: none; }



/* ── Cacher la barre 21st.dev (clé hardcodée par défaut) ────────────────── */
.nd-21st-bar { display: none !important; }

/* ── File picker compact en haut du chat panel ───────────────────────────── */
.nd-code-files-toolbar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}
.nd-code-files-toolbar__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 0.4rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.74rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.nd-code-files-toolbar__btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.14);
}
.nd-code-files-toolbar__btn svg { opacity: 0.65; }
.nd-code-files-toolbar__sep {
    flex: 1;
}
.nd-code-files-toolbar__count {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
}

/* Quand la toolbar du haut est active, on cache la grande drop-zone */
.nd-code-explorer.nd-explorer-compact .nd-code-drop {
    padding: 1rem 0.6rem !important;
    gap: 0.5rem !important;
}
.nd-code-explorer.nd-explorer-compact .nd-code-drop svg,
.nd-code-explorer.nd-explorer-compact .nd-code-drop__btns {
    display: none !important;
}
.nd-code-explorer.nd-explorer-compact .nd-code-drop__label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.3);
    text-align: center;
}




/* ═══════════════════════════════════════════════════════════════════════════
   FINAL : layout web/iOS — flexbox simple 30/70, sans conflits
   ═══════════════════════════════════════════════════════════════════════════ */

/* 21st.dev bandeau toujours caché */
.nd-21st-bar { display: none !important; }

/* Layout en flex row (override toutes les anciennes règles) */
.nd-code-layout.nd-web-active,
.nd-code-layout.nd-ios-active {
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden;
    position: relative;
}

/* Cacher tous les enfants SAUF le chat panel + le preview correspondant.
   On utilise des sélecteurs explicites (pas :not chained) pour éviter les surprises. */
.nd-web-active .nd-code-explorer,
.nd-web-active .nd-code-viewer,
.nd-web-active .nd-ios-preview,
.nd-web-active .nd-hf-preview,
.nd-web-active .nd-research-panel,
.nd-web-active .nd-synth-panel,
.nd-web-active .nd-document-panel,
.nd-web-active .nd-spreadsheet-panel,
.nd-web-active .nd-translate-panel,
.nd-web-active .nd-workflow-panel,
.nd-web-active .nd-slides-panel,
.nd-web-active .nd-img-panel,
.nd-web-active .nd-vid-panel { display: none !important; }

.nd-ios-active .nd-code-explorer,
.nd-ios-active .nd-code-viewer,
.nd-ios-active .nd-web-preview,
.nd-ios-active .nd-hf-preview,
.nd-ios-active .nd-research-panel,
.nd-ios-active .nd-synth-panel,
.nd-ios-active .nd-document-panel,
.nd-ios-active .nd-spreadsheet-panel,
.nd-ios-active .nd-translate-panel,
.nd-ios-active .nd-workflow-panel,
.nd-ios-active .nd-slides-panel,
.nd-ios-active .nd-img-panel,
.nd-ios-active .nd-vid-panel { display: none !important; }

/* Chat panel : 30% pour web et iOS */
.nd-web-active .nd-code-chat-panel,
.nd-ios-active .nd-code-chat-panel {
    flex: 0 0 30% !important;
    width: 30% !important;
    max-width: 30% !important;
    min-width: 380px !important;
}

/* Preview : 70% (l'autre côté du flex) */
.nd-web-active .nd-web-preview,
.nd-ios-active .nd-ios-preview {
    flex: 1 1 auto !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Browser frame et iphone wrap remplissent leur parent */
.nd-web-active .nd-web-preview .nd-browser-wrap {
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: none !important;
    align-self: stretch !important;
}
.nd-web-active .nd-web-preview .nd-browser-frame {
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: none !important;
}

/* Drawer : explorer en overlay slide-in depuis la gauche */
.nd-web-active .nd-code-explorer.nd-explorer-drawer-show,
.nd-ios-active .nd-code-explorer.nd-explorer-drawer-show {
    display: flex !important;
    position: absolute !important;
    left: 0; top: 0; bottom: 0;
    width: 280px;
    z-index: 50;
    background: rgba(10,10,14,0.96);
    border-right: 1px solid rgba(255,255,255,0.08);
    box-shadow: 6px 0 30px rgba(0,0,0,0.5);
}

/* Plus de label/nav arrows parasites */
.nd-web-screens-nav,
.nd-web-preview-label { display: none !important; }

/* Files toolbar styles */
.nd-code-files-toolbar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}
.nd-code-drawer-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.7rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 0.45rem;
    color: rgba(255,255,255,0.7);
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nd-code-drawer-toggle:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.95);
    border-color: rgba(255,255,255,0.14);
}
.nd-code-drawer-toggle.is-open {
    background: rgba(96,165,250,0.15);
    border-color: rgba(96,165,250,0.4);
    color: rgba(147,197,253,0.95);
}
.nd-code-files-toolbar__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: rgba(96,165,250,0.18);
    color: rgba(147,197,253,0.95);
    border-radius: 9px;
    font-size: 0.7rem;
    font-weight: 600;
}
.nd-code-files-toolbar__sep { flex: 1; }
