/* NinjaVoice Cockpit — AI Telemarketer Management */

/* ===== Override parent section padding ===== */
#section-ninjavoice.app-section {
    padding: 0;
    max-width: 100%;
}

/* ===== Layout ===== */
.nv-cockpit {
    padding: 0;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
}

.nv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 0;
    margin-bottom: 0;
    flex-shrink: 0;
}

.nv-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.nv-header p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 2px 0 0;
}

/* ===== Tabs ===== */
.nv-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-light);
    padding: 0 16px;
    margin-top: 8px;
    overflow-x: auto;
    flex-shrink: 0;
}

.nv-tab {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.nv-tab:hover {
    color: var(--text-primary);
}

.nv-tab.active {
    color: #7c3aed;
    border-bottom-color: #7c3aed;
}

.nv-tab-content {
    display: none;
    padding: 12px 16px;
    flex: 1;
    min-height: 0;
}

.nv-tab-content.active {
    display: flex;
    flex-direction: column;
}

/* Agents tab: zero padding — layout fills everything */
#nvTabAgents.nv-tab-content {
    padding: 0;
}

#nvTabAgents.nv-tab-content.active {
    display: flex;
}

/* ===== KPI Cards ===== */
.nv-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.nv-kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 18px 20px;
}

.nv-kpi-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nv-kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 4px 0;
    line-height: 1.2;
}

.nv-kpi-change {
    font-size: 12px;
    color: var(--text-muted);
}

.nv-kpi-change.positive {
    color: #22c55e;
}
.nv-kpi-change.negative {
    color: #ef4444;
}

/* ===== Live Calls ===== */
.nv-live-section {
    margin-bottom: 24px;
}

.nv-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nv-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    animation: nv-pulse 2s infinite;
}

@keyframes nv-pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

.nv-live-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nv-live-call {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    font-size: 13px;
}

.nv-live-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.nv-live-status.active {
    background: #22c55e;
}
.nv-live-status.ringing {
    background: #f59e0b;
    animation: nv-pulse 1s infinite;
}

.nv-live-phone {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 120px;
}

.nv-live-agent {
    color: #7c3aed;
    min-width: 80px;
}

.nv-live-duration {
    color: var(--text-muted);
    min-width: 50px;
}

.nv-live-status-text {
    color: var(--text-secondary);
    flex: 1;
    font-style: italic;
}

/* ===== Tables ===== */
.nv-table-wrapper {
    overflow-x: auto;
}

.nv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.nv-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

.nv-table td {
    padding: 12px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.nv-table tr:hover td {
    background: rgba(124, 58, 237, 0.03);
}

.nv-table tr:last-child td {
    border-bottom: none;
}

/* ===== Badges ===== */
.nv-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.nv-badge.draft {
    background: #f1f5f9;
    color: #64748b;
}
.nv-badge.running {
    background: #dcfce7;
    color: #16a34a;
}
.nv-badge.paused {
    background: #fef3c7;
    color: #d97706;
}
.nv-badge.completed {
    background: #dbeafe;
    color: #2563eb;
}
.nv-badge.scheduled {
    background: #f3e8ff;
    color: #7c3aed;
}
.nv-badge.answered,
.nv-badge.ANSWERED {
    background: #dcfce7;
    color: #16a34a;
}
.nv-badge.no_answer,
.nv-badge.NO_ANSWER {
    background: #fee2e2;
    color: #dc2626;
}
.nv-badge.busy,
.nv-badge.BUSY {
    background: #fff7ed;
    color: #ea580c;
}
.nv-badge.REJECTED {
    background: #fef2f2;
    color: #b91c1c;
}
.nv-badge.UNREACHABLE {
    background: #faf5ff;
    color: #7c3aed;
}
.nv-badge.INVALID_NUMBER {
    background: #f1f5f9;
    color: #475569;
}
.nv-badge.CONGESTION {
    background: #fefce8;
    color: #a16207;
}
.nv-badge.ERROR {
    background: #fef2f2;
    color: #991b1b;
}
.nv-badge.pending {
    background: #f1f5f9;
    color: #64748b;
}
.nv-badge.calling {
    background: #dbeafe;
    color: #2563eb;
}
.nv-badge.qualified {
    background: #dcfce7;
    color: #16a34a;
}

/* Disposition breakdown panel on dashboard */
.nv-disposition-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}
.nv-disp-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.nv-disp-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.nv-disp-info {
    min-width: 0;
}
.nv-disp-count {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
}
.nv-disp-label {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.nv-disp-bar {
    height: 3px;
    border-radius: 2px;
    margin-top: 4px;
    background: var(--border-light);
    overflow: hidden;
}
.nv-disp-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
}
@media (max-width: 768px) {
    .nv-disposition-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== Buttons ===== */
.nv-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all 0.15s;
}

