/* ============================================
   JULIANA PRO — PREMIUM DESIGN SYSTEM
   ============================================ */

/* === DESIGN TOKENS (Light) === */
:root {
    --bg: #f0f2f5;
    --bg-secondary: #e8ecf1;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #dde3eb;
    --card: #ffffff;

    /* Chat Bubbles */
    --assistant-bubble: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    --assistant-border: #e2e8f0;
    --assistant-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    --user-bubble: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    --user-text: #ffffff;
    --user-shadow: 0 2px 12px rgba(59, 130, 246, 0.25);

    /* Fields */
    --field-bg: #ffffff;
    --field-text: #0f172a;
    --field-border: #cbd5e1;
    --field-placeholder: #94a3b8;

    /* Buttons */
    --btn-primary-bg: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    --btn-primary-text: #ffffff;
    --btn-secondary-bg: #f1f5f9;
    --btn-secondary-text: #475569;
    --btn-secondary-border: #e2e8f0;
    --btn-secondary-bg-hover: #e2e8f0;

    /* Focus */
    --focus-ring: rgba(99, 102, 241, 0.35);
    --focus-border: #6366f1;

    /* Sidebar */
    --sidebar-bg: rgba(241, 245, 249, 0.85);
    --sidebar-header: rgba(226, 232, 240, 0.9);

    /* Accent gradients */
    --accent: #6366f1;
    --accent-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899);
    --avatar-juliana: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --avatar-user: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);

    /* Welcome card */
    --welcome-bg: linear-gradient(135deg, #f8fafc 0%, #eff6ff 50%, #f5f3ff 100%);
    --welcome-border: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899);
    --welcome-glow: rgba(99, 102, 241, 0.08);
}

/* === DESIGN TOKENS (Dark) === */
:root.dark {
    --bg: #0c0f17;
    --bg-secondary: #111827;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --border: #1e293b;
    --card: #151b28;

    --assistant-bubble: linear-gradient(135deg, #151b28 0%, #1a2236 100%);
    --assistant-border: #1e293b;
    --assistant-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    --user-bubble: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
    --user-text: #f1f5f9;
    --user-shadow: 0 2px 12px rgba(37, 99, 235, 0.3);

    --field-bg: #111827;
    --field-text: #e5e7eb;
    --field-border: #2d3748;
    --field-placeholder: #6b7280;

    --btn-primary-bg: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
    --btn-primary-text: #f1f5f9;
    --btn-secondary-bg: #1e293b;
    --btn-secondary-text: #e5e7eb;
    --btn-secondary-border: #334155;
    --btn-secondary-bg-hover: #293548;

    --focus-ring: rgba(99, 102, 241, 0.3);
    --focus-border: #6366f1;

    --sidebar-bg: rgba(17, 24, 39, 0.85);
    --sidebar-header: rgba(30, 41, 59, 0.9);

    --welcome-bg: linear-gradient(135deg, #151b28 0%, #1a2240 50%, #1e1b3a 100%);
    --welcome-border: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899);
    --welcome-glow: rgba(99, 102, 241, 0.06);
}

/* === BASE === */
* { box-sizing: border-box; }

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    transition: background 0.3s ease, color 0.3s ease;
}

/* === HEADER === */
.app-header {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.8);
    transition: background 0.3s ease;
}
:root.dark .app-header {
    background: rgba(12, 15, 23, 0.85);
}

.header-group {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 10px;
    background: var(--btn-secondary-bg);
    border: 1px solid var(--border);
    transition: background 0.2s ease;
}

