:root {
    --bg-base: #0c0d12;
    --bg-surface: #14161f;
    --bg-elevated: #1b1e2c;
    --bg-input: #181b26;
    --border-subtle: #242838;
    --border-focus: #3b82f6;
    
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.35);
    --cyan-glow: #25f4ee;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;

    --font-sans: 'Cairo', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 14px;
}

/* APP LAYOUT */
.app-layout {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* SIDEBAR LEFT */
.sidebar-left {
    width: 270px;
    height: 100%;
    background-color: var(--bg-surface);
    border-left: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    height: auto;
    min-height: 64px;
    padding-top: max(env(safe-area-inset-top, 0px), 46px);
    padding-bottom: 12px;
    padding-left: 16px;
    padding-right: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 15px;
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.brand-name {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    letter-spacing: -0.3px;
}

.btn-new-chat {
    margin: 12px 14px;
    padding: 10px 14px;
    background-color: #1e2233;
    border: 1px solid var(--border-subtle);
    border-radius: 9px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-new-chat:hover, .btn-new-chat:active {
    background-color: #272d42;
    border-color: #3b82f6;
}

.nav-links {
    padding: 0 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 7px;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.04);
    color: #fff;
}

.sidebar-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 6px 14px;
}

.section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 8px 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-list, .project-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-item, .project-item {
    padding: 8px 10px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12.5px;
    transition: all 0.15s;
}

.chat-item:hover, .chat-item.active, .project-item:hover {
    background-color: #1e2233;
    color: #fff;
}

.chat-item.active {
    border-right: 3px solid var(--accent);
}

.chat-item-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.chat-item-time {
    font-size: 10px;
    color: var(--text-dim);
}

.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--border-subtle);
}

.footer-btn {
    width: 100%;
    padding: 9px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12.5px;
}

.footer-btn:hover {
    background-color: #1a1e2d;
    color: #fff;
}

/* MAIN CHAT CANVAS */
.chat-main {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--bg-base);
    overflow: hidden;
}

/* TOP APP BAR - SAFE AREA AWARE FOR IPHONE DYNAMIC ISLAND & NOTCH */
.chat-header {
    height: auto;
    min-height: 64px;
    padding-top: max(env(safe-area-inset-top, 0px), 46px);
    padding-bottom: 12px;
    padding-left: 16px;
    padding-right: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(12, 13, 18, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 10;
}

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

.chat-title-box {
    display: flex;
    flex-direction: column;
}

.chat-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.chat-status-pill {
    font-size: 10.5px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #10b981;
    box-shadow: 0 0 6px #10b981;
}

/* MASCOT AVATAR */
.mascot-avatar {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mascot-glow {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 244, 238, 0.25) 0%, transparent 70%);
}

.icon-btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
}

.icon-btn-ghost:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.05);
}

.icon-btn-tiny {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 3px;
    font-size: 11px;
}

.icon-btn-tiny:hover {
    color: #fff;
}

/* CHAT CANVAS & MESSAGES */
.chat-canvas {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
}

.welcome-screen {
    margin: auto;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 0;
}

.welcome-mascot {
    position: relative;
    margin-bottom: 14px;
}

.big-robot-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.3) 0%, transparent 70%);
    animation: agPulse 2.4s infinite;
}

.welcome-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 6px;
}

.welcome-title span {
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.quick-prompts {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quick-prompt-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 12px 14px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: right;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-prompt-card:hover, .quick-prompt-card:active {
    border-color: #3b82f6;
    background-color: #1a1e2d;
    transform: translateY(-1px);
}

.quick-prompt-card i {
    font-size: 18px;
    color: #38bdf8;
    width: 24px;
}

.qp-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #fff;
}

.qp-desc {
    font-size: 11.5px;
    color: var(--text-dim);
}

/* MESSAGES LIST */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding-bottom: 20px;
}

.msg-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.msg-wrapper.user {
    align-items: flex-end;
}

.user-bubble {
    background-color: #1f2433;
    border: 1px solid #2d3448;
    color: #fff;
    padding: 10px 16px;
    border-radius: 16px 16px 4px 16px;
    max-width: 85%;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

.user-attached-img {
    max-width: 220px;
    max-height: 220px;
    border-radius: 10px;
    margin-bottom: 8px;
    border: 1px solid var(--border-subtle);
    display: block;
}

.msg-wrapper.assistant {
    align-items: flex-start;
}

.assistant-bubble {
    color: #f1f5f9;
    font-size: 14px;
    line-height: 1.7;
    max-width: 100%;
    word-break: break-word;
}

/* ANTIGRAVITY WORKING BADGE (1:1 with Antigravity Desktop Screenshot) */
.ag-working-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #4da3ff;
    letter-spacing: -0.2px;
    animation: agPulse 1.8s ease-in-out infinite;
    margin: 6px 0 10px;
}

.ag-working-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #38bdf8;
    box-shadow: 0 0 8px #38bdf8;
}