.nv-btn:hover {
    border-color: #7c3aed;
    color: #7c3aed;
}

.nv-btn.primary {
    background: #f3f0ff;
    color: #7c3aed;
    border-color: #ddd6fe;
}

.nv-btn.primary:hover {
    background: #ede9fe;
    border-color: #c4b5fd;
}

.nv-btn.success {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #bbf7d0;
}

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

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

.nv-btn.small {
    padding: 5px 10px;
    font-size: 12px;
}

/* ===== Actions Bar ===== */
.nv-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

/* ===== Campaign Card ===== */
.nv-campaign-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.nv-campaign-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 20px;
    transition: box-shadow 0.15s;
}

.nv-campaign-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.nv-campaign-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.nv-campaign-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.nv-campaign-card-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.nv-campaign-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 16px 0;
}

.nv-campaign-stat {
    text-align: center;
}

.nv-campaign-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.nv-campaign-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.nv-campaign-progress {
    height: 6px;
    background: #f1f5f9;
    border-radius: 3px;
    overflow: hidden;
    margin: 12px 0;
}

.nv-campaign-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #7c3aed, #a78bfa);
    border-radius: 3px;
    transition: width 0.3s;
}

.nv-campaign-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* ===== Call Detail (expandable row) ===== */
.nv-call-detail {
    padding: 16px;
    background: #fafaff;
    border-radius: 8px;
    margin: 8px 0;
}

.nv-transcript {
    font-size: 13px;
    line-height: 1.7;
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
}

.nv-transcript-line {
    margin-bottom: 6px;
}

.nv-transcript-role {
    font-weight: 600;
    display: inline;
}

.nv-transcript-role.agent {
    color: #7c3aed;
}
.nv-transcript-role.user {
    color: #2563eb;
}

/* ===== Score Badge ===== */
.nv-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
}

.nv-score.high {
    background: #dcfce7;
    color: #16a34a;
}
.nv-score.medium {
    background: #fef3c7;
    color: #d97706;
}
.nv-score.low {
    background: #fee2e2;
    color: #dc2626;
}

/* ===== Empty State ===== */
.nv-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.nv-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.nv-empty-text {
    font-size: 14px;
    margin-bottom: 16px;
}

/* ===== Hourly Chart (simple CSS bars) ===== */
.nv-hourly-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 80px;
    padding: 0;
    margin-bottom: 24px;
}

.nv-hourly-bar {
    flex: 1;
    background: linear-gradient(180deg, #7c3aed, #a78bfa);
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    position: relative;
}

.nv-hourly-label {
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: var(--text-muted);
}

/* ===== Modal ===== */
.nv-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nv-modal {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 28px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.nv-modal h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 20px;
    color: var(--text-primary);
}

.nv-form-group {
    margin-bottom: 16px;
    position: relative;
}

.nv-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.nv-form-group input,
.nv-form-group select,
.nv-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-card);
    box-sizing: border-box;
}

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

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

.nv-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ===== Audio Player ===== */
.nv-audio-player {
    margin-top: 8px;
}

.nv-audio-player audio {
    width: 100%;
    height: 32px;
}

/* ===== 2-Panel Agent Layout ===== */
.nv-agents-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 0;
    flex: 1;
    min-height: 0;
    border-top: 1px solid var(--border-light);
    overflow: hidden;
    background: var(--bg-card);
}

.nv-agent-list {
    border-right: 1px solid var(--border-light);
    background: #f8fafc;
    overflow-y: auto;
}

.nv-agent-list-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 2;
}

.nv-agent-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.1s;
}

.nv-agent-list-item:hover {
    background: #f1f5f9;
}

.nv-agent-list-item.selected {
    background: #ede9fe;
    border-left: 3px solid #7c3aed;
}

.nv-agent-list-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.nv-agent-list-item-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.nv-agent-list-item .nv-badge {
    flex-shrink: 0;
}

/* ===== Agent Editor (right panel) ===== */
.nv-agent-editor {
    overflow-y: auto;
    padding: 20px 24px;
}

.nv-agent-editor-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: var(--text-muted);
    font-size: 14px;
}

.nv-editor-section {
    margin-bottom: 20px;
}

.nv-editor-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #7c3aed;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nv-editor-section-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: #7c3aed;
    border-radius: 2px;
}

/* ===== Voice Picker Overlay ===== */
.nv-voice-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.nv-voice-picker {
    background: var(--bg-card);
    border-radius: 16px;
    width: 90vw;
    max-width: 960px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
}