.header-logo {
    font-weight: 700;
    font-size: 1rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* === MESSAGES === */
.msg {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: msgFadeIn 0.35s ease-out;
}

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

.msg.assistant { justify-content: flex-start; }
.msg.user { justify-content: flex-end; }

/* === AVATARS === */
.msg .avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.msg .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.msg.assistant .avatar {
    background: var(--avatar-juliana);
}

.msg.user .avatar {
    background: var(--avatar-user);
}

/* === CHAT BUBBLES === */
.msg > .bubble {
    display: inline-block;
    max-width: 82%;
    padding: 18px 22px;
    border-radius: 20px;
    word-wrap: break-word;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
    line-height: 1.6;
    font-size: 0.925rem;
    transition: box-shadow 0.3s ease;
}

/* --- Assistant bubble: premium card style (mesma do welcome) --- */
.msg.assistant > .bubble {
    background: var(--welcome-bg);
    border: 1px solid transparent;
    color: var(--text);
    border-top-left-radius: 4px;
    position: relative;
    box-shadow: 0 0 30px var(--welcome-glow), 0 2px 10px rgba(0, 0, 0, 0.06);
}

/* Borda gradiente animada (mesma técnica do welcome card) */
.msg.assistant > .bubble::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    padding: 1.5px;
    background: var(--welcome-border);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.6;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 0;
}

.msg.assistant > .bubble:hover::before {
    opacity: 1;
}

.msg.assistant > .bubble:hover {
    box-shadow: 0 0 40px var(--welcome-glow), 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* Conteúdo da bubble acima do ::before */
.msg.assistant > .bubble > * {
    position: relative;
    z-index: 1;
}

/* --- User bubble: premium card com acento teal/emerald --- */
.msg.user > .bubble {
    background: var(--welcome-bg);
    color: var(--text);
    border: 1px solid transparent;
    border-top-right-radius: 4px;
    position: relative;
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.06), 0 2px 10px rgba(0, 0, 0, 0.06);
}

.msg.user > .bubble::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    padding: 1.5px;
    background: linear-gradient(135deg, #10b981, #06b6d4, #3b82f6);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.6;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 0;
}

.msg.user > .bubble > * {
    position: relative;
    z-index: 1;
}

.msg.user > .bubble:hover::before {
    opacity: 1;
}

.msg.user > .bubble:hover {
    box-shadow: 0 0 35px rgba(16, 185, 129, 0.1), 0 4px 16px rgba(0, 0, 0, 0.1);
}

.tree-node.drag-over > div:first-child {
    background: rgba(99, 102, 241, 0.15) !important;
    border: 1px dashed var(--accent) !important;
    transform: scale(1.02);
    transition: all 0.2s ease;
}

.tree-node.drag-over-global {
    background: rgba(99, 102, 241, 0.05) !important;
    border: 2px dashed var(--accent) !important;
}

/* === WELCOME CARD === */
.welcome-card {
    background: var(--welcome-bg);
    border: 1px solid transparent;
    border-radius: 20px;
    padding: 24px 28px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 40px var(--welcome-glow), 0 2px 12px rgba(0,0,0,0.06);
    max-width: 82%;
}

.welcome-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    padding: 1.5px;
    background: var(--welcome-border);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    animation: welcomeGlow 4s ease-in-out infinite alternate;
}

@keyframes welcomeGlow {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

.welcome-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.welcome-card .subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.welcome-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.welcome-feature {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.04);
    border: 1px solid rgba(99, 102, 241, 0.08);
    font-size: 0.82rem;
    line-height: 1.4;
    transition: background 0.2s ease, transform 0.2s ease;
}
.welcome-feature:hover {
    background: rgba(99, 102, 241, 0.08);
    transform: translateY(-1px);
}

.welcome-feature .feat-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.welcome-card .welcome-cta {
    margin-top: 16px;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.7;
    font-style: italic;
}

.welcome-best-practices {
    margin-top: 20px;
    padding: 16px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(99, 102, 241, 0.1);
    text-align: left;
}

.welcome-best-practices h4 {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--accent);
}

.welcome-best-practices ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.welcome-best-practices li {
    font-size: 0.8rem;
    line-height: 1.6;
    margin-bottom: 8px;
    padding-left: 1.6em;
    text-indent: -1.6em;
}

.welcome-best-practices li:last-child {
    margin-bottom: 0;
}

/* === THINKING INDICATOR === */
.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

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

.thinking-dots span {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6366f1;
    animation: thinkBounce 1.4s ease-in-out infinite;
}

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

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