@keyframes agPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; text-shadow: 0 0 10px rgba(56, 189, 248, 0.7); }
}

/* ANTIGRAVITY STEP TREE (EXACT REPLICA OF DESKTOP IMAGE 1) */
.ag-steps-tree {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 8px 0 14px;
    font-size: 13px;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    direction: ltr; /* Desktop Antigravity renders action lines in LTR */
    text-align: left;
}

.ag-step-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
    padding: 3px 0;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
    flex-wrap: wrap;
}

.ag-step-row:hover {
    color: #f8fafc;
}

.ag-step-action {
    color: #64748b;
    font-weight: 500;
}

.ag-step-target {
    color: #cbd5e1;
    font-weight: 600;
    font-family: var(--font-mono);
    font-size: 12.5px;
}

.ag-step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.ag-step-icon.js-badge {
    background-color: #f7df1e;
    color: #000;
    font-weight: 800;
    font-size: 9px;
    padding: 1px 3px;
    border-radius: 2px;
    line-height: 1;
}

.ag-step-icon.html-badge {
    color: #f97316;
    font-weight: 700;
    font-size: 11px;
}

.ag-step-icon.css-badge {
    color: #38bdf8;
    font-weight: 700;
    font-size: 11px;
}

.ag-step-arrow {
    font-size: 10px;
    color: #475569;
    margin-left: 2px;
}

.ag-step-output {
    width: 100%;
    margin-top: 4px;
    padding: 8px 12px;
    background-color: #0b0d14;
    border: 1px solid #1e2235;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: #7dd3fc;
    white-space: pre-wrap;
    max-height: 180px;
    overflow-y: auto;
}

/* REAL-TIME TOOL EXECUTION BADGE (Files, Java, Commands, PM2) */
.tool-execution-card {
    background-color: #131622;
    border: 1px solid #252a3d;
    border-radius: 8px;
    margin: 8px 0;
    overflow: hidden;
    width: 100%;
    max-width: 620px;
    font-size: 12.5px;
}

.tool-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background-color: #181c2b;
    border-bottom: 1px solid #252a3d;
    cursor: pointer;
    font-family: var(--font-mono);
}

.tool-title-box {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.tool-badge-status {
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tool-badge-status.active {
    background-color: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.tool-badge-status.done {
    background-color: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.tool-body {
    padding: 10px 12px;
    background-color: #0d0f17;
    color: #cbd5e1;
    font-family: var(--font-mono);
    font-size: 11.5px;
    overflow-x: auto;
    max-height: 200px;
    white-space: pre-wrap;
}

/* Markdown rendered styles */
.assistant-bubble pre {
    background-color: #0e111a;
    border: 1px solid var(--border-subtle);
    border-radius: 9px;
    padding: 12px;
    margin: 10px 0;
    overflow-x: auto;
    direction: ltr;
    text-align: left;
}

.assistant-bubble code {
    font-family: var(--font-mono);
    font-size: 12.5px;
}

.assistant-bubble p {
    margin-bottom: 10px;
}

.assistant-bubble ul, .assistant-bubble ol {
    margin: 8px 18px 10px;
}

.assistant-bubble a {
    color: #38bdf8;
    text-decoration: none;
}

.assistant-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-dim);
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.action-btn:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.05);
}

/* BOTTOM INPUT CARD - SAFE AREA AWARE */
.chat-input-wrapper {
    padding-top: 8px;
    padding-left: 14px;
    padding-right: 14px;
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 24px);
    background: linear-gradient(to top, var(--bg-base) 80%, transparent);
}

.input-card {
    background-color: #171924;
    border: 1px solid #282c3f;
    border-radius: 14px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: border-color 0.2s;
}

.input-card:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.4);
}

/* Image preview chip */
.image-preview-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background-color: #12141d;
    border-radius: 8px;
    border: 1px solid #24293a;
}

.image-thumb-box {
    position: relative;
    width: 44px;
    height: 44px;
}

.image-thumb-box img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
}

.btn-remove-img {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.image-thumb-info {
    display: flex;
    flex-direction: column;
}

.img-name {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.img-status {
    font-size: 10.5px;
    color: #10b981;
}

.input-row-main {
    width: 100%;
}

#chatInput {
    width: 100%;
    background: transparent;
    border: none;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    outline: none;
    resize: none;
    max-height: 140px;
    min-height: 24px;
}

#chatInput::placeholder {
    color: var(--text-dim);
}

/* Antigravity Controls Row */
.input-bottom-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 4px;
}

.controls-left, .controls-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-attach {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.btn-attach:hover {
    background-color: #232738;
    color: #fff;
    border-color: #3b82f6;
}

/* MODEL SELECTOR PILL (MATCHING ANTIGRAVITY 1:1) */
.model-picker-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: transparent;
    padding: 4px 8px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12.5px;
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: all 0.15s;
}

.model-picker-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.model-badge-tag {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 4px;
    background-color: #232738;
    color: #94a3b8;
    font-weight: 500;
}

