:root {
    --bg-page: #f4f5f7;
    --bg-shell: rgba(255, 255, 255, 0.88);
    --bg-panel: rgba(255, 255, 255, 0.96);
    --bg-panel-strong: #ffffff;
    --bg-muted: #eef1f4;
    --bg-dark: #16181d;
    --bg-dark-soft: #23262d;
    --accent: #111827;
    --accent-strong: #0f172a;
    --accent-soft: #e8ecf1;
    --accent-alt: #3b82f6;
    --text-primary: #151821;
    --text-secondary: #5c6472;
    --text-muted: #8b93a1;
    --text-on-dark: #f8fafc;
    --border: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(15, 23, 42, 0.16);
    --success: #0f9d6c;
    --warning: #b7791f;
    --error: #d14343;
    --shadow-lg: 0 24px 70px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 12px 34px rgba(15, 23, 42, 0.06);
    --radius-xl: 26px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

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

html,
body {
    min-height: 100%;
}

body {
    font-family: 'IBM Plex Sans', sans-serif;
    color: var(--text-primary);
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.08), transparent 24%),
        radial-gradient(circle at bottom right, rgba(17, 24, 39, 0.05), transparent 22%),
        linear-gradient(180deg, #f8fafc 0%, #f3f4f6 100%);
    overflow: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.5) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.5) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.14), transparent 72%);
}

.app-container {
    display: flex;
    height: 100vh;
    padding: 14px;
    gap: 14px;
}

.sidebar,
.main-content {
    border: 1px solid var(--border);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow-lg);
}

.sidebar {
    width: 284px;
    background: linear-gradient(180deg, rgba(22, 24, 29, 0.98), rgba(29, 33, 40, 0.96));
    color: var(--text-on-dark);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(145deg, #111827, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 19px;
    font-weight: 700;
    color: #fff7ee;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.logo span {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.02em;
}

.new-chat-btn {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.92), rgba(17, 24, 39, 0.92));
    color: var(--text-on-dark);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.new-chat-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.sidebar-tabs {
    padding: 14px 12px 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.sidebar-tab {
    min-height: 68px;
    padding: 10px 8px;
    border: 1px solid transparent;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    color: rgba(247, 242, 234, 0.68);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: all 0.2s ease;
}

.sidebar-tab:hover,
.sidebar-tab.active {
    color: var(--text-on-dark);
    border-color: rgba(255, 255, 255, 0.1);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
}

.sidebar-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 18px;
}

.sidebar-content.active {
    display: block;
}

.tools-section h3,
.files-section h3,
.memory-section h3,
.projects-section h3,
.tasks-section h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 12px;
    color: rgba(247, 242, 234, 0.7);
}

.tool-toggles,
.memory-list,
.project-list,
.task-list,
.workflow-list,
.mesh-visualization,
.plugin-list,
.file-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tool-toggle,
.memory-item,
.project-item,
.task-item,
.workflow-item,
.mesh-node,
.plugin-item,
.file-item,
.privacy-option {
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 12px 13px;
}

.tool-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.tool-toggle span:last-of-type,
.memory-content,
.project-files,
.node-content,
.plugin-desc,
.plugin-plan,
.task-time {
    color: rgba(247, 242, 234, 0.64);
}

.thinking-mode-toggle {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.thinking-mode-btn {
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(247, 242, 234, 0.74);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.thinking-mode-btn.active,
.thinking-mode-btn:hover {
    color: var(--text-on-dark);
    background: rgba(191, 90, 54, 0.18);
    border-color: rgba(191, 90, 54, 0.34);
}

.memory-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.memory-input-row input,
.images-search input,
.terminal-input-row input,
.setting-group input[type="text"],
.setting-group input[type="password"],
#workspaceName {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(255, 251, 245, 0.9);
    color: var(--text-primary);
    font-size: 14px;
}

.add-btn,
.add-project-btn,
.add-task-btn,
.use-image-btn,
.plugin-item .plugin-btn,
.plan-btn,
.terminal-input-row button,
.btn-primary,
.btn-secondary {
    border: none;
    cursor: pointer;
}

.add-btn,
.btn-primary,
.terminal-input-row button,
.plugin-item .plugin-btn,
.plan-btn,
.use-image-btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff9f3;
}

.add-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    font-size: 20px;
}

.add-project-btn,
.add-task-btn {
    width: 100%;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.16);
    color: var(--text-on-dark);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