/* === PROCESSING INDICATOR (mid-stream idle) === */
.processing-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    animation: processingFadeIn 0.4s ease-out;
}

.processing-indicator.hidden {
    display: none;
}

.processing-spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2.5px solid rgba(99, 102, 241, 0.15);
    border-top-color: #6366f1;
    animation: processingSpinAnim 0.8s linear infinite;
    flex-shrink: 0;
}

.processing-indicator span {
    animation: processingPulse 2s ease-in-out infinite;
}

@keyframes processingSpinAnim {
    to { transform: rotate(360deg); }
}

@keyframes processingPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

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

/* === CURSOR (streaming) === */
.cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: #6366f1;
    animation: cursorBlink 1s step-end infinite;
    margin-left: 2px;
    border-radius: 1px;
    vertical-align: text-bottom;
}

@keyframes cursorBlink {
    50% { opacity: 0; }
}

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

/* === PROSE INSIDE BUBBLES === */
.bubble.prose :where(p, ul, ol, pre, code, blockquote, table) {
    margin-top: 0;
    margin-bottom: .5rem;
}
.bubble.prose :where(pre) { margin-bottom: .75rem; }

.bubble img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px !important;
    margin: 15px auto !important;
    display: block !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

/* === CODE BLOCKS === */
.code-block { position: relative; }

.bubble pre {
    padding: 2.2rem 1rem 1rem;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
    max-width: 100%;
    border-radius: 12px;
    font-size: 0.82rem;
    line-height: 1.5;
}

.bubble pre code {
    white-space: pre-wrap;
    word-break: break-word;
    display: block;
}

.bubble :not(pre) > code {
    white-space: pre-wrap;
    word-break: break-word;
    background: rgba(99, 102, 241, 0.08);
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 0.85em;
}

.msg.assistant .bubble pre,
.msg.assistant .bubble pre code,
.msg.assistant .bubble .hljs {
    background: #0d1117 !important;
    color: #e6edf3 !important;
    border: 1px solid #21262d;
}

.code-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.15s ease;
    font-weight: 500;
}
.code-copy:hover {
    background: var(--btn-secondary-bg-hover);
    transform: translateY(-1px);
}

/* === FORM FIELDS === */
textarea, input[type=text], input[type=search], select {
    background: var(--field-bg);
    color: var(--field-text);
    border: 1.5px solid var(--field-border);
    border-radius: 12px;
    padding: .7rem .9rem;
    outline: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

textarea::placeholder, input::placeholder {
    color: var(--field-placeholder);
}

textarea:focus, input[type=text]:focus, input[type=search]:focus, select:focus {
    border-color: var(--focus-border);
    box-shadow: 0 0 0 3px var(--focus-ring), 0 0 20px rgba(99, 102, 241, 0.08);
}

select option {
    background: var(--field-bg);
    color: var(--field-text);
}

/* === BUTTONS === */
#sendBtn {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.6rem 1.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
#sendBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}
#sendBtn:active {
    transform: translateY(0);
}
#sendBtn:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: 1px solid var(--btn-secondary-border);
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-secondary:hover {
    background: var(--btn-secondary-bg-hover);
    transform: translateY(-1px);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--btn-secondary-bg);
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.9rem;
}
.btn-icon:hover {
    background: var(--btn-secondary-bg-hover);
    transform: translateY(-1px);
}

/* === SIDEBAR === */
.sidebar {
    background: var(--sidebar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-left: 1px solid var(--border);
    transition: width 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 0 !important;
    border-left: none;
    opacity: 0;
    pointer-events: none;
}

.sidebar-header {
    background: var(--sidebar-header);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.82rem;
}

/* File tree icons */
.tree-folder::before { content: '📁 '; }
.tree-file-py::before { content: '🐍 '; }
.tree-file-js::before { content: '⚡ '; }
.tree-file-html::before { content: '🌐 '; }
.tree-file-css::before { content: '🎨 '; }
.tree-file-json::before { content: '📦 '; }
.tree-file-md::before { content: '📝 '; }
.tree-file-default::before { content: '📄 '; }

/* === CHAT SCROLL === */
#chatScroll {
    overscroll-behavior: contain;
    scroll-behavior: smooth;
}