.nv-voice-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.nv-voice-picker-header h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.nv-voice-picker-filters {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.nv-voice-picker-filters input,
.nv-voice-picker-filters select {
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 13px;
    background: var(--bg-card);
    color: var(--text-primary);
}

.nv-voice-picker-filters input {
    flex: 1;
    min-width: 200px;
}

.nv-voice-picker-body {
    overflow-y: auto;
    padding: 20px 24px;
    flex: 1;
}

.nv-voice-picker-section {
    margin-bottom: 24px;
}

.nv-voice-picker-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

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

.nv-voice-card {
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.nv-voice-card:hover {
    border-color: #7c3aed;
    box-shadow: 0 2px 12px rgba(124, 58, 237, 0.12);
}

.nv-voice-card.selected {
    border-color: #7c3aed;
    background: #faf5ff;
}

.nv-voice-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nv-voice-card-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.nv-voice-card-actions {
    display: flex;
    gap: 6px;
}

.nv-voice-card-actions .nv-btn {
    flex: 1;
    justify-content: center;
    padding: 6px 8px;
    font-size: 11px;
}

/* ===== Voice Settings Sliders ===== */
/* Voice sliders removed (P2 cleanup) */

/* ===== Toggle Switch ===== */
.nv-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.nv-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.nv-toggle-track {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.nv-toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.nv-toggle input:checked + .nv-toggle-track {
    background: #7c3aed;
}

.nv-toggle input:checked + .nv-toggle-track::after {
    transform: translateX(20px);
}

/* ===== Voice Selection Display ===== */
.nv-voice-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #faf5ff;
    border: 1px solid #e9d5ff;
    border-radius: 10px;
    margin-bottom: 16px;
}

.nv-voice-selected-info {
    flex: 1;
}

.nv-voice-selected-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.nv-voice-selected-id {
    font-size: 11px;
    color: var(--text-muted);
    font-family: monospace;
}

/* ===== Drop Zone (Voice Cloning) ===== */
/* Voice cloning drop zone removed (P2 cleanup) */

/* ===== TTS Test Section ===== */
.nv-tts-test {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nv-tts-test textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 13px;
    resize: vertical;
    min-height: 80px;
    box-sizing: border-box;
}

.nv-tts-test-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nv-tts-test-controls .nv-btn {
    flex-shrink: 0;
}

.nv-tts-test-controls audio {
    flex: 1;
    height: 36px;
}

.nv-tts-char-count {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
}

/* ===== Usage Widget ===== */
.nv-usage-widget {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.nv-usage-bar {
    width: 80px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.nv-usage-bar-fill {
    height: 100%;
    background: #7c3aed;
    border-radius: 3px;
    transition: width 0.3s;
}

.nv-usage-bar-fill.warning {
    background: #f59e0b;
}
.nv-usage-bar-fill.danger {
    background: #ef4444;
}

.nv-usage-text {
    font-weight: 600;
    color: var(--text-primary);
}

/* ===== Spinner ===== */
.nv-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: nv-spin 0.6s linear infinite;
}

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

/* ===== Editor Form Inline ===== */
.nv-form-inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.nv-form-inline .nv-form-group {
    margin-bottom: 0;
}

.nv-editor-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
    margin-top: 8px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .nv-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .nv-campaign-cards {
        grid-template-columns: 1fr;
    }
    .nv-tabs {
        padding: 0 12px;
    }
    .nv-tab-content {
        padding: 16px 12px;
    }
    .nv-form-row {
        grid-template-columns: 1fr;
    }
    .nv-agents-layout {
        grid-template-columns: 1fr;
    }
    .nv-agent-list {
        max-height: 180px;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
    }
    .nv-agent-editor {
        padding: 12px;
    }
    .nv-voice-picker {
        width: 95vw;
    }
    .nv-voice-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    .nv-form-inline {
        grid-template-columns: 1fr;
    }
}

/* ===== Test Playground ===== */

#nvTabTest.nv-tab-content {
    padding: 0;
}
#nvTabTest.nv-tab-content.active {
    display: flex;
}

.nv-test-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 0;
    flex: 1;
    min-height: 0;
    border-top: 1px solid var(--border-light);
    overflow: hidden;
    background: var(--bg-card);
}

/* Chat Panel (left) */
.nv-test-chat-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-right: 1px solid var(--border-light);
}

.nv-test-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    gap: 12px;
    flex-shrink: 0;
    background: #f8fafc;
}

.nv-test-chat-header-left {
    display: flex;
    gap: 8px;
    flex: 1;
}

.nv-test-chat-header-left select {
    padding: 6px 10px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    max-width: 180px;
}

.nv-test-chat-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Chat Messages Area */
.nv-test-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fafaff;
}

.nv-test-chat-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
    padding: 40px;
}

