/* TELEGRAM THEME — Green gradient bg, soft rounded, no monospace */
body.telegram-theme {
    --tg-blue: #2AABEE;
    --tg-blue-dark: #229ED9;
    --tg-blue-light: #E3F2FD;
    --tg-blue-pale: #F0F8FF;
    --tg-green-bubble: #EFFDDE;
    --tg-bg: #E8ECEF;
    --tg-white: #FFFFFF;
    --tg-text: #2C3E50;
    --tg-text-light: #7B8D9E;
    --tg-border: #E0E6EB;
    --tg-hover: #F4F6F8;
    --primary: #2AABEE; --primary-glow: rgba(42,171,238,0.15);
    --secondary: #66BB6A; --accent: #2AABEE;
    --bg-deep: var(--tg-bg); --surface: var(--tg-white); --surface-hover: var(--tg-hover);
    --border: var(--tg-border); --border-bright: var(--tg-blue);
    --text: var(--tg-text); --text-dim: var(--tg-text-light); --text-bright: #1A1A1A;
    --success: #4CAF50; --error: #E53935; --think: #2AABEE; --tool: #7C4DFF;
    --radius: 18px; --radius-sm: 12px;
    --mono: 'Inter', sans-serif;
}

/* Kill all glow/bg effects */
body.telegram-theme .bg-overlay,
body.telegram-theme .bg-layer { display: none !important; }
body.telegram-theme * { text-shadow: none !important; }

/* GLOBAL: override monospace everywhere */
body.telegram-theme .msg-meta,
body.telegram-theme .meta-tag,
body.telegram-theme .ci-meta,
body.telegram-theme .cw-aliases,
body.telegram-theme .cw-state-row .val,
body.telegram-theme .cw-session-meta,
body.telegram-theme .fsize,
body.telegram-theme .header-model,
body.telegram-theme #header-model-label,
body.telegram-theme .gw-notes-status,
body.telegram-theme .id-status,
body.telegram-theme .thinking-elapsed,
body.telegram-theme .log-line,
body.telegram-theme .section-title,
body.telegram-theme .cw-count,
body.telegram-theme .cw-section-title,
body.telegram-theme #header-abort-btn,
body.telegram-theme #identity-toggle-btn,
body.telegram-theme #theme-toggle-btn {
    font-family: 'Inter', sans-serif !important;
}