.user-plain-pre {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
}

/* === TIMESTAMP === */
.msg-timestamp {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 6px;
    opacity: 0.7;
}

/* === ATTACH MENU === */
#attachMenu {
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}
#attachMenu button {
    transition: background 0.15s ease;
}

/* === THEME TOGGLE === */
#themeBtn {
    position: relative;
    overflow: hidden;
}

/* === FOOTER === */
.app-footer {
    background: var(--card);
    border-top: 1px solid var(--border);
    transition: background 0.3s ease;
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* === CONFIG MODAL (preserve existing functionality) === */
#configModal input[type="number"],
#configModal input[type="text"],
#configModal input[type="search"],
#configModal select,
#configModal textarea {
    background: var(--field-bg) !important;
    color: var(--field-text) !important;
    border: 1px solid var(--field-border) !important;
    border-radius: 0.5rem;
    padding: 0.65rem 0.75rem;
}

#configModal input:focus,
#configModal select:focus,
#configModal textarea:focus {
    box-shadow: 0 0 0 3px var(--focus-ring) !important;
    border-color: transparent !important;
}

/* === RESIZE HANDLES === */
.resize-handle {
    width: 5px;
    cursor: col-resize;
    background: var(--border);
    transition: background 0.2s ease, width 0.15s ease;
    position: relative;
    z-index: 5;
    flex-shrink: 0;
}

.resize-handle:hover,
.resize-handle.dragging {
    width: 5px;
    background: linear-gradient(180deg, #3b82f6, #8b5cf6, #ec4899);
}

.resize-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 3px;
    height: 28px;
    border-radius: 3px;
    background: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.resize-handle:hover::after,
.resize-handle.dragging::after {
    opacity: 0.6;
}

/* === BIO MODAL === */
.bio-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.bio-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.bio-modal {
    background: var(--card);
    width: 100%;
    max-width: 450px;
    border-radius: 28px;
    padding: 32px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid var(--border);
    text-align: center;
}
.bio-modal-overlay.active .bio-modal {
    transform: scale(1);
}
.bio-modal .bio-avatar {
    width: 100px;
    height: 100px;
    border-radius: 24px;
    margin: -80px auto 20px;
    border: 4px solid var(--card);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
    overflow: hidden;
    background: var(--accent-gradient);
}
.bio-modal .bio-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.bio-modal h2 {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}
.bio-modal .bio-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 20px;
}
.bio-modal .bio-text {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 24px;
    text-align: justify;
}
.bio-modal .bio-footer {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.bio-modal .bio-close {
    margin-top: 20px;
    width: 100%;
    padding: 12px;
    background: var(--btn-secondary-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.bio-modal .bio-close:hover {
    background: var(--btn-secondary-bg-hover);
}


/* === THOUGHT BOX === */
.thought-container {
    margin: 8px 0 16px 0;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.03);
    border: 1px solid rgba(99, 102, 241, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}
:root.dark .thought-container {
    background: rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.15);
}

.thought-header {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6366f1;
    background: rgba(99, 102, 241, 0.05);
}
.thought-header:hover {
    background: rgba(99, 102, 241, 0.1);
}

.thought-header svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
    transform: rotate(0deg); /* Começa aberto */
}

.thought-container.collapsed .thought-header svg {
    transform: rotate(-90deg);
}

.thought-content {
    padding: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.5;
    border-top: 1px solid rgba(99, 102, 241, 0.08);
    max-height: 160px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.thought-content::-webkit-scrollbar {
    width: 4px;
}
.thought-content::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.2);
    border-radius: 2px;
}

.thought-container.collapsed .thought-content {
    display: none;
}