.mode-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 12px;
    background-color: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    font-size: 11.5px;
    font-weight: 600;
}

.icon-btn-tool {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 14px;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
}

.icon-btn-tool:hover {
    color: #fff;
}

/* MAIN ACTION BUTTON: SEND (BLUE ARROW) OR STOP (RED/WHITE SQUARE) */
.btn-action-main {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #2563eb;
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.btn-action-main:hover {
    background-color: #1d4ed8;
    transform: scale(1.05);
}

.btn-action-main.is-stop {
    background-color: #ef4444;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
    animation: stopPulse 1.5s infinite;
}

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

/* MODEL DROPDOWN MENU */
.model-dropdown-menu {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 290px;
    background-color: #141622;
    border: 1px solid #2c3144;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
    padding: 6px 0;
    z-index: 200;
    display: none;
    animation: dropIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(10px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.mdm-header {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-dim);
    padding: 6px 14px;
    text-transform: uppercase;
}

.mdm-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.mdm-item:hover {
    background-color: #1f2335;
}

.mdm-item.active {
    background-color: #1e2436;
}

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

.mdm-name {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
}

.mdm-tag {
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 4px;
    background-color: #24293a;
    color: #94a3b8;
}

.mdm-tag.notice {
    background-color: #262c3e;
    color: #60a5fa;
}

.mdm-tag.disabled {
    background-color: #1d202d;
    color: #64748b;
}

.mdm-check {
    font-size: 12px;
    color: #3b82f6;
    display: none;
}

.mdm-item.active .mdm-check {
    display: block;
}

.mdm-divider {
    height: 1px;
    background-color: #232738;
    margin: 6px 0;
}

/* RIGHT SIDEBAR (TOOLS & SERVER) */
.sidebar-right {
    width: 320px;
    height: 100%;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-right-header {
    height: auto;
    min-height: 64px;
    padding-top: max(env(safe-area-inset-top, 0px), 46px);
    padding-bottom: 12px;
    padding-left: 16px;
    padding-right: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
}

.sr-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.sr-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-subtle);
}

.sr-tab {
    flex: 1;
    padding: 10px 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12.5px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.sr-tab.active {
    color: #fff;
    border-bottom-color: var(--accent);
}

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

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

/* VPS CARDS */
.vps-card {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 14px;
}

.vps-card-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    margin-bottom: 10px;
}

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

.stat-box {
    background-color: #12141d;
    padding: 8px 10px;
    border-radius: 7px;
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 10.5px;
    color: var(--text-dim);
}

.stat-val {
    font-size: 13px;
    font-weight: 700;
    color: #38bdf8;
    margin-top: 2px;
}

.pm2-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 12px;
}

/* TERMINAL */
.term-box {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.term-header {
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.term-output {
    flex: 1;
    background-color: #0b0c10;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: #a5f3fc;
    overflow-y: auto;
    max-height: 380px;
    white-space: pre-wrap;
    direction: ltr;
    text-align: left;
}

.term-input-row {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.term-input-row input {
    flex: 1;
    background-color: #12141d;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 8px 10px;
    color: #fff;
    font-family: var(--font-mono);
    font-size: 12px;
    outline: none;
    direction: ltr;
}

.term-input-row button {
    padding: 0 12px;
    background-color: var(--accent);
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
}

/* MODAL */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal.active {
    display: flex;
}

.modal-card {
    width: 100%;
    max-width: 440px;
    background-color: #141724;
    border: 1px solid #2d3348;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
}

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

.modal-body {
    padding: 16px;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 90;
    display: none;
}

.overlay.active {
    display: block;
}

/* RESPONSIVE & MOBILE SPECIFIC */
@media (max-width: 768px) {
    .sidebar-left {
        position: fixed;
        right: 0;
        top: 0;
        transform: translateX(100%);
    }

    .sidebar-left.open {
        transform: translateX(0);
    }

    .sidebar-right {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
    }

    .sidebar-right.open {
        transform: translateX(0);
    }

    .model-dropdown-menu {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 84px;
    }
}

@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
}

/* Additional UI Enhancements for Multi-Conversation & Background Tasks */
.chat-running-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 9.5px;
    font-weight: 700;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    padding: 1px 6px;
    border-radius: 12px;
    letter-spacing: 0.2px;
}

.chat-running-pill .pulse-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: #38bdf8;
    box-shadow: 0 0 6px #38bdf8;
    animation: agPulse 1.2s infinite ease-in-out;
}

.chat-pin-btn {
    opacity: 0.35;
    transition: all 0.15s ease;
    cursor: pointer;
    font-size: 11px;
    padding: 3px;
}

.chat-pin-btn:hover {
    opacity: 1;
    color: #f59e0b;
}

.chat-pin-btn.pinned {
    opacity: 1;
    color: #f59e0b;
}

.chat-actions-group {
    display: flex;
    align-items: center;
    gap: 5px;
}