.project-item,
.task-item,
.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.project-item.active,
.file-item.active {
    background: linear-gradient(135deg, rgba(191, 90, 54, 0.26), rgba(45, 124, 106, 0.22));
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: rgba(247, 242, 234, 0.42);
}

.task-delete,
.memory-delete,
.file-delete {
    background: transparent;
    border: none;
    color: rgba(247, 242, 234, 0.46);
    cursor: pointer;
}

.sidebar-footer {
    padding: 16px 18px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.api-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(247, 242, 234, 0.86);
    font-size: 13px;
    font-weight: 600;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--warning);
    box-shadow: 0 0 0 6px rgba(180, 131, 35, 0.12);
    animation: pulse 1.8s infinite;
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 0 6px rgba(39, 130, 93, 0.12);
}

.status-dot.error {
    background: var(--error);
    box-shadow: 0 0 0 6px rgba(186, 77, 54, 0.12);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.12); opacity: 0.72; }
}

.main-content {
    flex: 1;
    min-width: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.74));
    border-radius: calc(var(--radius-xl) + 2px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background:
        linear-gradient(90deg, rgba(59, 130, 246, 0.06), transparent 36%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.9));
}

.model-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.model-badge,
.premium-badge,
.model-mode {
    border-radius: 999px;
    padding: 8px 13px;
    font-size: 12px;
    font-weight: 700;
}

.model-badge {
    background: var(--bg-dark);
    color: var(--text-on-dark);
    font-family: 'Space Grotesk', sans-serif;
}

.model-mode {
    background: rgba(59, 130, 246, 0.1);
    color: #2458c6;
}

.auth-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.78);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-chip:hover {
    transform: translateY(-1px);
    background: #ffffff;
}

.auth-chip.authenticated {
    background: linear-gradient(135deg, rgba(126, 231, 135, 0.18), rgba(77, 171, 247, 0.16));
    border-color: rgba(76, 175, 80, 0.3);
}

.auth-chip-label {
    white-space: nowrap;
}

.premium-badge.free {
    background: rgba(15, 23, 42, 0.06);
    color: var(--text-secondary);
}

.premium-badge.elite,
.premium-badge.infinity {
    color: #fff8f1;
}

.premium-badge.elite {
    background: linear-gradient(135deg, #2d7c6a, #266454);
}

.premium-badge.infinity {
    background: linear-gradient(135deg, #bf5a36, #8c3517);
}

.header-actions {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.action-btn,
.icon-btn,
.panel-btn,
.msg-action,
.attach-btn,
.send-btn,
.stop-btn {
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.action-btn,
.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.action-btn:hover,
.icon-btn:hover,
.panel-btn:hover,
.msg-action:hover,
.attach-btn:hover,
.send-btn:hover,
.stop-btn:hover {
    transform: translateY(-1px);
}

.action-btn.active {
    background: linear-gradient(135deg, #111827, #3b82f6);
    border-color: transparent;
    color: #fffaf3;
}

.action-btn.premium {
    background: linear-gradient(135deg, #111827, #3b82f6);
    color: #fffaf3;
    border-color: transparent;
}

.action-btn.premium-locked::after {
    content: "•";
    position: absolute;
    top: 3px;
    right: 7px;
    color: var(--warning);
    font-size: 18px;
}

.workspace {
    flex: 1;
    display: flex;
    gap: 0;
    padding: 18px 18px 14px;
    overflow: hidden;
}

.chat-area,
.code-panel {
    min-width: 0;
    border: 1px solid var(--border);
    background: rgba(255, 253, 249, 0.86);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 980px;
    width: 100%;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.78);
}

.code-panel {
    width: 0;
    min-width: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateX(20px);
    margin-left: 0;
    display: flex;
    flex-direction: column;
    border-color: transparent;
    box-shadow: none;
    transition: width 0.24s ease, opacity 0.24s ease, transform 0.24s ease, margin 0.24s ease;
}

.workspace.panel-open .code-panel {
    width: min(38vw, 520px);
    min-width: 360px;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
    margin-left: 16px;
    border-color: var(--border);
    box-shadow: var(--shadow-md);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 24px 8px;
}

.welcome-screen {
    max-width: 760px;
    margin: 0 auto;
}

.welcome-icon {
    position: relative;
    width: 82px;
    height: 82px;
    margin-bottom: 20px;
}

.pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 24px;
    border: 1px solid rgba(191, 90, 54, 0.3);
    animation: pulse-ring 2.2s infinite;
}

.aura-logo {
    position: absolute;
    inset: 8px;
    border-radius: 20px;
    background: linear-gradient(145deg, var(--accent), var(--accent-alt));
    color: #fffaf2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 34px;
    font-weight: 700;
}

@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 0.65; }
    100% { transform: scale(1.12); opacity: 0; }
}

.welcome-screen h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(32px, 5vw, 52px);
    line-height: 1;
    letter-spacing: -0.04em;
    margin-bottom: 12px;
    max-width: 620px;
}

.welcome-screen p {
    max-width: 700px;
    font-size: 17px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.feature-card {
    min-height: 96px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(243, 244, 246, 0.92));
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.feature-card span:last-child {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

.feature-card.premium-feature {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(17, 24, 39, 0.08));
}

.feature-icon {
    font-size: 26px;
}

.suggestions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.suggestion {
    min-height: 112px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
}

.suggestion:hover {
    border-color: rgba(59, 130, 246, 0.22);
    background: #f8fbff;
}

.suggestion .icon {
    font-size: 24px;
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
    animation: rise 0.24s ease;
}

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

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 13px;
}

.message.assistant .message-avatar {
    background: linear-gradient(145deg, var(--accent), var(--accent-alt));
    color: #fffaf2;
}

.message.user .message-avatar {
    background: var(--bg-dark);
    color: var(--text-on-dark);
}

.message-content {
    max-width: min(88%, 760px);
}

.branch-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(45, 124, 106, 0.1);
    color: var(--accent-alt);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 8px;
}