.thought-content p {
    margin-bottom: 8px;
}
.thought-content p:last-child {
    margin-bottom: 0;
}
.file-viewer-panel {
    display: flex;
    flex-direction: column;
    background: var(--sidebar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
    min-width: 0;
    transition: opacity 0.2s ease;
}

.file-viewer-header {
    background: var(--sidebar-header);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    padding: 6px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    flex-wrap: nowrap; /* Impede que quebre em duas linhas */
}

/* === FILE TABS === */
.file-tabs {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    flex: 1;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.file-tabs::-webkit-scrollbar {
    display: none;
}

.file-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    max-width: 160px;
    min-width: 0;
}

.file-tab:hover {
    background: var(--btn-secondary-bg);
    color: var(--text);
}

.file-tab.active {
    background: var(--btn-secondary-bg);
    color: var(--text);
    border-color: var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.file-tab .tab-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-tab .tab-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    font-size: 10px;
    line-height: 1;
    color: var(--text-muted);
    opacity: 0;
    transition: all 0.1s ease;
    flex-shrink: 0;
}

.file-tab:hover .tab-close,
.file-tab.active .tab-close {
    opacity: 0.7;
}

.file-tab .tab-close:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* === MONACO CONTAINER === */
#monacoContainer {
    background: #1e1e1e;
    border-top: 1px solid var(--border);
}

:root:not(.dark) #monacoContainer {
    background: #ffffff;
}

/* === SIDEBAR RESIZE OVERRIDES === */
.sidebar {
    background: var(--sidebar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-left: none;
    transition: opacity 0.3s ease;
    overflow: hidden;
    min-width: 0;
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: 0 !important;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

/* Viewer toggle button active state */
#viewerToggle.active {
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: white;
    border-color: transparent;
}

/* Sidebar toggle button active state */
#sidebarToggle.active {
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: white;
    border-color: transparent;
}

/* === NO-SELECT while resizing === */
body.resizing {
    user-select: none !important;
    -webkit-user-select: none !important;
    cursor: col-resize !important;
}

body.resizing * {
    cursor: col-resize !important;
}

body.resizing iframe,
body.resizing #monacoContainer {
    pointer-events: none !important;
}

/* ============================================
   ADMIN PANEL — USER MANAGEMENT STYLES
   ============================================ */

/* Admin link in header */
.admin-users-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    color: #a78bfa;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    transition: all 0.2s ease;
}
.admin-users-link:hover {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.2);
}

.admin-badge-header {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Container */
.admin-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* Title Section */
.admin-title-section {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}

.admin-title-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.admin-title {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.admin-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 2px 0 0 0;
}

/* Action Bar */
.admin-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.admin-search-wrapper {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.admin-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    opacity: 0.6;
    pointer-events: none;
}

.admin-search-input {
    width: 100%;
    padding: 10px 14px 10px 38px !important;
    font-size: 0.85rem !important;
    border-radius: 12px !important;
    background: var(--field-bg) !important;
    color: var(--field-text) !important;
    border: 1.5px solid var(--field-border) !important;
    transition: all 0.2s ease;
}
.admin-search-input:focus {
    border-color: var(--focus-border) !important;
    box-shadow: 0 0 0 3px var(--focus-ring), 0 0 20px rgba(99, 102, 241, 0.08) !important;
}

.admin-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
    font-family: 'Inter', sans-serif;
}
.admin-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.admin-btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
    font-family: 'Inter', sans-serif;
}
.admin-btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

/* Stats Grid */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 768px) {
    .admin-stats-grid {
        grid-template-columns: 1fr;
    }
}

.admin-stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--welcome-bg);
    border: 1px solid transparent;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px var(--welcome-glow), 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.admin-stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    padding: 1.5px;
    background: var(--welcome-border);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.4;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.admin-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px var(--welcome-glow), 0 4px 16px rgba(0, 0, 0, 0.08);
}

.admin-stat-card:hover::before {
    opacity: 0.8;
}

.admin-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.admin-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    position: relative;
    z-index: 1;
}

.admin-stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
}

/* Table Card */
.admin-table-card {
    background: var(--welcome-bg);
    border: 1px solid transparent;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 30px var(--welcome-glow), 0 2px 10px rgba(0, 0, 0, 0.04);
}