/* Message Bubbles */
.nv-test-msg {
    display: flex;
    gap: 8px;
    max-width: 80%;
    align-items: flex-end;
}

.nv-test-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.nv-test-msg-assistant {
    align-self: flex-start;
}

.nv-test-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    position: relative;
}

.nv-test-msg-user .nv-test-msg-bubble {
    background: #7c3aed;
    color: white;
    border-bottom-right-radius: 4px;
}

.nv-test-msg-assistant .nv-test-msg-bubble {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-bottom-left-radius: 4px;
}

.nv-test-msg-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.nv-test-msg-meta {
    display: flex;
    gap: 8px;
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.7;
}

.nv-test-msg-user .nv-test-msg-meta {
    color: rgba(255, 255, 255, 0.7);
}

.nv-test-msg-latency {
    font-weight: 600;
    color: #7c3aed;
}

.nv-test-msg-user .nv-test-msg-latency {
    color: rgba(255, 255, 255, 0.9);
}

.nv-test-msg-tokens {
    opacity: 0.6;
}

.nv-test-msg-play {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
    transition: background 0.15s;
}

.nv-test-msg-play:hover {
    background: #f1f5f9;
}

.nv-test-msg-system {
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
    padding: 4px 12px;
    background: #f1f5f9;
    border-radius: 12px;
    align-self: center;
}

/* Chat Input */
.nv-test-chat-input {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-card);
    flex-shrink: 0;
}

.nv-test-chat-input textarea {
    flex: 1;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    line-height: 1.4;
    background: #f8fafc;
    transition: border-color 0.15s;
}

.nv-test-chat-input textarea:focus {
    outline: none;
    border-color: #7c3aed;
    background: var(--bg-card);
}

.nv-test-chat-input .nv-btn {
    align-self: flex-end;
    border-radius: 12px;
    padding: 10px 20px;
}

/* Typing Indicator */
.nv-test-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-start;
}

.nv-test-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    animation: nvTypingBounce 1.2s infinite;
}

.nv-test-typing span:nth-child(2) {
    animation-delay: 0.2s;
}
.nv-test-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes nvTypingBounce {
    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Config Panel (right) */
.nv-test-config-panel {
    overflow-y: auto;
    padding: 0;
    background: #f8fafc;
}

.nv-test-config-panel .nv-editor-section {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
}

.nv-test-config-panel textarea {
    width: 100%;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    font-family: inherit;
    resize: vertical;
    background: var(--bg-card);
}

.nv-test-config-panel input[type='range'] {
    width: 100%;
}

/* Scenario Buttons */
.nv-test-scenario-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.nv-test-scenario-buttons .nv-btn {
    font-size: 11px;
    padding: 4px 10px;
}

/* Metrics */
.nv-test-metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.nv-test-metric {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 8px 10px;
    text-align: center;
}

.nv-test-metric-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.nv-test-metric-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Latency Chart */
.nv-test-latency-chart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 40px;
    margin-top: 10px;
    padding: 0 4px;
}

.nv-test-latency-bar {
    flex: 1;
    min-width: 6px;
    max-width: 20px;
    border-radius: 3px 3px 0 0;
    transition: height 0.3s ease;
    cursor: default;
}

/* Session History */
.nv-test-history-list {
    max-height: 200px;
    overflow-y: auto;
}

.nv-test-history-item {
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transition: background 0.15s;
}

.nv-test-history-item:hover {
    background: var(--bg-card);
}

.nv-test-history-item.active {
    background: #ede9fe;
    border: 1px solid #c4b5fd;
}

.nv-test-history-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 24px;
}

.nv-test-history-meta {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.nv-test-history-delete {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    display: none;
    border-radius: 4px;
    line-height: 1;
}

.nv-test-history-item:hover .nv-test-history-delete {
    display: flex;
    align-items: center;
    justify-content: center;
}

.nv-test-history-delete:hover {
    background: #fef2f2;
    color: #ef4444;
}

/* Actions */
.nv-test-actions {
    display: flex;
    gap: 8px;
}

.nv-test-actions .nv-btn {
    flex: 1;
}

/* Analysis Panel — inside scrollable .nv-test-chat-messages */
.nv-test-analysis {
    padding: 16px;
    border-top: 1px solid var(--border-light);
    background: #fefce8;
    border-radius: 8px;
    margin-top: 8px;
}

.nv-test-analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 13px;
    margin-top: 8px;
}

/* Tags */
.nv-test-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 11px;
    margin: 2px;
}

/* ===== LIVE Voice Conversation Mode ===== */

.nv-live-panel {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
    padding: 28px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(124, 58, 237, 0.3);
    position: relative;
    overflow: hidden;
}