/* LEFT SIDEBAR */
body.telegram-theme .sidebar {
    background: var(--tg-white); border-right: 1px solid var(--tg-border);
    backdrop-filter: none; -webkit-backdrop-filter: none;
}
body.telegram-theme .sidebar-header {
    background: var(--tg-blue); border-bottom: none; padding: 18px 16px 16px;
}
body.telegram-theme .logo-text { color: #fff; }
body.telegram-theme .logo-sub { color: rgba(255,255,255,0.75); }
body.telegram-theme .logo-icon { background: rgba(255,255,255,0.2); box-shadow: none; animation: none; }

body.telegram-theme .client-item-inbox {
    background: rgba(255,255,255,0.15) !important; border-color: rgba(255,255,255,0.25) !important; border-radius: 14px;
}
body.telegram-theme .client-item-inbox .ci-name { color: #fff !important; }
body.telegram-theme .client-item-inbox .ci-meta { color: rgba(255,255,255,0.7) !important; }
body.telegram-theme .client-item-inbox.active { background: rgba(255,255,255,0.3) !important; }

body.telegram-theme .client-search {
    background: var(--tg-hover); border: 1px solid var(--tg-border); border-radius: 22px;
    color: var(--tg-text); padding: 10px 16px; font-size: 14px;
}
body.telegram-theme .client-search:focus { border-color: var(--tg-blue); box-shadow: 0 0 0 3px rgba(42,171,238,0.12); }
body.telegram-theme .client-search::placeholder { color: var(--tg-text-light); }
body.telegram-theme .btn-new-client { background: var(--tg-blue); border-radius: 22px; }

body.telegram-theme .section-title {
    color: var(--tg-blue); font-weight: 600; font-size: 11px; letter-spacing: 1px;
}
body.telegram-theme .client-item {
    border-radius: 14px; padding: 12px 14px; margin-bottom: 3px; border: none;
}
body.telegram-theme .client-item:hover { background: var(--tg-hover); }
body.telegram-theme .client-item.active { background: var(--tg-blue) !important; border-color: transparent; }
body.telegram-theme .client-item.active .ci-name { color: #fff !important; }
body.telegram-theme .client-item.active .ci-meta { color: rgba(255,255,255,0.7) !important; }
body.telegram-theme .client-item.active::before { display: none; }
body.telegram-theme .client-item .ci-name { color: var(--tg-text); font-weight: 600; font-size: 14px; }
body.telegram-theme .client-item .ci-meta { color: var(--tg-text-light); font-size: 12px; }

/* HEADER — Telegram blue bar */
body.telegram-theme .chat-header { background: var(--tg-blue); border-bottom: none; backdrop-filter: none; }
body.telegram-theme .header-title { color: #fff; font-weight: 600; font-size: 15px; }
body.telegram-theme .status-dot { background: #4CAF50; box-shadow: 0 0 6px rgba(76,175,80,0.5); }
body.telegram-theme .header-client {
    background: rgba(255,255,255,0.2) !important; border: 1px solid rgba(255,255,255,0.3) !important;
    color: #fff !important; border-radius: 22px; font-size: 13px;
}
body.telegram-theme #identity-toggle-btn,
body.telegram-theme #theme-toggle-btn {
    background: rgba(255,255,255,0.15) !important; border: 1px solid rgba(255,255,255,0.25) !important;
    color: #fff !important; border-radius: 22px !important; font-size: 12px !important;
}
body.telegram-theme #identity-toggle-btn:hover,
body.telegram-theme #theme-toggle-btn:hover { background: rgba(255,255,255,0.25) !important; }
body.telegram-theme #header-abort-btn {
    background: rgba(255,80,80,0.25) !important; border: 1px solid rgba(255,100,100,0.5) !important;
    color: #fff !important; border-radius: 22px !important;
}
body.telegram-theme .header-model {
    background: rgba(255,255,255,0.15) !important; border: 1px solid rgba(255,255,255,0.25) !important;
    color: #fff !important; border-radius: 22px; font-size: 12px;
}
body.telegram-theme .model-dropdown {
    border-radius: 16px; background: var(--tg-white); border: 1px solid var(--tg-border);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

/* ============================================================
   CHAT AREA — GREEN GRADIENT + WAVE PATTERN (like Telegram)
   ============================================================ */
body.telegram-theme .main {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400' viewBox='0 0 400 400'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0%25' y1='0%25' x2='100%25' y2='100%25'%3E%3Cstop offset='0%25' stop-color='%23A8D8B9' stop-opacity='0.12'/%3E%3Cstop offset='100%25' stop-color='%2390C4A8' stop-opacity='0.08'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0 120 Q100 80 200 120 T400 120 V0 H0Z' fill='url(%23g)'/%3E%3Cpath d='M0 200 Q80 170 160 200 T320 190 T400 200 V160 Q320 150 240 170 T80 160 T0 170Z' fill='rgba(120,180,140,0.05)'/%3E%3Cpath d='M0 300 Q120 260 240 290 T400 280 V240 Q300 250 200 240 T0 260Z' fill='rgba(100,170,130,0.04)'/%3E%3Ccircle cx='50' cy='50' r='4' fill='rgba(120,180,140,0.06)'/%3E%3Ccircle cx='350' cy='90' r='3' fill='rgba(120,180,140,0.05)'/%3E%3Ccircle cx='180' cy='350' r='5' fill='rgba(120,180,140,0.04)'/%3E%3Ccircle cx='300' cy='300' r='3' fill='rgba(120,180,140,0.05)'/%3E%3C/svg%3E"),
        linear-gradient(165deg,
            #B5D8C4 0%,
            #A8D4B8 15%,
            #9ECFAF 30%,
            #96C9A6 50%,
            #8FC3A0 70%,
            #88BF9A 85%,
            #7FB893 100%
        ) !important;
    background-size: 400px 400px, cover !important;
}

body.telegram-theme .chat-messages { padding: 24px 50px; }

/* MESSAGE BUBBLES */
body.telegram-theme .msg { gap: 10px; }
body.telegram-theme .msg-agent .msg-content {
    background: var(--tg-white); border: none;
    border-radius: 20px 20px 20px 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    color: var(--tg-text); padding: 14px 18px; font-size: 15px; line-height: 1.6;
}
body.telegram-theme .msg-user .msg-content {
    background: var(--tg-green-bubble); border: none;
    border-radius: 20px 20px 6px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    color: var(--tg-text); padding: 14px 18px; font-size: 15px; line-height: 1.6;
}
body.telegram-theme .msg-avatar { border-radius: 50% !important; width: 38px; height: 38px; }
body.telegram-theme .msg-agent .msg-avatar { background: linear-gradient(135deg, var(--tg-blue), var(--tg-blue-dark)); box-shadow: none; }
body.telegram-theme .msg-user .msg-avatar { background: linear-gradient(135deg, #66BB6A, #43A047); }

body.telegram-theme .msg-content strong { color: var(--tg-blue); }
body.telegram-theme .msg-content code { background: rgba(42,171,238,0.08); color: var(--tg-blue-dark); border-radius: 6px; font-family: 'JetBrains Mono', monospace; }
body.telegram-theme .msg-content pre {
    background: #F5F7F9; border: 1px solid var(--tg-border); border-radius: 14px;
    color: var(--tg-text); font-family: 'JetBrains Mono', monospace;
}
body.telegram-theme .msg-content pre code { color: var(--tg-text); font-family: 'JetBrains Mono', monospace; }
body.telegram-theme .msg-content a { color: var(--tg-blue); }

body.telegram-theme .msg-meta { color: var(--tg-text-light); font-size: 11px; }
body.telegram-theme .meta-tag {
    background: rgba(42,171,238,0.08); border: 1px solid rgba(42,171,238,0.15);
    color: var(--tg-blue); border-radius: 12px; font-size: 11px;
}

/* THINKING PANEL */
body.telegram-theme .thinking-box {
    background: var(--tg-white); border: none; border-radius: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08); backdrop-filter: none;
}
body.telegram-theme .thinking-header {
    background: var(--tg-blue-pale); border-bottom: 1px solid var(--tg-border);
    border-radius: 20px 20px 0 0; color: var(--tg-blue);
}
body.telegram-theme .thinking-spinner { border-color: rgba(42,171,238,0.2); border-top-color: var(--tg-blue); }
body.telegram-theme .thinking-logs { color: var(--tg-text-light); font-size: 12px; }
body.telegram-theme .thinking-stop-btn { border-radius: 18px; }

/* INPUT BAR */
body.telegram-theme .chat-input-wrap { padding: 14px 50px 22px; }
body.telegram-theme .chat-input-container {
    background: var(--tg-white); border: none; border-radius: 26px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08); backdrop-filter: none;
}
body.telegram-theme .chat-input-container:focus-within { box-shadow: 0 3px 16px rgba(42,171,238,0.12); }
body.telegram-theme .chat-input textarea { color: var(--tg-text); font-size: 15px; font-family: 'Inter', sans-serif; }
body.telegram-theme .chat-input textarea::placeholder { color: var(--tg-text-light); }

body.telegram-theme .send-btn {
    background: var(--tg-blue) !important; border-radius: 50% !important;
    width: 44px; height: 44px; box-shadow: 0 2px 10px rgba(42,171,238,0.3);
}
body.telegram-theme .send-btn:hover { background: var(--tg-blue-dark) !important; box-shadow: 0 3px 14px rgba(42,171,238,0.4) !important; }
body.telegram-theme .send-btn:disabled { background: #B0BEC5 !important; box-shadow: none !important; }
body.telegram-theme .send-btn.stop-mode { background: #E53935 !important; box-shadow: 0 2px 10px rgba(229,57,53,0.3) !important; }

body.telegram-theme .attach-btn { background: transparent; border: none; color: var(--tg-blue); border-radius: 50%; }
body.telegram-theme .attach-btn:hover { background: var(--tg-blue-light); color: var(--tg-blue-dark); }
body.telegram-theme .attach-chip { background: var(--tg-blue-light); border: 1px solid rgba(42,171,238,0.2); border-radius: 18px; color: var(--tg-text); }

/* RIGHT SIDEBAR */
body.telegram-theme .sidebar-right {
    background: var(--tg-white); border-left: 1px solid var(--tg-border);
    backdrop-filter: none; -webkit-backdrop-filter: none;
}
body.telegram-theme .cw-header { background: linear-gradient(180deg, var(--tg-blue-pale), var(--tg-white)); border-bottom: 1px solid var(--tg-border); padding: 18px 16px; }
body.telegram-theme .cw-name { color: var(--tg-text); font-size: 16px; }
body.telegram-theme .cw-name .cw-name-dot { background: var(--tg-blue); box-shadow: 0 0 6px rgba(42,171,238,0.4); }
body.telegram-theme .cw-aliases { color: var(--tg-text-light); font-size: 12px; }

body.telegram-theme .cw-section { border-bottom: 1px solid var(--tg-border); padding: 10px 12px; }
body.telegram-theme .cw-section-title {
    color: var(--tg-blue); font-weight: 600; font-size: 13px; opacity: 1 !important;
    text-transform: none; letter-spacing: 0;
}
body.telegram-theme .cw-section-title.collapsible:hover { background: var(--tg-blue-pale); border-radius: 10px; }
body.telegram-theme .cw-tag { background: var(--tg-blue-light); color: var(--tg-blue); border-radius: 12px; font-size: 12px; }
body.telegram-theme .cw-state-row .key { color: var(--tg-text-light); font-size: 13px; }
body.telegram-theme .cw-state-row .val { color: var(--tg-text); font-size: 13px; }

body.telegram-theme .cw-file { border-radius: 14px; border: 1px solid var(--tg-border); background: var(--tg-white); padding: 10px 12px; }
body.telegram-theme .cw-file:hover { border-color: var(--tg-blue); background: var(--tg-blue-pale); }
body.telegram-theme .cw-file .fname { font-size: 13px; color: var(--tg-text); }
body.telegram-theme .cw-file .fsize { font-size: 11px; color: var(--tg-text-light); }
body.telegram-theme .cw-add-file-btn { background: var(--tg-blue-light); color: var(--tg-blue); border-radius: 50%; }
body.telegram-theme .cw-add-file-btn:hover { background: var(--tg-blue); color: #fff; }

/* GENERAL WORKSPACE */
body.telegram-theme .gw-header { background: var(--tg-blue-pale); padding: 18px 16px; }
body.telegram-theme .gw-title { color: var(--tg-blue); font-size: 16px; font-weight: 600; }
body.telegram-theme .gw-sub { color: var(--tg-text-light); font-size: 13px; }
body.telegram-theme .gw-notes-textarea {
    background: var(--tg-hover); border: 1px solid var(--tg-border); color: var(--tg-text);
    border-radius: 14px; font-family: 'Inter', sans-serif; font-size: 14px;
}
body.telegram-theme .gw-notes-textarea:focus { border-color: var(--tg-blue); box-shadow: 0 0 0 3px rgba(42,171,238,0.1); }
body.telegram-theme .gw-notes-status { font-size: 12px; }

body.telegram-theme .cw-channel-row { border-radius: 10px; padding: 8px; }
body.telegram-theme .cw-channel-badge { border-radius: 12px; font-size: 11px; }
body.telegram-theme .cw-channel-name { font-size: 13px; }

/* WELCOME */
body.telegram-theme .welcome-title { color: var(--tg-text); font-size: 28px; }
body.telegram-theme .welcome-sub { color: var(--tg-text-light); font-size: 15px; }
body.telegram-theme .welcome-brain { animation: none; }
body.telegram-theme .chip { background: var(--tg-white); border: 1px solid var(--tg-border); color: var(--tg-text); border-radius: 22px; font-size: 14px; padding: 10px 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
body.telegram-theme .chip:hover { background: var(--tg-blue); color: #fff; border-color: var(--tg-blue); }

/* MODALS */
body.telegram-theme .modal { background: var(--tg-white); border: none; border-radius: 22px; box-shadow: 0 8px 40px rgba(0,0,0,0.12); }
body.telegram-theme .modal-header { background: var(--tg-blue-pale); border-bottom: 1px solid var(--tg-border); border-radius: 22px 22px 0 0; }
body.telegram-theme .modal-title { color: var(--tg-blue); font-size: 15px; }
body.telegram-theme .modal-close { background: var(--tg-hover); border-radius: 50%; color: var(--tg-text-light); }
body.telegram-theme .modal-close:hover { background: var(--tg-blue-light); color: var(--tg-blue); }
body.telegram-theme .modal-body { color: var(--tg-text); font-size: 14px; }

body.telegram-theme .nc-card { background: var(--tg-white); border: none; border-radius: 22px; box-shadow: 0 8px 40px rgba(0,0,0,0.12); }
body.telegram-theme .nc-field input, body.telegram-theme .nc-field textarea {
    background: var(--tg-hover); border: 1px solid var(--tg-border); border-radius: 14px;
    color: var(--tg-text); font-size: 14px; font-family: 'Inter', sans-serif;
}
body.telegram-theme .nc-field input:focus, body.telegram-theme .nc-field textarea:focus { border-color: var(--tg-blue); box-shadow: 0 0 0 3px rgba(42,171,238,0.12); }
body.telegram-theme .nc-btn { border-radius: 14px; background: var(--tg-hover); border: 1px solid var(--tg-border); color: var(--tg-text); font-size: 14px; }
body.telegram-theme .nc-btn:hover { background: var(--tg-blue-light); color: var(--tg-blue); }
body.telegram-theme .nc-btn-primary { background: var(--tg-blue) !important; color: #fff !important; border: none !important; border-radius: 14px; }
body.telegram-theme .nc-btn-primary:hover { background: var(--tg-blue-dark) !important; }

/* IDENTITY PANEL */
body.telegram-theme .identity-panel { background: var(--tg-white); }
body.telegram-theme .id-header { background: var(--tg-blue-pale); border-bottom: 1px solid var(--tg-border); }
body.telegram-theme .id-header h2 { color: var(--tg-blue); }
body.telegram-theme .id-sub { color: var(--tg-text-light); }
body.telegram-theme .id-field input, body.telegram-theme .id-field textarea, body.telegram-theme .id-field select {
    background: var(--tg-hover); border: 1px solid var(--tg-border); color: var(--tg-text);
    border-radius: 14px; font-family: 'Inter', sans-serif; font-size: 14px;
}
body.telegram-theme .id-field input:focus, body.telegram-theme .id-field textarea:focus { border-color: var(--tg-blue); box-shadow: 0 0 0 3px rgba(42,171,238,0.12); }
body.telegram-theme .id-field label { color: var(--tg-text); font-size: 13px; }
body.telegram-theme .id-btn { border-radius: 14px; font-size: 14px; }
body.telegram-theme .id-btn-primary { background: var(--tg-blue) !important; border: none; border-radius: 14px; }

/* SCROLLBARS */
body.telegram-theme ::-webkit-scrollbar { width: 5px; }
body.telegram-theme ::-webkit-scrollbar-track { background: transparent; }
body.telegram-theme ::-webkit-scrollbar-thumb { background: rgba(42,171,238,0.2); border-radius: 10px; }
body.telegram-theme ::-webkit-scrollbar-thumb:hover { background: rgba(42,171,238,0.35); }

/* LOGS */
body.telegram-theme .log-think { color: var(--tg-blue); }
body.telegram-theme .log-tool { color: #7C4DFF; }
body.telegram-theme .log-result { color: var(--tg-text-light); }
body.telegram-theme .log-done { color: #4CAF50; }
body.telegram-theme .log-error { color: #E53935; }

/* SESSION ITEMS */
body.telegram-theme .cw-session { border-radius: 12px; padding: 10px 12px; }
body.telegram-theme .cw-session:hover { background: var(--tg-hover); }
body.telegram-theme .cw-session-msg { font-size: 13px; color: var(--tg-text); }
body.telegram-theme .cw-session-meta { font-size: 11px; color: var(--tg-text-light); }

/* MISC */
body.telegram-theme .drop-overlay { background: rgba(255,255,255,0.92); }
body.telegram-theme .drop-text { color: var(--tg-blue); font-size: 20px; }
body.telegram-theme .drop-sub { color: var(--tg-text-light); }
body.telegram-theme .switch-banner { background: var(--tg-blue-light); border-left: 3px solid var(--tg-blue); border-radius: 14px; color: var(--tg-text); }
body.telegram-theme .cw-log-event { font-size: 12px; color: var(--tg-text); padding: 6px 0; }
