:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #0d0d1f;
    --bg-input: #111122;
    --bg-bubble-user: #1a3a5c;
    --bg-bubble-assistant: #1a1a30;
    --border: #2a2a4a;
    --border-secondary: #1a1a2e;
    --text-primary: #e0e0e0;
    --text-secondary: #c0c0c0;
    --text-muted: #888;
    --text-dim: #666;
    --accent: #00d4ff;
}
body.light {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-input: #f0f0f0;
    --bg-bubble-user: #d0e4f0;
    --bg-bubble-assistant: #e8e8f0;
    --border: #d0d0d0;
    --border-secondary: #e0e0e0;
    --text-primary: #1a1a1a;
    --text-secondary: #333;
    --text-muted: #666;
    --text-dim: #999;
    --accent: #0088cc;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh;
    height: var(--vh, 100dvh);
    overflow: hidden;
    overscroll-behavior: none;
}

.screen {
    height: 100vh;
    height: 100dvh;
    height: var(--vh, 100dvh);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none !important;
}

/* ── Boot Animation ── */

.boot-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.boot-overlay.hidden {
    display: none;
}

.bat-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.boot-logo {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.boot-text {
    font-size: 32px;
    font-weight: 300;
    letter-spacing: 12px;
    color: #FFD700;
    opacity: 0;
    margin-top: 8px;
    text-indent: 12px;
    transition: color 1.5s ease, text-shadow 1.5s ease;
}

.boot-subtitle {
    font-size: 11px;
    letter-spacing: 6px;
    color: #FFD700;
    opacity: 0;
    margin-top: 6px;
    text-indent: 6px;
    transition: color 1.5s ease;
}

.boot-click {
    font-size: 13px;
    letter-spacing: 3px;
    color: rgba(255, 215, 0, 0.6);
    margin-top: 40px;
    animation: bootClickPulse 2s ease-in-out infinite;
    cursor: pointer;
}

@keyframes bootClickPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.boot-scanlines {
    position: absolute;
    inset: 0;
    z-index: 3;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
    pointer-events: none;
    opacity: 0.5;
}

/* ── Login ── */

.login-container {
    text-align: center;
    width: 100%;
    max-width: 320px;
    padding: 0 20px;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    background: radial-gradient(circle, #1e3a5f, #0d1b2a);
    border: 2px solid #1a5276;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    color: #00d4ff;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.15);
}

.login-title {
    font-size: 24px;
    font-weight: 300;
    color: #c0c0c0;
    margin-bottom: 32px;
    letter-spacing: 4px;
    text-transform: uppercase;
}

#login-form input {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 12px;
    background: #111122;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

#login-form input:focus {
    border-color: #00d4ff;
}

#login-form input::placeholder {
    color: #555;
}

#login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #1a3a5c, #0d4a6b);
    border: 1px solid #1a5276;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 4px;
}

#login-btn:hover {
    background: linear-gradient(135deg, #1e4a6c, #0d5a8b);
    border-color: #00d4ff;
}

#login-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.error-text {
    color: #ff4757;
    font-size: 13px;
    margin-top: 12px;
    min-height: 20px;
}

/* ── Error Screen (403 / 404) ── */

#error-screen {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.error-container {
    max-width: 440px;
    padding: 32px;
    text-align: center;
}

.error-code {
    font-size: 96px;
    font-weight: 200;
    letter-spacing: 4px;
    color: #FFD700;
    line-height: 1;
    margin-bottom: 24px;
}

.error-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: var(--text-primary);
}

.error-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.error-from {
    font-size: 12px;
    color: var(--text-muted, #666);
    font-family: ui-monospace, monospace;
    margin: 8px 0 24px 0;
    word-break: break-all;
}

.error-home-btn {
    background: #FFD700;
    color: #000;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.error-home-btn:hover {
    opacity: 0.88;
}

/* ── Main Screen (flex row) ── */

#main-screen {
    align-items: stretch;
    justify-content: flex-start;
    background: var(--bg-primary);
    flex-direction: row;
}

/* ── Sidebar ── */

.sidebar {
    width: 280px;
    min-width: 0;
    height: 100vh;
    height: 100dvh;
    height: var(--vh, 100dvh);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-secondary);
    display: flex;
    flex-direction: column;
    z-index: 100;
    position: relative;
    overflow: hidden;
    transition: width 0.2s ease;
}

.sidebar.collapsed {
    width: 0 !important;
    border-right: none;
}

/* Auto-hide sidebar when editing an active session — slides in via hover */
.sidebar.editor-autohide {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    z-index: 105;
}
.sidebar.editor-autohide.revealed {
    transform: translateX(0);
}
#editor-sidebar-hotzone {
    position: fixed;
    left: 0;
    top: 0;
    width: 5px;
    height: 100vh;
    z-index: 104;
    background: rgba(170, 119, 255, 0.55);
    pointer-events: auto;
    cursor: pointer;
    transition: width 0.12s ease, background 0.12s ease;
}
#editor-sidebar-hotzone::after {
    content: "›";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.85);
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease;
}
#editor-sidebar-hotzone:hover {
    width: 14px;
    background: rgba(170, 119, 255, 0.95);
    box-shadow: 2px 0 12px rgba(170, 119, 255, 0.5);
}
#editor-sidebar-hotzone:hover::after {
    opacity: 1;
}
#editor-sidebar-hotzone.hidden {
    display: none !important;
}

.resize-handle {
    position: absolute;
    top: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    z-index: 110;
    background: transparent;
}

.resize-handle:hover,
.resize-handle.active {
    background: #00d4ff44;
}

.sidebar .resize-handle {
    right: 0;
}

.artifact-panel .resize-handle {
    left: 0;
}

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

.sidebar-title {
    font-size: 14px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-new-btn {
    flex: 1;
    padding: 8px 12px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.sidebar-new-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

#traffic-view,
#design-view,
#copy-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.conversation-list,
.projects-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: 8px;
    min-height: 0;
}

.conv-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 2px;
}

.conv-item:hover {
    background: #151530;
}

.conv-item.active {
    background: #1a1a3a;
}

.conv-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.conv-item-title {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-item.active .conv-item-title {
    color: var(--text-primary);
}

.conv-item-meta {
    font-size: 11px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 4px;
}

.conv-item-meta .agent-dot {
    width: 6px;
    height: 6px;
}

.conv-item-id {
    display: none;
    font-size: 10px;
    color: #555;
    font-family: monospace;
    cursor: pointer;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.04);
}

.conv-item:hover .conv-item-id {
    display: inline;
}

.conv-item-id:hover {
    color: #818cf8;
    background: rgba(99, 102, 241, 0.1);
}

.conv-item-delete {
    opacity: 0;
    background: none;
    border: none;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.15s;
    flex-shrink: 0;
}

.conv-item:hover .conv-item-delete {
    opacity: 1;
}

.conv-item-delete:hover {
    color: #ff4757;
    background: rgba(255, 71, 87, 0.1);
}

/* ── Sidebar Agents ── */

.sidebar-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 1px;
    flex-shrink: 0;
    padding: 8px 12px 4px;
}

.sidebar-section-title.collapsible {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0;
    user-select: none;
    -webkit-user-select: none;
}
.sidebar-section-title.collapsible > span:first-child {
    flex: 1;
}

.sidebar-section-title.collapsible:hover {
    color: #888;
}

.collapse-arrow {
    transition: transform 0.2s ease;
    font-size: 10px;
}

.sidebar-section-title.collapsed .collapse-arrow {
    transform: rotate(-90deg);
}

.groups-list.collapsed,
.copy-filters.collapsed,
.copy-tasks-list.collapsed {
    display: none;
}

.section-unread {
    background: #ff4757;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 6px;
    min-width: 16px;
    text-align: center;
    line-height: 14px;
    margin-left: auto;
    margin-right: 4px;
}

/* Only show section badge when collapsed (individual badges visible when expanded) */
.sidebar-section-title:not(.collapsed) .section-unread {
    display: none;
}

.sidebar-add-btn {
    background: none;
    border: none;
    color: #555;
    font-size: 15px;
    font-weight: 600;
    width: 18px;
    height: 18px;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    padding: 0;
    line-height: 1;
    transition: all 0.15s;
    flex-shrink: 0;
}
.sidebar-add-btn:hover {
    background: #383838;
    color: #ccc;
}

/* ── Copy Group Modal ── */
.cg-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}
.cg-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    width: 340px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.cg-modal-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}
.cg-modal-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #888);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 4px;
    display: block;
}
.cg-modal-input {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    margin-bottom: 12px;
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.cg-modal-input:focus {
    border-color: var(--accent);
}
.cg-modal-input.cg-modal-slug {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}
.cg-modal-hint {
    font-size: 11px;
    color: var(--text-muted, #666);
    margin-top: -8px;
    margin-bottom: 12px;
}
.cg-modal-hint code {
    background: var(--bg-primary);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 11px;
}
.cg-modal-error {
    font-size: 12px;
    color: #ff4757;
    margin-bottom: 12px;
    padding: 6px 8px;
    background: rgba(255,71,87,0.1);
    border-radius: 4px;
}
.cg-modal-error.hidden { display: none; }
.cg-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.cg-modal-btn {
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}
.cg-modal-cancel {
    background: transparent;
    color: var(--text-secondary, #888);
    border: 1px solid var(--border);
}
.cg-modal-cancel:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}
.cg-modal-confirm {
    background: var(--accent);
    color: #fff;
}
.cg-modal-confirm:hover {
    filter: brightness(1.15);
}
.cg-modal-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Products editor */
.cg-products-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    min-height: 24px;
}
.cg-product-tag {
    display: flex;
    align-items: center;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0;
    gap: 0;
}
.cg-product-edit {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    width: 48px;
    min-width: 32px;
    padding: 4px 6px;
    outline: none;
    text-align: center;
}
.cg-product-edit:focus {
    background: rgba(0,212,255,0.08);
}
.cg-product-remove {
    background: none;
    border: none;
    border-left: 1px solid var(--border);
    color: var(--text-secondary, #888);
    cursor: pointer;
    font-size: 13px;
    padding: 3px 5px;
    line-height: 1;
    transition: color 0.15s;
}
.cg-product-remove:hover {
    color: #ff4757;
}
.cg-products-add {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 12px;
}
.cg-products-add .cg-modal-input {
    flex: 1;
    margin-bottom: 0;
}
.cg-product-add-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--accent);
    font-size: 16px;
    font-weight: 600;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}
.cg-product-add-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Edit products button on group items */
.cg-edit-products-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary, #666);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    line-height: 1;
    margin-left: auto;
    flex-shrink: 0;
    transition: color 0.15s;
}
.group-item:hover .cg-edit-products-btn {
    display: flex;
}
.cg-edit-products-btn:hover {
    color: var(--accent);
}

.agents-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 8px 8px;
    border-bottom: 1px solid var(--border-secondary);
}

.agent-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: default;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: #a0a0b0;
    font-size: 13px;
}

.agent-item-new {
    background: none;
    border: 1px solid #2a2a4a;
    border-radius: 4px;
    color: #666;
    width: 22px;
    height: 22px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

.agent-item-new:hover {
    border-color: #00d4ff;
    color: #00d4ff;
}

.agent-item-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #a0a0b0;
}