.admin-table-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    padding: 1.5px;
    background: var(--welcome-border);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.4;
    pointer-events: none;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    position: relative;
    z-index: 1;
}

.admin-table thead th {
    padding: 14px 18px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    text-align: left;
    background: rgba(99, 102, 241, 0.03);
}

.admin-table tbody td {
    padding: 14px 18px;
    font-size: 0.85rem;
    color: var(--text);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    vertical-align: middle;
}

.admin-table-row {
    transition: background 0.15s ease;
    animation: adminRowFadeIn 0.3s ease-out both;
}

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

.admin-table-row:hover {
    background: rgba(99, 102, 241, 0.04);
}

.admin-table-row:last-child td {
    border-bottom: none;
}

/* Table Cell Styles */
.admin-id-badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(99, 102, 241, 0.06);
    font-family: 'JetBrains Mono', monospace;
}

.admin-user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.admin-email {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.admin-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
}

.admin-role-admin {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.admin-role-user {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Action Buttons */
.admin-actions-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.admin-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--btn-secondary-bg);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s ease;
}

.admin-action-edit:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}

.admin-action-key:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    transform: translateY(-1px);
}

.admin-action-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

/* ============ Modals ============ */
.admin-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.admin-modal-overlay.active {
    opacity: 1;
}

.admin-modal {
    background: var(--card);
    border-radius: 20px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.25s ease;
    overflow: hidden;
}

.admin-modal-overlay.active .admin-modal {
    transform: translateY(0) scale(1);
}

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

.admin-modal-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.admin-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--btn-secondary-bg);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}
.admin-modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.admin-modal-body {
    padding: 24px;
}

.admin-form-group {
    margin-bottom: 16px;
}

.admin-form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.admin-form-group input[type="text"],
.admin-form-group input[type="email"],
.admin-form-group input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    background: var(--field-bg);
    color: var(--field-text);
    border: 1.5px solid var(--field-border);
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.admin-form-group input:focus {
    border-color: var(--focus-border);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Checkbox */
.admin-checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.88rem !important;
    color: var(--text) !important;
    font-weight: 500 !important;
}

.admin-checkbox-label input[type="checkbox"] {
    display: none;
}

.admin-checkbox-custom {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid var(--field-border);
    background: var(--field-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.admin-checkbox-label input[type="checkbox"]:checked + .admin-checkbox-custom {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    border-color: transparent;
}

.admin-checkbox-label input[type="checkbox"]:checked + .admin-checkbox-custom::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: 700;
}

.admin-form-error {
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 12px;
    color: #f87171;
    font-size: 0.82rem;
    margin-bottom: 12px;
}

.admin-reset-info {
    font-size: 0.88rem;
    color: var(--text);
    margin-bottom: 16px;
}

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

/* ============ Toast ============ */
.admin-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 200;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff;
    background: linear-gradient(135deg, #10b981, #06b6d4);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}
.admin-toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* === TABS SYSTEM === */
.tab-btn {
    padding: 6px 16px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: var(--text);
    background: rgba(0, 0, 0, 0.05);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
    background: rgba(99, 102, 241, 0.05);
}

/* === CONSOLE PANEL === */
#consolePanel {
    scrollbar-width: thin;
}

#consoleLog {
    font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace;
    text-shadow: 0 0 2px rgba(0,0,0,0.5);
}