.message-bubble {
    padding: 14px 16px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.68;
    border: 1px solid transparent;
}

.message.assistant .message-bubble {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(15, 23, 42, 0.08);
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #111827, #1f2937);
    color: #fff8f1;
}

.message-bubble pre,
.code-editor textarea,
.terminal-output,
.terminal-input-row input,
.message-bubble code {
    font-family: 'JetBrains Mono', monospace;
}

.message-bubble pre {
    margin: 10px 0;
    padding: 14px;
    overflow-x: auto;
    border-radius: 14px;
    background: #201d19;
    color: #f8f1e7;
}

.message-bubble code {
    background: rgba(45, 124, 106, 0.12);
    color: var(--accent-alt);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 13px;
}

.message-bubble pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.message:hover .message-actions {
    opacity: 1;
}

.msg-action,
.panel-btn,
.attach-btn,
.input-tool-btn {
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.78);
    color: var(--text-secondary);
    cursor: pointer;
}

.msg-action {
    padding: 6px 10px;
    font-size: 12px;
}

.chat-input-container {
    padding: 14px 20px 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.92) 24%);
}

.attachments-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    padding: 8px;
    border-radius: 16px;
    background: rgba(45, 124, 106, 0.08);
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    background: #fffaf3;
    font-size: 12px;
}

.attachment-item img {
    width: 34px;
    height: 34px;
    object-fit: cover;
    border-radius: 10px;
}

.remove-attach {
    color: var(--error);
    cursor: pointer;
    font-weight: 700;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px;
    border-radius: 24px;
    border: 1px solid var(--border-strong);
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.input-wrapper:focus-within {
    border-color: rgba(59, 130, 246, 0.28);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.08), 0 10px 28px rgba(15, 23, 42, 0.08);
}

.input-wrapper textarea {
    flex: 1;
    min-height: 54px;
    max-height: 140px;
    border: none;
    background: transparent;
    resize: none;
    outline: none;
    padding: 11px 14px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-primary);
}

.attach-btn,
.send-btn,
.stop-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attach-btn {
    background: rgba(59, 130, 246, 0.08);
    color: #2458c6;
}

.send-btn {
    background: linear-gradient(135deg, #111827, #3b82f6);
    color: #fff8f1;
}

.stop-btn {
    background: linear-gradient(135deg, var(--error), #8d3324);
    color: #fff8f1;
    display: none;
}

.stop-btn.visible {
    display: flex;
}

.input-tools {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
}

.input-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(245, 235, 222, 0.6));
}