.agent-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.agent-dot.traffic { background: #00d4ff; }
.agent-dot.copy { background: #a78bfa; }
.agent-dot.creative { background: #f59e0b; }
.agent-dot.design { background: #34d399; }
.agent-dot.strategist { background: #ef4444; }

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

/* ── Chat Container ── */

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    height: var(--vh, 100dvh);
    min-width: 0;
    background: var(--bg-primary);
}

.content-row {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}
body:not(.light) .chat-container {
    background: radial-gradient(ellipse at 50% 30%, #0d1a2e 0%, #0a0a1a 70%);
}

.top-bar {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border-secondary);
    gap: 12px;
    flex-shrink: 0;
    position: relative;
    z-index: 55;
}

.hamburger-btn {
    display: block;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
}

.hamburger-btn:hover {
    color: var(--accent);
}

.top-bar-spacer {
    flex: 1;
}


.user-menu-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: #666;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 8px;
    padding: 0;
    flex-shrink: 0;
}

.user-menu-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Shortcuts Popup ── */
.shortcuts-popup {
    position: absolute;
    top: 48px;
    right: 56px;
    background: var(--bg-secondary, #151530);
    border: 1px solid var(--border, #2a2a4a);
    border-radius: 12px;
    padding: 14px;
    z-index: 100;
    min-width: 220px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.shortcuts-popup.hidden { display: none; }
.shortcuts-popup-title {
    font-size: 12px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border, #2a2a4a);
}
.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.shortcut-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 4px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: 1px solid transparent;
}
.shortcut-item:hover {
    background: rgba(255,215,0,0.06);
    border-color: rgba(255,215,0,0.2);
}
.shortcut-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.shortcut-icon img {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    object-fit: cover;
}
.shortcut-label {
    font-size: 10px;
    color: #aaa;
    text-align: center;
    line-height: 1.3;
    max-width: 64px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.shortcut-item:hover .shortcut-label { color: #e0e0e0; }

.user-dropdown {
    position: absolute;
    top: 48px;
    right: 16px;
    background: #151530;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
    min-width: 180px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.user-dropdown.hidden {
    display: none;
}

.dropdown-name {
    font-size: 14px;
    color: #e0e0e0;
    font-weight: 500;
}

.dropdown-email {
    font-size: 12px;
    color: #888;
    padding-bottom: 6px;
    border-bottom: 1px solid #2a2a4a;
    word-break: break-all;
}

.dropdown-logout {
    background: none;
    border: none;
    color: #ff4466;
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    padding: 4px 0;
    transition: color 0.2s;
}

.dropdown-logout:hover {
    color: #ff6688;
}

/* ── Messages Area ── */

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

.welcome-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ── Orb ── */

.orb-area {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#waveform-canvas {
    position: absolute;
    width: 250px;
    height: 250px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.orb {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow 0.4s;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.orb-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    transition: background 0.4s;
}

.orb.sleeping .orb-inner {
    background: radial-gradient(circle at 40% 35%, #2a5a8c, #1a3a5c, #0d1b2a);
    box-shadow: 0 0 40px rgba(26, 58, 92, 0.4);
    animation: pulse-slow 3s ease-in-out infinite;
}

.orb.listening .orb-inner {
    background: radial-gradient(circle at 40% 35%, #00e5ff, #00b4d8, #0077b6);
    box-shadow: 0 0 60px rgba(0, 212, 255, 0.5);
    animation: pulse-fast 0.8s ease-in-out infinite;
}

.orb.transcribing .orb-inner {
    background: radial-gradient(circle at 40% 35%, #00c4e0, #0090b0, #006080);
    box-shadow: 0 0 50px rgba(0, 180, 216, 0.4);
    animation: pulse-medium 1.2s ease-in-out infinite;
}

.orb.thinking .orb-inner {
    background: radial-gradient(circle at 40% 35%, #a78bfa, #8b5cf6, #6d28d9);
    box-shadow: 0 0 60px rgba(139, 92, 246, 0.5);
    animation: rotate-glow 2s linear infinite;
}

.orb.speaking .orb-inner {
    background: radial-gradient(circle at 40% 35%, #4ade80, #22c55e, #15803d);
    box-shadow: 0 0 60px rgba(34, 197, 94, 0.5);
    animation: pulse-speak 0.6s ease-in-out infinite;
}

.orb.error .orb-inner {
    background: radial-gradient(circle at 40% 35%, #f87171, #ef4444, #b91c1c);
    box-shadow: 0 0 60px rgba(239, 68, 68, 0.5);
    animation: pulse-slow 2s ease-in-out infinite;
}

@keyframes pulse-slow {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

@keyframes pulse-medium {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

@keyframes pulse-fast {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes pulse-speak {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

@keyframes rotate-glow {
    0% { box-shadow: 0 0 60px rgba(139, 92, 246, 0.5), 10px 0 40px rgba(139, 92, 246, 0.3); }
    25% { box-shadow: 0 0 60px rgba(139, 92, 246, 0.5), 0 10px 40px rgba(139, 92, 246, 0.3); }
    50% { box-shadow: 0 0 60px rgba(139, 92, 246, 0.5), -10px 0 40px rgba(139, 92, 246, 0.3); }
    75% { box-shadow: 0 0 60px rgba(139, 92, 246, 0.5), 0 -10px 40px rgba(139, 92, 246, 0.3); }
    100% { box-shadow: 0 0 60px rgba(139, 92, 246, 0.5), 10px 0 40px rgba(139, 92, 246, 0.3); }
}

.status-text {
    margin-top: 20px;
    font-size: 14px;
    color: #666;
    letter-spacing: 1px;
    text-align: center;
    transition: color 0.3s;
}
.status-text.idle-warning { color: #f59e0b; }
.status-text.idle-danger { color: #ef4444; }

/* ── Chat Bubbles ── */

.msg-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

.msg-bubble img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    margin: 6px 0;
    object-fit: contain;
}

.msg-bubble.user {
    align-self: flex-end;
    background: var(--bg-bubble-user);
    color: var(--text-primary);
    border-bottom-right-radius: 4px;
}

.msg-bubble.assistant {
    align-self: flex-start;
    background: var(--bg-bubble-assistant);
    color: var(--text-secondary);
    border-bottom-left-radius: 4px;
}

.msg-bubble.assistant.error {
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.system-msg {
    align-self: center;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted, #888);
    padding: 4px 12px;
    margin-bottom: 8px;
    opacity: 0.7;
}

.msg-context-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 16px 0;
    gap: 12px;
}
.msg-context-clear::before,
.msg-context-clear::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color, #333);
    opacity: 0.5;
}
.msg-context-clear span {
    font-size: 11px;
    color: var(--text-muted, #888);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Message Queue */
.message-queue {
    padding: 4px 12px 0;
    max-height: 120px;
    overflow-y: auto;
}
.message-queue.hidden { display: none; }
.mq-header {
    font-size: 11px;
    color: var(--text-muted, #888);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.mq-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: var(--bg-secondary, #1a1a2e);
    border-radius: 6px;
    margin-bottom: 3px;
    font-size: 13px;
}
.mq-num {
    color: var(--text-muted, #888);
    font-size: 11px;
    min-width: 16px;
}
.mq-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary, #e0e0e0);
}
.mq-edit, .mq-remove {
    background: none;
    border: none;
    color: var(--text-muted, #888);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    line-height: 1;
    border-radius: 3px;
}
.mq-edit:hover, .mq-remove:hover {
    color: var(--text-primary, #e0e0e0);
    background: rgba(255,255,255,0.08);
}
.mq-remove:hover { color: #f44; }
.mq-file-tag {
    font-size: 10px;
    background: var(--accent, #6c63ff);
    color: #fff;
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
}
.mq-item.editing {
    flex-wrap: nowrap;
    gap: 6px;
}
.mq-edit-input {
    flex: 1;
    background: var(--bg-primary, #0a0a1a);
    color: var(--text-primary, #e0e0e0);
    border: 1px solid var(--accent, #6c63ff);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 28px;
    max-height: 80px;
    outline: none;
}
.mq-edit-input:focus {
    border-color: var(--accent-light, #8b83ff);
    box-shadow: 0 0 0 1px var(--accent, #6c63ff);
}
.mq-save, .mq-cancel {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    padding: 2px 5px;
    line-height: 1;
    border-radius: 3px;
}
.mq-save { color: #4caf50; }
.mq-save:hover { background: rgba(76,175,80,0.15); }
.mq-cancel { color: var(--text-muted, #888); }
.mq-cancel:hover { color: #f44; background: rgba(255,68,68,0.1); }

.msg-terminal-toggle {
    display: inline-block;
    margin-top: 8px;
    background: none;
    border: 1px solid #2a2a4a;
    border-radius: 4px;
    color: #555;
    padding: 3px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.msg-terminal-toggle:hover {
    border-color: #00d4ff;
    color: #888;
}

.msg-terminal-content {
    margin-top: 8px;
    background: #0d0d1a;
    border: 1px solid #1a1a2e;
    border-radius: 6px;
    padding: 12px;
    font-size: 13px;
    color: #a0a0b0;
    line-height: 1.7;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
}

/* Terminal markdown styles */
.msg-terminal-content h1,
.msg-terminal-content h2,
.msg-terminal-content h3,
.msg-terminal-content h4 {
    color: #00d4ff;
    margin: 12px 0 6px;
    font-weight: 600;
}
.msg-terminal-content h1 { font-size: 16px; }
.msg-terminal-content h2 { font-size: 14px; }
.msg-terminal-content h3 { font-size: 13px; }
.msg-terminal-content p { margin: 6px 0; }
.msg-terminal-content ul, .msg-terminal-content ol { padding-left: 20px; margin: 6px 0; }
.msg-terminal-content li { margin: 3px 0; }
.msg-terminal-content strong { color: #d0d0e0; }
.msg-terminal-content code {
    background: #1a1a30;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 12px;
    color: #c0c0d0;
}
.msg-terminal-content pre {
    background: #0a0a18;
    border: 1px solid #1a1a2e;
    border-radius: 6px;
    padding: 10px;
    overflow-x: auto;
    margin: 8px 0;
}
.msg-terminal-content pre code { background: none; padding: 0; }
.msg-terminal-content table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 12px; }
.msg-terminal-content th, .msg-terminal-content td { border: 1px solid #1a1a2e; padding: 5px 8px; text-align: left; }
.msg-terminal-content th { background: #111125; color: #00d4ff; font-weight: 600; }
.msg-terminal-content tr:nth-child(even) { background: #0e0e20; }
.msg-terminal-content a { color: #00d4ff; text-decoration: none; }
.msg-terminal-content hr { border: none; border-top: 1px solid #1a1a2e; margin: 10px 0; }

/* ── Message Content (markdown) ── */

.msg-content h1, .msg-content h2, .msg-content h3, .msg-content h4 {
    color: #00d4ff;
    margin: 12px 0 6px;
    font-weight: 600;
}
.msg-content h1 { font-size: 16px; }
.msg-content h2 { font-size: 14px; }
.msg-content h3 { font-size: 13px; }
.msg-content p { margin: 6px 0; }
.msg-content ul, .msg-content ol { padding-left: 20px; margin: 6px 0; }
.msg-content li { margin: 3px 0; }
.msg-content strong { color: #d0d0e0; }
.msg-content code {
    background: #1a1a30;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 12px;
    color: #c0c0d0;
}
.msg-content pre {
    background: #0a0a18;
    border: 1px solid #1a1a2e;
    border-radius: 6px;
    padding: 10px;
    overflow-x: auto;
    margin: 8px 0;
}
.msg-content pre code { background: none; padding: 0; }
.msg-content table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 12px; }
.msg-content th, .msg-content td { border: 1px solid #1a1a2e; padding: 5px 8px; text-align: left; }
.msg-content th { background: #111125; color: #00d4ff; font-weight: 600; }
.msg-content tr:nth-child(even) { background: #0e0e20; }
.msg-content a { color: #00d4ff; text-decoration: none; }
.msg-content hr { border: none; border-top: 1px solid #1a1a2e; margin: 10px 0; }

/* ── Artifact Buttons (in chat bubble) ── */

.msg-artifact-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    margin-right: 6px;
    padding: 5px 12px;
    background: rgba(0, 212, 255, 0.06);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 6px;
    color: #00d4ff;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.msg-artifact-btn:hover {
    background: rgba(0, 212, 255, 0.12);
    border-color: rgba(0, 212, 255, 0.4);
}

.msg-artifact-btn .artifact-icon {
    font-size: 14px;
    opacity: 0.7;
}

/* ── Artifact Side Panel ── */

.artifact-panel {
    width: 0;
    min-width: 0;
    height: 100%;
    background: #0d0d1f;
    border-left: 1px solid #1a1a2e;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 50;
    position: relative;
}

.artifact-panel:not(.hidden) {
    width: 50%;
    min-width: 200px;
}

.chat-container.panel-open {
    flex: 1;
    min-width: 0;
}

.artifact-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #1a1a2e;
    flex-shrink: 0;
}

.artifact-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: #c0c0c0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.artifact-panel-close {
    background: none;
    border: none;
    color: #666;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
    flex-shrink: 0;
}

.artifact-panel-close:hover {
    color: #e0e0e0;
}

.artifact-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    font-size: 13px;
    color: #c0c0d0;
    line-height: 1.7;
}

/* Artifact panel markdown styles */
.artifact-panel-content h1, .artifact-panel-content h2, .artifact-panel-content h3 {
    color: #00d4ff;
    margin: 12px 0 6px;
    font-weight: 600;
}
.artifact-panel-content h1 { font-size: 18px; }
.artifact-panel-content h2 { font-size: 16px; }
.artifact-panel-content h3 { font-size: 14px; }
.artifact-panel-content p { margin: 6px 0; }
.artifact-panel-content table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.artifact-panel-content th, .artifact-panel-content td { border: 1px solid #1a1a2e; padding: 8px 12px; text-align: left; }
.artifact-panel-content th { background: #111125; color: #00d4ff; font-weight: 600; white-space: nowrap; }
.artifact-panel-content tr:nth-child(even) { background: #0e0e20; }
.artifact-panel-content tr:hover { background: #151530; }
.artifact-panel-content pre {
    background: #0a0a18;
    border: 1px solid #1a1a2e;
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 13px;
}
.artifact-panel-content code {
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 13px;
}
.artifact-panel-content pre code { background: none; padding: 0; }

.artifact-overlay {
    display: none;
}

/* ── Streaming Progress ── */

.msg-bubble.streaming {
    min-height: 32px;
    padding: 12px 16px;
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    background: rgba(13, 13, 31, 0.8);
}

/* Header row: dot + label + tokens */
.streaming-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #2a2a4a;
    font-size: 12px;
}

.streaming-text {
    color: #b0b0c8;
    transition: color 0.3s;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}

.streaming-text:empty {
    display: none;
}

.streaming-text p {
    margin: 6px 0;
    line-height: 1.5;
}

.streaming-text code {
    background: rgba(139, 92, 246, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.streaming-text pre {
    background: #0d0d15;
    padding: 10px;
    border-radius: 6px;
    margin: 8px 0;
    overflow-x: auto;
    border-left: 3px solid #8b5cf6;
}

.streaming-tools {
    margin-bottom: 4px;
}

.streaming-tools:empty {
    display: none;
}

/* Separator between tools and response text */
.streaming-tools:not(:empty) + .streaming-text:not(:empty) {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #2a2a4a;
}

.msg-progress-tool {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: #1a1a35;
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    font-size: 11px;
    color: #8b8ba0;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    animation: pill-appear 0.2s ease-out;
}

.msg-progress-tool .tool-icon {
    font-size: 12px;
    flex-shrink: 0;
}

.msg-progress-tool .tool-preview {
    color: #555;
    margin-left: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-progress-tool.done {
    border-color: rgba(34, 197, 94, 0.3);
    color: #4ade80;
    background: rgba(34, 197, 94, 0.08);
}

.msg-progress-tool.done .tool-icon {
    color: #4ade80;
}

@keyframes pill-appear {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Thinking indicator in chat */
.msg-thinking {
    align-self: flex-start;
    padding: 10px 14px;
    margin-bottom: 8px;
}

.thinking-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.thinking-label {
    font-size: 12px;
    color: #8b5cf6;
    letter-spacing: 0.5px;
}

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

.thinking-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #8b5cf6;
    animation: thinking-bounce 1.4s ease-in-out infinite;
}
.thinking-dots.status-warning span { background: #f59e0b; }
.thinking-dots.status-warning + .thinking-label { color: #f59e0b; }
.thinking-dots.status-error span { background: #ef4444; }
.thinking-dots.status-error + .thinking-label { color: #ef4444; }

.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Streaming bubble status dot + label */
.streaming-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #8b5cf6;
    flex-shrink: 0;
    animation: proc-pulse 1.2s ease-in-out infinite;
}
.streaming-status-label {
    color: #8b5cf6;
    font-size: 12px;
}
.streaming-status-dot.status-warning { background: #f59e0b; }
.streaming-status-dot.status-warning ~ .streaming-status-label { color: #f59e0b; }
.streaming-status-dot.status-error { background: #ef4444; }
.streaming-status-dot.status-error ~ .streaming-status-label { color: #ef4444; }

@keyframes proc-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}

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

/* ── Input Area ── */

.input-area {
    position: relative;
    padding: 6px 12px 8px;
    border-top: 1px solid var(--border-secondary);
    flex-shrink: 0;
}

/* Command Palette */
.cmd-palette {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 6px;
    max-height: 200px;
    overflow-y: auto;
}
.cmd-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s;
}
.cmd-item:hover, .cmd-item.selected { background: rgba(0, 212, 255, 0.08); }
.cmd-name { color: var(--accent); font-weight: 600; font-size: 13px; font-family: monospace; }
.cmd-args { color: var(--text-dim); font-size: 12px; font-family: monospace; }
.cmd-desc { color: var(--text-muted); font-size: 12px; width: 100%; }
.cmd-example { color: var(--text-dim); font-size: 11px; font-family: monospace; width: 100%; font-style: italic; }

.stop-speaking-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px;
    margin-bottom: 8px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #f87171;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.stop-speaking-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

#text-form {
    display: flex;
    gap: 6px;
    align-items: center;
}

.mic-btn {
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid #2a2a4a;
    border-radius: 50%;
    color: #888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.mic-btn:hover {
    border-color: #00d4ff;
    color: #00d4ff;
}

.mic-btn.recording {
    border-color: #ef4444;
    color: #ef4444;
    animation: pulse-fast 0.8s ease-in-out infinite;
}

.file-btn {
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid #2a2a4a;
    border-radius: 50%;
    color: #888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.file-btn:hover {
    border-color: #00d4ff;
    color: #00d4ff;
}

#text-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    resize: none;
    overflow-y: auto;
    max-height: 150px;
    line-height: 1.4;
}

#text-input:focus {
    border-color: var(--accent);
}

#text-input::placeholder {
    color: #444;
}

#text-send {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #1a3a5c, #0d4a6b);
    border: 1px solid #1a5276;
    border-radius: 50%;
    color: #c0c0c0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

#text-send:hover {
    border-color: #00d4ff;
    color: #e0e0e0;
}

#text-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Scrollbar ── */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2a4a; border-radius: 3px; }

/* ── Table wrapper (scrollable on mobile) ── */

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 8px 0;
}
.table-wrapper table {
    margin: 0;
}

/* ── Mobile ── */

@media (max-width: 768px) {
    /* Sidebar: GPU-accelerated animation */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        width: 280px !important;
        padding-top: env(safe-area-inset-top, 0px);
    }

    .sidebar.collapsed {
        width: 280px !important;
        left: 0;
        transform: translateX(-100%);
        border-right: 1px solid #1a1a2e;
    }

    .sidebar.open {
        left: 0;
        transform: translateX(0);
        width: 280px !important;
    }

    .resize-handle {
        display: none;
    }

    /* Top bar: reduce gap and padding on mobile */
    .top-bar {
        gap: 6px;
        padding: 10px 10px;
        padding-top: calc(10px + env(safe-area-inset-top, 0px));
    }

    .connection-status {
        display: none;
    }

    .model-select,
    .agent-select {
        max-width: 80px;
    }

    .user-menu-btn {
        width: 30px;
        height: 30px;
        margin-left: 0;
    }

    .input-area {
        padding: 4px 8px 4px;
        padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px));
    }

    /* Prevent horizontal scroll */
    .messages-area {
        overflow-x: hidden;
    }
    .msg-content,
    .msg-terminal-content {
        overflow-wrap: break-word;
        word-break: break-word;
    }

    /* Touch targets (min 44px) */
    .mic-btn, .file-btn, #text-send, .stop-generation-btn {
        width: 44px;
        height: 44px;
    }

    .hamburger-btn {
        padding: 8px 10px;
    }

    .conv-item {
        padding: 12px;
    }

    .agent-item-new {
        width: 28px;
        height: 28px;
    }

    /* Input font-size 16px (prevents iOS zoom) */
    #text-input { font-size: 16px; }
    .model-select { font-size: 16px; }
    .agent-select { font-size: 16px; }
    .sidebar-search input { font-size: 16px; }
    #login-form input { font-size: 16px; }

    /* Hover-only buttons → always visible on mobile */
    .msg-copy-btn { opacity: 0.7; }
    .msg-actions .msg-retry-btn { opacity: 0.7; }
    .conv-item .conv-item-delete { opacity: 0.5; }
    .conv-item .conv-item-pin { opacity: 0.5; }
    .conv-item .conv-item-pin.pinned { opacity: 1; }

    /* Code blocks: smooth horizontal scroll */
    .msg-bubble pre { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .msg-bubble code { font-size: 12px; }

    .msg-bubble {
        max-width: 90%;
    }
    /* Action buttons inside bubble on mobile to prevent overflow */
    .msg-hover-actions {
        right: 4px;
        bottom: 4px;
        top: auto;
        transform: none;
        flex-direction: row;
        opacity: 0;
    }
    .msg-hover-btn { width: 26px; height: 26px; }
    .msg-hover-btn svg { width: 12px; height: 12px; }
    .msg-bubble.user .msg-hover-actions { left: 4px; right: auto; }

    .orb {
        width: 100px;
        height: 100px;
    }

    #waveform-canvas {
        width: 200px;
        height: 200px;
    }

    .artifact-panel:not(.hidden) {
        position: fixed;
        right: 0;
        top: 0;
        width: 100%;
        min-width: 0;
        z-index: 200;
    }

    .artifact-overlay:not(.hidden) {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 199;
    }
}

/* ── Feature #1: Copy buttons ── */

.msg-copy-btn {
    opacity: 0;
    position: absolute;
    top: 6px;
    right: 6px;
    background: #1a1a35;
    border: 1px solid #2a2a4a;
    border-radius: 4px;
    color: #888;
    font-size: 11px;
    padding: 2px 8px;
    cursor: pointer;
    transition: all 0.15s;
    z-index: 5;
}

.msg-bubble.assistant {
    position: relative;
}

.msg-bubble.assistant:hover .msg-copy-btn {
    opacity: 1;
}

.msg-copy-btn:hover {
    border-color: #00d4ff;
    color: #00d4ff;
}

.copy-code-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #1a1a35;
    border: 1px solid #2a2a4a;
    border-radius: 4px;
    color: #888;
    font-size: 11px;
    padding: 2px 8px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.15s;
}

pre:hover .copy-code-btn {
    opacity: 1;
}

.copy-code-btn:hover {
    border-color: #00d4ff;
    color: #00d4ff;
}

/* ── Feature #3: Search conversations ── */

.sidebar-search {
    padding: 4px 8px 8px;
}

.sidebar-search input {
    width: 100%;
    padding: 7px 10px;
    background: #111122;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    color: #c0c0c0;
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s;
}

.sidebar-search input:focus {
    border-color: #00d4ff;
}

.sidebar-search input::placeholder {
    color: #444;
}

/* ── Feature #5: Sortable table headers ── */

.artifact-panel-content th[data-sort-dir] {
    user-select: none;
    transition: color 0.15s;
}

.artifact-panel-content th:hover {
    color: #fff;
}

/* ── Feature #6: Cost indicator ── */

.msg-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.msg-actions .msg-retry-btn {
    opacity: 0;
    transition: opacity 0.15s;
}

.msg-bubble.assistant:hover .msg-actions .msg-retry-btn {
    opacity: 1;
}

.msg-cost {
    font-size: 10px;
    color: #777;
    font-variant-numeric: tabular-nums;
}

/* ── Feature #7: Model selector (top bar) ── */

.model-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: #888;
    font-size: 12px;
    padding: 6px 10px;
    cursor: pointer;
    outline: none;
    flex-shrink: 0;
    transition: border-color 0.2s;
}

.model-select:focus,
.model-select:hover {
    border-color: #00d4ff;
    color: #c0c0c0;
}

.model-select option {
    background: var(--bg-input);
    color: var(--text-secondary);
}

/* ── Agent selector (top bar) ── */

.agent-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: #888;
    font-size: 12px;
    padding: 6px 10px;
    cursor: pointer;
    outline: none;
    flex-shrink: 0;
    transition: border-color 0.2s;
}

.agent-select:focus,
.agent-select:hover {
    border-color: #00d4ff;
    color: #c0c0c0;
}

.agent-select option {
    background: var(--bg-input);
    color: var(--text-secondary);
}

/* ── Connection status indicator ── */

.connection-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    flex-shrink: 0;
    transition: background 0.3s;
}

.connection-status.disconnected {
    background: #ef4444;
    animation: pulse-slow 2s ease-in-out infinite;
}

.resource-warning {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: default;
    white-space: nowrap;
    flex-shrink: 0;
}
.resource-warning.hidden { display: none; }
.resource-warning.warn {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
    border: 1px solid rgba(234, 179, 8, 0.3);
}
.resource-warning.critical {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    animation: pulse-slow 2s ease-in-out infinite;
}

/* ── Message timestamps ── */

.msg-time {
    font-size: 10px;
    color: #777;
    margin-top: 4px;
}

/* ── Empty conversation list ── */

.conv-list-empty {
    padding: 16px 12px;
    text-align: center;
    color: #444;
    font-size: 12px;
}

/* ── Feature #8: Pinned conversations ── */

.conv-item-pin {
    opacity: 0;
    background: none;
    border: none;
    color: #555;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 4px;
    transition: all 0.15s;
    flex-shrink: 0;
}

.conv-item:hover .conv-item-pin {
    opacity: 1;
}

.conv-item-pin.pinned {
    opacity: 1;
    color: #f59e0b;
}

.conv-item-pin:hover {
    color: #f59e0b;
}

.conv-item-rename {
    opacity: 0;
    background: none;
    border: none;
    color: #555;
    font-size: 13px;
    cursor: pointer;
    padding: 2px 4px;
    transition: all 0.15s;
    flex-shrink: 0;
}

.conv-item:hover .conv-item-rename {
    opacity: 1;
}

.conv-item-rename:hover {
    color: #8b5cf6;
}

.conv-item-title-input {
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid #8b5cf6;
    border-radius: 4px;
    color: inherit;
    font: inherit;
    padding: 1px 6px;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    outline: none;
}

/* ── Feature: Pinned message banner ── */

.pinned-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #1a1a2e;
    border-bottom: 1px solid #2a2a3e;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}

.pinned-banner:hover {
    background: #222240;
}

.pinned-banner .pin-icon {
    color: #f59e0b;
    flex-shrink: 0;
}

.pinned-banner .pinned-text {
    flex: 1;
    font-size: 13px;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.pinned-banner .pinned-close {
    background: none;
    border: none;
    color: #666;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}

.pinned-banner .pinned-close:hover {
    color: #fff;
}

.pinned-banner.hidden {
    display: none;
}

.msg-bubble.pinned-highlight {
    animation: pinned-pulse 2s ease-out;
}

@keyframes pinned-pulse {
    0% { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.5); }
    100% { box-shadow: none; }
}

/* ── Feature #9: Stop generation button (replaces send btn position) ── */

.stop-generation-btn {
    width: 40px;
    height: 40px;
    background: #dc2626;
    border: 1px solid #ef4444;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.stop-generation-btn:hover {
    background: #b91c1c;
    border-color: #f87171;
}

/* ── Feature #10: Expandable tool calls ── */

.tool-details {
    width: fit-content;
    max-width: 100%;
    margin-bottom: 4px;
}

.tool-details summary {
    list-style: none;
    cursor: pointer;
}

.tool-details summary::-webkit-details-marker {
    display: none;
}

.tool-details summary.msg-progress-tool {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: #1a1a35;
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    font-size: 11px;
    color: #8b8ba0;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    animation: pill-appear 0.2s ease-out;
}

.tool-details summary.done {
    border-color: rgba(34, 197, 94, 0.3);
    color: #4ade80;
    background: rgba(34, 197, 94, 0.08);
}

.tool-details summary.done .tool-icon {
    color: #4ade80;
}

.tool-result-content {
    background: #0a0a18;
    border: 1px solid #1a1a2e;
    border-radius: 6px;
    padding: 8px 10px;
    margin: 4px 0;
    font-size: 11px;
    color: #777;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: 'Menlo', 'Consolas', monospace;
}

/* ── Tool calls: collapsible with counter ── */

.tool-counter {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    margin-bottom: 4px;
    font-size: 11px;
    color: #6b6b80;
}

.tool-counter-icon {
    font-size: 12px;
    color: #555;
}

.tool-counter-text {
    color: #6b6b80;
}

.tool-expand-btn {
    background: none;
    border: 1px solid #2a2a4a;
    border-radius: 10px;
    color: #00b8d9;
    font-size: 10px;
    padding: 1px 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-left: 4px;
}

.tool-expand-btn:hover {
    background: rgba(0, 184, 217, 0.1);
    border-color: #00b8d9;
}

.tool-expand-btn.expanded {
    background: rgba(0, 184, 217, 0.08);
}

.tool-hidden-section {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #1a1a2e;
    border-radius: 6px;
    padding: 4px;
    margin-bottom: 6px;
    background: #08081a;
}

.tool-hidden-section::-webkit-scrollbar {
    width: 4px;
}

.tool-hidden-section::-webkit-scrollbar-track {
    background: transparent;
}

.tool-hidden-section::-webkit-scrollbar-thumb {
    background: #2a2a4a;
    border-radius: 2px;
}

.tool-visible-section {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ── Feature #11: Retry button ── */

.msg-retry-btn {
    background: none;
    border: 1px solid #2a2a4a;
    border-radius: 4px;
    color: #666;
    font-size: 11px;
    padding: 2px 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.msg-retry-btn:hover {
    border-color: #00d4ff;
    color: #00d4ff;
}

/* ── Feature #12: Edit message ── */

.msg-bubble.user {
    position: relative;
}


.msg-edit-textarea {
    width: 100%;
    background: #111122;
    border: 1px solid #00d4ff;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 13px;
    font-family: inherit;
    padding: 8px;
    resize: none;
    outline: none;
    margin-top: 4px;
}

.msg-edit-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.msg-edit-save, .msg-edit-cancel {
    background: none;
    border: 1px solid #2a2a4a;
    border-radius: 4px;
    color: #888;
    font-size: 11px;
    padding: 3px 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.msg-edit-save:hover {
    border-color: #00d4ff;
    color: #00d4ff;
}

.msg-edit-cancel:hover {
    border-color: #666;
    color: #c0c0c0;
}

.msg-user-text {
    display: inline;
    white-space: pre-wrap;
}

/* ── Message attachments ── */

.msg-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.msg-attachment {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 4px;
    text-decoration: none;
    transition: border-color 0.2s;
}

.msg-attachment:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.msg-attachment img {
    max-height: 120px;
    max-width: 180px;
    border-radius: 4px;
    object-fit: cover;
}

.msg-attachment-icon {
    font-size: 10px;
    font-weight: 700;
    color: #aaa;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    padding: 8px 10px;
    line-height: 1;
}

.msg-attachment-name {
    font-size: 11px;
    color: #999;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 6px;
}

/* ── Feature #13: Drag & drop ── */

.drop-zone {
    border: 2px dashed #00d4ff44;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    color: #00d4ff88;
    font-size: 13px;
    margin-bottom: 8px;
    background: rgba(0, 212, 255, 0.03);
    transition: all 0.2s;
}

.file-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.file-preview {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    background: #111122;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    padding: 6px 8px;
}

.file-preview img {
    max-height: 60px;
    max-width: 80px;
    border-radius: 4px;
    object-fit: cover;
}

.file-preview-icon {
    font-size: 12px;
    font-weight: 700;
    color: #888;
    background: #1a1a35;
    border-radius: 4px;
    padding: 4px 6px;
    line-height: 1;
}

.file-preview-name {
    font-size: 11px;
    color: #888;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-preview-remove {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    line-height: 1;
}

.file-preview-remove:hover {
    color: #ff4757;
}

/* ── Pasted content attachment ── */

.file-preview.pasted {
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    max-width: 320px;
    padding: 8px 10px;
    background: #111125;
    border-color: #2a2a5a;
}

.file-preview-icon.lang {
    font-size: 10px;
    font-weight: 700;
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 4px;
    padding: 4px 6px;
    line-height: 1;
    flex-shrink: 0;
}

.file-preview-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.file-preview-info .file-preview-name {
    max-width: none;
    font-size: 11px;
    color: #999;
    white-space: nowrap;
}

.file-preview-snippet {
    font-size: 10px;
    color: #555;
    font-family: 'Menlo', 'Consolas', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Pasted attachment in sent messages ── */

.msg-pasted-attachments {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 6px;
}

.pasted-attachment {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    overflow: hidden;
}

.pasted-attachment summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.pasted-attachment summary::-webkit-details-marker {
    display: none;
}

.pasted-attachment summary::after {
    content: '\25B6';
    font-size: 8px;
    color: #555;
    margin-left: auto;
    transition: transform 0.15s;
}

.pasted-attachment[open] summary::after {
    transform: rotate(90deg);
}

.pasted-badge {
    font-size: 10px;
    font-weight: 700;
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.12);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
    line-height: 1;
    flex-shrink: 0;
}

.pasted-info {
    font-size: 11px;
    color: #888;
}

.pasted-code {
    margin: 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    max-height: 300px;
    overflow: auto;
    font-size: 11px;
    line-height: 1.5;
}

.pasted-code code {
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 11px;
    color: #b0b0c0;
    background: none;
    padding: 0;
}

/* ── Confirm Modal ── */

.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-modal.hidden {
    display: none;
}

.confirm-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.confirm-modal-box {
    position: relative;
    background: #151530;
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    padding: 24px;
    min-width: 280px;
    max-width: 360px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.confirm-modal-text {
    font-size: 14px;
    color: #d0d0d0;
    margin-bottom: 20px;
    line-height: 1.5;
}

.confirm-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.confirm-modal-btn {
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.confirm-modal-btn.cancel {
    background: none;
    border: 1px solid #2a2a4a;
    color: #888;
}

.confirm-modal-btn.cancel:hover {
    border-color: #555;
    color: #c0c0c0;
}

.confirm-modal-btn.ok {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.confirm-modal-btn.ok:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.6);
}

/* ── New Project Modal Fields ── */

.np-field {
    margin-bottom: 12px;
}

.np-field label {
    display: block;
    font-size: 12px;
    color: #888;
    margin-bottom: 4px;
}

.np-field input,
.np-field select {
    width: 100%;
    padding: 8px 10px;
    background: #0d0d20;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    color: #d0d0d0;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.np-field input:focus,
.np-field select:focus {
    border-color: rgba(99, 102, 241, 0.5);
}

/* ── Sidebar Tabs ── */

.sidebar-tabs {
    display: flex;
    padding: 4px 8px;
    gap: 4px;
    border-bottom: 1px solid var(--border-secondary);
}

.sidebar-tab {
    flex: 1;
    padding: 6px 0;
    background: transparent;
    border: 1px solid #333;
    border-radius: 6px;
    color: #888;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.sidebar-tab:hover {
    color: #ccc;
    border-color: #555;
}

.sidebar-tab.active {
    background: #1a1a2e;
    color: #fff;
    border-color: #00d4ff;
}

.sidebar-tab[data-tab="design"].active {
    border-color: #a78bfa;
}

/* ── Projects ── */

.projects-list {
    padding: 0 8px 8px;
}

.project-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    border-left: 3px solid #444;
    margin-bottom: 4px;
    transition: background 0.15s;
}

.project-item:hover {
    background: #1a1a2e;
}

.project-item.active {
    background: #1a1a2e;
    border-left-color: #a78bfa;
}

.project-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.project-item-name {
    font-size: 13px;
    color: #ccc;
}

.project-item-slug {
    font-size: 10px;
    color: #666;
    font-family: monospace;
    cursor: pointer;
    transition: color 0.15s;
}

.project-item-slug:hover {
    color: #a78bfa;
}

.project-item-slug.copied {
    color: #4ade80;
}

/* ── Groups ── */

.groups-list {
    padding: 0 8px 8px;
    border-bottom: 1px solid var(--border-secondary);
}

.group-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    border-left: 3px solid #333;
    margin-bottom: 4px;
    transition: background 0.15s;
}

.group-item:hover {
    background: #1a1a2e;
}

.group-item.active {
    background: #1a1a2e;
    border-left-color: #00d4ff;
}

.group-item-name {
    font-size: 13px;
    color: #ccc;
}

.group-item-id {
    display: none;
    font-size: 10px;
    color: #555;
    font-family: monospace;
    cursor: pointer;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.04);
    margin-left: auto;
    margin-right: 4px;
    flex-shrink: 0;
}
.group-item:hover .group-item-id { display: inline; }
.group-item-id:hover { color: #818cf8; background: rgba(99, 102, 241, 0.1); }

.processing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #8b5cf6;
    animation: proc-pulse 1.2s ease-in-out infinite;
    flex-shrink: 0;
    margin-left: auto;
}

.group-unread {
    background: #ff4757;
    color: #fff;
    font-size: 10px;
    border-radius: 50%;
    padding: 2px 6px;
    min-width: 18px;
    text-align: center;
    line-height: 14px;
}

.msg-sender {
    font-size: 11px;
    color: #888;
    margin-bottom: 2px;
}

.msg-sender.agent {
    color: #00d4ff;
}

/* ── Group Search ── */

.group-search-btn {
    background: none; border: 1px solid var(--border); border-radius: 50%;
    color: var(--text-muted); width: 30px; height: 30px; font-size: 14px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; flex-shrink: 0;
}
.group-search-btn:hover { border-color: var(--accent); color: var(--accent); }

.group-search {
    display: flex; align-items: center; gap: 8px; padding: 8px 16px;
    border-bottom: 1px solid var(--border-secondary); flex-shrink: 0;
}
.group-search input {
    flex: 1; padding: 6px 10px; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-primary); font-size: 13px; outline: none;
}
.group-search input:focus { border-color: var(--accent); }
.group-search button {
    background: none; border: none; color: var(--text-dim); font-size: 20px; cursor: pointer;
    padding: 0 4px;
}
.group-search button:hover { color: var(--text-primary); }
.group-search mark { background: rgba(0, 212, 255, 0.25); color: inherit; border-radius: 2px; }

/* ── Typing Indicator ── */

.typing-indicator {
    padding: 4px 16px 2px; font-size: 12px; color: var(--text-dim);
    flex-shrink: 0; font-style: italic;
}

/* ── Markdown Preview ── */

.md-preview {
    max-height: 150px; overflow-y: auto; padding: 8px 12px; margin-bottom: 6px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 8px; font-size: 13px; color: var(--text-secondary); line-height: 1.6;
}
.md-preview p { margin: 4px 0; }
.md-preview code { background: rgba(0,0,0,0.1); padding: 1px 4px; border-radius: 3px; font-size: 12px; }
.md-preview a { color: #60a5fa; text-decoration: underline; }
.md-preview a:hover { color: #93c5fd; }
.light-theme .md-preview a { color: #2563eb; }
.light-theme .md-preview a:hover { color: #1d4ed8; }
.md-preview-btn {
    width: 30px; height: 30px; background: none; border: 1px solid var(--border);
    border-radius: 50%; color: var(--text-dim); cursor: pointer; font-size: 14px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.md-preview-btn.active { border-color: var(--accent); color: var(--accent); }

/* ── Reply/Quote ── */

.reply-preview {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 12px; margin-bottom: 6px;
    background: var(--bg-input); border-left: 3px solid var(--accent);
    border-radius: 4px; font-size: 12px; color: var(--text-muted);
}
.reply-preview-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-preview-close { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 16px; padding: 0 4px; }
.reply-preview-close:hover { color: var(--text-primary); }
.msg-quoted {
    padding: 4px 8px; margin-bottom: 6px;
    border-left: 2px solid var(--accent); background: rgba(0, 212, 255, 0.04);
    font-size: 11px; color: var(--text-muted); border-radius: 2px;
}

/* ── Reactions ── */

.msg-reactions { display: flex; gap: 4px; margin-top: 6px; opacity: 0; transition: opacity 0.2s; }
.msg-bubble:hover .msg-reactions,
.msg-reactions:has(.active) { opacity: 1; }
.reaction-btn {
    background: none; border: 1px solid var(--border); border-radius: 12px;
    color: var(--text-dim); font-size: 12px; padding: 2px 8px; cursor: pointer;
    transition: all 0.2s; display: flex; align-items: center; gap: 3px;
}
.reaction-btn:hover { border-color: var(--accent); color: var(--accent); }
.reaction-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(0, 212, 255, 0.08); }
.reaction-btn .count { font-size: 11px; }

/* ── Checkpoints ── */
.msg-checkpoint {
    display: flex; align-items: center; gap: 8px; margin-top: 6px;
    padding: 4px 10px; border-radius: 6px;
    background: rgba(0, 212, 255, 0.06); border: 1px solid rgba(0, 212, 255, 0.15);
    font-size: 12px; width: fit-content;
}
.msg-checkpoint.active {
    border-color: var(--accent); background: rgba(0, 212, 255, 0.12);
}
.checkpoint-label {
    color: var(--text-dim); font-family: monospace; font-size: 11px;
}
.msg-checkpoint.active .checkpoint-label { color: var(--accent); }
.checkpoint-restore-btn {
    background: none; border: 1px solid var(--border); border-radius: 4px;
    color: var(--text-dim); font-size: 11px; padding: 1px 8px; cursor: pointer;
    transition: all 0.2s;
}
.checkpoint-restore-btn:hover { border-color: var(--accent); color: var(--accent); }
.checkpoint-preview-btn {
    background: none; border: 1px solid rgba(80, 200, 120, 0.3); border-radius: 4px;
    color: var(--text-dim); font-size: 11px; padding: 1px 8px; cursor: pointer;
    transition: all 0.2s;
}
.checkpoint-preview-btn:hover { border-color: #50c878; color: #50c878; }
.checkpoint-preview-btn.loading {
    opacity: 0.7; cursor: wait;
    animation: pvPulse 1.5s ease-in-out infinite;
}
.checkpoint-preview-btn.done {
    border-color: #50c878; color: #50c878; background: rgba(80, 200, 120, 0.1);
}
@keyframes pvPulse { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }
.checkpoint-dirty {
    color: #f0a030; font-size: 11px; font-style: italic;
}
.checkpoint-revert-btn {
    background: none; border: 1px solid rgba(240, 160, 48, 0.3); border-radius: 4px;
    color: #f0a030; font-size: 11px; padding: 1px 8px; cursor: pointer;
    transition: all 0.2s;
}
.checkpoint-revert-btn:hover { border-color: #f0a030; background: rgba(240, 160, 48, 0.08); }

/* ── Restart Service Pill ── */
.msg-restart-service {
    display: flex; align-items: center; gap: 8px; margin-top: 6px;
    padding: 4px 10px; border-radius: 6px;
    background: rgba(240, 140, 30, 0.08); border: 1px solid rgba(240, 140, 30, 0.25);
    font-size: 12px; width: fit-content;
}
.restart-label {
    color: #f0a030; font-size: 11px;
}
.restart-service-btn {
    background: none; border: 1px solid rgba(240, 140, 30, 0.4); border-radius: 4px;
    color: #f0a030; font-size: 11px; padding: 1px 8px; cursor: pointer;
    transition: all 0.2s;
}
.restart-service-btn:hover { border-color: #f0a030; background: rgba(240, 140, 30, 0.15); color: #ffb84d; }

/* ── Learning Approval Buttons ── */
.msg-learning-actions {
    display: flex; align-items: center; gap: 8px; margin-top: 8px;
}
.learning-btn {
    background: none; border-radius: 6px; font-size: 12px;
    padding: 4px 14px; cursor: pointer; transition: all 0.2s;
    font-weight: 500;
}
.learning-btn.approve {
    border: 1px solid rgba(0, 200, 100, 0.3); color: #0c8;
}
.learning-btn.approve:hover {
    border-color: #0c8; background: rgba(0, 200, 100, 0.1); color: #0ea;
}
.learning-btn.edit {
    border: 1px solid rgba(180, 160, 60, 0.3); color: #ba4;
}
.learning-btn.edit:hover {
    border-color: #cb5; background: rgba(200, 180, 60, 0.1); color: #dc6;
}
.learning-btn.reject {
    border: 1px solid rgba(180, 60, 60, 0.3); color: #b44;
}
.learning-btn.reject:hover {
    border-color: #c55; background: rgba(200, 60, 60, 0.1); color: #d66;
}
.learning-edit-area {
    width: 100%; min-height: 60px; background: rgba(255,255,255,0.05);
    border: 1px solid rgba(180, 160, 60, 0.4); border-radius: 6px;
    color: #ddd; font-size: 12px; padding: 8px; resize: vertical;
    font-family: inherit; line-height: 1.4;
}
.learning-edit-area:focus {
    outline: none; border-color: #cb5;
}
.learning-status {
    font-size: 12px; padding: 4px 10px; border-radius: 6px;
}
.learning-status.approved {
    color: #0c8; background: rgba(0, 200, 100, 0.08);
    border: 1px solid rgba(0, 200, 100, 0.2);
}
.learning-status.rejected {
    color: #b44; background: rgba(200, 60, 60, 0.08);
    border: 1px solid rgba(200, 60, 60, 0.2);
}

/* ── Toast ── */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: #2a2a3a; color: #e8e8f0; padding: 10px 20px; border-radius: 8px;
    font-size: 13px; z-index: 10000; opacity: 0; transition: opacity 0.3s, transform 0.3s;
    border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-error {
    background: #3a1a1a; border: 1px solid #f87171; color: #fca5a5; max-width: 500px;
    white-space: pre-wrap; word-break: break-word; padding: 12px 36px 12px 16px;
    cursor: default; bottom: 24px;
}
.toast.toast-success {
    background: #1a3a1a; border: 1px solid #4ade80; color: #86efac;
}
.toast .toast-close {
    position: absolute; top: 6px; right: 10px; background: none; border: none;
    color: inherit; font-size: 16px; cursor: pointer; opacity: 0.7; line-height: 1;
}
.toast .toast-close:hover { opacity: 1; }

/* ── File Edit Toolbar ── */
.file-edit-toolbar {
    display: flex; gap: 4px; align-items: center; margin-left: auto;
}
.file-toolbar-btn {
    background: none; border: 1px solid var(--border); border-radius: 4px;
    color: var(--text-dim); font-size: 12px; padding: 2px 10px; cursor: pointer;
    transition: all 0.2s;
}
.file-toolbar-btn:hover { border-color: var(--accent); color: var(--accent); }
.file-toolbar-btn.primary {
    border-color: var(--accent); color: var(--accent);
}
.file-toolbar-btn.primary:hover { background: rgba(0, 212, 255, 0.1); }
.file-toolbar-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Code Edit Textarea ── */
.code-edit-textarea {
    width: 100%; height: 100%; min-height: 400px;
    background: var(--bg-secondary); color: var(--text-primary);
    border: none; outline: none; resize: none;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px; line-height: 1.5;
    padding: 8px 12px; tab-size: 2;
    box-sizing: border-box;
}
.code-edit-textarea:focus { outline: none; }

/* ── Save Error Banner ── */
.save-error-banner {
    background: rgba(255, 60, 60, 0.08); border: 1px solid rgba(255, 60, 60, 0.25);
    border-radius: 6px; padding: 8px 12px; margin: 8px;
}
.save-error-title { color: #f44; font-weight: 600; font-size: 12px; margin-bottom: 4px; }
.save-error-line {
    color: var(--text-dim); font-family: 'JetBrains Mono', monospace;
    font-size: 11px; line-height: 1.5; white-space: pre-wrap; word-break: break-all;
}
.save-error-actions { display: flex; gap: 6px; margin-top: 8px; }

/* ── Deploy ── */
.deploy-wrapper { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.project-links { display: inline-flex; gap: 4px; align-items: center; }
.project-link {
    font-size: 11px; padding: 3px 10px; border-radius: 6px;
    color: var(--text-muted); text-decoration: none;
    background: transparent; border: 1px solid var(--border);
    transition: all 0.2s; letter-spacing: 0.3px;
    position: relative; cursor: pointer;
}
.project-link:hover {
    color: var(--accent); border-color: var(--accent);
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.15);
}
.project-link .link-tooltip {
    position: absolute; top: 100%; left: 50%;
    transform: translateX(-50%); white-space: nowrap;
    font-size: 10px; padding: 5px 10px; border-radius: 4px;
    background: var(--bg-secondary); border: 1px solid var(--border);
    color: var(--accent); text-decoration: none;
    opacity: 0; pointer-events: none; transition: opacity 0.15s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 60; margin-top: 6px;
}
.project-link .link-tooltip-list {
    display: flex; flex-direction: column; gap: 4px;
    white-space: nowrap;
}
.project-link .link-tooltip-list a {
    color: var(--accent); text-decoration: none;
}
.project-link .link-tooltip-list a:hover {
    text-decoration: underline;
}
/* Ponte invisível entre o botão e o tooltip */
.project-link .link-tooltip::before {
    content: ''; position: absolute; bottom: 100%; left: 0;
    width: 100%; height: 8px;
}
.project-link:hover .link-tooltip {
    opacity: 1; pointer-events: auto;
}
.project-link .link-tooltip:hover {
    opacity: 1; pointer-events: auto; text-decoration: underline;
}
.deploy-btn {
    background: #1a7a2e; border: 1px solid #2a9a3e; border-radius: 4px;
    color: #fff; font-size: 12px; padding: 3px 12px; cursor: pointer;
    transition: all 0.2s; font-weight: 500; margin-left: 4px;
}
.deploy-btn:hover { background: #2a9a3e; }
.deploy-btn:disabled { opacity: 0.5; cursor: default; }

.deploy-log-panel {
    position: absolute; top: 100%; right: 0; margin-top: 6px;
    width: 380px; max-height: 200px;
    background: var(--bg-secondary); border: 1px solid var(--border-secondary);
    border-radius: 8px; z-index: 50;
    display: flex; flex-direction: column;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.deploy-log-content {
    overflow-y: auto; padding: 8px 12px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 11px; line-height: 1.5; flex: 1;
}
.deploy-log-line { color: var(--text-dim); white-space: pre-wrap; word-break: break-all; }
.deploy-log-line.error { color: #f44; }
.deploy-log-line.success { color: #4f4; }
.deploy-log-actions {
    display: flex; gap: 6px; padding: 6px 12px;
    border-top: 1px solid var(--border-secondary);
    justify-content: flex-end;
}
.deploy-fix-btn {
    background: #c33; border: 1px solid #e44; border-radius: 4px;
    color: #fff; font-size: 12px; padding: 4px 14px; cursor: pointer;
    transition: all 0.2s;
}
.deploy-fix-btn:hover { background: #e44; }

/* ── Quick Actions ── */

.quick-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 4px; flex: 1; }
.quick-action-btn {
    background: rgba(0, 212, 255, 0.06);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 16px;
    color: var(--accent);
    font-size: 12px;
    padding: 5px 14px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.quick-action-btn:hover { background: rgba(0, 212, 255, 0.12); border-color: rgba(0, 212, 255, 0.4); }

/* Quick Actions Row (toggle + pills) */
.quick-actions-row { display: flex; align-items: flex-start; gap: 6px; }

/* Quick Actions Toggle */
.quick-actions-toggle {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-muted);
    width: 28px; height: 28px;
    min-width: 28px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 1px;
}
.quick-actions-toggle:hover { color: var(--accent); border-color: var(--accent); }
.quick-actions-toggle.active { color: var(--accent); border-color: var(--accent); background: rgba(0, 212, 255, 0.08); }

/* Hover Action Buttons on Messages (reply + edit) */
.msg-hover-actions {
    position: absolute;
    right: -36px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}
.msg-bubble { position: relative; }
.msg-bubble:hover .msg-hover-actions { opacity: 1; }
.msg-bubble.user .msg-hover-actions { right: auto; left: -36px; }

.msg-hover-btn {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-dim);
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    padding: 0;
    font-size: 13px;
}
.msg-hover-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ── Theme Transition Overlay ── */

#theme-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
}

#theme-transition-overlay.wipe-to-light {
    background: linear-gradient(to top, #f5f5f5 0%, #fffbe6 40%, #f5f5f5 100%);
    animation: wipeUpLight 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

#theme-transition-overlay.wipe-to-dark {
    background: linear-gradient(to bottom, #0a0a1a 0%, #0d1025 40%, #0a0a1a 100%);
    animation: wipeDownDark 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes wipeUpLight {
    0% {
        clip-path: inset(100% 0 0 0);
        opacity: 1;
    }
    45% {
        clip-path: inset(0 0 0 0);
        opacity: 1;
    }
    55% {
        clip-path: inset(0 0 0 0);
        opacity: 1;
    }
    100% {
        clip-path: inset(0 0 0 0);
        opacity: 0;
    }
}

@keyframes wipeDownDark {
    0% {
        clip-path: inset(0 0 100% 0);
        opacity: 1;
    }
    45% {
        clip-path: inset(0 0 0 0);
        opacity: 1;
    }
    55% {
        clip-path: inset(0 0 0 0);
        opacity: 1;
    }
    100% {
        clip-path: inset(0 0 0 0);
        opacity: 0;
    }
}

/* ── Theme Switch (inside profile dropdown) ── */

.dropdown-theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
    border-top: 1px solid #2a2a4a;
}

.dropdown-theme-label {
    font-size: 13px;
    color: #ccc;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

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

.theme-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #444;
    border-radius: 20px;
    transition: background 0.2s;
}

.theme-switch-slider::before {
    content: "";
    position: absolute;
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.theme-switch input:checked + .theme-switch-slider {
    background: var(--accent);
}

.theme-switch input:checked + .theme-switch-slider::before {
    transform: translateX(16px);
}

body.light .dropdown-theme-row {
    border-top-color: var(--border);
}

body.light .dropdown-theme-label {
    color: #555;
}

/* ── Light mode overrides ── */

body.light .login-container .login-logo {
    background: radial-gradient(circle, #dde8f0, #c0d8ec);
    border-color: #a0c0e0;
}

body.light .login-title { color: #555; }

body.light #login-form input {
    background: var(--bg-input);
    border-color: var(--border);
    color: var(--text-primary);
}

body.light .user-dropdown {
    background: var(--bg-secondary);
    border-color: var(--border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

body.light .conv-item:hover { background: #e8e8f0; }
body.light .conv-item.active { background: #dde4f0; }
body.light .group-item:hover { background: #e8e8f0; }
body.light .group-item.active { background: #e8e8f0; }
body.light .project-item:hover { background: #e8e8f0; }
body.light .project-item.active { background: #e8e8f0; }
body.light .sidebar-tab { border-color: #ccc; color: #666; }
body.light .sidebar-tab:hover { color: #333; border-color: #999; }
body.light .sidebar-tab.active { background: #e8e8f0; color: #111; }

body.light .mic-btn,
body.light .file-btn {
    border-color: var(--border);
    color: var(--text-muted);
}

body.light .msg-content code { background: rgba(0,0,0,0.06); color: #333; }
body.light .msg-content pre { background: #f8f8f8; border-color: var(--border); }
body.light .msg-content th { background: #e8e8f0; color: var(--accent); }

body.light .streaming-text { color: #444; }
body.light .msg-bubble.streaming { background: rgba(232,232,240,0.8); border-color: var(--border); }

body.light .sidebar-search input {
    background: var(--bg-input);
    border-color: var(--border);
    color: var(--text-primary);
}

body.light .artifact-panel {
    background: var(--bg-secondary);
    border-left-color: var(--border-secondary);
}

body.light ::-webkit-scrollbar-thumb { background: #c0c0c0; }

/* ── Voice Mode Button ── */

.voice-mode-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #1a3a5c, #0d4a6b);
    border: 1px solid #1a5276;
    border-radius: 50%;
    color: #c0c0c0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.voice-mode-btn:hover {
    border-color: #00d4ff;
    color: #00d4ff;
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.25);
}

.voice-mode-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Voice Mode Overlay ── */

.voice-overlay {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 15, 0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.voice-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.voice-overlay.hidden {
    display: none !important;
}

.voice-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    width: 100%;
    max-width: 400px;
    padding: 20px;
    padding-bottom: 12vh;
    height: 100%;
}

.voice-overlay-orb-area {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#voice-waveform-canvas {
    position: absolute;
    width: 200px;
    height: 200px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

#voice-orb {
    width: 100px;
    height: 100px;
}

.voice-status-text {
    font-size: 16px;
    color: #888;
    letter-spacing: 1px;
    text-align: center;
    transition: color 0.3s;
}

.voice-transcript {
    font-size: 14px;
    color: #555;
    text-align: center;
    min-height: 20px;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.voice-transcript:empty { display: none; }

.voice-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 16px;
}

.voice-mute-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #c0c0c0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
}

.voice-mute-btn svg {
    position: absolute;
    transition: opacity 0.2s;
}

.voice-mute-btn .mute-icon-on { opacity: 1; }
.voice-mute-btn .mute-icon-off { opacity: 0; }
.voice-mute-btn.muted .mute-icon-on { opacity: 0; }
.voice-mute-btn.muted .mute-icon-off { opacity: 1; }

.voice-mute-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
}

.voice-mute-btn.muted {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    color: #f87171;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.voice-mute-btn.muted:hover {
    background: rgba(239, 68, 68, 0.35);
    border-color: #f87171;
}

.voice-end-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #dc2626;
    border: 2px solid #ef4444;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.voice-end-btn:hover {
    background: #b91c1c;
    border-color: #f87171;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

@media (max-width: 768px) {
    .voice-mode-btn {
        width: 44px;
        height: 44px;
    }
    #voice-orb {
        width: 90px;
        height: 90px;
    }
    #voice-waveform-canvas {
        width: 180px;
        height: 180px;
    }
    .voice-end-btn {
        width: 44px;
        height: 44px;
    }
    .voice-mute-btn {
        width: 40px;
        height: 40px;
    }
}

/* ── File Browser Panel ── */

.file-panel {
    width: 0;
    min-width: 0;
    height: 100%;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-secondary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 50;
    position: relative;
}

.file-panel:not(.hidden) {
    width: 300px;
    min-width: 200px;
}

.file-panel .resize-handle {
    left: 0;
    right: auto;
}

.file-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-secondary);
    flex-shrink: 0;
}

.file-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-panel-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
    flex-shrink: 0;
}

.file-panel-close:hover {
    color: var(--text-primary);
}

.file-panel-content {
    flex: 1;
    overflow-y: auto;
    font-size: 13px;
}

.file-panel-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: color 0.15s, background 0.15s;
}

.file-panel-btn:hover {
    color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
}

.file-panel-btn.active {
    color: var(--accent);
}

/* Tree View */
.file-tree {
    padding: 8px 0;
}

.tree-item {
    display: flex;
    align-items: center;
    padding: 3px 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.6;
    transition: background 0.1s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.tree-arrow {
    display: inline-block;
    width: 16px;
    flex-shrink: 0;
    font-size: 10px;
    color: var(--text-dim);
    text-align: center;
    transition: transform 0.15s;
}

.tree-arrow.open {
    transform: rotate(90deg);
}

.tree-icon {
    width: 16px;
    flex-shrink: 0;
    text-align: center;
    margin-right: 4px;
    font-size: 11px;
}

.tree-dir > .tree-icon { color: var(--accent); }
.tree-file > .tree-icon { color: var(--text-dim); }

.tree-children {
    overflow: hidden;
}

.tree-children.collapsed {
    display: none;
}

/* Active tree item */
.tree-item.active {
    background: rgba(0, 212, 255, 0.1);
    color: var(--accent);
}

/* Create file/folder button */
.file-create-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.file-create-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Create dialog */
.file-create-dialog {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.file-create-dialog.hidden { display: none; }

.file-create-location {
    font-size: 11px;
    color: var(--text-muted);
    padding: 2px 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    border: 1px solid var(--border);
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Inline add button on folder rows */
.tree-dir-add {
    display: none;
    width: 18px;
    height: 18px;
    border-radius: 3px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    flex-shrink: 0;
    padding: 0;
}
.tree-dir:hover > .tree-dir-add,
.tree-dir-add:focus-visible {
    display: inline-flex;
}
.tree-dir-add:hover {
    background: var(--accent);
    color: #fff;
}

.file-create-type-toggle {
    display: flex;
    gap: 4px;
}
.file-create-type-btn {
    flex: 1;
    padding: 4px 0;
    font-size: 11px;
    font-weight: 600;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}
.file-create-type-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.file-create-type-btn:hover:not(.active) {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}

.file-create-input {
    width: 100%;
    padding: 5px 8px;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 4px;
    outline: none;
    box-sizing: border-box;
}
.file-create-input:focus {
    border-color: var(--accent);
}

.file-create-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}
.file-create-confirm {
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.file-create-confirm:hover { opacity: 0.85; }
.file-create-cancel {
    padding: 4px 12px;
    font-size: 11px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
}
.file-create-cancel:hover { border-color: var(--text-secondary); color: var(--text-secondary); }

/* File Viewer Panel (separate panel to the right of tree) */
.file-viewer-panel {
    width: 0;
    min-width: 0;
    height: 100%;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-secondary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 50;
    position: relative;
}

.file-viewer-panel:not(.hidden) {
    width: 45%;
    min-width: 250px;
}

.file-viewer-panel .resize-handle {
    left: 0;
    right: auto;
}

.file-viewer-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-secondary);
    flex-shrink: 0;
}

.viewer-tabs { display: flex; gap: 0; }
.viewer-tab {
    padding: 4px 14px; background: none; border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted); cursor: pointer; font-size: 13px;
}
.viewer-tab:hover { color: var(--text-secondary); }
.viewer-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.file-viewer-name {
    flex: 1;
    font-size: 12px;
    font-family: 'Menlo', 'Consolas', monospace;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-viewer-content {
    flex: 1;
    overflow: auto;
    padding: 0;
    background: #1e1e1e;
}

/* ── Preview mode ── */
.preview-container {
    display: flex; flex-direction: column; flex: 1; overflow: hidden;
}
.preview-container.hidden { display: none; }
.preview-url-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-bottom: 1px solid var(--border-secondary);
    flex-shrink: 0;
}
.preview-url-input {
    flex: 1; background: var(--bg-input); border: 1px solid var(--border);
    color: var(--text-primary); padding: 4px 8px; border-radius: 4px;
    font-family: monospace; font-size: 13px;
}
.preview-url-input:focus { outline: 1px solid var(--accent); }
.preview-refresh-btn {
    background: none; border: 1px solid var(--border); color: var(--text-muted);
    padding: 4px 8px; border-radius: 4px; cursor: pointer; font-size: 16px;
}
.preview-refresh-btn:hover { color: var(--text-primary); border-color: var(--text-muted); }
.preview-device-toggle {
    background: none; border: 1px solid var(--border); color: var(--text-muted);
    padding: 4px 8px; border-radius: 4px; cursor: pointer; font-size: 16px;
    min-width: 34px; text-align: center;
}
.preview-device-toggle:hover { color: var(--text-primary); border-color: var(--text-muted); }
.preview-device-toggle.mobile { color: var(--accent); border-color: var(--accent); }
.preview-iframe-wrapper {
    flex: 1; display: flex; justify-content: center; align-items: stretch;
    overflow: hidden; background: var(--bg-secondary);
}
.preview-iframe-wrapper.mobile {
    align-items: flex-start; padding: 16px 0;
    overflow-y: auto;
}
.preview-iframe {
    border: none; background: white; width: 100%; height: 100%;
}
.preview-iframe-wrapper.mobile .preview-iframe {
    width: 375px; height: 812px; border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.3); flex-shrink: 0;
}
.preview-iframe.hidden { display: none; }
.preview-loading {
    display: flex; align-items: center; justify-content: center;
    flex: 1; color: var(--text-muted); font-size: 14px;
}
.preview-loading.hidden { display: none; }

/* ── Code editor view ── */
.code-editor {
    display: flex;
    font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    line-height: 20px;
    min-height: 100%;
}

.code-gutter {
    flex-shrink: 0;
    background: #1e1e1e;
    color: #858585;
    text-align: right;
    user-select: none;
    padding: 8px 0;
    border-right: 1px solid #2d2d2d;
    position: sticky;
    left: 0;
    z-index: 2;
}

.code-gutter-line {
    display: flex;
    align-items: center;
    height: 20px;
    padding-right: 8px;
}

.code-gutter-line:hover { color: #c0c0c0; }

.code-gutter-num {
    min-width: 32px;
    text-align: right;
    font-size: 12px;
}

.code-fold-btn {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #858585;
    font-size: 10px;
    margin-left: 4px;
    border-radius: 2px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.1s;
}

.code-gutter-line:hover .code-fold-btn,
.code-fold-btn.folded {
    opacity: 1;
}

.code-fold-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
}

.code-fold-btn.folded {
    color: var(--accent);
}

.code-lines {
    flex: 1;
    padding: 8px 0 8px 12px;
    overflow-x: auto;
    min-width: 0;
    color: #d4d4d4;
}

.code-line {
    height: 20px;
    white-space: pre;
    padding-right: 16px;
}

.code-line:hover {
    background: rgba(255, 255, 255, 0.03);
}

.code-fold-placeholder {
    display: inline;
    background: #264f78;
    color: #c0c0c0;
    padding: 0 6px;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    margin-left: 4px;
}

.code-fold-placeholder:hover {
    background: #37699e;
}

.code-line.fold-hidden {
    display: none;
}

.code-gutter-line.fold-hidden {
    display: none;
}

/* ── VS Code Dark+ hljs overrides for file viewer ── */
.file-viewer-content .hljs { background: transparent !important; padding: 0 !important; }
.file-viewer-content .hljs-keyword { color: #569cd6; }
.file-viewer-content .hljs-built_in { color: #4ec9b0; }
.file-viewer-content .hljs-type { color: #4ec9b0; }
.file-viewer-content .hljs-literal { color: #569cd6; }
.file-viewer-content .hljs-number { color: #b5cea8; }
.file-viewer-content .hljs-string { color: #ce9178; }
.file-viewer-content .hljs-template-variable { color: #ce9178; }
.file-viewer-content .hljs-subst { color: #d4d4d4; }
.file-viewer-content .hljs-regexp { color: #d16969; }
.file-viewer-content .hljs-comment { color: #6a9955; font-style: italic; }
.file-viewer-content .hljs-function { color: #dcdcaa; }
.file-viewer-content .hljs-title { color: #dcdcaa; }
.file-viewer-content .hljs-title.function_ { color: #dcdcaa; }
.file-viewer-content .hljs-title.class_ { color: #4ec9b0; }
.file-viewer-content .hljs-params { color: #9cdcfe; }
.file-viewer-content .hljs-variable { color: #9cdcfe; }
.file-viewer-content .hljs-property { color: #9cdcfe; }
.file-viewer-content .hljs-attr { color: #9cdcfe; }
.file-viewer-content .hljs-attribute { color: #9cdcfe; }
.file-viewer-content .hljs-tag { color: #569cd6; }
.file-viewer-content .hljs-name { color: #569cd6; }
.file-viewer-content .hljs-selector-tag { color: #d7ba7d; }
.file-viewer-content .hljs-selector-class { color: #d7ba7d; }
.file-viewer-content .hljs-selector-id { color: #d7ba7d; }
.file-viewer-content .hljs-selector-attr { color: #d7ba7d; }
.file-viewer-content .hljs-meta { color: #569cd6; }
.file-viewer-content .hljs-meta .hljs-string { color: #ce9178; }
.file-viewer-content .hljs-symbol { color: #b5cea8; }
.file-viewer-content .hljs-punctuation { color: #d4d4d4; }
.file-viewer-content .hljs-operator { color: #d4d4d4; }
.file-viewer-content .hljs-deletion { color: #ce9178; background: rgba(206, 60, 50, 0.15); }
.file-viewer-content .hljs-addition { color: #b5cea8; background: rgba(80, 160, 80, 0.15); }

/* Light theme overrides for file viewer */
body.light .file-viewer-content { background: #ffffff; }
body.light .code-gutter { background: #ffffff; color: #999; border-right-color: #e0e0e0; }
body.light .code-line:hover { background: rgba(0, 0, 0, 0.03); }
body.light .code-fold-placeholder { background: #d0e4f0; color: #333; }
body.light .file-viewer-content .hljs-keyword { color: #0000ff; }
body.light .file-viewer-content .hljs-built_in { color: #267f99; }
body.light .file-viewer-content .hljs-string { color: #a31515; }
body.light .file-viewer-content .hljs-comment { color: #008000; }
body.light .file-viewer-content .hljs-function,
body.light .file-viewer-content .hljs-title { color: #795e26; }
body.light .file-viewer-content .hljs-number { color: #098658; }
body.light .file-viewer-content .hljs-variable,
body.light .file-viewer-content .hljs-property,
body.light .file-viewer-content .hljs-attr { color: #001080; }

.file-viewer-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    display: block;
    margin: 16px auto;
    border-radius: 4px;
}

/* Mobile: panels fullscreen */
@media (max-width: 768px) {
    .file-panel:not(.hidden) {
        position: fixed;
        right: 0;
        top: 0;
        width: 100%;
        min-width: 0;
        z-index: 200;
    }
    .file-viewer-panel:not(.hidden) {
        position: fixed;
        right: 0;
        top: 0;
        width: 100%;
        min-width: 0;
        z-index: 201;
    }
}

/* ── Highlight.js overrides ── */

.hljs {
    background: #0a0a18 !important;
    padding: 10px !important;
}

body.light .hljs {
    background: #f8f8f8 !important;
}

/* ── Uptime Alert (pulsing red) ── */

#uptime-btn {
    position: relative;
}

#uptime-btn .uptime-alert-dot {
    display: none;
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
}

#uptime-btn.uptime-alert .uptime-alert-dot {
    display: block;
    animation: uptime-pulse 1.5s ease-in-out infinite;
}

#uptime-btn.uptime-alert {
    color: #ef4444;
}

@keyframes uptime-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    50% { opacity: 0.6; box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.uptime-alert-banner {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #ef4444;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    animation: uptime-banner-in 0.3s ease-out;
}

.uptime-alert-banner.visible {
    display: flex;
}

.uptime-alert-banner .alert-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    animation: uptime-pulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

.uptime-alert-banner:hover {
    background: rgba(239, 68, 68, 0.2);
}

@keyframes uptime-banner-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Uptime Status ── */

.uptime-container {
    max-width: 800px;
    max-height: 85vh;
}

.uptime-content {
    padding: 16px 24px 24px;
    overflow-y: auto;
    max-height: calc(85vh - 60px);
}

.uptime-group {
    margin-bottom: 24px;
}

.uptime-group-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.uptime-page {
    margin-bottom: 16px;
}

.uptime-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.uptime-page-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.uptime-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.uptime-dot.uptime-status-up { background: #22c55e; }
.uptime-dot.uptime-status-down { background: #ef4444; }
.uptime-dot.uptime-status-unknown { background: #6b7280; }

.uptime-page-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.uptime-page-slug {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'SF Mono', 'Fira Code', monospace;
    opacity: 0.6;
    margin-left: 6px;
}

.uptime-badge {
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.uptime-badge.uptime-status-up { background: rgba(34,197,94,0.15); color: #22c55e; }
.uptime-badge.uptime-status-down { background: rgba(239,68,68,0.15); color: #ef4444; }
.uptime-badge.uptime-status-unknown { background: rgba(107,114,128,0.15); color: #6b7280; }

.uptime-pct {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.uptime-bar {
    display: flex;
    gap: 1px;
    height: 28px;
    border-radius: 4px;
    overflow: hidden;
}

.uptime-bar-day {
    flex: 1;
    min-width: 0;
    border-radius: 2px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.uptime-bar-day:hover {
    opacity: 0.8;
    transform: scaleY(1.2);
}

/* Custom tooltip for uptime bars */
.uptime-tooltip {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    font-size: 13px;
    color: var(--text-primary);
    opacity: 0;
    transition: opacity 0.15s;
    max-width: 280px;
    backdrop-filter: blur(8px);
}

.uptime-tooltip.visible {
    opacity: 1;
}

.uptime-tooltip-date {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.uptime-tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 12px;
}

.uptime-tooltip-row .label {
    color: var(--text-muted);
}

.uptime-tooltip-pct {
    font-weight: 600;
    font-size: 13px;
}

.uptime-tooltip-pct.ok { color: #22c55e; }
.uptime-tooltip-pct.warn { color: #eab308; }
.uptime-tooltip-pct.down { color: #ef4444; }
.uptime-tooltip-pct.nodata { color: var(--text-muted); }

.uptime-tooltip-downs {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: #ef4444;
}
.uptime-tooltip-down-detail {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 3px;
    font-size: 10px;
    color: #f87171;
}
.uptime-tooltip-down-detail .down-time {
    font-family: var(--font-mono);
    white-space: nowrap;
}
.uptime-tooltip-down-detail .down-reason {
    color: #a1a1aa;
    text-align: right;
}

.uptime-tooltip-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.uptime-tooltip-dot.ok { background: #22c55e; }
.uptime-tooltip-dot.warn { background: #eab308; }
.uptime-tooltip-dot.down { background: #ef4444; }
.uptime-tooltip-dot.nodata { background: var(--text-muted); }

.uptime-bar-ok { background: #22c55e; }
.uptime-bar-warn { background: #eab308; }
.uptime-bar-down { background: #ef4444; }
.uptime-bar-nodata { background: var(--border); }

.uptime-bar-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Uptime heartbeat icon in file tree */
.tree-uptime-icon {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    cursor: help;
    color: #22c55e;
    opacity: 0.7;
}

.tree-uptime-icon:hover {
    opacity: 1;
}

.tree-uptime-icon svg {
    display: block;
}

/* Uptime dialog overlay */
.uptime-dialog-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.uptime-dialog {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    width: 380px;
    max-width: 90vw;
}

.uptime-dialog h3 {
    margin: 0 0 16px;
    font-size: 16px;
    color: var(--text);
}

.uptime-dialog label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.uptime-dialog input,
.uptime-dialog select {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 8px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    box-sizing: border-box;
}

.uptime-dialog select {
    font-size: 16px; /* prevent iOS zoom */
}

.uptime-dialog-btns {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

.uptime-dialog-btns .btn-secondary {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.uptime-dialog-btns .btn-primary {
    background: var(--accent);
    border: none;
    color: #fff;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.uptime-dialog-btns .btn-primary:hover { opacity: 0.9; }
.uptime-dialog-btns .btn-secondary:hover { background: var(--bg-secondary); }

/* ── Mapa Alfred ── */

.mapa-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: #666;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 8px;
    padding: 0;
    flex-shrink: 0;
}
.mapa-btn:hover {
    border-color: #FFD700;
    color: #FFD700;
}

.mapa-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mapa-modal.hidden { display: none; }

.mapa-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
}

.mapa-container {
    position: relative;
    width: 94vw;
    max-width: 1100px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
}

.mapa-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.mapa-title {
    font-size: 20px;
    font-weight: 700;
    color: #FFD700;
}

.mapa-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
}
.mapa-close:hover { color: var(--text-primary); }

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

.mapa-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    transition: border-color 0.2s;
}
.mapa-card:hover {
    border-color: var(--accent);
}

.mapa-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.mapa-card-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.mapa-card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.mapa-card-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}
.mapa-card-badge.web {
    background: rgba(0, 212, 255, 0.15);
    color: #00d4ff;
    border: 1px solid rgba(0, 212, 255, 0.3);
}
.mapa-card-badge.externo {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.mapa-card-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.4;
}

.mapa-card-section {
    margin-bottom: 8px;
}
.mapa-card-section:last-child { margin-bottom: 0; }

.mapa-card-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    margin-bottom: 4px;
}

.mapa-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.mapa-tag {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(99, 102, 241, 0.12);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.mapa-tag.group {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.25);
}

.mapa-tag.project {
    background: rgba(234, 179, 8, 0.12);
    color: #eab308;
    border-color: rgba(234, 179, 8, 0.25);
}

@media (max-width: 600px) {
    .mapa-container {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        padding: 16px;
    }
    .mapa-grid {
        grid-template-columns: 1fr;
    }
    .mapa-btn {
        width: 30px;
        height: 30px;
        margin-left: 0;
    }
}

/* Context menu for file tree */
.ctx-menu {
    position: fixed;
    z-index: 9999;
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 4px 0;
    min-width: 150px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.ctx-menu.hidden { display: none; }
.ctx-menu-item {
    padding: 8px 14px;
    font-size: 13px;
    color: #ccc;
    cursor: pointer;
}
.ctx-menu-item:hover { background: rgba(167,139,250,0.15); color: #fff; }
.ctx-menu-item.danger { color: #f87171; }
.ctx-menu-item.danger:hover { background: rgba(248,113,113,0.15); }

/* Move mode */
.move-status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(99, 102, 241, 0.12);
    border-bottom: 1px solid rgba(99, 102, 241, 0.3);
    font-size: 12px;
    color: #a5b4fc;
}
.move-status-bar span { flex: 1; }
.move-status-btn {
    background: none; border: 1px solid rgba(99, 102, 241, 0.4);
    color: #a5b4fc; border-radius: 4px; padding: 2px 8px;
    font-size: 11px; cursor: pointer; white-space: nowrap;
}
.move-status-btn:hover { background: rgba(99, 102, 241, 0.2); }
.move-status-btn.cancel { border-color: #666; color: #999; }
.move-status-btn.cancel:hover { background: rgba(255,255,255,0.05); }
.file-tree.move-mode .tree-dir.move-target:hover {
    background: rgba(99, 102, 241, 0.15);
}
.file-tree.move-mode .tree-dir.move-target:hover > .tree-icon {
    color: #818cf8;
}
.file-tree.move-mode .tree-item.move-source {
    opacity: 0.4;
}

/* ── Task Progress Bar ── */
.task-progress {
    position: relative;
    background: var(--bg-secondary, #1e1e2e);
    border: 1px solid var(--border-color, #313244);
    border-radius: 8px;
    height: 28px;
    margin: 8px 0;
    overflow: hidden;
}
.task-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1 0%, #818cf8 100%);
    border-radius: 8px;
    transition: width 0.4s ease;
    width: 0%;
}
.task-progress-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #cdd6f4;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.task-progress.completed .task-progress-fill {
    background: linear-gradient(90deg, #22c55e 0%, #4ade80 100%);
}

/* ── Copy Canvas ── */

.sidebar-tab[data-tab="copy"].active {
    border-color: #f59e0b;
}

/* Copy filters */
.copy-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 8px 12px;
}
.copy-filters select {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 11px;
    min-width: 0;
}

/* Script items in sidebar */
.scripts-list {
    overflow-y: auto;
    flex: 1;
}
.script-item {
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    border-left: 3px solid #444;
    margin: 0 8px 4px 8px;
    transition: background 0.15s;
}
.script-item:hover {
    background: rgba(255,255,255,0.04);
}
.script-item.active {
    border-left-color: #f59e0b;
    background: #1a1a2e;
}
.script-item-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.script-item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

/* Status badges */
.status-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.status-rascunho { background: #374151; color: #9ca3af; }
.status-aprovado { background: #064e3b; color: #34d399; }
.status-editado { background: #1a3a2e; color: #a7f3d0; }
.status-em_producao { background: #78350f; color: #fbbf24; }
.status-no_ar { background: #1e3a5f; color: #60a5fa; }
.status-pausado { background: #3b1a1a; color: #f87171; }

/* Produto badges */
.produto-badge {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    background: #1a1a2e;
    color: #888;
}
.produto-badge-alt {
    background: #1e293b;
    color: #60a5fa;
}
.prio-badge {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
}
.prio-1 { background: #064e3b; color: #6ee7b7; }
.prio-2 { background: #1e3a5f; color: #7dd3fc; }
.prio-3 { background: #27272a; color: #a1a1aa; }
.lang-badge {
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 3px;
    background: #1e293b;
    color: #94a3b8;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Canvas panel (mirrors artifact-panel) */
.canvas-panel {
    width: 0;
    min-width: 0;
    height: 100%;
    background: #0d0d1f;
    border-left: 1px solid #1a1a2e;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 50;
    position: relative;
}
.canvas-panel .resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    cursor: col-resize;
    z-index: 10;
}
.canvas-panel:not(.hidden) {
    width: 55%;
    min-width: 400px;
}
a.canvas-link {
    color: #60a5fa;
    text-decoration: underline;
    cursor: pointer;
    word-break: break-all;
}
a.canvas-link:hover {
    color: #93bbfd;
}
.canvas-panel.canvas-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100%;
    min-width: 0;
    z-index: 9999;
    border-left: none;
}
.canvas-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #1a1a2e;
    flex-shrink: 0;
}
.canvas-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.canvas-panel-title {
    font-weight: 600;
    font-size: 14px;
    color: #f59e0b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.canvas-total-time-header {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}
.canvas-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.canvas-view-toggle {
    display: flex;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.canvas-view-btn {
    background: none;
    border: none;
    color: #666;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}
.canvas-view-btn:hover {
    color: #aaa;
}
.canvas-view-btn.active {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}
.canvas-status-select {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
}
.canvas-panel-content {
    flex: 1;
    overflow: auto;
    padding: 16px;
}

/* Canvas script cards */
.cs-card {
    border: 1px solid #222;
    border-radius: 6px;
    margin-bottom: 4px;
    transition: border-color 0.15s;
}
.cs-card:hover {
    border-color: #333;
}
.cs-card.cs-open {
    border-color: rgba(245, 158, 11, 0.4);
}
.cs-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.cs-card-header:hover {
    background: rgba(255,255,255,0.03);
}
.cs-card-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}
.cs-card-name {
    font-weight: 600;
    font-size: 13px;
    color: #f59e0b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cs-card-time {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.cs-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 8px;
}
.cs-card-blocos {
    font-size: 10px;
    color: #6b7280;
}
.cs-chevron {
    font-size: 10px;
    color: #555;
}
.cs-card-body {
    border-top: 1px solid #1a1a2e;
}
.cs-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #1a1a2e;
}
.cs-status-select {
    font-size: 11px;
}
.cs-card-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
}
.cs-delete-btn {
    background: none;
    border: none;
    color: #555;
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.15s;
}
.cs-delete-btn:hover {
    color: #f87171;
}
.cs-card-content {
    padding: 12px;
}
.cs-new-btn {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #f59e0b;
    border-radius: 4px;
    padding: 2px 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s;
}
.cs-new-btn:hover {
    background: rgba(245, 158, 11, 0.25);
}
.cs-refreshing svg {
    animation: cs-spin 0.6s ease;
}
@keyframes cs-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.cs-search-bar {
    padding: 4px 10px 6px;
    border-bottom: 1px solid var(--border);
}
.cs-search-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 13px;
    outline: none;
}
.cs-search-input:focus {
    border-color: var(--accent);
}
.canvas-scripts-count {
    font-size: 11px;
    color: var(--text-muted);
}

/* Context menu */
.cs-ctx-menu {
    position: fixed;
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 4px 0;
    /* Above .canvas-panel.canvas-fullscreen (z-index 9999) */
    z-index: 10010;
    min-width: 140px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.cs-ctx-item {
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.1s;
}
.cs-ctx-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}
.cs-ctx-danger:hover {
    background: rgba(248, 113, 113, 0.1);
    color: #f87171;
}

/* Canvas blocks (accordion style) */
.canvas-blocks {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cb-block {
    border: 1px solid #222;
    border-radius: 6px;
    transition: border-color 0.15s;
}
.cb-block:hover {
    border-color: #333;
}
.cb-block.cb-expanded {
    border-color: rgba(245, 158, 11, 0.4);
}
.cb-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    background: rgba(255,255,255,0.02);
    transition: background 0.15s;
    user-select: none;
}
.cb-header:hover {
    background: rgba(255,255,255,0.05);
}
.cb-drag-handle {
    cursor: grab;
    color: #444;
    font-size: 12px;
    padding: 2px 4px;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.cb-drag-handle:hover {
    color: #888;
    background: rgba(255,255,255,0.05);
}
.cb-drag-handle:active {
    cursor: grabbing;
}
.cb-block.cb-dragging {
    opacity: 0.4;
}
.cb-block.cb-drop-above {
    border-top: 2px solid #f59e0b;
}
.cb-block.cb-drop-below {
    border-bottom: 2px solid #f59e0b;
}
.cb-name {
    font-weight: 600;
    font-size: 13px;
    color: #f59e0b;
    min-width: 80px;
}
.cb-name-inline {
    font-weight: 600;
    font-size: 13px;
    color: #f59e0b;
    background: var(--bg-input);
    border: 1px solid #f59e0b;
    border-radius: 3px;
    padding: 1px 6px;
    min-width: 80px;
    outline: none;
}
.cb-block-number {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.7;
}
.cb-timing {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.cb-annot-count {
    font-size: 10px;
    color: #6b7280;
    background: #1e293b;
    padding: 2px 6px;
    border-radius: 3px;
}
.cb-delete {
    margin-left: auto;
    background: none;
    border: none;
    color: #555;
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}
.cb-delete:hover {
    color: #f87171;
}
.cb-chevron {
    font-size: 10px;
    color: #555;
    flex-shrink: 0;
}
.cb-preview {
    padding: 0 12px 10px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Expanded editor */
.cb-editor {
    padding: 0 12px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cb-editor label {
    font-size: 11px;
    color: #888;
    display: block;
    margin-bottom: 3px;
    font-weight: 500;
}
.cb-name-edit input {
    width: 200px;
    background: var(--bg-input);
    color: #f59e0b;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 600;
}
.cb-copy-area {
    position: relative;
}
.cb-copy-input {
    width: 100%;
    min-height: 80px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.15s;
}
.cb-copy-input:focus {
    border-color: #f59e0b;
    outline: none;
}
.cb-word-count {
    position: absolute;
    bottom: 6px;
    right: 8px;
    font-size: 10px;
    color: #666;
    pointer-events: none;
}

/* Annotations */
.cb-annotations {
    display: flex;
    gap: 10px;
}
.cb-annot-item {
    flex: 1;
    background: rgba(255,255,255,0.02);
    border: 1px solid #1e293b;
    border-radius: 6px;
    padding: 8px 10px;
}
.cb-annot-label {
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
    font-weight: 500;
}
.cb-annot-icon {
    margin-right: 3px;
}
.cb-annot-input {
    width: 100%;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 12px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
}
.cb-annot-input:focus {
    border-color: rgba(245, 158, 11, 0.5);
    outline: none;
}
.cb-annot-visual { border-left: 2px solid #6366f1; }
.cb-annot-texto { border-left: 2px solid #22c55e; }

/* Add block button */
.canvas-add-block {
    margin-top: 12px;
    padding: 8px 16px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px dashed rgba(245, 158, 11, 0.3);
    border-radius: 6px;
    color: #f59e0b;
    cursor: pointer;
    font-size: 13px;
    text-align: center;
    transition: background 0.15s;
}
.canvas-add-block:hover {
    background: rgba(245, 158, 11, 0.2);
}

/* Script notas area */
.canvas-notas {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #222;
}
.canvas-notas label {
    font-size: 11px;
    color: #888;
    display: block;
    margin-bottom: 4px;
}
.canvas-notas textarea {
    width: 100%;
    min-height: 60px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}

/* Canvas 3-column table view */
.canvas-panel-content:has(.canvas-table-wrap) {
    padding-top: 0;
}
.canvas-table-wrap {
    /* no overflow — sticky thead relies on canvas-panel-content as scroll container */
}
.canvas-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}
.canvas-table thead th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    padding: 8px 10px;
    border-bottom: 2px solid #333;
    position: sticky;
    top: 0;
    background: #0d0d1f;
    z-index: 2;
    white-space: nowrap;
}
.ct-col-handle { width: 28px; }
.ct-col-block { width: 90px; }
.ct-col-copy, .ct-col-visual, .ct-col-texto { width: calc((100% - 150px) / 3); }
.ct-col-actions { width: 56px; }
.ct-cell-handle {
    padding: 10px 4px;
    vertical-align: top;
    text-align: center;
}
.ct-cell-actions {
    padding: 10px 4px;
    vertical-align: top;
    text-align: center;
}
.canvas-table tr.cb-block { cursor: default; }
.canvas-table tr.cb-dragging { opacity: 0.4; }
.canvas-table tr.cb-drop-above td { border-top: 2px solid #f59e0b; }
.canvas-table tr.cb-drop-below td { border-bottom: 2px solid #f59e0b; }
.canvas-table tbody tr {
    border-bottom: 1px solid #1a1a2e;
}
.canvas-table tbody tr:hover {
    background: rgba(255,255,255,0.02);
}
.ct-cell-block {
    padding: 10px;
    vertical-align: top;
}
.ct-block-name {
    display: block;
    font-weight: 600;
    color: #f59e0b;
    font-size: 12px;
}
.ct-block-timing {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}
.ct-cell {
    padding: 10px;
    vertical-align: top;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}
.ct-cell:hover {
    background: rgba(245, 158, 11, 0.05);
}
.ct-inline-edit {
    width: 100%;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid #f59e0b;
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
}
.ct-inline-editable {
    width: 100%;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid #f59e0b;
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.5;
    min-height: 40px;
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
}
.ct-inline-editable .insert-annotated {
    cursor: pointer;
}

/* Mobile: canvas panel fullscreen */
@media (max-width: 768px) {
    .canvas-panel:not(.hidden) {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100% !important;
        min-width: 0;
        z-index: 200;
    }
}

/* Light mode overrides */
body.light .canvas-panel {
    background: var(--bg-secondary);
    border-left-color: var(--border);
}
body.light .canvas-panel-header {
    border-bottom-color: var(--border);
}
body.light .canvas-grid th {
    background: var(--bg-secondary);
    border-bottom-color: var(--border);
}
body.light .canvas-table thead th {
    background: var(--bg-secondary);
}
body.light .canvas-grid td {
    border-bottom-color: var(--border-secondary);
}
body.light .canvas-grid td:hover {
    background: var(--bg-primary);
}
body.light .script-item.active {
    background: var(--bg-primary);
}

/* ── Copy All Button ── */
.cb-copy-all-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    vertical-align: middle;
}
.cb-copy-all-btn:hover {
    background: rgba(0, 212, 255, 0.1);
    color: var(--accent);
    border-color: var(--accent);
}
.canvas-blocks-header {
    display: flex;
    justify-content: flex-end;
    padding: 4px 0 8px;
}

/* ── Viewer Copys Role ── */
body.viewer-copys .top-bar { display: none !important; }
body.viewer-copys .chat-body { display: none !important; }
body.viewer-copys .chat-container { flex: 1 !important; min-width: 0 !important; }
body.viewer-copys .content-row { flex: 1 !important; }
body.viewer-copys #new-conv-btn { display: none !important; }
body.viewer-copys .sidebar-tab:not([data-tab="copy"]) { display: none !important; }
body.viewer-copys #sidebar-tabs { display: flex !important; }
body.viewer-copys #cs-new-script-btn { display: none !important; }
body.viewer-copys .cs-delete-btn { display: none !important; }
body.viewer-copys .cb-delete { display: none !important; }
body.viewer-copys .cb-drag-handle { display: none !important; }
body.viewer-copys .canvas-add-block { display: none !important; }
body.viewer-copys .canvas-notas { display: none !important; }
body.viewer-copys .ct-cell { cursor: default; }
body.viewer-copys .canvas-panel {
    display: flex !important;
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
}
body.viewer-copys .canvas-panel .resize-handle { display: none !important; }
body.viewer-copys #canvas-panel-close { display: none !important; }
body.viewer-copys .canvas-header-actions .viewer-user-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
}
body.viewer-copys .canvas-header-actions .viewer-user-btn:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
}
body.viewer-copys .canvas-header-actions .user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 100;
}

/* ── Image Optimizer Modal ── */
.img-optimizer-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.img-optimizer-modal.hidden { display: none !important; }
.img-optimizer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}
.img-optimizer-box {
    position: relative;
    background: #151530;
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    padding: 24px;
    width: 90vw;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.img-optimizer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.img-optimizer-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #e1e4e8;
    margin: 0;
}
.img-optimizer-close-btn {
    background: none;
    border: none;
    color: #8b949e;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
}
.img-optimizer-close-btn:hover { color: #fff; }
.img-optimizer-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.img-opt-control {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 100px;
}
.img-opt-control label {
    font-size: 11px;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.img-opt-control select,
.img-opt-control input {
    background: #0d0d1f;
    border: 1px solid #2a2a4a;
    color: #e1e4e8;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}
.img-opt-control select:focus,
.img-opt-control input:focus { border-color: #58a6ff; }
.img-opt-dropzone {
    border: 2px dashed #2a2a4a;
    border-radius: 10px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #0d0d1f;
    margin-bottom: 12px;
}
.img-opt-dropzone:hover,
.img-opt-dropzone.dragover {
    border-color: #58a6ff;
    background: #111128;
}
.img-opt-dropzone p { color: #8b949e; font-size: 13px; margin: 8px 0 4px; }
.img-opt-dropzone strong { color: #58a6ff; }
.img-opt-dropzone small { color: #484f58; font-size: 11px; }
.img-opt-status {
    font-size: 13px;
    color: #8b949e;
    margin-bottom: 8px;
    min-height: 20px;
}
.img-opt-results {
    max-height: 250px;
    overflow-y: auto;
}
.img-opt-result-item {
    background: #0d0d1f;
    border: 1px solid #1a1a3a;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 6px;
    font-size: 13px;
}
.img-opt-result-name { color: #e1e4e8; font-weight: 500; word-break: break-all; }
.img-opt-result-meta { color: #8b949e; font-size: 12px; margin-top: 3px; }
.img-opt-result-saved { color: #3fb950; font-weight: 600; }
.img-opt-result-url {
    font-size: 11px;
    color: #58a6ff;
    cursor: pointer;
    background: #1a1a3a;
    padding: 3px 6px;
    border-radius: 4px;
    margin-top: 4px;
    display: inline-block;
    word-break: break-all;
}
.img-opt-result-url:hover { text-decoration: underline; }
.img-opt-result-error { color: #f85149; }
.img-optimizer-footer {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.img-opt-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}
.img-opt-btn-deploy { background: #238636; color: #fff; }
.img-opt-btn-deploy:hover { background: #2ea043; }
.img-opt-btn-deploy:disabled { opacity: 0.4; cursor: not-allowed; }
.img-opt-deploy-status { font-size: 12px; color: #8b949e; }

/* ── Copy Tasks ── */
.copy-tasks-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: 0 8px 8px;
    min-height: 0;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
}
.copy-tasks-list::-webkit-scrollbar { width: 5px; }
.copy-tasks-list::-webkit-scrollbar-track { background: transparent; }
.copy-tasks-list::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }
.copy-tasks-list::-webkit-scrollbar-thumb:hover { background: #666; }
.copy-task-item {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 6px 4px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    cursor: default;
    transition: opacity 0.15s, background 0.15s;
}
.copy-task-item:last-child { border-bottom: none; }
.copy-task-item input[type="checkbox"] {
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
}
.copy-task-drag {
    cursor: grab;
    color: #555;
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
    user-select: none;
    margin-top: 1px;
}
.copy-task-drag:hover { color: #999; }
.copy-task-drag:active { cursor: grabbing; }
.copy-task-content { flex: 1; min-width: 0; }
.copy-task-title { color: var(--text-primary); }
.copy-task-id {
    color: #555;
    font-size: 10px;
    cursor: pointer;
    transition: color 0.15s;
    user-select: none;
}
.copy-task-id:hover { color: #58a6ff; }
.copy-task-id.copied { color: #3fb950; }
.copy-task-produto {
    font-size: 9px;
    background: #1e3a5f;
    color: #60a5fa;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
    vertical-align: middle;
}
.copy-task-desc {
    color: var(--text-secondary);
    font-size: 11px;
    margin-top: 2px;
    white-space: pre-wrap;
    word-break: break-word;
}
.copy-task-desc.truncated {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.copy-task-desc-toggle {
    color: #58a6ff;
    cursor: pointer;
    font-size: 10px;
    margin-top: 2px;
    user-select: none;
}
.copy-task-desc-toggle:hover { text-decoration: underline; }
.copy-task-script-link {
    color: #58a6ff;
    cursor: pointer;
    font-size: 11px;
    margin-top: 10px;
    display: block;
}
.copy-task-script-link:hover { text-decoration: underline; }
.copy-task-delete {
    color: #8b949e;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
}
.copy-task-item:hover .copy-task-delete { opacity: 1; }
.copy-task-delete:hover { color: #f85149; }
.copy-task-done .copy-task-title {
    text-decoration: line-through;
    opacity: 0.5;
}
.copy-task-done .copy-task-desc { opacity: 0.4; }
.copy-tasks-empty {
    color: var(--text-secondary);
    font-size: 12px;
    padding: 8px 4px;
    text-align: center;
}
.copy-task-add-btn {
    cursor: pointer;
    color: #8b949e;
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
    width: 20px;
    text-align: center;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.copy-task-add-btn:hover { color: #f59e0b; background: rgba(245,158,11,0.1); }
.copy-task-tier-header {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 4px 3px;
    color: #8b949e;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}
.copy-task-tier-header:hover { opacity: 0.8; }
.tier-chevron {
    font-size: 8px;
    transition: transform 0.2s;
    display: inline-block;
}
.copy-task-tier-header:not(.collapsed) .tier-chevron { transform: rotate(90deg); }
.copy-task-tier-group { overflow: hidden; }
.copy-task-tier-group.collapsed { display: none; }
.copy-task-tier-header.tier-1 { color: #58a6ff; }
.copy-task-tier-header.tier-2 { color: #f59e0b; }
.copy-task-tier-header.tier-3 { color: #8b949e; }
.copy-task-tier-header.tier-done { color: #555; }
.copy-task-tier-count {
    font-weight: 400;
    opacity: 0.6;
}
.copy-task-tier-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1.3;
    margin-top: 2px;
    transition: opacity 0.15s;
}
.copy-task-tier-badge:hover { opacity: 0.7; }
.copy-task-tier-badge.tier-1 { background: rgba(88,166,255,0.15); color: #58a6ff; }
.copy-task-tier-badge.tier-2 { background: rgba(245,158,11,0.15); color: #f59e0b; }
.copy-task-tier-badge.tier-3 { background: rgba(139,148,158,0.15); color: #8b949e; }
/* ── Task Panel (sidebar-anchored) ── */
.task-panel {
    position: fixed;
    top: 50%;
    left: 290px;
    transform: translateY(-50%);
    z-index: 310;
    width: 320px;
    background: #151530;
    border: 1px solid #2a2a4a;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    animation: taskPanelIn 0.15s ease-out;
}
.task-panel.hidden { display: none; }
@keyframes taskPanelIn {
    from { opacity: 0; transform: translateY(-50%) translateX(-8px); }
    to { opacity: 1; transform: translateY(-50%) translateX(0); }
}
.task-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.task-panel-close {
    cursor: pointer;
    color: #8b949e;
    font-size: 18px;
    line-height: 1;
}
.task-panel-close:hover { color: var(--text-primary); }
.task-panel-body {
    padding: 0 16px 16px;
}
.task-panel-body .np-field { margin-bottom: 10px; }
.task-panel-body label {
    display: block;
    font-size: 11px;
    color: #8b949e;
    margin-bottom: 4px;
}
.task-panel-body input[type="text"],
.task-panel-body textarea,
.task-panel-body select {
    width: 100%;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
}
.task-panel-body textarea { resize: vertical; }
.task-panel-body .error-text {
    font-size: 12px;
    color: #f85149;
    margin: 4px 0 0;
}
/* Tier select colors */
.task-panel-body select#task-tier option[value="1"] { color: #58a6ff; }
.task-panel-body select#task-tier option[value="2"] { color: #f59e0b; }
.task-panel-body select#task-tier option[value="3"] { color: #8b949e; }
.task-panel-body select#task-tier.tier-1 { border-color: rgba(88,166,255,0.4); color: #58a6ff; }
.task-panel-body select#task-tier.tier-2 { border-color: rgba(245,158,11,0.4); color: #f59e0b; }
.task-panel-body select#task-tier.tier-3 { border-color: rgba(139,148,158,0.4); color: #8b949e; }
.task-panel-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.task-panel-btn {
    flex: 1;
    padding: 7px 0;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.task-panel-btn-delete {
    background: transparent;
    color: #f85149;
    border-color: rgba(248,81,73,0.25);
}
.task-panel-btn-delete:hover { background: rgba(248,81,73,0.1); }
.task-panel-btn-save {
    background: rgba(88,166,255,0.12);
    border-color: rgba(88,166,255,0.3);
    color: #58a6ff;
}
.task-panel-btn-save:hover { background: rgba(88,166,255,0.2); }
.task-panel-btn:disabled { opacity: 0.4; cursor: not-allowed; }
@media (max-width: 768px) {
    .task-panel {
        left: 50%;
        transform: translate(-50%, -50%);
        width: calc(100vw - 32px);
        max-width: 340px;
    }
    @keyframes taskPanelIn {
        from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
        to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    }
}

/* ── Task Conversation Banner ── */
.task-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(88,166,255,0.08);
    border-bottom: 1px solid rgba(88,166,255,0.2);
    font-size: 13px;
    flex-shrink: 0;
}
.task-banner-back {
    color: #58a6ff;
    cursor: pointer;
    white-space: nowrap;
    font-size: 12px;
}
.task-banner-back:hover { text-decoration: underline; }
.task-banner-title {
    flex: 1;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.task-banner-done {
    color: #3fb950;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.task-banner-done:hover { text-decoration: underline; }

.copy-task-content { cursor: pointer; }
.copy-task-content:hover .copy-task-title { color: #58a6ff; }

.task-start-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 16px;
    gap: 10px;
    flex-shrink: 0;
}
.task-start-prompt-wrapper {
    width: 100%;
    max-width: 600px;
}
.task-start-prompt {
    width: 100%;
    background: #161b22;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 10px;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    overflow: hidden;
    box-sizing: border-box;
}
.task-start-prompt:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 2px rgba(88,166,255,0.2);
}
.task-start-btn {
    padding: 12px 40px;
    background: #58a6ff;
    color: #000;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.5px;
    animation: task-start-pulse 1.8s ease-in-out infinite;
    box-shadow: 0 0 16px rgba(88,166,255,0.4);
}
.task-start-btn:hover {
    background: #79b8ff;
    animation: none;
    box-shadow: 0 0 24px rgba(88,166,255,0.6);
}
.task-start-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.task-start-dismiss {
    width: 36px;
    height: 36px;
    background: transparent;
    color: #8b949e;
    border: 1px solid #30363d;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.task-start-dismiss:hover {
    color: #f85149;
    border-color: #f85149;
    background: rgba(248,81,73,0.1);
}
@keyframes task-start-pulse {
    0%, 100% { box-shadow: 0 0 16px rgba(88,166,255,0.3); transform: scale(1); }
    50% { box-shadow: 0 0 28px rgba(88,166,255,0.6); transform: scale(1.03); }
}
.copy-task-done .copy-task-content { cursor: default; }
.copy-task-done .copy-task-content:hover .copy-task-title { color: inherit; }

/* ── Canvas Hipotese ── */
.canvas-hipotese {
    margin: 0 0 12px;
    padding: 10px 12px;
    background: rgba(245,158,11,0.06);
    border: 1px solid rgba(245,158,11,0.2);
    border-radius: 8px;
}
.canvas-hipotese-label {
    font-size: 11px;
    font-weight: 600;
    color: #f59e0b;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.canvas-hipotese-icon { font-size: 14px; }
.canvas-hipotese-input {
    width: 100%;
    background: transparent;
    color: var(--text-primary);
    border: none;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    padding: 0;
    box-sizing: border-box;
}
.canvas-hipotese-input::placeholder { color: #555; }
.canvas-hipotese-input:focus { outline: none; }

/* ── Canvas Metadata Fields (formato, persona, nivel_consciencia) ── */
.canvas-meta-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin: 0 0 12px;
}
.canvas-meta-field {
    padding: 8px 10px;
    background: rgba(139,92,246,0.06);
    border: 1px solid rgba(139,92,246,0.18);
    border-radius: 8px;
}
.canvas-meta-label {
    font-size: 10px;
    font-weight: 600;
    color: #8b5cf6;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.canvas-meta-label .cmf-icon { font-size: 12px; }
.canvas-meta-input {
    width: 100%;
    background: transparent;
    color: var(--text-primary);
    border: none;
    font-size: 12px;
    font-family: inherit;
    line-height: 1.4;
    resize: none;
    padding: 0;
    box-sizing: border-box;
}
.canvas-meta-input::placeholder { color: #555; }
.canvas-meta-input:focus { outline: none; }
@media (max-width: 768px) {
    .canvas-meta-fields { grid-template-columns: 1fr; }
}

/* ── Producao Toolbar ── */
.producao-toolbar {
    display: flex;
    gap: 16px;
    padding: 10px 12px;
    margin: 0 0 12px;
    background: rgba(245,158,11,0.06);
    border: 1px solid rgba(245,158,11,0.18);
    border-radius: 8px;
}
.producao-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.producao-label {
    font-size: 10px;
    font-weight: 700;
    color: #f59e0b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.producao-toggles {
    display: flex;
    gap: 4px;
}
.producao-toggle {
    padding: 4px 10px;
    font-size: 11px;
    font-family: inherit;
    border: 1px solid #333;
    border-radius: 12px;
    background: transparent;
    color: #888;
    cursor: pointer;
    transition: all 0.15s;
}
.producao-toggle:hover {
    border-color: #f59e0b;
    color: #f59e0b;
}
.producao-toggle.active {
    background: rgba(245,158,11,0.2);
    border-color: #f59e0b;
    color: #f59e0b;
    font-weight: 600;
}
.producao-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    margin: 0 0 8px;
    font-size: 11px;
    color: #f59e0b;
    background: rgba(245,158,11,0.1);
    border: 1px solid rgba(245,158,11,0.25);
    border-radius: 6px;
}
.producao-clear-hook {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
}
.producao-clear-hook:hover { color: #f87171; }

/* ── Hook Picker Popup ── */
.hook-picker-popup {
    position: fixed;
    z-index: 10020;
    width: 420px;
    max-height: 400px;
    background: #111;
    border: 1px solid rgba(245,158,11,0.3);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.hook-picker-popup.hidden { display: none; }
.hook-picker-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(245,158,11,0.08);
    border-bottom: 1px solid rgba(245,158,11,0.15);
    font-size: 12px;
    font-weight: 600;
    color: #f59e0b;
}
.hook-picker-popup-close {
    background: none;
    border: none;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.hook-picker-popup-close:hover { color: #f87171; }
.hook-picker-popup .hook-picker-search {
    margin: 8px 10px;
    width: calc(100% - 20px);
    box-sizing: border-box;
}
.hook-picker-popup .hook-picker-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 10px 10px;
}
.hook-picker-search {
    padding: 7px 10px;
    font-size: 12px;
    font-family: inherit;
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 6px;
    color: var(--text-primary);
}
.hook-picker-search:focus { outline: none; border-color: #f59e0b; }
.hook-picker-list {
    max-height: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.hook-picker-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 10px;
    border: 1px solid #1a1a1a;
    border-radius: 6px;
    cursor: default;
    transition: border-color 0.15s;
}
.hook-picker-item:hover { border-color: #333; background: rgba(255,255,255,0.02); }
.hook-picker-item-top {
    display: flex;
    align-items: center;
    gap: 8px;
}
.hook-picker-name {
    font-size: 12px;
    font-weight: 600;
    color: #f59e0b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hook-picker-preview {
    font-size: 11px;
    color: #999;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.hook-picker-meta {
    display: flex;
    gap: 4px;
    font-size: 10px;
    color: #555;
}
.hook-picker-meta span {
    padding: 1px 5px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
}
.hook-picker-use {
    padding: 4px 10px;
    font-size: 10px;
    font-family: inherit;
    font-weight: 600;
    border: 1px solid #f59e0b;
    border-radius: 4px;
    background: transparent;
    color: #f59e0b;
    cursor: pointer;
    white-space: nowrap;
    align-self: flex-end;
}
.hook-picker-use:hover {
    background: rgba(245,158,11,0.15);
}
@media (max-width: 600px) {
    .hook-picker-popup { width: calc(100vw - 20px); left: 10px !important; }
}

/* ── Video Panel ── */
.video-panel {
    margin: 0 0 12px;
}
.video-dropzone {
    padding: 24px;
    border: 2px dashed #333;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s;
}
.video-dropzone:hover, .video-dropzone.dragover {
    border-color: #f59e0b;
}
.video-dropzone-label {
    font-size: 12px;
    color: #888;
}
.video-file-input {
    display: none;
}
.video-tiktok-input {
    display: flex;
    gap: 8px;
}
.video-tiktok-url {
    flex: 1;
    padding: 8px 10px;
    font-size: 12px;
    font-family: inherit;
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 6px;
    color: var(--text-primary);
}
.video-tiktok-url:focus { outline: none; border-color: #f59e0b; }
.video-tiktok-btn {
    padding: 8px 16px;
    font-size: 12px;
    font-family: inherit;
    font-weight: 600;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    background: rgba(245,158,11,0.15);
    color: #f59e0b;
    cursor: pointer;
}
.video-tiktok-btn:hover { background: rgba(245,158,11,0.25); }
.video-tiktok-btn:disabled { opacity: 0.5; cursor: default; }
.video-ai-match { display: flex; flex-direction: column; gap: 8px; }
.video-ai-btn {
    padding: 8px 16px;
    font-size: 12px;
    font-family: inherit;
    font-weight: 600;
    border: 1px solid #8b5cf6;
    border-radius: 6px;
    background: rgba(139,92,246,0.1);
    color: #8b5cf6;
    cursor: pointer;
    align-self: flex-start;
}
.video-ai-btn:hover { background: rgba(139,92,246,0.2); }
.video-ai-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Match Results ── */
.match-results {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 300px;
    overflow-y: auto;
}
.match-card {
    padding: 10px 12px;
    background: rgba(139,92,246,0.05);
    border: 1px solid rgba(139,92,246,0.15);
    border-radius: 8px;
    transition: border-color 0.15s;
}
.match-card:hover { border-color: rgba(139,92,246,0.35); }
.match-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.match-rank {
    font-size: 12px;
    font-weight: 700;
    color: #8b5cf6;
}
.match-sim {
    font-size: 11px;
    font-weight: 600;
    color: #22c55e;
    padding: 1px 6px;
    background: rgba(34,197,94,0.1);
    border-radius: 4px;
}
.match-qual {
    font-size: 10px;
    color: #f59e0b;
}
.match-prod {
    font-size: 10px;
    color: #555;
    margin-left: auto;
}
.match-card-desc {
    font-size: 11px;
    color: #bbb;
    line-height: 1.4;
    margin-bottom: 4px;
}
.match-card-visual {
    font-size: 11px;
    color: #888;
    line-height: 1.4;
    margin-bottom: 4px;
    font-style: italic;
}
.match-card-visual.hidden { display: none; }
.match-card-visual-full {
    font-size: 11px;
    color: #999;
    line-height: 1.5;
    margin-bottom: 4px;
    font-style: italic;
    padding: 6px 8px;
    background: rgba(139,92,246,0.04);
    border-radius: 4px;
    border-left: 2px solid rgba(139,92,246,0.3);
}
.match-card-visual-full.hidden { display: none; }
.match-expand-btn {
    background: none;
    border: none;
    color: #8b5cf6;
    font-size: 10px;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    margin-bottom: 4px;
}
.match-expand-btn:hover { text-decoration: underline; }
.match-subtipo {
    font-size: 10px;
    color: #ccc;
    padding: 1px 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    text-transform: capitalize;
}
.match-card-ts {
    font-size: 10px;
    color: #888;
    margin-bottom: 4px;
}
.match-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 6px;
}
.match-tag {
    font-size: 9px;
    padding: 1px 5px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    color: #666;
}
.match-tag.uso {
    background: rgba(245,158,11,0.1);
    color: #f59e0b;
    font-weight: 600;
}
.match-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.match-video-link {
    font-size: 11px;
    font-weight: 600;
    color: #60a5fa;
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid rgba(96,165,250,0.3);
    border-radius: 4px;
    transition: all 0.15s;
}
.match-video-link:hover {
    background: rgba(96,165,250,0.1);
    border-color: #60a5fa;
}
.match-select-btn {
    padding: 4px 12px;
    font-size: 11px;
    font-family: inherit;
    font-weight: 600;
    border: 1px solid #8b5cf6;
    border-radius: 4px;
    background: transparent;
    color: #8b5cf6;
    cursor: pointer;
}
.match-select-btn:hover {
    background: rgba(139,92,246,0.15);
}

/* ── Video Preview ── */
.video-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin: 0 0 8px;
    background: rgba(34,197,94,0.06);
    border: 1px solid rgba(34,197,94,0.2);
    border-radius: 6px;
    font-size: 11px;
}
.video-preview-type {
    font-weight: 700;
    color: #22c55e;
    text-transform: uppercase;
    font-size: 10px;
}
.video-preview-url {
    color: #60a5fa;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}
.video-preview-desc {
    color: #888;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.video-preview-path {
    color: #888;
}
.video-preview-clear {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    margin-left: auto;
}
.video-preview-clear:hover { color: #f87171; }

/* ── Producao Sidebar (Editor Tab) ── */
.producao-group-sidebar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 4px;
}
.producao-label-sidebar {
    font-size: 10px;
    font-weight: 700;
    color: #f59e0b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 34px;
}
.producao-toggles-sidebar {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
}
.editor-hook-selected {
    padding: 6px 0;
}
.editor-hook-copy-preview {
    font-size: 11px;
    color: #888;
    line-height: 1.4;
    margin-top: 4px;
    max-height: 60px;
    overflow: hidden;
}

@media (max-width: 768px) {
    .producao-toolbar { flex-direction: column; gap: 8px; }
}

.copy-task-dragging { opacity: 0.3; }
.copy-task-drop-above { box-shadow: 0 -2px 0 0 #58a6ff; }
.copy-task-drop-below { box-shadow: 0 2px 0 0 #58a6ff; }

/* ── Insert Annotation System ── */
.insert-float-btn {
    position: fixed;
    /* Above .canvas-panel.canvas-fullscreen (z-index 9999) */
    z-index: 10010;
    background: #8b5cf6;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(139,92,246,0.4);
    white-space: nowrap;
}
.insert-float-btn:hover { background: #7c3aed; }
.insert-float-btn svg { width: 12px; height: 12px; }

/* Popover for creating an insert */
.insert-popover {
    position: fixed;
    z-index: 10001;
    background: var(--bg-secondary);
    border: 1px solid rgba(139,92,246,0.4);
    border-radius: 10px;
    padding: 12px;
    width: 320px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.insert-popover-title {
    font-size: 11px;
    font-weight: 600;
    color: #8b5cf6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.insert-popover-phrase {
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(139,92,246,0.08);
    padding: 6px 8px;
    border-radius: 6px;
    margin-bottom: 8px;
    line-height: 1.4;
    max-height: 60px;
    overflow: hidden;
    font-style: italic;
}
.insert-popover label {
    font-size: 11px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 3px;
    margin-top: 8px;
}
.insert-popover input,
.insert-popover textarea {
    width: 100%;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 12px;
    font-family: inherit;
    box-sizing: border-box;
}
.insert-popover textarea { resize: vertical; min-height: 50px; }
.insert-popover input:focus,
.insert-popover textarea:focus { outline: none; border-color: #8b5cf6; }
.insert-popover-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    justify-content: flex-end;
}
.insert-popover-save {
    background: #8b5cf6;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.insert-popover-save:hover { background: #7c3aed; }
.insert-popover-cancel {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 14px;
    font-size: 12px;
    cursor: pointer;
}
.insert-popover-cancel:hover { color: var(--text-primary); }
.insert-popover-delete {
    background: transparent;
    color: #f85149;
    border: 1px solid #f85149;
    border-radius: 6px;
    padding: 5px 14px;
    font-size: 12px;
    cursor: pointer;
    margin-right: auto;
}
.insert-popover-delete:hover { background: rgba(248,81,73,0.1); }

/* Annotated text spans in copy_falada */
.insert-annotated {
    background: rgba(139,92,246,0.15);
    border-bottom: 2px solid rgba(139,92,246,0.5);
    cursor: pointer;
    border-radius: 2px;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.insert-annotated:hover,
.insert-annotated.insert-highlight {
    background: rgba(139,92,246,0.45);
    border-bottom-color: rgba(139,92,246,1);
    color: #fff;
}

/* Insert cards in direcao_visual column */
.insert-cards { display: flex; flex-direction: column; gap: 6px; }
.insert-card {
    background: rgba(139,92,246,0.08);
    border: 1px solid rgba(139,92,246,0.2);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 11px;
    line-height: 1.4;
    position: relative;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.insert-card:hover,
.insert-card.insert-highlight {
    background: rgba(139,92,246,0.18);
    border-color: rgba(139,92,246,0.5);
}
.insert-card-phrase {
    color: var(--text-muted);
    font-style: italic;
    font-size: 10px;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.insert-card-visual {
    color: var(--text-primary);
}
.insert-card-link {
    margin-top: 3px;
}
.insert-card-link a {
    color: #58a6ff;
    font-size: 10px;
    text-decoration: none;
    word-break: break-all;
}
.insert-card-link a:hover { text-decoration: underline; }
.insert-card-delete {
    position: absolute;
    top: 3px;
    right: 5px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
}
.insert-card-delete:hover { color: #f85149; }

/* Legacy text below insert cards (for non-insert content in direcao_visual) */
.insert-legacy-text {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border-secondary);
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ── ElevenLabs TTS Modal ── */

.cs-audio-btn {
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 500;
}
.cs-audio-btn:hover { background: #6d28d9; }
.cs-audio-btn-done { background: #16a34a; }
.cs-audio-btn-done:hover { background: #15803d; }

/* ── Ad Builder: botão Criar Timeline + modal de fonte de áudio ── */
.cs-timeline-btn {
    background: #0e7490;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    margin-left: 6px;
    transition: background 0.15s;
}
.cs-timeline-btn:hover { background: #155e75; }
.cs-timeline-btn-disabled,
.cs-timeline-btn[disabled] {
    background: #475569;
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.7;
}
.cs-timeline-btn-disabled:hover { background: #475569; }
.cs-timeline-btn-stale {
    background: #c2410c;
}
.cs-timeline-btn-stale:hover { background: #9a3412; }
.cs-timeline-btn-done { background: #15803d; }
.cs-timeline-btn-done:hover { background: #166534; }

.timeline-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}
.timeline-modal {
    background: var(--bg-primary, #1a1a2e);
    border: 1px solid var(--border-primary, #333);
    border-radius: 12px;
    width: 600px;
    max-width: 92vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    overflow: hidden;
}
.timeline-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-primary, #333);
}
.timeline-modal-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #f1f5f9);
}
.timeline-modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary, #94a3b8);
    font-size: 22px;
    cursor: pointer;
    padding: 0 6px;
    line-height: 1;
}
.timeline-modal-close:hover { color: #f1f5f9; }
.timeline-modal-body {
    padding: 18px;
    overflow-y: auto;
    color: var(--text-primary, #e2e8f0);
}
.timeline-stale-warn {
    background: #c2410c33;
    border: 1px solid #c2410c;
    color: #fed7aa;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 13px;
}
.timeline-stale-ok {
    background: #14532d33;
    border: 1px solid #15803d;
    color: #bbf7d0;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 13px;
}
.timeline-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary, #94a3b8);
    margin-bottom: 8px;
}
.timeline-source-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.timeline-source {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--bg-secondary, #232342);
    border: 1px solid var(--border-primary, #333);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.timeline-source:hover { border-color: #0e7490; }
.timeline-source.disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.timeline-source.disabled:hover { border-color: var(--border-primary, #333); }
.timeline-source input[type="radio"] {
    margin-top: 3px;
    accent-color: #0e7490;
}
.timeline-source-hint {
    color: var(--text-secondary, #94a3b8);
    font-size: 12px;
}
.timeline-source-warn {
    color: #f59e0b;
    font-size: 11px;
    font-weight: 500;
    margin-left: 4px;
}
.timeline-file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}
.timeline-file-row input[type="file"] {
    color: var(--text-secondary, #94a3b8);
    font-size: 12px;
    max-width: 250px;
}
.timeline-file-status {
    font-size: 11px;
    color: var(--text-secondary, #94a3b8);
}
.timeline-file-status.ok { color: #4ade80; }
.timeline-file-status.err { color: #f87171; }
.timeline-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-primary, #333);
}
.timeline-cancel-btn {
    background: transparent;
    color: var(--text-secondary, #94a3b8);
    border: 1px solid var(--border-primary, #333);
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
}
.timeline-cancel-btn:hover { color: #f1f5f9; border-color: #475569; }
.timeline-build-btn {
    background: #0e7490;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 18px;
    font-weight: 500;
    cursor: pointer;
}
.timeline-build-btn:hover { background: #155e75; }
.timeline-build-btn[disabled] { background: #475569; cursor: not-allowed; }
.timeline-open-editor-btn {
    background: #15803d;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 18px;
    font-weight: 500;
    cursor: pointer;
}
.timeline-open-editor-btn:hover { background: #166534; }
.timeline-open-editor-btn[disabled] { background: #475569; cursor: not-allowed; }
.timeline-progress {
    margin-top: 14px;
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border-primary, #333);
    border-radius: 8px;
    padding: 12px;
}
.timeline-progress-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #94a3b8);
    margin-bottom: 8px;
}
.timeline-progress-log {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    color: var(--text-primary, #e2e8f0);
    max-height: 220px;
    overflow-y: auto;
}
.timeline-log-line { padding: 2px 0; }
.timeline-log-line.ok { color: #4ade80; }
.timeline-log-line.err { color: #f87171; }

.tts-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tts-modal {
    background: var(--bg-primary, #1a1a2e);
    border: 1px solid var(--border-primary, #333);
    border-radius: 12px;
    width: 1200px;
    max-width: 95vw;
    max-height: 95vh;
    height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    overflow: hidden;
}

/* Two-column layout */
.tts-columns {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.tts-col-audio,
.tts-col-video {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}
.tts-col-audio {
    border-right: 1px solid var(--border-primary, #333);
}
@media (max-width: 900px) {
    .tts-columns { flex-direction: column; }
    .tts-col-audio { border-right: none; border-bottom: 1px solid var(--border-primary, #333); }
}

/* Provider toggle (ElevenLabs | HeyGen) */
.tts-provider-toggle {
    display: flex;
    gap: 0;
    padding: 12px 20px 0;
    flex-shrink: 0;
}
.tts-provider-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-primary, #444);
    background: transparent;
    color: var(--text-secondary, #888);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.tts-provider-btn:first-child { border-radius: 6px 0 0 6px; }
.tts-provider-btn:last-child { border-radius: 0 6px 6px 0; border-left: none; }
.tts-provider-btn.tts-provider-active {
    background: #7c3aed;
    color: #fff;
    border-color: #7c3aed;
}
.tts-provider-btn:hover:not(.tts-provider-active) {
    background: rgba(124,58,237,0.15);
    color: #c4b5fd;
}

/* HeyGen voice panel (compact) */
.hg-voice-panel {
    padding: 8px 20px 12px;
}
.hg-voice-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.hg-voice-row label {
    font-size: 11px;
    color: var(--text-secondary, #888);
    white-space: nowrap;
}
.hg-voice-row .tts-fav-btn {
    flex-shrink: 0;
}

/* Video column title */
.tts-col-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-primary, #333);
    flex-shrink: 0;
}

.tts-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-primary, #333);
}

.tts-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
}

.tts-close {
    background: none;
    border: none;
    color: var(--text-secondary, #888);
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
}
.tts-close:hover { color: #fff; }

.tts-controls {
    flex-shrink: 0;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-primary, #333);
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-primary, #1a1a2e);
}

.tts-control-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.tts-control-row label {
    font-size: 13px;
    color: var(--text-secondary, #888);
    min-width: 30px;
}

.tts-select {
    flex: 1;
    background: var(--bg-secondary, #252540);
    color: var(--text-primary, #e0e0e0);
    border: 1px solid var(--border-primary, #444);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
}

.tts-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
}

.tts-slider-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.tts-slider-group label {
    font-size: 11px;
    color: var(--text-secondary, #888);
    min-width: 55px;
}
.tts-slider-group input[type="range"] {
    flex: 1;
    height: 4px;
    accent-color: #7c3aed;
}
.tts-slider-group span {
    font-size: 11px;
    color: var(--text-secondary, #999);
    min-width: 32px;
    text-align: right;
    font-family: monospace;
}

.tts-blocks {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px;
}

.tts-block {
    border: 1px solid var(--border-primary, #333);
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}
.tts-block-split {
    border-left: 3px solid var(--accent-primary, #7c6ef0);
}

.tts-block-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-secondary, #252540);
}

.tts-block-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
}

.tts-block-timing {
    font-size: 11px;
    color: var(--text-secondary, #888);
}

.tts-block-status {
    margin-left: auto;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.tts-status-generating { background: #854d0e; color: #fde68a; }
.tts-status-generated { background: #1e3a5f; color: #93c5fd; }
.tts-status-approved { background: #14532d; color: #86efac; }
.tts-status-error { background: #7f1d1d; color: #fca5a5; }

.tts-block-body {
    padding: 10px 12px;
}
.tts-block-body label {
    font-size: 12px;
    color: var(--text-secondary, #888);
    margin-bottom: 4px;
    display: block;
}

.tts-hint {
    font-size: 11px;
    color: var(--text-secondary, #666);
    font-style: italic;
}

.tts-audio-text {
    width: 100%;
    background: var(--bg-primary, #1a1a2e);
    color: var(--text-primary, #e0e0e0);
    border: 1px solid var(--border-primary, #444);
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 8px;
    box-sizing: border-box;
}

.tts-block-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tts-generate-btn {
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 16px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 500;
}
.tts-generate-btn:hover { background: #6d28d9; }
.tts-generate-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.tts-fav-btn {
    background: none;
    border: 1px solid var(--border-primary, #444);
    border-radius: 6px;
    color: var(--text-secondary, #888);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}
.tts-fav-btn:hover { color: #f59e0b; border-color: #f59e0b; }
.tts-fav-btn.tts-fav-active { color: #f59e0b; border-color: #f59e0b; }

.tts-player-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    background: var(--bg-secondary, #252540);
    border: 1px solid var(--border-primary, #333);
    border-radius: 8px;
    padding: 6px 10px;
}

.tts-player-wrap audio { display: none; }

.tts-play-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: #7c3aed;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tts-play-btn:hover { background: #6d28d9; }

.tts-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--border-primary, #444);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    min-width: 60px;
}
.tts-progress-fill {
    height: 100%;
    background: #7c3aed;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}
.tts-progress-bar:hover .tts-progress-fill { background: #a78bfa; }

.tts-time {
    font-size: 11px;
    color: var(--text-secondary, #888);
    font-family: monospace;
    min-width: 70px;
    text-align: center;
    flex-shrink: 0;
}

.tts-approve-btn, .tts-regen-btn, .tts-download-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border-primary, #444);
    background: transparent;
    color: var(--text-secondary, #999);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tts-approve-btn:hover { border-color: #22c55e; color: #22c55e; }
.tts-approve-btn.tts-approved {
    background: #14532d;
    border-color: #22c55e;
    color: #22c55e;
}
.tts-regen-btn:hover { border-color: #f59e0b; color: #f59e0b; }
.tts-download-btn { text-decoration: none; font-size: 16px; }
.tts-download-btn:hover { border-color: #60a5fa; color: #60a5fa; }

.tts-footer {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-top: 1px solid var(--border-primary, #333);
}

.tts-progress {
    font-size: 13px;
    color: var(--text-secondary, #888);
}

.tts-concat-btn {
    background: #22c55e;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.tts-concat-btn:hover { background: #16a34a; }
.tts-concat-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── HeyGen Section ── */

.hg-section {
    flex: 1;
    min-height: 0;
    border-top: 1px solid var(--border-primary, #333);
    overflow-y: auto;
}

.hg-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    cursor: pointer;
}
.hg-section-header:hover { background: var(--bg-secondary, #252540); }

.hg-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
}

.hg-toggle-btn {
    background: none;
    border: none;
    color: var(--text-secondary, #888);
    font-size: 14px;
    cursor: pointer;
}

.hg-section-body {
    padding: 0 20px 16px;
}
.hg-section-body label {
    font-size: 12px;
    color: var(--text-secondary, #888);
    margin-bottom: 6px;
    display: block;
}

.hg-avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    max-height: none;
    overflow: visible;
    margin-bottom: 12px;
    padding: 4px;
}

.hg-avatar-card {
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-secondary, #252540);
    transition: border-color 0.15s;
    text-align: center;
}
.hg-avatar-card:hover { border-color: var(--border-primary, #555); }
.hg-avatar-card.hg-avatar-selected { border-color: #7c3aed; box-shadow: 0 0 0 1px #7c3aed; }

.hg-avatar-img {
    width: 100%;
    aspect-ratio: 9/16;
    object-fit: cover;
    object-position: top;
    display: block;
    background: var(--bg-primary, #1a1a2e);
}

.hg-avatar-name {
    display: block;
    font-size: 10px;
    color: var(--text-secondary, #999);
    padding: 3px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hg-grid-divider {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}
.hg-grid-divider span {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent, #7c3aed);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.hg-grid-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border, #333);
}

.hg-options {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}
.hg-option {
    flex: 1;
}
.hg-option label {
    font-size: 11px;
    margin-bottom: 4px;
}

.hg-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hg-generate-btn {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}
.hg-generate-btn:hover { background: #1d4ed8; }
.hg-generate-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.hg-generate-btn-el {
    background: #6d28d9;
    margin-left: 8px;
}
.hg-generate-btn-el:hover { background: #5b21b6; }

.hg-status {
    flex: 1;
}

.hg-status-msg {
    font-size: 12px;
    color: var(--text-secondary, #888);
}

.hg-videos-list {
    margin-bottom: 12px;
}
.hg-videos-list label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary, #888);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.hg-video-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px;
    text-decoration: none;
    color: #a78bfa;
    font-size: 13px;
    margin-bottom: 4px;
    transition: background 0.15s;
}
.hg-video-link:hover {
    background: rgba(139, 92, 246, 0.15);
}
.hg-video-icon {
    font-size: 16px;
}
.hg-video-title {
    flex: 1;
}
.hg-video-date {
    font-size: 11px;
    color: var(--text-secondary, #888);
}
.hg-video-generating {
    background: rgba(59, 130, 246, 0.08); border-color: rgba(59, 130, 246, 0.2);
    cursor: default;
}
.hg-video-failed {
    background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.2);
    cursor: default; flex-wrap: wrap;
}
.hg-video-error {
    width: 100%; font-size: 11px; color: #f87171; margin-top: 2px;
    white-space: pre-wrap; word-break: break-word;
}
.hg-video-link-inner {
    display: flex; align-items: center; gap: 8px; flex: 1;
    text-decoration: none; color: inherit; min-width: 0;
}
.hg-video-delete {
    background: none; border: none; color: var(--text-secondary, #888);
    font-size: 16px; cursor: pointer; padding: 2px 6px; border-radius: 4px;
    opacity: 0; transition: opacity 0.15s, color 0.15s; flex-shrink: 0;
}
.hg-video-link:hover .hg-video-delete { opacity: 1; }
.hg-video-delete:hover { color: #f87171; background: rgba(239, 68, 68, 0.1); }
.hg-video-edit {
    background: none; border: none; color: var(--text-secondary, #888);
    font-size: 14px; cursor: pointer; padding: 2px 6px; border-radius: 4px;
    opacity: 0; transition: opacity 0.15s, color 0.15s; flex-shrink: 0;
}
.hg-video-link:hover .hg-video-edit { opacity: 1; }
.hg-video-edit:hover { color: var(--accent-primary, #7c6ef0); background: rgba(124, 110, 240, 0.1); }
.hg-add-manual {
    display: flex; gap: 6px; margin-bottom: 8px;
}
.hg-manual-url {
    flex: 1; padding: 6px 10px; border-radius: 6px;
    border: 1px solid var(--border-primary, #333);
    background: var(--bg-primary, #1a1a2e);
    color: var(--text-primary, #eee); font-size: 13px;
}
.hg-manual-url::placeholder { color: var(--text-secondary, #888); }
.hg-manual-add-btn {
    padding: 6px 12px; border-radius: 6px; border: none;
    background: var(--accent-primary, #7c6ef0); color: #fff;
    font-size: 16px; font-weight: bold; cursor: pointer;
}
.hg-manual-add-btn:hover { opacity: 0.85; }
@keyframes hg-spin { to { transform: rotate(360deg); } }
.hg-spinner {
    animation: hg-spin 1s linear infinite; display: inline-block;
}

.hg-progress-bar {
    height: 4px;
    background: var(--border-primary, #444);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}
.hg-progress-fill {
    height: 100%;
    background: #2563eb;
    border-radius: 2px;
    width: 0%;
    transition: width 0.5s ease;
}

.hg-error {
    font-size: 12px;
    color: #fca5a5;
}

.hg-loading {
    font-size: 12px;
    color: var(--text-secondary, #888);
    grid-column: 1 / -1;
    padding: 12px 0;
}

.hg-result {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hg-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
}

.hg-result-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hg-result-done {
    font-size: 13px;
    font-weight: 600;
    color: #86efac;
}

.hg-result-dur {
    font-size: 11px;
    color: var(--text-secondary, #888);
}

.hg-download-btn {
    display: inline-block;
    background: #2563eb;
    color: #fff;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
}
.hg-download-btn:hover { background: #1d4ed8; }

/* ── A/B Tests Panel ── */
.ab-panel {
    width: 0;
    min-width: 0;
    height: 100%;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-secondary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 50;
    position: relative;
}
.ab-panel:not(.hidden) {
    width: 340px;
    min-width: 240px;
}
.ab-panel.ab-fullscreen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100% !important;
    min-width: 100% !important;
    z-index: 200;
    border-left: none;
}
.ab-panel .resize-handle {
    left: 0;
    right: auto;
}
.ab-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-secondary);
    flex-shrink: 0;
}
.ab-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}
.ab-panel-content {
    flex: 1;
    overflow-y: auto;
    font-size: 13px;
}

/* A/B Filters */
.ab-filters {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ab-filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.ab-filter-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 48px;
}
.ab-filter-chips {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.ab-filter-chip {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid var(--border-primary);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.12s;
    user-select: none;
}
.ab-filter-chip:hover {
    border-color: var(--text-dim);
}
.ab-filter-chip.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.5);
    color: #a5b4fc;
}

/* A/B List */
.ab-list { padding: 8px 0; }
.ab-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-dim);
    font-size: 12px;
}
.ab-test-item {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-primary);
    cursor: pointer;
    transition: background 0.12s;
}
.ab-test-item:hover {
    background: rgba(255, 255, 255, 0.03);
}
.ab-test-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.ab-test-item-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ab-test-item-meta {
    font-size: 11px;
    color: var(--text-dim);
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Status badges */
.ab-status {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    flex-shrink: 0;
}
.ab-status-no_ar {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}
.ab-status-ideia {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}
.ab-status-em_producao {
    background: rgba(250, 204, 21, 0.15);
    color: #fbbf24;
}
.ab-status-encerrado {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}
.ab-status-pausado {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}
/* Status selector dropdown */
.ab-status-selector {
    display: inline-block; position: relative;
}
.ab-status-clickable {
    cursor: pointer; user-select: none;
}
.ab-status-clickable:hover { opacity: 0.8; }
.ab-status-dropdown {
    position: absolute; top: 100%; left: 0; z-index: 50;
    background: var(--bg-secondary, #1e1e2e); border: 1px solid var(--border);
    border-radius: 6px; padding: 4px 0; margin-top: 4px;
    min-width: 120px; box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.ab-status-option {
    padding: 6px 12px; cursor: pointer; font-size: 11px;
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px;
}
.ab-status-option:hover { background: rgba(255,255,255,0.05); }
.ab-status-option.active { opacity: 0.5; pointer-events: none; }
/* Notas edit */
.ab-notas-edit-btn {
    background: none; border: 1px solid var(--border); border-radius: 4px;
    color: var(--text-dim); font-size: 10px; padding: 1px 6px; cursor: pointer;
    margin-left: 8px; vertical-align: middle;
}
.ab-notas-edit-btn:hover { border-color: var(--accent); color: var(--accent); }
.ab-analyze-link {
    background: none; border: none; color: var(--text-dim); font-size: 11px;
    cursor: pointer; padding: 0; text-decoration: underline;
    opacity: 0.6; transition: opacity 0.2s;
}
.ab-analyze-link:hover { opacity: 1; }
.ab-sql-toggle-btn {
    background: none; border: 1px solid var(--border); border-radius: 4px;
    color: var(--text-dim); font-size: 10px; padding: 1px 6px; cursor: pointer;
    margin-left: 8px; vertical-align: middle;
}
.ab-sql-toggle-btn:hover { border-color: var(--accent); color: var(--accent); }
.ab-sql-textarea {
    width: 100%; background: #0d1117; color: #c9d1d9;
    border: 1px solid var(--border); border-radius: 6px; padding: 10px;
    font-size: 12px; font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    resize: vertical; tab-size: 2; line-height: 1.5;
}
.ab-sql-textarea:focus { outline: none; border-color: var(--accent); }
.ab-notas-edit-area {
    width: 100%; background: var(--bg-secondary, #1a1a2e); color: var(--text-primary);
    border: 1px solid var(--border); border-radius: 6px; padding: 8px;
    font-size: 12px; font-family: inherit; resize: vertical;
    margin-top: 4px;
}

/* A/B Detail view */
.ab-detail { padding: 16px; }
.ab-detail-back {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.ab-detail-back:hover { text-decoration: underline; }
.ab-detail-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.ab-detail-section {
    margin-top: 16px;
}
.ab-detail-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    margin-bottom: 8px;
}
.ab-detail-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.ab-variant-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 6px;
}
.ab-variant-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 2px;
}
.ab-variant-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

/* A/B Actions */
.ab-actions {
    display: flex;
    gap: 6px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.ab-action-btn {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border-secondary);
    background: var(--bg-primary);
    color: var(--text-secondary);
    transition: all 0.15s;
}
.ab-action-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}
.ab-action-btn.primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.ab-action-btn.primary:hover {
    opacity: 0.85;
}
.ab-action-btn.danger {
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}
.ab-action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* A/B Results table */
.ab-results-table-wrap {
    overflow-x: auto;
    margin-top: 8px;
}
.ab-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}
.ab-results-table .winner-row td {
    background: rgba(34, 197, 94, 0.08);
    color: #4ade80;
    font-weight: 600;
}
.ab-results-table th {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-secondary);
    color: var(--text-dim);
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.ab-results-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-primary);
    color: var(--text-secondary);
    white-space: nowrap;
}
.ab-results-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}
.ab-results-loading {
    text-align: center;
    padding: 16px;
    color: var(--text-dim);
    font-size: 12px;
}

/* A/B Metricas summary cards */
.ab-metricas-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 8px;
}
.ab-metrica-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 8px 10px;
}
.ab-metrica-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.ab-metrica-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2px;
}

/* A/B Create form */
.ab-create { padding: 16px; }
.ab-create-form { margin-top: 12px; }
.ab-form-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 12px;
}
.ab-form-input,
.ab-form-select,
.ab-form-textarea {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 7px 10px;
    font-size: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-secondary);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: inherit;
    box-sizing: border-box;
}
.ab-form-input:focus,
.ab-form-select:focus,
.ab-form-textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.ab-form-textarea {
    resize: vertical;
    min-height: 60px;
}
.ab-form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 0;
}
.ab-variant-entry {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 6px;
    position: relative;
}
.ab-variant-entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.ab-variant-entry-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
}
.ab-variant-remove {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 16px;
    padding: 0 2px;
    line-height: 1;
}
.ab-variant-remove:hover { color: #f87171; }
.ab-variant-name-input,
.ab-variant-desc-input {
    display: block;
    width: 100%;
    padding: 5px 8px;
    font-size: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    color: var(--text-primary);
    font-family: inherit;
    margin-top: 3px;
    box-sizing: border-box;
}
.ab-variant-name-input:focus,
.ab-variant-desc-input:focus {
    outline: none;
    border-color: var(--accent);
}

@media (max-width: 768px) {
    .ab-panel:not(.hidden) {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 85vw;
        max-width: 340px;
        z-index: 200;
    }
}

/* A/B Results Rich Cards */
.ab-results-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}
.ab-result-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 12px;
}
.ab-result-card.winner {
    border-color: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.15);
}
.ab-result-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.ab-result-variant-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}
.ab-result-winner-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ab-result-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.ab-result-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ab-result-metric-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.ab-result-metric-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.ab-result-metric-value.best {
    color: #4ade80;
}
.ab-result-bar {
    height: 3px;
    background: var(--border-primary);
    border-radius: 2px;
    margin-top: 2px;
    overflow: hidden;
}
.ab-result-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--accent);
    transition: width 0.3s ease;
}
.ab-result-card.winner .ab-result-bar-fill {
    background: #22c55e;
}
.ab-results-toggle {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-dim);
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px 0;
    font-family: inherit;
}
.ab-results-toggle:hover {
    color: var(--accent);
}

/* AI Generation */
.ab-ai-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 12px;
}
.ab-ai-status {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-dim);
    padding: 6px 8px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 4px;
}
.ab-ai-status.error {
    color: #f87171;
    background: rgba(239, 68, 68, 0.08);
}

/* A/B Analysis */
.ab-analysis-result {
    margin-top: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 12px;
}
.ab-analysis-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ── Review Tab ── */
.review-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.review-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    cursor: pointer;
    border-radius: 6px;
    margin: 2px 8px;
    transition: background 0.15s;
}
.review-item:hover { background: var(--bg-hover); }
.review-item:hover .group-item-id { display: inline; }
.review-item.active { background: var(--bg-active); }
.review-item-date {
    flex: 1;
    font-size: 14px;
    color: var(--text);
}
.review-status-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.review-status-badge.rascunho { background: #332800; color: #fbbf24; }
.review-status-badge.concluida { background: #0d3320; color: #34d399; }

/* Review Panel */
.review-panel {
    width: 0;
    min-width: 0;
    height: 100%;
    background: var(--bg-primary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 50;
    position: relative;
}
.review-panel .resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    cursor: col-resize;
    z-index: 10;
}
.review-panel:not(.hidden) {
    width: 60%;
    min-width: 500px;
}
.review-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.review-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.review-panel-title {
    font-weight: 600;
    font-size: 14px;
    color: #60a5fa;
    white-space: nowrap;
}
.review-panel-date {
    font-size: 12px;
    color: var(--text-muted);
}
.review-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.review-status-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 12px;
    padding: 4px 8px;
    cursor: pointer;
}
.review-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Review Warnings Banner */
.review-warnings {
    margin: 0 16px;
    padding: 10px 14px;
    background: #2a1a00;
    border: 1px solid #b45309;
    border-radius: 8px;
    color: #fbbf24;
    font-size: 13px;
    line-height: 1.5;
}
.review-warnings strong { display: block; margin-bottom: 4px; color: #f59e0b; }
.review-warnings ul { margin: 0; padding-left: 18px; }
.review-warnings li { margin: 2px 0; color: #d4a44a; }
[data-theme="light"] .review-warnings { background: #fffbeb; border-color: #f59e0b; color: #92400e; }
[data-theme="light"] .review-warnings strong { color: #b45309; }
[data-theme="light"] .review-warnings li { color: #92400e; }

/* Review Sections */
.review-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: visible;
}
.review-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    border-radius: 8px 8px 0 0;
}
.review-section-header:hover { background: var(--bg-hover); }
.review-section-header h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: var(--text);
}
.review-section-arrow {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.2s;
}
.review-section.collapsed .review-section-arrow { transform: rotate(-90deg); }
.review-section-body {
    padding: 0 16px 16px;
}
.review-section.collapsed .review-section-body { display: none; }

/* Review sub-sections (per account) */
.review-account {
    margin-bottom: 16px;
}
.review-account:last-child { margin-bottom: 0; }
.review-account-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

/* Metric grid */
.review-metric-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}
.review-metric-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.review-metric-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.review-metric-input {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px 8px;
    color: var(--text);
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
}
.review-metric-input:focus {
    border-color: rgba(59, 130, 246, 0.5);
    outline: none;
}

/* Textarea */
.review-textarea {
    width: 100%;
    min-height: 60px;
    resize: vertical;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px;
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    line-height: 1.5;
    box-sizing: border-box;
}
.review-textarea:focus {
    border-color: rgba(59, 130, 246, 0.5);
    outline: none;
}

/* Criativos table */
.review-criativos-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 8px;
}
.review-criativos-table th {
    text-align: left;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.review-criativos-table td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--border);
}
.review-criativos-table input {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 4px 6px;
    color: var(--text);
    font-size: 12px;
    width: 100%;
    box-sizing: border-box;
}
.review-criativos-table input:focus {
    border-color: rgba(59, 130, 246, 0.5);
    outline: none;
}
.review-add-row-btn {
    background: none;
    border: 1px dashed var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 12px;
    padding: 4px 10px;
    cursor: pointer;
    margin-top: 4px;
}
.review-add-row-btn:hover { color: var(--text); border-color: var(--text-muted); }
.review-remove-row-btn {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    opacity: 0.5;
}
.review-remove-row-btn:hover { opacity: 1; }

/* Actions checklist */
.review-action-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 6px;
}
.review-action-checkbox {
    accent-color: #3b82f6;
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}
.review-action-text {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px 8px;
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
}
.review-action-text:focus { border-color: rgba(59, 130, 246, 0.5); outline: none; }
.review-action-assignee {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 6px;
    color: var(--text);
    font-size: 12px;
    width: 90px;
    flex-shrink: 0;
}
.review-action-due {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 6px;
    color: var(--text);
    font-size: 12px;
    width: 130px;
    flex-shrink: 0;
}
.review-action-due::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
}
.review-add-action-btn {
    background: none;
    border: 1px dashed var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 12px;
    padding: 6px 12px;
    cursor: pointer;
    margin-top: 6px;
    width: 100%;
}
.review-add-action-btn:hover { color: var(--text); border-color: var(--text-muted); }
.review-actions-footer {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
}
.review-actions-footer .review-add-action-btn { margin-top: 0; flex: 1; }
.review-create-all-asana-btn {
    background: rgba(246, 133, 87, 0.15);
    border: 1px solid rgba(246, 133, 87, 0.3);
    border-radius: 4px;
    color: #f68557;
    font-size: 12px;
    padding: 6px 12px;
    cursor: pointer;
    white-space: nowrap;
}
.review-create-all-asana-btn:hover { background: rgba(246, 133, 87, 0.25); }
.review-create-all-asana-btn:disabled { opacity: 0.5; cursor: default; }
.review-asana-create-btn {
    background: rgba(246, 133, 87, 0.15);
    border: 1px solid rgba(246, 133, 87, 0.3);
    border-radius: 3px;
    color: #f68557;
    font-size: 11px;
    padding: 2px 8px;
    cursor: pointer;
    flex-shrink: 0;
}
.review-asana-create-btn:hover { background: rgba(246, 133, 87, 0.3); }
.review-asana-create-btn:disabled { opacity: 0.5; cursor: default; }
.review-asana-edit-btn {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 3px;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
    cursor: pointer;
    text-decoration: none;
}
.review-asana-edit-btn:hover { background: rgba(34, 197, 94, 0.25); }
.review-asana-delete-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 12px;
    cursor: pointer;
    padding: 0 4px;
    flex-shrink: 0;
    opacity: 0.5;
}
.review-asana-delete-btn:hover { opacity: 1; color: #ef4444; }
.review-action-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.review-action-notes-toggle {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 10px;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: transform 0.15s;
    width: 14px;
    text-align: center;
}
.review-action-notes-toggle.open { transform: rotate(0deg); color: var(--accent); }
.review-action-notes-toggle:not(.open) { transform: rotate(-90deg); }
.review-action-notes-toggle.has-notes { color: var(--accent); }
.review-action-notes-wrap {
    padding: 0 0 6px 22px;
}
.review-action-notes-wrap.hidden { display: none; }
.review-action-notes {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 12px;
    padding: 6px 8px;
    resize: vertical;
    font-family: inherit;
}
.review-action-section {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 11px;
    padding: 2px 4px;
    max-width: 110px;
}

/* Copys da semana table */
.review-copys-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.review-copys-table th {
    text-align: left;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.review-copys-table td { padding: 4px 8px; border-bottom: 1px solid var(--border); }
.review-copys-table input {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 4px 6px;
    color: var(--text);
    font-size: 12px;
    width: 100%;
    box-sizing: border-box;
}
.review-copys-table input:focus { border-color: rgba(59, 130, 246, 0.5); outline: none; }

/* ── Review tree (year > month > day) ── */
.review-tree-year {
    margin-bottom: 2px;
}
.review-tree-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
    border-radius: 4px;
}
.review-tree-header:hover { background: var(--bg-hover); }
.review-tree-month-header {
    font-weight: 500;
    font-size: 12px;
    color: var(--text-dim);
    padding-left: 16px;
}
.review-tree-arrow {
    font-size: 10px;
    transition: transform 0.15s;
    display: inline-block;
    width: 12px;
}
.review-tree-year.collapsed .review-tree-arrow,
.review-tree-month.collapsed > .review-tree-header .review-tree-arrow {
    transform: rotate(-90deg);
}
.review-tree-year.collapsed > .review-tree-month,
.review-tree-month.collapsed > .review-item {
    display: none;
}
.review-tree-month > .review-item {
    padding-left: 32px;
}

/* ── Review rich editor (atualizacoes) ── */
.review-rich-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
}
.review-rich-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
}
.review-rich-btn:hover { background: var(--bg-hover); }
.review-rich-sep {
    width: 1px;
    height: 16px;
    background: var(--border);
    margin: 0 4px;
}
.review-mention-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 3px;
}
.review-mention-btn:hover { background: var(--bg-hover); }
.review-rich-editor {
    min-height: 200px;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 0 0 6px 6px;
    color: var(--text);
    font-size: 13px;
    line-height: 1.6;
    outline: none;
    overflow-y: auto;
    max-height: 500px;
}
.review-rich-editor:focus { border-color: rgba(59, 130, 246, 0.5); }
.review-rich-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--text-dim);
    pointer-events: none;
}
.review-mention {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 500;
    font-size: 12px;
}

/* ── Review fullscreen ── */
.review-fullscreen-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.review-fullscreen-btn:hover { color: var(--text); border-color: var(--text-muted); }
.review-panel.review-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100%;
    min-width: 0;
    z-index: 9999;
    border-left: none;
    border-radius: 0;
}

/* ── Review updates (unified document) ── */
.review-updates-doc {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 6px 6px;
    padding: 8px 0;
}
.review-update-row {
    display: flex;
    align-items: flex-start;
    padding: 4px 12px;
    min-height: 28px;
}
.review-update-row + .review-update-row {
    border-top: 1px solid rgba(255,255,255,0.03);
}
.review-update-author-label {
    flex-shrink: 0;
    width: 60px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    padding-top: 3px;
    user-select: none;
}
.review-update-editor {
    flex: 1;
    min-height: 24px;
    padding: 2px 6px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
    outline: none;
    border-radius: 3px;
}
/* Links inline em áreas de texto do painel de revisão — fundo escuro pede azul claro
   pra contraste. Excluí elementos que já são botões estilizados como <a>. */
.review-panel a:not(.review-asana-edit-btn):not(.review-asana-create-btn):not(.canvas-link) {
    color: #60a5fa;
    text-decoration: underline;
}
.review-panel a:not(.review-asana-edit-btn):not(.review-asana-create-btn):not(.canvas-link):hover {
    color: #93c5fd;
}
.light-theme .review-panel a:not(.review-asana-edit-btn):not(.review-asana-create-btn):not(.canvas-link) {
    color: #2563eb;
}
.light-theme .review-panel a:not(.review-asana-edit-btn):not(.review-asana-create-btn):not(.canvas-link):hover {
    color: #1d4ed8;
}
.review-update-editor:focus {
    background: rgba(59, 130, 246, 0.05);
}
.review-update-editor:empty::before {
    content: 'Escrever...';
    color: var(--text-dim);
    opacity: 0.5;
    pointer-events: none;
}
.review-updates-save-status {
    margin-left: auto;
    font-size: 11px;
    padding: 2px 6px;
}
.review-updates-save-status.saving { color: var(--text-dim); }
.review-updates-save-status.saved { color: #34d399; }
.review-updates-save-status.error { color: #f87171; }
.light-theme .review-update-row + .review-update-row {
    border-top-color: rgba(0,0,0,0.06);
}
.light-theme .review-update-editor:focus {
    background: rgba(59, 130, 246, 0.04);
}

/* ── Review V2 (per-project) ── */
.review-week-range {
    color: var(--text-dim);
    font-size: 12px;
    padding: 4px 0 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.review-last-updated {
    margin-left: 12px;
    opacity: 0.7;
    font-style: italic;
    font-size: 12px;
    color: var(--text-muted);
}
.review-inc-toggle {
    color: var(--text-dim);
    font-size: 11px;
    cursor: pointer;
    padding: 4px 0;
    opacity: 0.7;
}
.review-inc-toggle:hover { opacity: 1; }
.review-inc-toggle.open { opacity: 1; }
.review-inc-table { opacity: 0.7; }
.review-overflow-hidden { display: none !important; }
.review-ver-mais-btn {
    color: var(--accent);
    font-size: 11px;
    cursor: pointer;
    padding: 4px 0;
    text-align: center;
}
.review-ver-mais-btn:hover { text-decoration: underline; }
.review-lang-block {
    margin-bottom: 16px;
    padding-left: 8px;
    border-left: 2px solid var(--accent);
}
.review-lang-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--accent);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
}
.review-lang-title:hover { opacity: 0.8; }
.review-lang-arrow {
    font-size: 10px;
    transition: transform 0.2s;
    display: inline-block;
}
.review-lang-block.collapsed .review-lang-arrow { transform: rotate(-90deg); }
/* Visão Geral */
.review-visao-geral {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
}
.review-vg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.review-vg-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.review-vg-pct {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}
.review-pct-p90 { background: #7c3aed; color: #fff; }
.review-pct-p70 { background: #059669; color: #fff; }
.review-pct-p50 { background: #0891b2; color: #fff; }
.review-pct-p30 { background: #d97706; color: #fff; }
.review-pct-p0 { background: #dc2626; color: #fff; }
.review-pct-none { background: var(--bg-secondary); color: var(--text-dim); }
.review-vg-proj-label {
    font-size: 9px;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-top: 4px;
}
.review-vg-proj {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 6px;
}
.review-vg-proj.negative { color: #ef4444; }
.review-vg-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.review-vg-split {
    display: flex;
    gap: 16px;
    align-items: stretch;
}
.review-vg-left {
    flex: 0 0 45%;
    min-width: 0;
}
.review-vg-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.review-vg-lang-card {
    flex: 1;
    min-width: 0;
    background: var(--bg-secondary);
    border-radius: 6px;
    padding: 5px 8px;
}
.review-vg-lang-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}
.review-vg-lang-name {
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
}
.review-vg-lang-proj {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}
.review-vg-lang-proj.negative { color: #ef4444; }
.review-vg-lang-card .review-vg-pct { font-size: 9px; padding: 1px 5px; margin-left: auto; }
.review-vg-lang-card .review-vg-hbars { gap: 1px; }
.review-vg-lang-card .review-vg-hbar-row { gap: 3px; }
.review-vg-lang-card .review-vg-hbar-month { font-size: 8px; width: 20px; }
.review-vg-lang-card .review-vg-hbar-track { height: 8px; }
.review-vg-lang-card .review-vg-hbar-val { font-size: 8px; width: 42px; }
/* Horizontal bar chart */
.review-vg-hbars {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.review-vg-hbar-row {
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.6;
}
.review-vg-hbar-row.current { opacity: 1; }
.review-vg-hbar-month {
    font-size: 10px;
    color: var(--text-dim);
    width: 26px;
    text-align: right;
    flex-shrink: 0;
}
.review-vg-hbar-track {
    flex: 1;
    height: 14px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}
.review-vg-hbar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    opacity: 0.5;
    min-width: 2px;
}
.review-vg-hbar-fill.current { opacity: 1; }
.review-vg-hbar-fill.negative { background: #ef4444; }
.review-vg-hbar-val {
    font-size: 10px;
    color: var(--text-dim);
    width: 55px;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.review-vg-hbar-val.negative { color: #ef4444; }
/* Light theme */
body.light .review-visao-geral { background: #f8fafc; }
body.light .review-vg-hbar-track { background: #e2e8f0; }

.review-lang-body { }
.review-product-columns {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.review-product-left {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
}
.review-product-right {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    max-height: 85vh;
    overflow-y: auto;
}
.review-product-right .review-comentario-text {
    width: 100%;
    box-sizing: border-box;
}
.review-right-analysis {
    margin-top: 10px;
    font-size: 11px;
}
.review-right-analysis .review-analise-traffic-label {
    font-size: 11px;
}
.review-right-analysis .review-analise-traffic-text {
    font-size: 11px;
}
.review-lang-block.collapsed .review-lang-body { display: none; }
.review-subsection-title {
    font-size: 12px;
    color: var(--text-dim);
    margin: 8px 0 4px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 5px;
}
.review-subsection-title:hover { opacity: 0.8; }
.review-subsection-arrow {
    font-size: 9px;
    transition: transform 0.2s;
    display: inline-block;
}
.review-subsection-wrap.collapsed .review-subsection-arrow { transform: rotate(-90deg); }
.review-subsection-body { }
.review-subsection-wrap.collapsed .review-subsection-body { display: none; }
.review-v2-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-bottom: 8px;
}
.review-v2-table th {
    text-align: left;
    padding: 4px 8px;
    font-size: 11px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    font-weight: 500;
    white-space: nowrap;
}
.review-v2-table td {
    padding: 3px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: var(--text);
    white-space: nowrap;
}
.review-v2-table tr:hover td { background: var(--bg-hover); }
.review-v2-table .roas-good { color: #34d399; font-weight: 600; }
.review-v2-table .roas-ok { color: #fbbf24; }
.review-v2-table .roas-bad { color: #f87171; }
.review-v2-table .profit-positive { color: #34d399; }
.review-v2-table .profit-negative { color: #f87171; }
.review-v2-table .body-name { font-weight: 600; color: var(--accent); }
.review-empty {
    font-size: 12px;
    color: var(--text-dim);
    font-style: italic;
    padding: 4px 0;
}
/* Semáforo de concentração */
.review-semaforo {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 10px;
    margin-left: 8px;
    white-space: nowrap;
}
.review-semaforo-verde { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.review-semaforo-amarelo { background: rgba(234, 179, 8, 0.15); color: #eab308; }
.review-semaforo-vermelho { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
/* Análise traffic agent + comentário */
.review-analise-row {
    display: flex;
    gap: 8px;
    margin: 8px 0 12px;
}
.review-analise-traffic {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    background: rgba(59, 130, 246, 0.06);
    border-left: 2px solid rgba(59, 130, 246, 0.4);
    border-radius: 0 6px 6px 0;
}
.review-analise-traffic-label {
    font-size: 10px;
    font-weight: 600;
    color: rgba(96, 165, 250, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.review-analise-traffic-text {
    font-size: 12px;
    color: var(--text);
    line-height: 1.5;
}
.review-analise-section {
    display: inline-block;
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.5px;
    color: rgba(96, 165, 250, 0.9);
    margin-top: 4px;
}
.review-analise-sublabel {
    display: inline-block;
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.3px;
    padding: 1px 5px;
    border-radius: 3px;
    margin-top: 2px;
}
.review-analise-sublabel:first-of-type { margin-top: 4px; }
.review-analise-copy .review-analise-sublabel { color: rgba(168, 85, 247, 0.85); background: rgba(168, 85, 247, 0.08); }
.review-analise-traffic .review-analise-sublabel { color: rgba(96, 165, 250, 0.85); background: rgba(96, 165, 250, 0.08); }
.light-theme .review-analise-copy .review-analise-sublabel { color: rgba(126, 34, 206, 0.8); background: rgba(126, 34, 206, 0.06); }
.review-analise-copy {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    background: rgba(168, 85, 247, 0.06);
    border-left: 2px solid rgba(168, 85, 247, 0.4);
    border-radius: 0 6px 6px 0;
}
.review-analise-copy-label {
    font-size: 10px;
    font-weight: 600;
    color: rgba(168, 85, 247, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.review-analise-copy-text {
    font-size: 12px;
    color: var(--text);
    line-height: 1.5;
}
.review-analise-copy .review-analise-section {
    color: rgba(168, 85, 247, 0.9);
}
.review-comentario {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.review-comentario-label {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.review-comentario-text {
    flex: 1;
    resize: vertical;
    font-size: 12px;
    min-height: 60px;
}
/* Body aggregation rows */
.review-body-toggle { cursor: pointer; }
.review-body-toggle:hover { background: rgba(255, 255, 255, 0.04); }
.review-body-row td:first-child { font-weight: 600; }
.review-body-arrow { font-size: 10px; display: inline-block; transition: transform 0.15s; margin-right: 2px; }
.review-var-row { background: rgba(255, 255, 255, 0.02); }
.review-var-name { padding-left: 20px !important; color: var(--text-dim); font-weight: 400; }
.review-vars-count { font-weight: 400; font-size: 11px; color: var(--text-dim); }
.light-theme .review-body-toggle:hover { background: rgba(0, 0, 0, 0.03); }
.light-theme .review-var-row { background: rgba(0, 0, 0, 0.02); }
/* Fadiga criativa */
.review-fadiga-table { border-left: 2px solid #ef4444; }
.review-fadiga-decay { color: #ef4444; font-weight: 600; }
/* Oportunidades de escala */
.review-dark-horses-table { border-left: 2px solid #22c55e; }
.review-dark-horses-hint {
    font-size: 11px;
    color: #22c55e;
    font-weight: 500;
    margin-top: 4px;
    padding: 3px 8px;
    background: rgba(34, 197, 94, 0.08);
    border-radius: 4px;
    display: inline-block;
}
.review-v2-testes {
    margin-top: 4px;
}

/* Ad preview popup */
#ad-preview-popup {
    display: none;
    position: fixed;
    z-index: 9999;
    width: 320px;
    height: 400px;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    cursor: pointer;
}
.light-theme #ad-preview-popup { border-color: rgba(0, 0, 0, 0.15); }
#ad-preview-popup .ad-preview-lang-badge {
    display: none;
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 1;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    letter-spacing: 0.5px;
    pointer-events: none;
}
.ad-preview-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 5px;
    font-size: 8px;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    cursor: pointer;
    vertical-align: middle;
    transition: background 0.15s, color 0.15s;
}
.ad-preview-btn:hover {
    background: var(--accent);
    color: #fff;
}
.light-theme .ad-preview-btn { background: rgba(0, 0, 0, 0.06); }
.light-theme .ad-preview-btn:hover { background: #2563eb; color: #fff; }
.ad-preview-missing {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 5px;
    font-size: 10px;
    color: #f59e0b;
    opacity: 0.5;
    cursor: default;
}
.light-theme .ad-preview-missing { color: #d97706; }

/* Light theme overrides */
.light-theme .review-status-badge.rascunho { background: #fef3c7; color: #92400e; }
.light-theme .review-status-badge.concluida { background: #d1fae5; color: #065f46; }
.light-theme .review-panel-title { color: #2563eb; }
.light-theme .review-v2-table .roas-good { color: #059669; }
.light-theme .review-v2-table .roas-bad { color: #dc2626; }
.light-theme .review-v2-table .profit-positive { color: #059669; }
.light-theme .review-v2-table .profit-negative { color: #dc2626; }
.light-theme .review-lang-block { border-left-color: #2563eb; }
.light-theme .review-lang-title { color: #2563eb; }
.light-theme .review-semaforo-verde { background: rgba(22, 163, 74, 0.12); color: #16a34a; }
.light-theme .review-semaforo-amarelo { background: rgba(202, 138, 4, 0.12); color: #ca8a04; }
.light-theme .review-semaforo-vermelho { background: rgba(220, 38, 38, 0.12); color: #dc2626; }
.light-theme .review-dark-horses-hint { color: #16a34a; background: rgba(22, 163, 74, 0.08); }
.light-theme .review-analise-traffic { background: rgba(37, 99, 235, 0.05); border-left-color: rgba(37, 99, 235, 0.3); }
.light-theme .review-analise-traffic-label { color: rgba(37, 99, 235, 0.6); }
.light-theme .review-analise-copy { background: rgba(126, 34, 206, 0.05); border-left-color: rgba(126, 34, 206, 0.3); }
.light-theme .review-analise-copy-label { color: rgba(126, 34, 206, 0.6); }
.light-theme .review-analise-copy .review-analise-section { color: rgba(126, 34, 206, 0.8); }
.light-theme .review-comentario-label { color: rgba(0, 0, 0, 0.4); }
.review-author-legend {
    display: flex;
    gap: 8px;
    margin-bottom: 3px;
}
.review-author-tag {
    font-size: 9px;
    font-weight: 600;
    opacity: 0.7;
}

/* ── Editor (Edicao) Tab ── */
#edicao-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;
}
.sidebar-tab[data-tab="edicao"].active {
    border-color: #ff6b6b;
}
.editor-select {
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 8px;
    background: var(--bg-input);
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
}
.editor-input {
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 8px;
    background: var(--bg-input);
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
}
.editor-textarea {
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 8px;
    background: var(--bg-input);
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}
.editor-upload-area {
    width: 100%;
    padding: 20px;
    margin-bottom: 8px;
    background: var(--bg-input);
    border: 2px dashed #2a2a4a;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    color: #666;
    font-size: 13px;
    transition: border-color 0.2s;
}
.editor-upload-area:hover,
.editor-upload-area.drag-over {
    border-color: #ff6b6b;
    color: #ff6b6b;
}
.editor-upload-area.has-file {
    border-color: #4ade80;
    color: #4ade80;
}
.editor-file-name {
    font-size: 11px;
    color: #888;
    margin-bottom: 8px;
    word-break: break-all;
}
.faceswap-detect-btn {
    width: 100%;
    padding: 8px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 6px;
}
.faceswap-detect-btn:hover {
    opacity: 0.9;
}
.faceswap-detect-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.editor-faceswap-faces {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.faceswap-face-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 6px 8px;
}
.faceswap-thumb {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #555;
    flex-shrink: 0;
}
.faceswap-thumb.swapping {
    border-color: #ff6b6b;
}
.faceswap-info {
    flex: 1;
    font-size: 11px;
    color: #aaa;
    min-width: 0;
}
.faceswap-info .face-label {
    color: #fff;
    font-weight: 600;
    font-size: 12px;
}
.faceswap-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.faceswap-btn {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #555;
    background: transparent;
    color: #ccc;
    font-size: 11px;
    cursor: pointer;
}
.faceswap-btn:hover {
    background: rgba(255,255,255,0.1);
}
.faceswap-btn.active {
    background: #ff6b6b;
    border-color: #ff6b6b;
    color: #fff;
}
.faceswap-source-preview {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ff6b6b;
}
.editor-prepare-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #ff6b6b, #ff4757);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}
.editor-prepare-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.editor-prepare-btn:not(:disabled):hover {
    opacity: 0.85;
}
.editor-heygen-warning {
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 11px;
    color: #fbbf24;
    margin-top: 6px;
    line-height: 1.4;
}
.new-hook-music-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.45);
    border-radius: 8px;
    padding: 8px 28px 8px 10px;
    font-size: 11px;
    color: #f87171;
    margin-top: 6px;
    line-height: 1.4;
    position: relative;
}
.new-hook-music-error-close {
    position: absolute;
    top: 4px;
    right: 6px;
    background: none;
    border: none;
    color: #f87171;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    opacity: 0.7;
}
.new-hook-music-error-close:hover {
    opacity: 1;
}
.new-hook-prepare-hint {
    display: inline-block;
    font-size: 11px;
    color: #fbbf24;
    padding: 6px 10px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 6px;
    line-height: 1.4;
}
.editor-heygen-info {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 11px;
    color: #22c55e;
    margin-top: 6px;
    line-height: 1.4;
}
.editor-heygen-info .heygen-thumb {
    width: 100%;
    border-radius: 6px;
    margin-top: 6px;
}
/* HeyGen ready badge */
.heygen-ready {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #22c55e;
    font-weight: 600;
}
.heygen-ready-icon {
    font-size: 14px;
}
/* HeyGen drag & drop zone */
.heygen-drop-zone {
    border: 1px dashed rgba(139,92,246,0.4);
    border-radius: 10px;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(139,92,246,0.03);
}
.heygen-drop-zone:hover {
    border-color: #8b5cf6;
    background: rgba(139,92,246,0.08);
}
.heygen-drop-zone.drag-over {
    border-color: #8b5cf6;
    background: rgba(139,92,246,0.15);
    border-style: solid;
    box-shadow: 0 0 0 2px rgba(139,92,246,0.2);
}
.heygen-drop-zone.has-file {
    border-color: #22c55e;
    background: rgba(34,197,94,0.06);
    border-style: solid;
    cursor: default;
}
.heygen-drop-icon {
    font-size: 24px;
    opacity: 0.7;
}
.heygen-drop-text {
    font-size: 12px;
    color: #888;
}
.heygen-drop-done {
    font-size: 22px;
    color: #22c55e;
}
.heygen-drop-filename {
    font-size: 12px;
    color: #ccc;
    font-weight: 600;
}
.heygen-drop-size {
    font-size: 10px;
    color: #888;
}
.heygen-upload-status {
    font-size: 11px;
    margin-top: 4px;
    min-height: 14px;
}
.heygen-dashboard-link {
    font-size: 10px;
    color: #8b5cf6;
    text-decoration: underline;
    margin-top: 2px;
    display: inline-block;
}
.hook-picker-heygen-badge {
    display: inline-block;
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 600;
    margin-left: 4px;
    vertical-align: middle;
}
.hook-picker-heygen-badge.has-video {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}
.hook-picker-heygen-badge.no-video {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}
.editor-progress {
    margin-top: 8px;
    font-size: 12px;
    color: #888;
}
.editor-progress .step-done { color: #4ade80; }
.editor-progress .step-active { color: #fbbf24; }
.editor-steps {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.editor-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 3px 0;
    color: #555;
    transition: color 0.2s;
}
.editor-step.done {
    color: #4ade80;
}
.editor-step.running {
    color: #fbbf24;
}
.editor-step.error {
    color: #ff6b6b;
}
.editor-step-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
    border: 1.5px solid currentColor;
}
.editor-step.done .editor-step-icon {
    background: #4ade80;
    color: #000;
    border-color: #4ade80;
}
.editor-step.running .editor-step-icon {
    animation: editorPulse 1s ease-in-out infinite;
    border-color: #fbbf24;
}
@keyframes editorPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* Editor main area */
.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.editor-top-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid #1a1a3a;
    min-height: 44px;
}
.editor-top-title {
    font-size: 14px;
    font-weight: 700;
    color: #ff6b6b;
}
.editor-session-id {
    font-size: 11px;
    color: #666;
    font-family: monospace;
    cursor: pointer;
    margin-left: 8px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.editor-session-id:hover {
    color: #aaa;
    background: rgba(255,255,255,0.05);
}
.editor-iframe {
    flex: 1;
    border: none;
    width: 100%;
}
.editor-render-btn-top {
    padding: 6px 16px;
    background: linear-gradient(135deg, #ff6b6b, #ff4757);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.editor-render-btn-top:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.editor-render-status {
    font-size: 12px;
    color: #888;
}
.editor-render-status.done { color: #4ade80; }
.editor-render-status.error { color: #ff6b6b; }

/* Render queue */
.editor-queue-toggle {
    position: relative;
    background: none;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    color: #888;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    transition: border-color 0.15s, color 0.15s;
}
.editor-queue-toggle:hover {
    border-color: #5a5a8a;
    color: #ccc;
}
.editor-queue-toggle.has-active {
    border-color: #fbbf24;
    color: #fbbf24;
}
.editor-queue-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ff4757;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    padding: 0 4px;
}
.editor-queue-panel {
    position: absolute;
    top: 44px;
    right: 12px;
    width: 360px;
    max-height: 400px;
    background: #13132a;
    border: 1px solid #2a2a4a;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    z-index: 100;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.editor-queue-header {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
    border-bottom: 1px solid #1e1e3e;
}
.editor-queue-list {
    overflow-y: auto;
    max-height: 350px;
}
.editor-queue-empty {
    padding: 24px 16px;
    text-align: center;
    font-size: 12px;
    color: #444;
}
.editor-queue-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid #1a1a3a;
}
.editor-queue-item:last-child {
    border-bottom: none;
}
.editor-queue-item-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.editor-queue-item-icon.rendering {
    background: #fbbf2422;
    color: #fbbf24;
    animation: editorPulse 1s ease-in-out infinite;
}
.editor-queue-item-icon.done {
    background: #4ade8022;
    color: #4ade80;
}
.editor-queue-item-icon.error {
    background: #ff6b6b22;
    color: #ff6b6b;
}
.editor-queue-item-icon.cancelled {
    background: #fbbf2422;
    color: #fbbf24;
}
.editor-queue-cancel {
    padding: 4px 10px;
    background: #ff6b6b22;
    border: 1px solid #ff6b6b;
    border-radius: 5px;
    color: #ff6b6b;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.editor-queue-cancel:hover {
    background: #ff6b6b44;
}
.editor-queue-cancel-sm {
    padding: 2px 8px;
    font-size: 10px;
}
.editor-queue-item-info {
    flex: 1;
    min-width: 0;
}
.editor-queue-item-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.editor-queue-item-meta {
    font-size: 10px;
    color: #555;
    margin-top: 2px;
}
.editor-queue-item-actions {
    flex-shrink: 0;
}
.editor-queue-download {
    padding: 4px 10px;
    background: #4ade8022;
    border: 1px solid #4ade80;
    border-radius: 5px;
    color: #4ade80;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
.editor-queue-download:hover {
    background: #4ade8044;
}

/* Editor renders list (sidebar) */
.editor-renders-list {
    max-height: 220px;
    overflow-y: auto;
}
.editor-render-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #1a1a3a;
}
.editor-render-item-icon {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}
.editor-render-item-icon.rendering {
    background: #fbbf2422;
    color: #fbbf24;
    animation: editorPulse 1s ease-in-out infinite;
}
.editor-render-item-icon.done {
    background: #4ade8022;
    color: #4ade80;
}
.editor-render-item-icon.error {
    background: #ff6b6b22;
    color: #ff6b6b;
}
.editor-render-item-icon.cancelled {
    background: #fbbf2422;
    color: #fbbf24;
}
.editor-render-item-info {
    flex: 1;
    min-width: 0;
}
.editor-render-item-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.editor-render-item-meta {
    font-size: 9px;
    color: #555;
    display: flex;
    gap: 5px;
    align-items: center;
}
.editor-render-item-actions {
    flex-shrink: 0;
}
.editor-render-download-sm {
    padding: 3px 8px;
    background: #4ade8022;
    border: 1px solid #4ade80;
    border-radius: 4px;
    color: #4ade80;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.editor-render-download-sm:hover {
    background: #4ade8044;
}

/* Editor history */
.editor-history-list {
    max-height: 200px;
    overflow-y: auto;
}
.editor-history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #1a1a3a;
    transition: background 0.15s;
}
.editor-history-item:hover {
    background: rgba(255,107,107,0.08);
}
.editor-history-item.active {
    background: rgba(255,107,107,0.15);
    border-left: 3px solid #ff6b6b;
}
.editor-history-item.expired {
    opacity: 0.4;
}
.editor-history-info {
    flex: 1;
    min-width: 0;
}
.editor-history-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.editor-history-meta {
    font-size: 10px;
    color: #666;
    display: flex;
    gap: 6px;
}
.editor-history-badge {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 3px;
    background: #1a1a3e;
    color: #a0a0ff;
    font-weight: 600;
}
.editor-history-delete {
    opacity: 0;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
}
.editor-history-item:hover .editor-history-delete {
    opacity: 1;
}
.editor-history-delete:hover {
    color: #ff6b6b;
}

/* ── Preparing List (sidebar) ── */
.editor-preparing-item {
    border-bottom: 1px solid #1a1a3a;
    transition: background 0.15s;
}
.editor-preparing-item.prep-active {
    border-left: 3px solid #fbbf24;
    background: rgba(251,191,36,0.05);
}
.editor-preparing-item.prep-done {
    border-left: 3px solid #4ade80;
    background: rgba(74,222,128,0.08);
}
.editor-preparing-item.prep-done .editor-preparing-header:hover {
    background: rgba(74,222,128,0.15);
}
.editor-preparing-item.prep-error {
    border-left: 3px solid #ff6b6b;
    background: rgba(255,107,107,0.05);
}
.editor-preparing-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    user-select: none;
}
.editor-preparing-header:hover {
    background: rgba(255,255,255,0.03);
}
.editor-preparing-arrow {
    font-size: 9px;
    color: #888;
    width: 10px;
    flex-shrink: 0;
    transition: transform 0.15s;
}
.editor-preparing-item.expanded .editor-preparing-arrow {
    color: #ccc;
}
.editor-preparing-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.editor-preparing-status {
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.2px;
}
.prep-active .editor-preparing-status {
    color: #fbbf24;
    background: rgba(251,191,36,0.12);
}
.prep-done .editor-preparing-status {
    color: #4ade80;
    background: rgba(74,222,128,0.12);
}
.prep-error .editor-preparing-status {
    color: #ff6b6b;
    background: rgba(255,107,107,0.12);
}
.editor-preparing-cancel {
    opacity: 0;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    flex-shrink: 0;
    transition: opacity 0.15s, color 0.15s;
}
.editor-preparing-item:hover .editor-preparing-cancel {
    opacity: 1;
}
.editor-preparing-cancel:hover {
    color: #ff6b6b;
}
.editor-preparing-body {
    padding: 4px 12px 10px 22px;
    border-top: 1px solid rgba(255,255,255,0.04);
}
.editor-preparing-item .editor-steps {
    font-size: 10px;
}
.editor-preparing-item .editor-step {
    padding: 2px 0;
}

/* ── Novo Hook Button (sidebar) ── */
.editor-new-hook-btn {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(245,158,11,0.15));
    border: 1px solid rgba(139,92,246,0.4);
    border-radius: 10px;
    color: #c4b5fd;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.3px;
}
.editor-new-hook-btn:hover {
    background: linear-gradient(135deg, rgba(139,92,246,0.35), rgba(245,158,11,0.25));
    border-color: #8b5cf6;
    color: #e0d4ff;
    transform: translateY(-1px);
}

/* ── New Hook Modal ── */
/* ── Confirm Modal (generic) — used by cancel prepare ── */
.confirm-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    /* Above .canvas-panel.canvas-fullscreen (z-index 9999) */
    z-index: 10010;
}
.confirm-modal.hidden { display: none; }
.confirm-modal-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
}
.confirm-modal-container {
    position: absolute;
    width: 320px;
    background: #0d0d1a;
    border: 1px solid rgba(255,107,107,0.3);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,107,107,0.08);
    animation: confirmModalIn 0.15s ease-out;
}
@keyframes confirmModalIn {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}
.confirm-modal-header {
    padding: 18px 22px 10px;
}
.confirm-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #ff6b6b;
    letter-spacing: 0.3px;
}
.confirm-modal-body {
    padding: 0 22px 18px;
}
.confirm-modal-body p {
    margin: 0;
    font-size: 13px;
    color: #b8b8c8;
    line-height: 1.5;
}
.confirm-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
}
.confirm-btn-secondary,
.confirm-btn-danger {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.2px;
}
.confirm-btn-secondary {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    color: #c0c0d0;
}
.confirm-btn-secondary:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.25);
    color: #fff;
}
.confirm-btn-danger {
    background: linear-gradient(135deg, #ff6b6b, #ff4757);
    border: none;
    color: #fff;
}
.confirm-btn-danger:hover {
    background: linear-gradient(135deg, #ff7a7a, #ff5366);
    box-shadow: 0 4px 16px rgba(255,107,107,0.35);
}

.new-hook-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    /* Above .canvas-panel.canvas-fullscreen (z-index 9999) */
    z-index: 10010;
    display: flex;
    align-items: center;
    justify-content: center;
}
.new-hook-modal.hidden { display: none; }
.new-hook-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.75);
}
.new-hook-container {
    position: relative;
    width: 90vw;
    max-width: 900px;
    max-height: 88vh;
    background: #0d0d1a;
    border: 1px solid rgba(139,92,246,0.3);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(139,92,246,0.1);
}
.new-hook-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.new-hook-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #e0e0e0;
    letter-spacing: 0.3px;
}
.new-hook-close {
    background: none;
    border: none;
    color: #666;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
}
.new-hook-close:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
}
.new-hook-body {
    display: flex;
    gap: 24px;
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.new-hook-left {
    flex: 0 0 340px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.new-hook-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}
.new-hook-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.new-hook-label {
    font-size: 10px;
    font-weight: 700;
    color: #f59e0b;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* Style cards for composition */
.new-hook-styles {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}
.new-hook-style-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    color: #888;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}
.new-hook-style-btn:hover {
    border-color: rgba(139,92,246,0.5);
    color: #c4b5fd;
    background: rgba(139,92,246,0.06);
}
.new-hook-style-btn.active {
    border-color: #8b5cf6;
    color: #e0d4ff;
    background: rgba(139,92,246,0.15);
    font-weight: 600;
}
.new-hook-style-btn .style-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}
.new-hook-style-btn .style-name {
    font-size: 12px;
}

/* Mood selector in Novo Hook popup */
.new-hook-mood-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.new-hook-mood-btn {
    padding: 5px 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid #2a2a4a;
    border-radius: 14px;
    color: #888;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}
.new-hook-mood-btn:hover {
    border-color: rgba(46,204,113,0.5);
    color: #a0e8c0;
    background: rgba(46,204,113,0.06);
}
.new-hook-mood-btn.active {
    border-color: #2ecc71;
    color: #e0ffe8;
    background: rgba(46,204,113,0.15);
    font-weight: 600;
}
.new-hook-mood-trends {
    border-color: rgba(245,158,11,0.3);
    color: #f59e0b;
}
.new-hook-mood-trends:hover {
    border-color: rgba(245,158,11,0.6) !important;
    color: #fbbf24 !important;
    background: rgba(245,158,11,0.08) !important;
}
.new-hook-mood-trends.active {
    border-color: #f59e0b !important;
    color: #fef3c7 !important;
    background: rgba(245,158,11,0.18) !important;
}
.new-hook-mood-uploads {
    border-color: rgba(78,168,255,0.3);
    color: #7aa8e0;
}
.new-hook-mood-uploads:hover {
    border-color: rgba(78,168,255,0.6) !important;
    color: #4ea8ff !important;
    background: rgba(78,168,255,0.08) !important;
}
.new-hook-mood-uploads.active {
    border-color: #4ea8ff !important;
    color: #e8f3ff !important;
    background: rgba(78,168,255,0.18) !important;
}
.new-hook-mood-upload-btn {
    border-color: rgba(46,204,113,0.4);
    color: #2ecc71;
    margin-left: 4px;
}
.new-hook-mood-upload-btn:hover {
    border-color: #2ecc71 !important;
    color: #0f0f1e !important;
    background: #2ecc71 !important;
}
.new-hook-mood-upload-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

/* Upload item actions (rename / delete) */
.new-hook-music-item {
    position: relative;
}
.new-hook-music-upload-actions {
    display: flex;
    gap: 2px;
    margin-left: 6px;
    opacity: 0.5;
    transition: opacity 0.12s;
    align-self: flex-start;
}
.new-hook-music-item:hover .new-hook-music-upload-actions {
    opacity: 1;
}
.new-hook-music-rename,
.new-hook-music-delete {
    background: none;
    border: none;
    color: #888;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.new-hook-music-rename:hover {
    background: rgba(78,168,255,0.15);
    color: #4ea8ff;
}
.new-hook-music-delete:hover {
    background: rgba(255,107,107,0.15);
    color: #ff6b6b;
}
/* Delete confirmation state */
.new-hook-music-upload-actions.confirming {
    opacity: 1 !important;
    background: rgba(255,107,107,0.08);
    border: 1px solid rgba(255,107,107,0.5);
    border-radius: 4px;
    padding: 2px 6px;
    gap: 6px;
    animation: confirm-pulse 1.2s ease-in-out infinite;
}
/* Hide rename while confirming delete — prevents misclick */
.new-hook-music-upload-actions.confirming .new-hook-music-rename {
    display: none;
}
.new-hook-music-confirm-label {
    font-size: 11px;
    font-weight: 600;
    color: #ff8585;
    align-self: center;
    white-space: nowrap;
    letter-spacing: 0.2px;
}
.new-hook-music-upload-actions.confirming .new-hook-music-delete {
    color: #ff6b6b !important;
    font-weight: 700;
    font-size: 15px;
}
.new-hook-music-upload-actions.confirming .new-hook-music-delete:hover {
    background: #ff6b6b !important;
    color: #fff !important;
}
@keyframes confirm-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,107,107,0.25); }
    50% { box-shadow: 0 0 0 3px rgba(255,107,107,0); }
}

/* Inline rename input */
.new-hook-music-title-edit {
    background: rgba(78,168,255,0.08);
    border: 1px solid #4ea8ff;
    color: #e8f3ff;
    font-size: 13px;
    font-family: inherit;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    outline: none;
    min-width: 140px;
    max-width: 100%;
}
.new-hook-music-title-edit:focus {
    box-shadow: 0 0 0 2px rgba(78,168,255,0.2);
}

/* Music panel in Novo Hook popup */
.new-hook-music-panel {
    margin-top: 8px;
}
.new-hook-music-search {
    width: 100%;
    padding: 7px 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    color: #ccc;
    font-size: 12px;
    font-family: inherit;
    margin-bottom: 6px;
    outline: none;
    transition: border-color 0.15s;
}
.new-hook-music-search:focus {
    border-color: rgba(46,204,113,0.5);
}
.new-hook-music-search::placeholder {
    color: #555;
}
.new-hook-music-list {
    max-height: 380px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.new-hook-music-list::-webkit-scrollbar {
    width: 4px;
}
.new-hook-music-list::-webkit-scrollbar-thumb {
    background: #2a2a4a;
    border-radius: 2px;
}
.new-hook-music-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(255,255,255,0.02);
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.12s;
}
.new-hook-music-item:hover {
    background: rgba(46,204,113,0.06);
    border-color: rgba(46,204,113,0.2);
}
.new-hook-music-item.selected {
    background: rgba(46,204,113,0.12);
    border-color: #2ecc71;
}
.new-hook-music-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.new-hook-music-item-title {
    font-size: 12px;
    color: #ddd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.new-hook-music-item-meta {
    font-size: 10px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.new-hook-music-fav {
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #444;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
    transition: color 0.15s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.new-hook-music-fav:hover {
    color: #f59e0b;
    transform: scale(1.2);
}
.new-hook-music-fav.favorited {
    color: #f59e0b;
}
/* Trend indicators */
.music-trend {
    font-size: 9px;
    margin-right: 2px;
    vertical-align: middle;
}
.music-trend-up {
    color: #2ecc71;
}
.music-trend-stable {
    color: #888;
    font-size: 7px;
}
.music-trend-hot {
    color: #f59e0b;
    font-size: 8px;
    letter-spacing: -2px;
}
.music-trend-down {
    color: #e74c3c;
}
.music-mood-badge {
    display: inline-block;
    background: rgba(255,255,255,0.06);
    color: #888;
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
    text-transform: capitalize;
}
.music-rank {
    display: inline-block;
    background: rgba(139,92,246,0.25);
    color: #c4b5fd;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: middle;
}
/* Play button */
.new-hook-music-play {
    width: 24px;
    height: 24px;
    background: rgba(46,204,113,0.1);
    border: 1px solid rgba(46,204,113,0.3);
    border-radius: 50%;
    cursor: pointer;
    font-size: 10px;
    color: #2ecc71;
    flex-shrink: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.new-hook-music-play:hover {
    background: rgba(46,204,113,0.2);
    border-color: #2ecc71;
    transform: scale(1.1);
}
.new-hook-music-play.playing {
    background: rgba(46,204,113,0.2);
    border-color: #2ecc71;
    font-size: 8px;
    letter-spacing: 1px;
}
/* Waveform row */
.new-hook-music-wave-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}
.new-hook-music-wave {
    flex: 1;
    height: 32px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
}
.new-hook-music-time {
    font-size: 9px;
    color: #666;
    white-space: nowrap;
    min-width: 60px;
    text-align: right;
}
.new-hook-music-item-desc {
    font-size: 10px;
    color: #555;
    line-height: 1.3;
    margin-top: 1px;
}
.new-hook-music-more-btn {
    width: 100%;
    padding: 8px;
    background: rgba(255,255,255,0.03);
    border: 1px dashed #2a2a4a;
    border-radius: 6px;
    color: #888;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    margin-top: 2px;
}
.new-hook-music-more-btn:hover {
    border-color: rgba(46,204,113,0.4);
    color: #2ecc71;
    background: rgba(46,204,113,0.05);
}
.new-hook-music-loading {
    padding: 12px;
    text-align: center;
    color: #666;
    font-size: 11px;
}
.new-hook-music-empty {
    padding: 12px;
    text-align: center;
    color: #555;
    font-size: 11px;
    font-style: italic;
}

/* Hook picker button in popup */
.new-hook-pick-btn {
    width: 100%;
    padding: 10px 14px;
    background: rgba(245,158,11,0.08);
    border: 1px dashed rgba(245,158,11,0.4);
    border-radius: 8px;
    color: #f59e0b;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}
.new-hook-pick-btn:hover {
    background: rgba(245,158,11,0.15);
    border-style: solid;
}

/* Video tabs in popup */
.new-hook-video-tabs {
    display: flex;
    gap: 4px;
    background: rgba(255,255,255,0.03);
    padding: 3px;
    border-radius: 8px;
}
.new-hook-vtab {
    flex: 1;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #666;
    cursor: pointer;
    transition: all 0.15s;
}
.new-hook-vtab:hover {
    color: #aaa;
    background: rgba(255,255,255,0.04);
}
.new-hook-vtab.active {
    background: rgba(139,92,246,0.15);
    border-color: rgba(139,92,246,0.4);
    color: #c4b5fd;
}
.new-hook-video-panels {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* IA Match results — larger popup format */
.match-results-popup {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    max-height: none;
    overflow-y: visible;
}
.match-results-popup .match-card {
    padding: 14px 16px;
    background: rgba(139,92,246,0.05);
    border: 1px solid rgba(139,92,246,0.15);
    border-radius: 10px;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.match-results-popup .match-card:hover {
    border-color: rgba(139,92,246,0.45);
    background: rgba(139,92,246,0.08);
}
.match-results-popup .match-card.selected {
    border-color: #22c55e;
    background: rgba(34,197,94,0.08);
    box-shadow: 0 0 0 1px rgba(34,197,94,0.2);
}
.match-results-popup .match-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}
.match-results-popup .match-rank {
    font-size: 14px;
    font-weight: 700;
    color: #8b5cf6;
}
.match-results-popup .match-sim {
    font-size: 13px;
    font-weight: 700;
    color: #22c55e;
    padding: 2px 8px;
    background: rgba(34,197,94,0.12);
    border-radius: 6px;
}
.match-results-popup .match-card-body {
    display: flex;
    gap: 14px;
}
.match-results-popup .match-thumb {
    flex: 0 0 120px;
    height: 180px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.match-results-popup .match-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.match-results-popup .match-thumb-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #555;
    font-size: 11px;
}
.match-results-popup .match-thumb-placeholder .thumb-score {
    font-size: 28px;
    font-weight: 700;
    color: #8b5cf6;
    line-height: 1;
}
.match-results-popup .match-thumb-play {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    backdrop-filter: blur(4px);
}
.match-results-popup .match-thumb-play:hover {
    background: rgba(139,92,246,0.7);
    transform: scale(1.1);
}
.match-results-popup .match-thumb-play.playing {
    background: rgba(139,92,246,0.5);
}
.match-results-popup .match-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.match-results-popup .match-card-desc {
    font-size: 12px;
    color: #ccc;
    line-height: 1.45;
    margin-bottom: 2px;
}
.match-results-popup .match-card-visual {
    font-size: 11px;
    color: #999;
    line-height: 1.4;
    font-style: italic;
}
.match-results-popup .match-card-ts {
    font-size: 11px;
    color: #888;
}
.match-results-popup .match-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.match-results-popup .match-tag {
    font-size: 10px;
    padding: 2px 8px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    color: #888;
}
.match-results-popup .match-tag.uso {
    background: rgba(245,158,11,0.12);
    color: #f59e0b;
    font-weight: 600;
}
.match-results-popup .match-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}
.match-results-popup .match-select-btn {
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid #8b5cf6;
    border-radius: 6px;
    background: transparent;
    color: #8b5cf6;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.match-results-popup .match-select-btn:hover {
    background: rgba(139,92,246,0.2);
}
.match-results-popup .match-video-link {
    font-size: 12px;
    font-weight: 600;
    color: #60a5fa;
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid rgba(96,165,250,0.3);
    border-radius: 6px;
    transition: all 0.15s;
}
.match-results-popup .match-video-link:hover {
    background: rgba(96,165,250,0.12);
    border-color: #60a5fa;
}

/* Footer */
.new-hook-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 24px;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: rgba(0,0,0,0.2);
}
.new-hook-footer .editor-progress {
    width: 100%;
    max-height: 120px;
    overflow-y: auto;
}
.new-hook-footer .editor-progress::-webkit-scrollbar {
    width: 3px;
}
.new-hook-footer .editor-progress::-webkit-scrollbar-thumb {
    background: #2a2a4a;
    border-radius: 2px;
}
.new-hook-footer .editor-progress:empty {
    display: none;
}
.new-hook-footer .editor-prepare-btn {
    align-self: flex-end;
    min-width: 200px;
}

/* Responsive */
@media (max-width: 768px) {
    .new-hook-container { width: 96vw; max-height: 94vh; }
    .new-hook-body { flex-direction: column; }
    .new-hook-left { flex: none; }
}

/* ───────────────────────────────────────────────────────────────────────── */
/*  Enriquecimento de Direcao Visual — Modal de Revisao                      */
/* ───────────────────────────────────────────────────────────────────────── */

/* Botoes de gatilho — variantes pra grid view e table view */

/* Per-block trigger: discrete icon button (matches cb-delete style) */
.cb-enrich {
    background: none;
    border: none;
    color: #888;
    font-size: 14px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s, transform 0.1s;
}
.cb-enrich:hover {
    color: #b48eff;
    transform: scale(1.1);
}
/* In grid view, give it a hint of border so it stands apart */
.cb-header .cb-enrich {
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 26px; height: 26px;
    display: inline-flex; align-items: center; justify-content: center;
    margin-right: 4px;
}
.cb-header .cb-enrich:hover {
    background: rgba(180, 142, 255, 0.12);
    border-color: #b48eff;
}

/* Global "enrich all" button — strong purple in grid header, ghost in table header */
.cb-enrich-all-btn {
    background: linear-gradient(135deg, #6e3aff 0%, #b48eff 100%);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px;
    margin-right: 8px;
    transition: opacity .15s, transform .1s;
}
.cb-enrich-all-btn:hover { opacity: .92; transform: translateY(-1px); }
.cb-enrich-icon { font-size: 13px; }

/* Inline ghost variant when inside a table header <th> */
.ct-col-visual .cb-enrich-all-btn,
.cb-enrich-all-btn.ct-enrich-all {
    background: none;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 3px 8px;
    margin-right: 0;
    margin-left: 6px;
    font-weight: 500;
    font-size: 11px;
    vertical-align: middle;
}
.ct-col-visual .cb-enrich-all-btn:hover,
.cb-enrich-all-btn.ct-enrich-all:hover {
    background: rgba(180, 142, 255, 0.12);
    color: #b48eff;
    border-color: #b48eff;
    opacity: 1;
    transform: none;
}

/* Overlay + container */
.enrich-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    backdrop-filter: blur(2px);
}
.enrich-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: min(960px, 100%);
    max-height: 90vh;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* Header */
.enrich-modal-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border);
    position: relative;
}
.enrich-modal-header h2 {
    font-size: 16px; font-weight: 600;
    color: var(--text-primary);
    display: flex; align-items: center; gap: 8px;
}
.enrich-modal-header h2 .cb-enrich-icon { color: #b48eff; }
.enrich-modal-subtitle {
    font-size: 12px; color: var(--text-muted);
    margin-top: 4px;
    display: flex; gap: 12px; align-items: center;
}
.enrich-modal-blocks-count {
    background: var(--bg-input);
    padding: 2px 8px; border-radius: 10px;
    font-size: 11px;
}
.enrich-modal-close {
    position: absolute; top: 12px; right: 12px;
    background: transparent; border: none;
    color: var(--text-muted);
    width: 28px; height: 28px;
    border-radius: 6px;
    font-size: 20px; line-height: 1;
    cursor: pointer;
}
.enrich-modal-close:hover { background: var(--bg-input); color: var(--text-primary); }

/* Body */
.enrich-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}
.enrich-empty {
    padding: 32px; text-align: center; color: var(--text-muted);
}

/* Block section */
.enrich-block-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--border-secondary);
}
.enrich-block-section:last-child { border-bottom: none; }
.enrich-block-title {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap;
}
.enrich-block-title strong {
    color: var(--text-primary); font-size: 13px;
}
.enrich-block-counts {
    margin-left: auto; font-size: 11px; color: var(--text-muted);
}
.enrich-block-counts strong { color: #b48eff; }
.enrich-stub-badge {
    background: rgba(255, 165, 0, 0.15);
    color: #ffa500;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}
.enrich-fallback-pill {
    display: inline-block;
    background: rgba(255, 200, 60, 0.12);
    color: #ffd166;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    margin-bottom: 4px;
    border: 1px solid rgba(255, 200, 60, 0.3);
}
.enrich-block-loading .enrich-spinner {
    color: var(--text-muted);
    font-style: italic;
}
.enrich-partial-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(139, 92, 246, 0.12);
    color: #b48eff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    margin-left: 8px;
}
.enrich-partial-badge .enrich-spinner {
    width: 8px; height: 8px;
    border: 2px solid rgba(180, 142, 255, 0.3);
    border-top-color: #b48eff;
    border-radius: 50%;
    display: inline-block;
    animation: enrich-spin 0.8s linear infinite;
}
.enrich-pending-msg {
    color: #b48eff;
    font-style: italic;
    display: flex; align-items: center; gap: 6px;
}
.enrich-pending-msg .enrich-spinner {
    width: 10px; height: 10px;
    border: 2px solid rgba(180, 142, 255, 0.3);
    border-top-color: #b48eff;
    border-radius: 50%;
    display: inline-block;
    animation: enrich-spin 0.8s linear infinite;
}
@keyframes enrich-spin {
    to { transform: rotate(360deg); }
}
.enrich-block-error-msg {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    color: #ff7066;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
}

/* Row */
.enrich-row {
    display: grid;
    grid-template-columns: 32px 1fr 1.4fr;
    gap: 12px;
    padding: 10px 8px;
    border-radius: 8px;
    border: 1px solid transparent;
    margin-bottom: 6px;
    align-items: start;
}
.enrich-row-approved {
    background: rgba(180, 142, 255, 0.06);
    border-color: rgba(180, 142, 255, 0.2);
}
.enrich-row-skipped {
    opacity: 0.65;
}
/* Insert ja ancorado — full opacity (clicavel pra editar) e badge */
.enrich-row-skipped:has(.enrich-existing-insert) {
    opacity: 1;
}
.enrich-existing-insert {
    cursor: pointer;
}
.enrich-existing-insert:hover .enrich-asset-card {
    border-color: rgba(124, 92, 255, 0.55);
    background: rgba(124, 92, 255, 0.07);
}
.enrich-existing-badge {
    display: inline-block;
    font-size: 11px;
    color: #c9b9ff;
    background: rgba(124, 92, 255, 0.15);
    border: 1px solid rgba(124, 92, 255, 0.4);
    padding: 2px 8px;
    border-radius: 999px;
    margin-bottom: 6px;
}
.enrich-existing-edit {
    margin-top: 8px;
    background: rgba(124, 92, 255, 0.18);
    border: 1px solid rgba(124, 92, 255, 0.5);
    color: #d3c5ff;
    padding: 5px 11px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}
.enrich-existing-edit:hover {
    background: rgba(124, 92, 255, 0.32);
}
.enrich-row-check {
    display: flex; justify-content: center; padding-top: 4px;
}
.enrich-row-checkbox {
    width: 16px; height: 16px;
    accent-color: #b48eff;
    cursor: pointer;
}
.enrich-row-skip-icon {
    color: var(--text-dim);
    font-size: 14px;
}

.enrich-row-phrase-text {
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.4;
    font-style: italic;
}
.enrich-row-trigger {
    margin-top: 6px;
    display: flex; gap: 6px; align-items: center;
}
.enrich-trigger-pill {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    background: var(--bg-input);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.enrich-trigger-valor_financeiro { background: rgba(46, 204, 113, 0.18); color: #2ecc71; }
.enrich-trigger-aplicacao_tecnica { background: rgba(52, 152, 219, 0.18); color: #3498db; }
.enrich-trigger-teoria_anatomica { background: rgba(155, 89, 182, 0.18); color: #9b59b6; }
.enrich-trigger-produto_citado { background: rgba(241, 196, 15, 0.18); color: #f1c40f; }
.enrich-trigger-complicacao_efeito { background: rgba(231, 76, 60, 0.18); color: #e74c3c; }
.enrich-trigger-prova_social { background: rgba(180, 142, 255, 0.18); color: #b48eff; }
.enrich-trigger-transformacao { background: rgba(230, 126, 34, 0.18); color: #e67e22; }
.enrich-trigger-autoridade { background: rgba(149, 165, 166, 0.18); color: #95a5a6; }
.enrich-trigger-intensity {
    font-size: 10px; color: var(--text-muted);
}

/* Proposal column */
.enrich-asset-card {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
}
.enrich-asset-thumb {
    width: 64px; height: 64px;
    background: var(--bg-primary);
    border-radius: 6px;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.enrich-asset-thumb img { width: 100%; height: 100%; object-fit: cover; }
.enrich-asset-thumb-placeholder {
    font-size: 9px;
    color: var(--text-dim);
    text-align: center;
    padding: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.enrich-asset-info {
    min-width: 0;
}
.enrich-asset-desc {
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.35;
    margin-bottom: 4px;
}
.enrich-asset-meta {
    display: flex; flex-wrap: wrap; gap: 6px;
    font-size: 10px;
    color: var(--text-muted);
}
.enrich-asset-meta span {
    background: var(--bg-primary);
    padding: 1px 6px;
    border-radius: 4px;
}
.enrich-asset-sim { color: #b48eff !important; font-weight: 600; }

.enrich-alt-toggle {
    margin-top: 6px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
}
.enrich-alt-toggle:hover { border-color: #b48eff; color: #b48eff; }

.enrich-row-reason {
    margin-top: 6px;
    font-size: 11px;
}
.enrich-row-reason summary {
    cursor: pointer;
    color: var(--text-muted);
    user-select: none;
}
.enrich-row-reason summary:hover { color: var(--text-secondary); }
.enrich-reason-text {
    margin-top: 4px;
    color: var(--text-secondary);
    background: var(--bg-input);
    padding: 6px 8px;
    border-radius: 4px;
    font-style: italic;
}
.enrich-reason-hyde {
    margin-top: 4px;
    color: var(--text-muted);
    font-family: monospace;
    font-size: 10px;
}

.enrich-skip-msg {
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
}
.enrich-skip-detail {
    color: var(--text-dim);
    font-size: 10px;
    margin-top: 2px;
}

/* Alt picker popover */
.enrich-alt-picker {
    position: fixed;
    z-index: 10001;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    padding: 8px;
    width: 360px;
    max-height: 320px;
    overflow-y: auto;
}
.enrich-alt-picker-title {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 6px 8px;
}
.enrich-alt-item {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 8px;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
}
.enrich-alt-item:hover { background: var(--bg-input); }
.enrich-alt-thumb {
    width: 48px; height: 48px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-primary);
}
.enrich-alt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.enrich-alt-thumb-placeholder { width: 100%; height: 100%; background: var(--border-secondary); }
.enrich-alt-label {
    font-size: 11px; font-weight: 600;
    color: #b48eff;
}
.enrich-alt-desc {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.3;
    margin-top: 2px;
}

/* Footer */
.enrich-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
}
.enrich-modal-stats {
    font-size: 11px; color: var(--text-muted);
}
.enrich-modal-actions {
    display: flex; gap: 8px;
}
.enrich-cancel {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}
.enrich-cancel:hover { border-color: var(--text-secondary); }
.enrich-apply {
    background: linear-gradient(135deg, #6e3aff 0%, #b48eff 100%);
    color: #fff;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}
.enrich-apply:disabled {
    background: var(--bg-input);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Mobile */
@media (max-width: 768px) {
    .enrich-modal { width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
    .enrich-row { grid-template-columns: 28px 1fr; }
    .enrich-row-proposal { grid-column: 1 / -1; }
}

/* Rerank rejection diagnostics in enrich modal */
.enrich-rerank-reason {
    margin-top: 6px;
    padding: 6px 8px;
    background: rgba(231, 76, 60, 0.08);
    border-left: 2px solid rgba(231, 76, 60, 0.5);
    border-radius: 0 4px 4px 0;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}
.enrich-rerank-reason strong { color: #e74c3c; }
.enrich-top-cands {
    margin-top: 8px;
    font-size: 11px;
}
.enrich-top-cands summary {
    cursor: pointer;
    color: var(--text-muted);
    user-select: none;
    padding: 4px 0;
}
.enrich-top-cands summary:hover { color: #b48eff; }
.enrich-top-cands[open] summary { color: #b48eff; }
.enrich-top-cand-item {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 8px;
    padding: 6px;
    border-radius: 6px;
    margin-top: 4px;
    background: var(--bg-input);
}
.enrich-top-cand-thumb {
    width: 56px; height: 56px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-primary);
}
.enrich-top-cand-thumb img { width: 100%; height: 100%; object-fit: cover; }
.enrich-top-cand-thumb-placeholder { width: 100%; height: 100%; background: var(--border-secondary); }
.enrich-top-cand-info { min-width: 0; }
.enrich-top-cand-desc {
    color: var(--text-primary);
    font-size: 11px;
    line-height: 1.3;
    margin-bottom: 4px;
}
.enrich-top-cand-meta {
    display: flex; gap: 6px; flex-wrap: wrap;
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.enrich-top-cand-meta span {
    background: var(--bg-primary);
    padding: 1px 5px;
    border-radius: 3px;
}
.enrich-accept-anyway {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 2px;
}
.enrich-accept-anyway:hover {
    background: rgba(180, 142, 255, 0.12);
    color: #b48eff;
    border-color: #b48eff;
}

/* Nanobanana fallback area */
.enrich-fallback-actions {
    margin-top: 8px;
    display: flex; gap: 6px;
}
.enrich-gen-btn {
    background: linear-gradient(135deg, #6e3aff 0%, #b48eff 100%);
    color: #fff;
    border: none;
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex; align-items: center; gap: 4px;
}
.enrich-gen-btn:hover { opacity: 0.92; transform: translateY(-1px); }
.enrich-gen-area {
    margin-top: 8px;
}
.enrich-gen-loading {
    padding: 12px;
    background: var(--bg-input);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 11px;
    font-style: italic;
}
.enrich-gen-error {
    padding: 8px 12px;
    background: rgba(231, 76, 60, 0.1);
    border-left: 2px solid #e74c3c;
    border-radius: 0 4px 4px 0;
    color: #e74c3c;
    font-size: 11px;
}
.enrich-gen-box {
    padding: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.enrich-gen-label {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}
.enrich-gen-prompt {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-family: inherit;
    line-height: 1.4;
    resize: vertical;
}
.enrich-gen-notes {
    margin-top: 4px;
    font-size: 10px;
    color: var(--text-muted);
    font-style: italic;
}
.enrich-gen-actions {
    margin-top: 8px;
    display: flex; gap: 6px; justify-content: flex-end;
}
.enrich-gen-actions button {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
}
.enrich-gen-actions button:hover { border-color: #b48eff; color: #b48eff; }
.enrich-gen-actions .enrich-gen-go {
    background: linear-gradient(135deg, #6e3aff 0%, #b48eff 100%);
    color: #fff;
    border: none;
    font-weight: 600;
}
.enrich-gen-actions .enrich-gen-go:hover { color: #fff; opacity: 0.92; }
.enrich-gen-actions .enrich-gen-go:disabled {
    background: var(--bg-input);
    color: var(--text-muted);
    cursor: not-allowed;
}
.enrich-gen-result {
    margin-top: 10px;
}
.enrich-gen-image img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 6px;
    display: block;
}
.enrich-gen-images {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.enrich-gen-images.multi .enrich-gen-image-card {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
}
.enrich-gen-image-card {
    position: relative;
    border-radius: 6px;
    border: 2px solid transparent;
    overflow: hidden;
    cursor: default;
    transition: border-color 0.15s, transform 0.15s;
}
.enrich-gen-images.multi .enrich-gen-image-card {
    cursor: pointer;
}
.enrich-gen-images.multi .enrich-gen-image-card:hover {
    border-color: rgba(180, 142, 255, 0.5);
}
.enrich-gen-image-card.selected {
    border-color: #b48eff;
    box-shadow: 0 0 0 1px #b48eff inset;
}
.enrich-gen-image-card img {
    max-width: 100%;
    width: 100%;
    max-height: 360px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}
.enrich-gen-image-badge {
    position: absolute;
    bottom: 6px; left: 6px; right: 6px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 3px;
    text-align: center;
    font-weight: 500;
    pointer-events: none;
}
.enrich-gen-image-card.selected .enrich-gen-image-badge {
    background: linear-gradient(135deg, #6e3aff 0%, #b48eff 100%);
}
.enrich-gen-count, .regen-count {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
}
.enrich-gen-count:hover, .regen-count:hover {
    border-color: #b48eff;
}
.enrich-gen-image-actions {
    margin-top: 6px;
    display: flex; gap: 6px;
}
.enrich-gen-accept {
    background: linear-gradient(135deg, #6e3aff 0%, #b48eff 100%);
    color: #fff;
    border: none;
    padding: 5px 14px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}
.enrich-gen-accept:hover { opacity: 0.92; }

/* Regerar insert: painel maior + AI badge no popover normal */
.insert-pop-aigen-badge {
    background: linear-gradient(135deg, #6e3aff 0%, #b48eff 100%);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    vertical-align: middle;
}
.insert-popover-regen {
    background: linear-gradient(135deg, #6e3aff 0%, #b48eff 100%);
    color: #fff;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    margin-right: auto;
}
.insert-popover-regen:hover { opacity: 0.92; }
.insert-popover-animate {
    background: linear-gradient(135deg, #ff5e5e 0%, #ffae5e 100%);
    color: #fff;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}
.insert-popover-animate:hover { opacity: 0.92; }
.animate-insert-panel .animate-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-top: 10px;
    margin-bottom: 4px;
}
.animate-insert-panel .animate-model-select,
.animate-insert-panel .animate-duration-select,
.animate-insert-panel .animate-motion-prompt {
    width: 100%;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 13px;
    box-sizing: border-box;
}
.animate-insert-panel .animate-motion-prompt {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    resize: vertical;
}
.animate-insert-panel .animate-cost {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}
.animate-insert-panel .animate-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
    align-items: center;
}
.animate-insert-panel .animate-go-btn,
.animate-insert-panel .animate-regen-btn {
    background: linear-gradient(135deg, #ff5e5e 0%, #ffae5e 100%);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}
.animate-insert-panel .animate-cancel-btn,
.animate-insert-panel .animate-close-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
}
.animate-insert-panel .animate-video-wrap {
    margin: 10px 0;
    display: flex;
    justify-content: center;
}
.animate-insert-panel .animate-video-wrap video {
    width: 240px;
    aspect-ratio: 9 / 16;
    background: #000;
    border-radius: 8px;
}
.animate-insert-panel .animate-meta {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 6px;
}
.animate-insert-panel .animate-success-note {
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(110, 58, 255, 0.08);
    border: 1px solid rgba(110, 58, 255, 0.25);
    padding: 8px 10px;
    border-radius: 6px;
    margin-top: 10px;
}

/* ── Animate panel: layout 2-col com sidebar de gerações ── */
/* Painel sempre wide desde a abertura — sidebar mostra estado vazio se não
   houver gerações ainda (em vez de empurrar o painel pra fora quando aparece). */
/* Especificidade dupla pra vencer .regen-insert-panel{width:480px} que vem
   depois no CSS — ambos sao base do painel animate (que tem ambas classes). */
.regen-insert-panel.animate-insert-panel {
    width: 1100px;
    max-width: calc(100vw - 48px);
    overflow-x: hidden;
}
.animate-insert-panel .animate-2col {
    display: flex;
    gap: 16px;
    align-items: stretch;
    margin-top: 4px;
    min-width: 0;
}
.animate-insert-panel .animate-form-col {
    flex: 0 1 380px;
    min-width: 0;
}
.animate-insert-panel .animate-source-row {
    display: flex;
    align-items: stretch;
    gap: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 14px;
}
.animate-insert-panel .animate-source-thumb {
    flex: 0 0 56px;
    width: 56px;
    aspect-ratio: 9 / 16;
    background: #0d1117;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.animate-insert-panel .animate-source-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.animate-insert-panel .animate-source-placeholder {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
}
.animate-insert-panel .animate-source-info {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}
.animate-insert-panel .animate-source-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
}
.animate-insert-panel .animate-swap-image {
    align-self: flex-start;
    background: rgba(124, 92, 255, 0.15);
    border: 1px solid rgba(124, 92, 255, 0.4);
    color: #c9b9ff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}
.animate-insert-panel .animate-swap-image:hover {
    background: rgba(124, 92, 255, 0.28);
}
.animate-insert-panel .animate-gens-col {
    flex: 1 1 0;
    border-left: 1px solid var(--border);
    padding-left: 16px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.animate-insert-panel .animate-gens-header {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.animate-insert-panel .animate-gens-count {
    background: rgba(255, 94, 94, 0.15);
    color: #ff8e8e;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
    margin-left: 6px;
}
/* Grid auto-fit — adapta colunas conforme a largura disponível, mantendo cards
   compactos (170-200px) que respeitam aspect ratio 9:16 do vídeo. Em sidebar
   ~700px wide, cabem 3-4 colunas → 6-8 cards visíveis sem scroll. */
.animate-insert-panel .animate-gens-list {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 200px);
    padding-right: 4px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    align-content: start;
}
.animate-insert-panel .animate-gens-empty {
    grid-column: 1 / -1;  /* full width no grid */
}
.animate-insert-panel .animate-gens-empty {
    color: var(--text-muted);
    font-size: 11px;
    font-style: italic;
    padding: 24px 10px;
    text-align: center;
}
.animate-insert-panel .animate-gens-footer {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Generation card ── */
.animate-insert-panel .animate-gen-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: border-color 120ms ease;
}
.animate-insert-panel .animate-gen-card.is-primary {
    border-color: #ffae5e;
    box-shadow: 0 0 0 1px rgba(255, 174, 94, 0.5);
}
.animate-insert-panel .animate-gen-media {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.animate-insert-panel .animate-gen-media video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.animate-insert-panel .animate-gen-failed {
    color: #f85149;
    font-size: 11px;
    text-align: center;
    padding: 12px;
}
.animate-insert-panel .animate-gen-failed small {
    color: var(--text-muted);
    font-size: 10px;
    display: block;
    margin-top: 4px;
}
.animate-insert-panel .animate-gen-loading-card {
    color: var(--text-muted);
    font-size: 11px;
    text-align: center;
}
.animate-insert-panel .animate-gen-spinner {
    width: 24px; height: 24px;
    margin: 0 auto 8px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-top-color: #ff8e8e;
    border-radius: 50%;
    animation: animate-spin 0.9s linear infinite;
}
@keyframes animate-spin { to { transform: rotate(360deg); } }
.animate-insert-panel .animate-gen-elapsed {
    font-size: 11px;
    color: var(--text-secondary);
}
.animate-insert-panel .animate-gen-star-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(255, 174, 94, 0.95);
    color: #1a1a1a;
    font-size: 14px;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.animate-insert-panel .animate-gen-meta {
    font-size: 10px;
    color: var(--text-secondary);
    line-height: 1.3;
}
.animate-insert-panel .animate-gen-model {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 11px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.animate-insert-panel .animate-gen-price {
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 10px;
    margin-top: 1px;
}
.animate-insert-panel .animate-gen-aid {
    /* removido visualmente — info redundante na sidebar compacta. Mantido o
       seletor pra nao quebrar caso ainda renderize. */
    display: none;
}
.animate-insert-panel .animate-gen-prompt {
    color: var(--text-muted);
    font-size: 9px;
    font-style: italic;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.animate-insert-panel .animate-gen-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 2px;
}
.animate-insert-panel .animate-gen-actions button {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 3px 6px;
    font-size: 9px;
    border-radius: 3px;
    cursor: pointer;
    flex: 1 1 auto;
    white-space: nowrap;
}
.animate-insert-panel .animate-gen-actions button:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}
.animate-insert-panel .animate-gen-star {
    background: linear-gradient(135deg, #ffae5e 0%, #ff8e5e 100%) !important;
    border-color: transparent !important;
    color: #1a1a1a !important;
    font-weight: 600;
}
.animate-insert-panel .animate-gen-star:hover { opacity: 0.92; }
.animate-insert-panel .animate-gen-unstar {
    color: #ffae5e !important;
    border-color: rgba(255, 174, 94, 0.5) !important;
}
.animate-insert-panel .animate-gen-delete {
    color: #f85149 !important;
}
.animate-insert-panel .animate-gen-delete:hover {
    border-color: #f85149 !important;
    background: rgba(248, 81, 73, 0.08) !important;
}

.regen-pop-overlay {
    position: fixed;
    inset: 0;
    z-index: 10002;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
    /* permite scroll do overlay quando painel for maior que viewport */
}
.regen-insert-panel {
    position: relative;
    width: 480px;
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    padding: 14px;
    margin: auto;
}
.regen-pop-overlay .regen-insert-panel.wide {
    width: 720px;  /* mais espaco quando 2 imagens lado a lado */
}
.regen-pop-header {
    display: flex; justify-content: space-between; align-items: center;
    color: var(--text-primary);
    font-size: 14px; font-weight: 600;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px; margin-bottom: 8px;
}
.regen-pop-header .cb-enrich-icon { color: #b48eff; }
.regen-pop-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 24px; height: 24px;
    border-radius: 4px;
    font-size: 18px; line-height: 1;
    cursor: pointer;
}
.regen-pop-close:hover { background: var(--bg-input); color: var(--text-primary); }
.regen-pop-phrase {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 10px;
    padding: 6px 8px;
    background: var(--bg-input);
    border-radius: 4px;
}
.regen-pop-body {
    font-size: 12px;
}
.regen-prompt {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px;
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
    line-height: 1.4;
    resize: vertical;
    min-height: 80px;
}
.regen-cancel, .regen-go {
    padding: 5px 12px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
}
.regen-cancel:hover, .regen-go:hover { border-color: #b48eff; color: #b48eff; }
.regen-go {
    background: linear-gradient(135deg, #6e3aff 0%, #b48eff 100%);
    color: #fff;
    border: none;
    font-weight: 600;
}
.regen-go:hover { color: #fff; opacity: 0.92; }
.regen-go:disabled {
    background: var(--bg-input);
    color: var(--text-muted);
    cursor: not-allowed;
}
.regen-accept {
    background: linear-gradient(135deg, #6e3aff 0%, #b48eff 100%);
    color: #fff;
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.regen-accept:hover { opacity: 0.92; }
.regen-accept:disabled {
    background: var(--bg-input);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* AI-Gen popover: layout maior com thumbnail + prompt visiveis */
.insert-popover-aigen {
    width: 380px;
    max-height: 80vh;
    overflow-y: auto;
}
.insert-pop-image-wrap {
    margin: 8px 0;
    background: var(--bg-input);
    border-radius: 6px;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    max-height: 200px;
}
.insert-pop-image {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    display: block;
}
.insert-pop-image-placeholder {
    padding: 30px;
    color: var(--text-muted);
    font-size: 11px;
    font-style: italic;
}
.insert-pop-prompt-section {
    margin-top: 8px;
}
.insert-pop-prompt-section label {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}
.insert-pop-prompt-box {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.4;
    max-height: 80px;
    overflow-y: auto;
    font-style: italic;
}

/* Modal de confirmacao do canvas — dark + purple accent (matching canvas) */
.canvas-confirm-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 10005;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    backdrop-filter: blur(2px);
}
.canvas-confirm-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    width: min(380px, 100%);
    padding: 18px 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.55);
}
.canvas-confirm-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.canvas-confirm-message {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-bottom: 14px;
}
.canvas-confirm-actions {
    display: flex; gap: 8px; justify-content: flex-end;
}
.canvas-confirm-actions button {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.canvas-confirm-cancel {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.canvas-confirm-cancel:hover { border-color: var(--text-secondary); color: var(--text-primary); }
.canvas-confirm-cancel:focus { outline: 2px solid #b48eff; outline-offset: 2px; }
.canvas-confirm-ok {
    background: linear-gradient(135deg, #6e3aff 0%, #b48eff 100%);
    color: #fff;
    border: none;
}
.canvas-confirm-ok:hover { opacity: 0.92; transform: translateY(-1px); }
.canvas-confirm-ok.danger {
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
}
.canvas-confirm-ok.danger:hover { opacity: 0.92; }

/* SmartPlayer preview modal — full embedded player com auto-seek */
.sp-preview-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 10010;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    backdrop-filter: blur(3px);
}
.sp-preview-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    width: min(640px, 100%);
    max-height: 95vh;
    display: flex; flex-direction: column;
    box-shadow: 0 25px 70px rgba(0,0,0,0.6);
}
.sp-preview-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    gap: 10px;
}
.sp-preview-title {
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.3;
}
.sp-preview-title strong { font-size: 14px; }
.sp-preview-take-info {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 11px;
}
.sp-preview-take-info strong { color: #b48eff; }
.sp-preview-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 28px; height: 28px;
    border-radius: 6px;
    font-size: 22px; line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}
.sp-preview-close:hover { background: var(--bg-input); color: var(--text-primary); }
.sp-preview-iframe-wrap {
    /* 9:16 vertical (typical Reels) — adjust dynamically se vier diferente.
       Aqui usamos um aspect-ratio que cobre os 2 casos. */
    width: 100%;
    aspect-ratio: 9 / 16;
    max-height: 70vh;
    background: #000;
    overflow: hidden;
}
.sp-preview-iframe-wrap iframe {
    width: 100%; height: 100%;
    border: none;
    display: block;
}
.sp-preview-desc {
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 11px;
    border-top: 1px solid var(--border);
    line-height: 1.45;
}

/* Botao "Ver take" reutilizado nos varios cards */
.enrich-sp-preview, .enrich-alt-preview {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 4px;
    margin-top: 2px;
    display: inline-flex; align-items: center; gap: 3px;
}
.enrich-sp-preview:hover, .enrich-alt-preview:hover {
    background: rgba(180, 142, 255, 0.12);
    color: #b48eff;
    border-color: #b48eff;
}
.enrich-asset-buttons {
    margin-top: 6px;
    display: flex; gap: 4px; flex-wrap: wrap;
}
.enrich-asset-ts {
    background: rgba(180, 142, 255, 0.15) !important;
    color: #b48eff !important;
    font-weight: 600;
}

/* HLS player + source badges */
.sp-preview-video {
    width: 100%; height: 100%;
    background: #000;
    display: block;
}
.sp-preview-loading {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
}
.sp-source-badge {
    background: linear-gradient(135deg, #6e3aff 0%, #b48eff 100%);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    margin-right: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    vertical-align: middle;
}
.sp-source-badge.sp-fallback {
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
}

/* Hover preview popup pra inserts SmartPlayer/DigitalPlayer */
.sp-hover-popup {
    position: fixed;
    z-index: 10020;
    width: 240px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.55);
    overflow: hidden;
    display: none;
}
.sp-hover-popup video {
    width: 100%;
    aspect-ratio: 9 / 16;
    background: #000;
    display: block;
}
.sp-hover-info {
    padding: 6px 10px;
    font-size: 10px;
    color: var(--text-secondary);
    line-height: 1.35;
    border-top: 1px solid var(--border);
    background: var(--bg-input);
}
.sp-hover-info strong { color: var(--text-primary); }
.sp-hover-info em { color: var(--text-muted); }

/* Indicador de play sobre thumbnail clicavel/hoverable */
[data-hover-asset-id] {
    position: relative;
    cursor: pointer;
}
.enrich-thumb-play-hint {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.55);
    color: #fff;
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    pointer-events: none;
    transition: opacity 0.15s, transform 0.15s;
}
[data-hover-asset-id]:hover .enrich-thumb-play-hint {
    background: rgba(180, 142, 255, 0.85);
    transform: translate(-50%, -50%) scale(1.15);
}

/* Popover de edicao com player de video embedded */
.insert-popover-video {
    width: 380px;
    max-height: 85vh;
    overflow-y: auto;
}
.insert-pop-video-badge {
    background: linear-gradient(135deg, #2980b9 0%, #3498db 100%);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    vertical-align: middle;
}
.insert-pop-video-wrap {
    margin: 8px 0;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 9 / 16;
    max-height: 380px;
    display: flex; align-items: center; justify-content: center;
}
.insert-pop-video-wrap video,
.insert-pop-video-wrap iframe {
    width: 100%; height: 100%;
    display: block;
    border: none;
}
.insert-pop-static-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}
.insert-pop-video-loading {
    color: var(--text-muted);
    font-size: 11px;
    font-style: italic;
    padding: 30px;
    text-align: center;
}
.insert-pop-video-info {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding: 4px 0;
}
.insert-pop-video-info strong { color: var(--text-primary); }

/* ── Background card (Storyboard Director) ── */
.cb-storyboard-btn {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 8px;
    transition: opacity 0.15s;
}
.cb-storyboard-btn:hover { opacity: 0.85; }
.cb-storyboard-btn:disabled { opacity: 0.5; cursor: wait; }

.ct-cell-bg { padding: 8px !important; vertical-align: top; max-width: 280px; }
.bg-empty {
    color: var(--text-secondary, #94a3b8);
    font-size: 12px;
    font-style: italic;
    padding: 8px 4px;
    text-align: center;
}
.bg-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
}
.bg-header {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}
.bg-intent-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 11px;
    color: white;
    cursor: help;
}
.bgi-volume    { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.bgi-cont      { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.bgi-named     { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.bgi-generic   { background: linear-gradient(135deg, #64748b, #334155); }
.bgi-demo      { background: linear-gradient(135deg, #10b981, #047857); }
.bgi-enum      { background: linear-gradient(135deg, #f59e0b, #b45309); }

.bg-type-pill {
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 11px;
    background: rgba(139, 92, 246, 0.15);
    color: var(--text-primary);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.bg-clips {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.bg-clip {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 4px;
    overflow: hidden;
    background: #1e293b;
    border: 1px solid rgba(139, 92, 246, 0.3);
}
.bg-clip-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.bg-clip-pct {
    position: absolute;
    bottom: 0; right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 9px;
    padding: 1px 3px;
    border-top-left-radius: 3px;
}

.bg-entities {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
}
.bg-entity-chip {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
}

.bg-reason {
    color: var(--text-secondary, #94a3b8);
    font-size: 11px;
    line-height: 1.3;
    cursor: help;
    padding-top: 2px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

/* ── Insert card with inline thumb ── */
.insert-card.has-thumb {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 8px;
    align-items: start;
}
.insert-card-thumb-wrap {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    background: #1e293b;
    border: 1px solid rgba(139, 92, 246, 0.3);
    flex-shrink: 0;
    position: relative;
}
.insert-card-thumb-wrap.insert-thumb-fail {
    background: linear-gradient(135deg, #1e293b, #334155);
}
.insert-card-thumb-wrap.insert-thumb-fail::after {
    content: '⚠ no thumb';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #94a3b8;
    text-align: center;
    padding: 4px;
}
.insert-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.insert-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.insert-card-overlay {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    border-left: 2px solid #f59e0b;
}
.insert-card-meta {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    font-size: 10px;
}
.insert-card-meta > span {
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
}
.insert-card-trigger { background: rgba(34, 197, 94, 0.15) !important; color: #86efac !important; }
.insert-card-entity { background: rgba(245, 158, 11, 0.2) !important; color: #fbbf24 !important; font-weight: 600; }

/* ── Bg clip thumb fail fallback ── */
.bg-clip-fallback {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 10px;
    background: linear-gradient(135deg, #1e293b, #334155);
}
.bg-clip-fail .bg-clip-fallback { display: flex; }

/* ── Bg clip play indicator (hover/click preview) ── */
.bg-clip {
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}
.bg-clip:hover {
    transform: scale(1.06);
    border-color: rgba(139, 92, 246, 0.7);
    z-index: 2;
}
.bg-clip-play {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.85);
    font-size: 18px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.7);
    pointer-events: none;
    opacity: 0.7;
    transition: opacity 0.15s, color 0.15s;
}
.bg-clip:hover .bg-clip-play {
    opacity: 1;
    color: #c4b5fd;
}
.bg-clip-fail .bg-clip-play { display: none; }

/* ── Storyboard alternatives gallery (bg + insert) ── */
.bg-clip-wrap {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
}
.alts-toggle {
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.4);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.4;
    width: fit-content;
}
.alts-toggle:hover {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.7);
}
.alts-toggle-open {
    background: rgba(139, 92, 246, 0.4);
    color: white;
}
.alts-toggle-bg {
    align-self: center;
    margin-top: 2px;
}
.alts-toggle-insert {
    margin-top: 4px;
}
.alts-gallery-wrap {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 4px;
    padding: 4px;
    margin-top: 4px;
}
.alts-gallery {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.alt-thumb {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 4px;
    overflow: hidden;
    background: #1e293b;
    border: 1px solid rgba(139, 92, 246, 0.3);
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.alt-thumb:hover {
    transform: scale(1.08);
    border-color: rgba(139, 92, 246, 0.9);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.4);
    z-index: 3;
}
.alt-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.alt-thumb-fallback {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 10px;
    background: linear-gradient(135deg, #1e293b, #334155);
}
.alt-fail .alt-thumb-fallback { display: flex; }
.alt-meta {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,0.75);
    color: white;
    font-size: 9px;
    padding: 1px 3px;
    text-align: center;
    line-height: 1.2;
}
.alt-same-lesson {
    color: #fbbf24;
    margin-left: 2px;
}
.alt-thumb-loading {
    pointer-events: none;
    opacity: 0.5;
    animation: alt-pulse 1s infinite;
}
@keyframes alt-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

/* ── Mode Toggle (Chat / Análise de anúncios) ─────────────────────────── */
.mode-toggle {
    display: inline-flex;
    background: var(--bg-input, rgba(255,255,255,0.04));
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
    margin-left: 4px;
}
.mode-toggle.hidden { display: none; }
.mode-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted, #888);
    padding: 4px 12px;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.mode-toggle-btn:hover { color: var(--text-primary); }
.mode-toggle-btn.active {
    background: var(--accent, #00d4ff);
    color: #0a0a0a;
    font-weight: 600;
}
.light-theme .mode-toggle-btn.active { color: #fff; }

/* ── Análise de anúncios — view (substitui chat-body em modo análise) ─── */
.analise-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
}
.analise-view.hidden { display: none; }
.analise-header {
    padding: 16px 20px 0 20px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.06));
    margin-bottom: 12px;
}
.analise-title-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
}
.analise-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}
.analise-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    padding-bottom: 12px;
    flex-wrap: wrap;
}
.analise-search-input {
    flex: 1;
    min-width: 220px;
    background: var(--bg-input, rgba(255,255,255,0.04));
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
}
.analise-search-input:focus { border-color: var(--accent, #00d4ff); }
.analise-period-select {
    background: var(--bg-input, rgba(255,255,255,0.04));
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
}
.analise-count {
    color: var(--text-muted);
    font-size: 12px;
}
.analise-cards {
    flex: 1;
    overflow: auto;
    padding: 0 20px 20px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
@media (min-width: 1400px) {
    .analise-cards.has-multiple { grid-template-columns: 1fr 1fr; }
}
.analise-empty, .analise-loading, .analise-error {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    grid-column: 1 / -1;
}
.analise-error { color: #f87171; }
.analise-card {
    background: var(--bg-input, rgba(255,255,255,0.02));
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.analise-card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.analise-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}
.analise-card-update {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.analise-card-outdated {
    font-size: 11px;
    color: #f87171;
    font-weight: 600;
    margin-top: 2px;
}
.analise-card-count {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}
.analise-card-body {
    overflow: auto;
}
.analise-card-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}
table.analise-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.analise-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-base, #0a0a0a);
    z-index: 1;
}
.analise-table th {
    text-align: center;
    padding: 8px 8px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.1));
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    font-size: 11px;
}
.analise-table th.left { text-align: left; }
.analise-table th:hover { color: var(--text-primary); }
.analise-table th.sorted { color: var(--accent, #00d4ff); }
.analise-table th .sort-arrow { font-size: 10px; margin-left: 4px; opacity: 0.7; }
.analise-table td {
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: var(--text-primary);
    white-space: nowrap;
    text-align: center;
}
.analise-table td.left { text-align: left; }
.analise-table tbody tr.analise-row-group {
    cursor: pointer;
}
.analise-table tbody tr.analise-row-group:hover { background: rgba(255,255,255,0.03); }
.analise-table tbody tr.analise-row-variation {
    background: rgba(255,255,255,0.015);
    color: var(--text-secondary);
    font-size: 11px;
}
.analise-table td.num { font-variant-numeric: tabular-nums; }
.analise-table td.dim { color: var(--text-muted); }
.analise-table .ad-name { font-weight: 500; }
.analise-table .ad-name-variation {
    color: var(--text-muted);
    padding-left: 24px;
    font-size: 11px;
}
.analise-table .var-count {
    color: var(--text-muted);
    font-size: 10px;
    margin-left: 6px;
}
.analise-table .row-arrow {
    display: inline-block;
    width: 14px;
    color: var(--text-muted);
    font-size: 10px;
    transition: transform 0.15s;
}
.analise-table .row-arrow.expanded { transform: rotate(90deg); }
.analise-prod-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 10px;
    background: rgba(96, 165, 250, 0.15);
    color: rgba(96, 165, 250, 0.95);
}
.analise-roas-good { color: #34d399; font-weight: 600; }
.analise-roas-mid { color: #fbbf24; }
.analise-roas-bad { color: #f87171; }

/* === Vini fork: features em standby (sem credenciais HeyGen/Nanobanana/Drive) === */
.cb-enrich,
.cb-enrich-all-btn,
.ct-enrich-all,
.cs-audio-btn {
  display: none !important;
}

/* Vini fork: esconder entrada 'Alfred' (traffic) do agents-list — só mostra Agente de Copy */
.agent-item[data-id="traffic"] {
  display: none !important;
}