.nv-live-panel::before {
    content: '';
    position: absolute;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.12) 0%, transparent 70%);
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

.nv-live-agent-info {
    text-align: center;
    z-index: 1;
}

.nv-live-agent-avatar {
    font-size: 44px;
    margin-bottom: 2px;
    filter: drop-shadow(0 0 12px rgba(124, 58, 237, 0.3));
}

.nv-live-agent-name {
    font-size: 16px;
    font-weight: 600;
    color: #e2e8f0;
    letter-spacing: 0.5px;
}

.nv-live-timer {
    font-size: 30px;
    font-weight: 700;
    color: #a78bfa;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    letter-spacing: 3px;
    margin-top: 4px;
}

.nv-live-waveform-container {
    width: 300px;
    height: 80px;
    border-radius: 12px;
    border: 2px solid rgba(148, 163, 184, 0.15);
    overflow: hidden;
    transition:
        border-color 0.3s,
        box-shadow 0.3s;
    z-index: 1;
    background: rgba(0, 0, 0, 0.2);
}

.nv-live-waveform-container.listening {
    border-color: rgba(34, 197, 94, 0.5);
    box-shadow: 0 0 24px rgba(34, 197, 94, 0.12);
    animation: nvLiveGlowGreen 2s ease-in-out infinite;
}

.nv-live-waveform-container.speaking {
    border-color: rgba(124, 58, 237, 0.5);
    box-shadow: 0 0 24px rgba(124, 58, 237, 0.12);
    animation: nvLiveGlowPurple 2s ease-in-out infinite;
}

.nv-live-waveform-container.processing {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 24px rgba(59, 130, 246, 0.12);
    animation: nvLiveGlowBlue 1s ease-in-out infinite;
}

.nv-live-waveform-container.held {
    border-color: rgba(245, 158, 11, 0.4);
}

@keyframes nvLiveGlowGreen {
    0%,
    100% {
        box-shadow: 0 0 15px rgba(34, 197, 94, 0.08);
    }
    50% {
        box-shadow: 0 0 35px rgba(34, 197, 94, 0.22);
    }
}

@keyframes nvLiveGlowPurple {
    0%,
    100% {
        box-shadow: 0 0 15px rgba(124, 58, 237, 0.08);
    }
    50% {
        box-shadow: 0 0 35px rgba(124, 58, 237, 0.22);
    }
}

@keyframes nvLiveGlowBlue {
    0%,
    100% {
        box-shadow: 0 0 15px rgba(59, 130, 246, 0.08);
    }
    50% {
        box-shadow: 0 0 35px rgba(59, 130, 246, 0.22);
    }
}

#nvLiveWaveform {
    width: 100%;
    height: 100%;
    display: block;
}

.nv-live-status {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    z-index: 1;
    transition: color 0.3s;
}

.nv-live-status.listening {
    color: #22c55e;
}
.nv-live-status.speaking {
    color: #a78bfa;
}
.nv-live-status.processing {
    color: #60a5fa;
}
.nv-live-status.held {
    color: #f59e0b;
}

.nv-live-interim {
    font-size: 14px;
    color: rgba(226, 232, 240, 0.55);
    font-style: italic;
    min-height: 20px;
    text-align: center;
    max-width: 420px;
    z-index: 1;
    line-height: 1.4;
}

.nv-live-controls {
    display: flex;
    gap: 18px;
    z-index: 1;
    margin-top: 6px;
}

.nv-live-control-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 2px solid rgba(148, 163, 184, 0.25);
    background: rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 20px;
    transition: all 0.2s;
}

.nv-live-control-btn span {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.nv-live-control-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(148, 163, 184, 0.5);
    transform: scale(1.05);
}

.nv-live-control-btn.active {
    background: rgba(245, 158, 11, 0.15);
    border-color: #f59e0b;
    color: #f59e0b;
}

.nv-live-control-btn.end-call {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.5);
    color: #ef4444;
}

.nv-live-control-btn.end-call:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
}

.nv-live-mode-toggle-row {
    display: flex;
    gap: 6px;
    z-index: 1;
}

.nv-live-mode-toggle-row .nv-btn {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    font-size: 11px;
}

.nv-live-mode-toggle-row .nv-btn.primary {
    background: rgba(124, 58, 237, 0.2);
    border-color: #7c3aed;
    color: #a78bfa;
}

.nv-live-start-btn {
    margin-top: 8px;
    z-index: 1;
    padding: 14px 36px !important;
    font-size: 15px !important;
    letter-spacing: 0.5px;
}

.nv-live-start-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.nv-live-mode-switch {
    display: flex;
    gap: 3px;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 2px;
}

.nv-live-mode-switch .nv-btn {
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 12px;
    padding: 4px 10px;
}