.panel-tabs,
.panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.panel-tab {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.panel-tab.active,
.panel-tab:hover {
    border-color: rgba(45, 124, 106, 0.18);
    background: rgba(45, 124, 106, 0.08);
    color: var(--accent-alt);
}

.panel-btn {
    width: 36px;
    height: 36px;
}

.panel-content,
.code-editor,
.code-preview,
.images-panel,
.sources-panel {
    flex: 1;
    min-height: 0;
}

.panel-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.code-editor,
.code-preview {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.code-language {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: rgba(245, 235, 222, 0.55);
}

.code-editor textarea {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    resize: none;
    padding: 18px;
    background: #fcfbf8;
    color: #2c2b29;
    font-size: 13px;
    line-height: 1.7;
}

.code-preview iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

.images-panel,
.sources-panel {
    padding: 16px;
    overflow-y: auto;
}

.images-search {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.images-search button {
    width: 44px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fffaf2;
    cursor: pointer;
}

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

.image-viewer {
    margin-bottom: 18px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: linear-gradient(180deg, #fffdf8 0%, #f7f1e7 100%);
    padding: 12px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.image-viewer-stage {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    background: #f1ece2;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-viewer-stage img {
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    display: block;
}

.image-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 999px;
    background: rgba(20, 24, 28, 0.72);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}

.image-nav-btn.prev { left: 12px; }
.image-nav-btn.next { right: 12px; }

.image-viewer-meta {
    margin-top: 12px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.image-viewer-title {
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
}

.image-viewer-source {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.image-viewer-actions {
    display: flex;
    gap: 8px;
}

.image-viewer-actions button {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: var(--text-primary);
    padding: 9px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.image-thumbs {
    margin-top: 12px;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 88px;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
}

.image-thumb {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    padding: 0;
    scroll-snap-align: start;
}

.image-thumb.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(194, 87, 44, 0.16);
}

.image-thumb img {
    width: 100%;
    height: 66px;
    display: block;
    object-fit: cover;
}

.image-card,
.source-item {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fffaf2;
    overflow: hidden;
}

.image-card img {
    width: 100%;
    height: 132px;
    object-fit: cover;
    cursor: pointer;
}

.image-info {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.image-title {
    font-size: 12px;
    color: var(--text-secondary);
}

.image-source {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

.image-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.use-image-btn,
.open-image-btn,
.download-image-btn {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: var(--text-primary);
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.use-image-btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fffaf2;
    border: none;
}

.open-image-btn:hover,
.download-image-btn:hover {
    background: #f4efe7;
}

@media (max-width: 720px) {
    .image-viewer-stage {
        min-height: 220px;
    }

    .image-viewer-meta {
        flex-direction: column;
    }

    .image-viewer-actions {
        width: 100%;
    }

    .image-viewer-actions button {
        flex: 1;
    }
}

.sources-panel h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
    margin-bottom: 12px;
}

.sources-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.source-item {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-decoration: none;
}

.source-title {
    color: var(--text-primary);
    font-weight: 700;
}

.source-url {
    font-size: 12px;
    color: var(--text-muted);
}

.activity-panel {
    margin: 0 20px 10px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.activity-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
}

.activity-status {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.activity-pulse {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--accent-alt);
    box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.12);
    animation: pulse 1.8s infinite;
    flex-shrink: 0;
}

.activity-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.activity-copy strong {
    font-size: 13px;
    color: var(--text-primary);
}

.activity-copy span {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-chevron {
    color: var(--text-muted);
    font-size: 16px;
    transition: transform 0.2s ease;
}

.activity-panel.collapsed .activity-chevron {
    transform: rotate(180deg);
}

.reasoning-content {
    padding: 0 14px 14px;
    overflow-y: auto;
    max-height: 180px;
}

.activity-panel.collapsed .reasoning-content {
    display: none;
}

.reasoning-step {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
}

.step-number {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.12);
    color: #2458c6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

.step-text {
    flex: 1;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.55;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(18, 23, 22, 0.45);
    backdrop-filter: blur(8px);
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    width: min(92vw, 520px);
    max-height: 82vh;
    overflow-y: auto;
    background: #fffaf4;
    border: 1px solid var(--border);
    border-radius: 26px;
    box-shadow: var(--shadow-lg);
}

.modal.premium-modal,
.modal.terminal-modal {
    width: min(94vw, 960px);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 14px;
    position: sticky;
    top: 0;
    background: #fffaf4;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    letter-spacing: -0.02em;
}

.close-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 20px;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px 20px;
    border-top: 1px solid var(--border);
}

.modal-info {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 14px;
}

.session-summary,
.auth-state {
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text-secondary);
    padding: 12px 14px;
    font-size: 13px;
}

.auth-state-line {
    color: var(--text-primary);
    font-weight: 700;
}

.auth-error {
    min-height: 20px;
    margin-top: 10px;
    color: #c23b3b;
    font-size: 13px;
    font-weight: 600;
}

.btn-secondary,
.btn-primary {
    padding: 10px 16px;
    border-radius: 14px;
    font-weight: 700;
}

.btn-secondary {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.premium-plans {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.premium-plan {
    border-radius: 22px;
    border: 1px solid var(--border);
    background: #fff8ef;
    padding: 18px;
}

.premium-plan.recommended {
    background: linear-gradient(135deg, rgba(191, 90, 54, 0.1), rgba(45, 124, 106, 0.08));
}

.premium-plan.current {
    border-color: rgba(39, 130, 93, 0.35);
}

.plan-header {
    margin-bottom: 16px;
}

.plan-header h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 20px;
    margin-bottom: 4px;
}

.plan-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-strong);
}

.plan-price span {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.plan-features {
    list-style: none;
    margin-bottom: 16px;
}

.plan-features li {
    padding: 6px 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.terminal-body {
    display: flex;
    flex-direction: column;
    min-height: 440px;
}

.terminal-output {
    flex: 1;
    padding: 16px;
    background: #171d1c;
    color: #edf4ef;
    font-size: 13px;
}

.terminal-line {
    margin-bottom: 8px;
}

.term-cmd {
    display: block;
    color: #83d5a9;
}

.term-output {
    display: block;
    padding-left: 14px;
    color: #d7e5de;
}

.terminal-input-row {
    display: flex;
    gap: 8px;
    padding: 14px;
    border-top: 1px solid var(--border);
    background: #fffaf4;
}

.plugin-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.plugin-item .plugin-icon {
    font-size: 24px;
}

.plugin-item .plugin-info {
    flex: 1;
}

.plugin-item .plugin-name {
    display: block;
    font-weight: 700;
}

.plugin-item.locked {
    opacity: 0.56;
}

.plugin-item.installed {
    border-color: rgba(39, 130, 93, 0.28);
}

.workflow-item,
.mesh-node {
    display: flex;
    align-items: center;
    gap: 10px;
}

.workflow-item {
    flex-direction: column;
    align-items: stretch;
}

.wf-header,
.wf-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.wf-actions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.wf-action-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(45, 124, 106, 0.1);
    color: var(--accent-alt);
    font-size: 11px;
    font-weight: 700;
}

.wf-toggle,
.wf-delete,
.copy-invite,
.invite-btn,
.share-project-btn,
.settings-btn,
.create-ws-btn {
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    color: var(--text-primary);
}

.team-create,
.team-info,
.team-members,
.team-actions,
.invite-link {
    margin-bottom: 14px;
}

.team-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(45, 124, 106, 0.08);
    margin-bottom: 8px;
}

.member-role {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 12px;
}

.invite-link input {
    margin-bottom: 8px;
}

.privacy-option {
    display: flex;
    align-items: center;
    gap: 12px;
}

.privacy-delete {
    margin-top: 18px;
}

.delete-data-btn {
    width: 100%;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(186, 77, 54, 0.28);
    background: rgba(186, 77, 54, 0.08);
    color: var(--error);
    cursor: pointer;
    font-weight: 700;
}

.empty-state {
    padding: 18px 12px;
    color: var(--text-muted);
    text-align: center;
    font-size: 13px;
}

.download-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 10px 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent-alt), #225748);
    color: #fffaf2 !important;
    text-decoration: none !important;
    font-weight: 700;
}

body.prism-active .model-badge,
body.prism-active .aura-logo {
    background: linear-gradient(145deg, #b48323, var(--accent));
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(31, 43, 40, 0.18);
    border-radius: 999px;
}

@media (max-width: 1280px) {
    .workspace.panel-open .code-panel {
        width: min(42vw, 460px);
        min-width: 320px;
    }

    .features-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1100px) {
    .app-container {
        padding: 12px;
        gap: 12px;
    }

    .sidebar {
        width: 272px;
    }

    .workspace.panel-open .code-panel {
        position: absolute;
        top: 74px;
        right: 12px;
        bottom: 12px;
        width: min(48vw, 420px);
        min-width: 300px;
        z-index: 30;
        background: rgba(255, 255, 255, 0.98);
    }

    .workspace {
        padding: 12px;
        position: relative;
    }

    .chat-area {
        min-width: 0;
    }
}

@media (max-width: 800px) {
    body {
        overflow: auto;
    }

    .app-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .sidebar,
    .main-content {
        width: 100%;
        height: auto;
    }

    .sidebar {
        min-height: auto;
    }

    .main-content {
        min-height: calc(100vh - 180px);
    }

    .workspace {
        padding: 10px;
    }

    .chat-header {
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        justify-content: flex-start;
    }

    .features-grid,
    .suggestions,
    .premium-plans {
        grid-template-columns: 1fr;
    }

    .activity-panel {
        margin: 0 10px 10px;
    }
}