.log-entry {
    padding: 2px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.log-ts { color: #569cd6; margin-right: 8px; }
.log-level-INFO { color: #4ec9b0; }
.log-level-WARNING { color: #ce9178; font-weight: bold; }
.log-level-ERROR { color: #f44747; font-weight: bold; }
.log-msg { color: #d4d4d4; }

/* ============================================
   GIT / GITHUB PANEL
   ============================================ */

/* Viewer Tab Buttons */
.viewer-tab {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.viewer-tab:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text);
}
.viewer-tab.active {
    background: rgba(99, 102, 241, 0.12);
    color: #6366f1;
    border-color: rgba(99, 102, 241, 0.25);
}

/* Git Panel Container */
.git-panel {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    font-size: 0.82rem;
}

/* Git Section Cards */
.git-section {
    background: rgba(99, 102, 241, 0.04);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: 12px;
    padding: 12px;
}
.git-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Git Status Badge */
.git-branch-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* File change list */
.git-file-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
}
.git-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-family: 'Consolas', 'Monaco', monospace;
    transition: background 0.15s ease;
    cursor: pointer;
}
.git-file-item:hover {
    background: rgba(99, 102, 241, 0.08);
}
.git-file-item input[type="checkbox"] {
    accent-color: #6366f1;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}
.git-file-status {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    flex-shrink: 0;
}
.git-file-status.modified { background: rgba(251, 191, 36, 0.15); color: #f59e0b; }
.git-file-status.added, .git-file-status.new { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.git-file-status.deleted { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.git-file-status.staged { background: rgba(99, 102, 241, 0.15); color: #6366f1; }

.git-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}

/* Action buttons row */
.git-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.git-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--btn-secondary-bg);
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s ease;
}
.git-btn:hover {
    transform: translateY(-1px);
    background: var(--btn-secondary-bg-hover);
}
.git-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}
.git-btn.primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border-color: transparent;
}
.git-btn.primary:hover {
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.3);
}
.git-btn.success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border-color: transparent;
}
.git-btn.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    border-color: transparent;
}

/* Commit message input */
.git-commit-input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--field-border);
    background: var(--field-bg);
    color: var(--field-text);
    font-size: 0.8rem;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}
.git-commit-input:focus {
    border-color: var(--focus-border);
    box-shadow: 0 0 0 2px var(--focus-ring);
}
.git-commit-input::placeholder {
    color: var(--field-placeholder);
}