.nv-live-mode-switch .nv-btn.primary {
    background: #7c3aed;
    color: white;
}

/* Live Transcript Panel */
.nv-live-transcript-panel {
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nv-live-transcript-line {
    font-size: 12px;
    line-height: 1.4;
    padding: 4px 8px;
    border-radius: 6px;
    word-break: break-word;
}

.nv-live-transcript-line.user {
    color: var(--text-primary);
    background: #ede9fe;
}

.nv-live-transcript-line.assistant {
    color: var(--text-secondary);
    background: #f1f5f9;
}

.nv-live-transcript-line.listening {
    color: var(--text-muted);
    font-style: italic;
    animation: nv-pulse 2s infinite;
}

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

/* Live Metrics Breakdown */
.nv-live-metrics-breakdown {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nv-live-metrics-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 3px 0;
}

.nv-live-metrics-row strong {
    color: var(--text-primary);
    font-weight: 600;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.nv-live-metrics-row.total {
    border-top: 1px solid var(--border-light);
    padding-top: 6px;
    margin-top: 2px;
}

.nv-live-metrics-row.total strong {
    color: #7c3aed;
    font-size: 13px;
}

/* Responsive */
@media (max-width: 900px) {
    .nv-test-layout {
        grid-template-columns: 1fr;
    }
    .nv-test-config-panel {
        max-height: 300px;
        border-top: 1px solid var(--border-light);
    }
    .nv-live-panel {
        padding: 16px 12px;
    }
    .nv-live-timer {
        font-size: 22px;
    }
    .nv-live-waveform-container {
        width: 220px;
        height: 60px;
    }
    .nv-live-control-btn {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
}

/* ============================================================
   SCENARIO EDITOR TABS + EXPERT BADGE
   ============================================================ */

.nv-sc-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-light, #e2e8f0);
    margin-bottom: 16px;
}

.nv-sc-tab {
    padding: 8px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary, #64748b);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition:
        color 0.2s,
        border-color 0.2s;
}

.nv-sc-tab:hover {
    color: var(--text-primary, #1e293b);
}

.nv-sc-tab.active {
    color: var(--primary, #2563eb);
    border-bottom-color: var(--primary, #2563eb);
}

.nv-sc-tab-content {
    display: none;
}

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

.nv-badge-expert {
    display: inline-block;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    letter-spacing: 0.5px;
    vertical-align: middle;
    text-transform: uppercase;
}

.nv-badge-blocks {
    display: inline-block;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    letter-spacing: 0.5px;
    vertical-align: middle;
    text-transform: uppercase;
}

.nv-badge-legacy {
    display: inline-block;
    background: var(--text-muted, #94a3b8);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    letter-spacing: 0.5px;
    vertical-align: middle;
    text-transform: uppercase;
}

/* ============================================================
   BLOCK EDITOR
   ============================================================ */

.nv-block-editor-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 12px;
    min-height: 500px;
}

.nv-block-editor-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nv-block-editor-right {
    display: flex;
    flex-direction: column;
}

.nv-block-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    position: relative;
}

.nv-block-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nv-block-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted, #94a3b8);
    font-size: 13px;
    border: 2px dashed var(--border-light, #e2e8f0);
    border-radius: 8px;
}

/* Accordion wrapper */
.nv-block-accordion {
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
    background: var(--bg-card, #fff);
}

.nv-block-accordion:hover {
    border-color: var(--primary, #2563eb);
}

.nv-block-accordion.open {
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.nv-block-accordion.open .nv-block-form {
    border: none;
    border-top: 1px solid var(--border-light, #e2e8f0);
    border-radius: 0;
    margin: 0;
}

.nv-block-card {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
    background: transparent;
}

.nv-block-card:hover {
    background: rgba(37, 99, 235, 0.03);
}

.nv-block-card.active {
    background: rgba(37, 99, 235, 0.06);
}

.nv-block-card-chevron {
    font-size: 10px;
    color: var(--text-muted, #94a3b8);
    width: 14px;
    text-align: center;
    transition: transform 0.2s;
}

.nv-block-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nv-block-card-icon {
    font-size: 16px;
    width: 24px;
    text-align: center;
}

.nv-block-card-type {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    flex: 1;
}

.nv-block-card-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.nv-block-card:hover .nv-block-card-actions,
.nv-block-card.active .nv-block-card-actions {
    opacity: 1;
}

.nv-block-btn {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 4px;
    background: var(--bg-card, #fff);
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary, #64748b);
    transition:
        background 0.15s,
        color 0.15s;
    padding: 0;
}

.nv-block-btn:hover {
    background: var(--border-light, #e2e8f0);
}

.nv-block-btn.danger:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
}

.nv-block-card-summary {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    margin-top: 4px;
    padding-left: 32px;
}

/* Block form (edit panel) */
.nv-block-form {
    border: 1px solid var(--primary, #2563eb);
    border-radius: 8px;
    padding: 12px;
    background: rgba(37, 99, 235, 0.02);
}

.nv-block-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary, #2563eb);
}

.nv-block-form .nv-form-group {
    margin-bottom: 10px;
}

.nv-block-form label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    display: block;
    margin-bottom: 4px;
}

.nv-block-form input,
.nv-block-form textarea,
.nv-block-form select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: var(--bg-card, #fff);
    box-sizing: border-box;
}

.nv-block-form textarea {
    min-height: 80px;
    resize: vertical;
}

/* Prompt preview */
.nv-block-preview-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    margin-bottom: 8px;
}

.nv-block-preview {
    flex: 1;
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    font-size: 12px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    line-height: 1.5;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 700px;
}

/* Add block dropdown menu */
.nv-add-block-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 100;
    min-width: 220px;
    padding: 4px 0;
    margin-top: 4px;
}

.nv-add-block-group {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted, #94a3b8);
    padding: 8px 12px 4px;
}

.nv-add-block-item {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-primary, #1e293b);
    transition: background 0.15s;
}

.nv-add-block-item:hover {
    background: rgba(37, 99, 235, 0.06);
    color: var(--primary, #2563eb);
}

/* UberEkspertyza URL list */
.nv-uber-url-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nv-uber-url-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-body, #f0f4f8);
    border-radius: 6px;
    font-size: 13px;
}

.nv-uber-url-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.nv-uber-url-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary, #1e293b);
}

/* Toast */
.nv-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1e293b;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 10000;
    opacity: 0;
    transform: translateY(8px);
    transition:
        opacity 0.2s,
        transform 0.2s;
}

.nv-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.nv-toast.success {
    background: #16a34a;
}

/* ===== Decision Tree Visual Editor ===== */
/* Decision tree editor removed (P2 cleanup) */

/* Block library browser removed (P2 cleanup) */
.nv-add-block-divider {
    height: 1px;
    background: var(--border-light, #e2e8f0);
    margin: 4px 0;
}

/* Responsive */
@media (max-width: 900px) {
    .nv-block-editor-layout {
        grid-template-columns: 1fr;
    }
    .nv-block-preview {
        max-height: 300px;
    }
}


/* ===== SMS Tab ===== */

.nv-sms-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-light);
    gap: 12px;
    background: #fff;
    flex-shrink: 0;
}

.nv-sms-toolbar-left {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nv-sms-toolbar-center {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nv-sms-toolbar-right {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.nv-sms-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

.nv-sms-status-dot.online {
    background: #22c55e;
    box-shadow: 0 0 4px #22c55e80;
}

.nv-sms-status-dot.offline {
    background: #94a3b8;
}

.nv-sms-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.nv-sms-threads {
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.nv-sms-search {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-light);
}

.nv-sms-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 13px;
    background: var(--bg-body);
    outline: none;
    box-sizing: border-box;
}

.nv-sms-search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.nv-sms-thread-list {
    flex: 1;
    overflow-y: auto;
}

.nv-sms-thread {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    gap: 10px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.15s;
    position: relative;
}

.nv-sms-thread .nv-sms-thread-actions {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    gap: 2px;
}

.nv-sms-thread:hover .nv-sms-thread-actions {
    display: flex;
}

.nv-sms-thread-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    padding: 3px 6px;
    border-radius: 4px;
    opacity: 0.5;
    color: var(--text-secondary);
}

.nv-sms-thread-action-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.06);
}

.nv-sms-thread-action-btn.danger:hover {
    color: #ef4444;
    background: #fef2f2;
}

.nv-sms-thread:hover {
    background: var(--bg-body);
}

.nv-sms-thread.active {
    background: #eff6ff;
    border-left: 3px solid var(--primary);
}

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

.nv-sms-thread-info {
    flex: 1;
    min-width: 0;
}

.nv-sms-thread-name {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nv-sms-thread-snippet {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.nv-sms-thread-meta {
    text-align: right;
    flex-shrink: 0;
}

.nv-sms-thread-time {
    font-size: 11px;
    color: var(--text-muted);
}

.nv-sms-thread-count {
    display: inline-block;
    background: #cbd5e1;
    color: #475569;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    margin-top: 4px;
}

.nv-sms-thread-unread {
    display: inline-block;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    margin-top: 4px;
    animation: nv-sms-pulse 2s ease-in-out infinite;
}

@keyframes nv-sms-pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.nv-sms-thread.unread .nv-sms-thread-name {
    font-weight: 700;
    color: var(--text-primary);
}

.nv-sms-thread.unread .nv-sms-thread-snippet {
    color: var(--text-primary);
    font-weight: 500;
}

/* SMS Conversation */

.nv-sms-conversation {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.nv-sms-conv-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.nv-sms-conv-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.nv-sms-conv-action-btn {
    background: none;
    border: 1px solid var(--border-light);
    cursor: pointer;
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 6px;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.nv-sms-conv-action-btn:hover {
    background: var(--bg-body);
    color: var(--text-primary);
}

.nv-sms-conv-action-btn.danger:hover {
    border-color: #fecaca;
    color: #ef4444;
    background: #fef2f2;
}

.nv-sms-conv-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.nv-sms-conv-phone {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.nv-sms-conv-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8fafc;
}

.nv-sms-bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    position: relative;
}

.nv-sms-bubble.outbound {
    align-self: flex-end;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.nv-sms-bubble.inbound {
    align-self: flex-start;
    background: #fff;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-bottom-left-radius: 4px;
}

.nv-sms-bubble-text {
    word-break: break-word;
}

.nv-sms-bubble-time {
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.7;
}

.nv-sms-bubble.outbound .nv-sms-bubble-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.7);
}

.nv-sms-bubble.inbound .nv-sms-bubble-time {
    color: var(--text-muted);
}

.nv-sms-failed {
    color: #fbbf24;
    font-weight: bold;
}

/* SMS Input */

.nv-sms-conv-input {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
    background: #fff;
}

.nv-sms-input-field {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 100px;
}

.nv-sms-input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.nv-sms-send-btn {
    padding: 10px 20px;
    border-radius: 12px;
    white-space: nowrap;
}

/* SMS Empty state */

.nv-sms-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
}

.nv-sms-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.nv-sms-empty-text {
    font-size: 14px;
}

.nv-sms-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    font-size: 13px;
}


/* Small button variant */

.nv-btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

/* SMS Port Picker */

.nv-sms-port-picker {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nv-sms-port-label {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.nv-sms-port-select {
    padding: 5px 10px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 12px;
    background: #fff;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    min-width: 160px;
}

.nv-sms-port-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* SMS Port status dots */

.nv-sms-port-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-left: 3px;
}

.nv-sms-port-dot.ok {
    background: #22c55e;
}

.nv-sms-port-dot.err {
    background: #ef4444;
}

/* SMS Tab Badge */

.nv-sms-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    margin-left: 6px;
    vertical-align: middle;
}

/* SMS Delivery status icons */

.nv-sms-delivered {
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    letter-spacing: -2px;
}

.nv-sms-sent {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}

.nv-sms-failed {
    color: #fbbf24;
    font-weight: bold;
}

/* Incoming call pulse animation */
@keyframes nv-incoming-pulse {
    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 8px 24px rgba(34, 197, 94, 0.6);
    }
}

/* SMS Input area improved */

.nv-sms-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.nv-sms-input-meta {
    display: flex;
    justify-content: flex-end;
    padding-top: 4px;
}

.nv-sms-char-count {
    font-size: 11px;
    color: var(--text-muted);
}

.nv-sms-char-warn {
    color: #f59e0b;
    font-weight: 600;
}

.nv-sms-send-btn {
    min-width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
}

.nv-sms-send-icon {
    font-size: 18px;
}

/* SMS Conv header */

.nv-sms-conv-header-left {
    flex: 1;
}

/* SMS Refresh button animation */

.nv-sms-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.nv-sms-refresh-icon {
    display: inline-block;
    font-size: 14px;
    transition: transform 0.3s;
}

.nv-sms-refresh-btn.spinning .nv-sms-refresh-icon {
    animation: nv-spin 0.8s linear infinite;
}

@keyframes nv-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* SMS Sending spinner */

.nv-sms-sending-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: nv-spin 0.6s linear infinite;
    display: inline-block;
}

/* SMS Contact suggestions */

.nv-sms-suggestions {
    position: absolute;
    z-index: 100;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    width: calc(100% - 2px);
    margin-top: 2px;
}

.nv-sms-suggestion {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #f1f5f9;
}

.nv-sms-suggestion:last-child {
    border-bottom: none;
}

.nv-sms-suggestion:hover {
    background: #f0f4f8;
}

/* SMS Stats today */

.nv-sms-stats-today {
    font-variant-numeric: tabular-nums;
}

/* SMS Mobile responsive */

@media (max-width: 768px) {
    .nv-sms-layout {
        grid-template-columns: 1fr;
    }

    .nv-sms-threads {
        border-right: none;
        max-height: 40vh;
    }

    .nv-sms-bubble {
        max-width: 85%;
    }
}