/* Commit log */
.git-log-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(99, 102, 241, 0.06);
    font-size: 0.75rem;
}
.git-log-item:last-child { border-bottom: none; }
.git-log-hash {
    font-family: 'Consolas', monospace;
    color: #6366f1;
    font-weight: 600;
    flex-shrink: 0;
}
.git-log-msg {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.git-log-date {
    color: var(--text-muted);
    font-size: 0.68rem;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Diff viewer */
.git-diff-viewer {
    background: #0d1117;
    border-radius: 8px;
    padding: 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.72rem;
    line-height: 1.6;
    overflow-x: auto;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid #21262d;
}
.diff-add { color: #3fb950; background: rgba(63, 185, 80, 0.1); display: block; }
.diff-del { color: #f85149; background: rgba(248, 81, 73, 0.1); display: block; }
.diff-hunk { color: #79c0ff; font-weight: bold; display: block; }
.diff-meta { color: #8b949e; display: block; }

/* Git not-initialized prompt */
.git-init-prompt {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
}
.git-init-prompt p {
    margin-bottom: 12px;
    font-size: 0.85rem;
}

/* Git no-project */
.git-no-project {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 12px;
    padding: 40px;
    text-align: center;
}
.git-no-project .git-icon { font-size: 2.5rem; opacity: 0.4; }

/* Git modal overlay */
.git-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: gitModalFadeIn 0.2s ease;
}
@keyframes gitModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.git-modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.git-modal h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.git-modal-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.15s;
}
.git-modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Repo list (clone modal) */
.git-repo-list {
    list-style: none;
    padding: 0;
    margin: 10px 0;
    max-height: 250px;
    overflow-y: auto;
}
.git-repo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.8rem;
}
.git-repo-item:hover {
    background: rgba(99, 102, 241, 0.08);
}
.git-repo-item.selected {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
}
.git-repo-private {
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(251, 191, 36, 0.15);
    color: #f59e0b;
}

/* Spinner for git operations */
.git-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: processingSpinAnim 0.7s linear infinite;
    display: inline-block;
}

/* ============================================
   HUB PAGE — PREMIUM DESIGN
   ============================================ */
.hub-container {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
}

.hub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--card);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.hub-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hub-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hub-logo-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hub-logo-img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.hub-logo-text {
    font-size: 1.3rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hub-username {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.hub-admin-link {
    font-size: 0.8rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}
.hub-admin-link:hover { opacity: 0.8; }

.hub-logout-link {
    font-size: 0.8rem;
    color: #ef4444;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}
.hub-logout-link:hover { opacity: 0.7; }

/* Mode Section */
.hub-modes {
    max-width: 900px;
    margin: 40px auto 30px;
    padding: 0 24px;
}

.hub-section-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
}

.hub-mode-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.hub-mode-card {
    background: var(--welcome-bg);
    border: 1px solid transparent;
    border-radius: 20px;
    padding: 28px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 0 30px var(--welcome-glow), 0 2px 10px rgba(0,0,0,0.06);
}

.hub-mode-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    padding: 1.5px;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.5;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.agent-card::before {
    background: linear-gradient(135deg, #6366f1, #8b5cf6, #ec4899);
}

.builder-card::before {
    background: linear-gradient(135deg, #10b981, #06b6d4, #3b82f6);
}

.hub-mode-card:hover, .hub-mode-active {
    transform: translateY(-4px);
    box-shadow: 0 0 50px var(--welcome-glow), 0 8px 32px rgba(0,0,0,0.12);
}

.hub-mode-card:hover::before, .hub-mode-active::before {
    opacity: 1;
}

/* Borda extra ou destaque visual persistente para o ativo */
.hub-mode-active {
    border-color: rgba(99, 102, 241, 0.4);
    background: linear-gradient(180deg, var(--card), rgba(99, 102, 241, 0.05));
}

.mode-card-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.hub-mode-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.hub-mode-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 16px;
}

.mode-card-features {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.mode-card-features span {
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.1);
    font-weight: 500;
}

.mode-card-action {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
}

/* Projects Section */
.hub-projects {
    max-width: 900px;
    margin: 0 auto 60px;
    padding: 0 24px;
}

.hub-projects-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.hub-projects-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

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

.hub-project-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.hub-project-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-color: var(--accent);
}

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

.project-card-icon {
    font-size: 1.3rem;
}

.project-card-name {
    font-weight: 700;
    font-size: 0.95rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-card-owner {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
    font-weight: 500;
}

.project-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.project-card-port {
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 8px;
    background: rgba(14, 165, 233, 0.1);
    color: #0ea5e9;
    border: 1px solid rgba(14, 165, 233, 0.2);
    font-weight: 600;
    font-family: 'Inter', monospace;
}

.project-card-date {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.project-card-actions {
    display: flex;
    gap: 8px;
}

/* Hub Buttons */
.hub-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.hub-btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
.hub-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.hub-btn-secondary {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: 1px solid var(--btn-secondary-border);
}
.hub-btn-secondary:hover {
    background: var(--btn-secondary-bg-hover);
}

.hub-btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.hub-btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.hub-btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
    border-radius: 10px;
}

/* Empty State */
.hub-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.hub-empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}
.hub-empty-state h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}
.hub-empty-state p {
    font-size: 0.85rem;
    max-width: 400px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Modal */
.hub-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.hub-modal-overlay.hidden {
    display: none;
}

.hub-modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px;
    min-width: 380px;
    max-width: 90vw;
    box-shadow: 0 16px 48px rgba(0,0,0,0.2);
}

.hub-modal h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.hub-modal-body {
    margin-bottom: 20px;
}

.hub-modal-body label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.hub-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1.5px solid var(--field-border);
    background: var(--field-bg);
    color: var(--field-text);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all 0.2s ease;
}
.hub-input:focus {
    border-color: var(--focus-border);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.hub-input-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.hub-input-error {
    font-size: 0.78rem;
    color: #ef4444;
    margin-top: 6px;
    font-weight: 500;
}
.hub-input-error.hidden {
    display: none;
}

.hub-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Responsive */
@media (max-width: 640px) {
    .hub-mode-cards {
        grid-template-columns: 1fr;
    }
    .hub-project-grid {
        grid-template-columns: 1fr;
    }
    .hub-header {
        padding: 12px 16px;
    }
    .hub-modes, .hub-projects {
        padding: 0 16px;
    }
}