* {
    box-sizing: border-box;
}

:root {
    --bg: #07111f;
    --panel: rgba(12, 20, 36, 0.78);
    --border: rgba(255, 255, 255, 0.10);
    --text: #edf2ff;
    --muted: #9ca8c3;
    --accent: #7c5cff;
    --accent-2: #22c55e;
    --accent-3: #38bdf8;
    --bot: rgba(27, 38, 59, 0.9);
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: Inter, Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(124, 92, 255, 0.22), transparent 34%),
        radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.18), transparent 25%),
        linear-gradient(180deg, #06101c 0%, #0a1322 48%, #09101d 100%);
    color: var(--text);
    overflow-x: hidden;
}

body { padding: 24px; }

.bg-orb {
    position: fixed;
    border-radius: 999px;
    filter: blur(80px);
    opacity: 0.34;
    pointer-events: none;
    animation: floatOrb 9s ease-in-out infinite;
}

.orb-1 {
    width: 260px; height: 260px; background: rgba(124, 92, 255, 0.55); top: 6%; left: -40px;
}
.orb-2 {
    width: 300px; height: 300px; background: rgba(56, 189, 248, 0.35); right: -70px; bottom: 10%; animation-delay: 1.2s;
}
@keyframes floatOrb {
    0%,100% { transform: translateY(0px) translateX(0px); }
    50% { transform: translateY(-14px) translateX(8px); }
}

.app-shell {
    position: relative;
    z-index: 1;
    max-width: 1380px;
    margin: 0 auto;
    min-height: calc(100vh - 48px);
    display: grid;
    grid-template-columns: 330px 1fr;
    gap: 24px;
}

.sidebar,
.chat-panel {
    background: var(--panel);
    backdrop-filter: blur(22px);
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.sidebar {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

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

.brand-badge {
    width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center;
    font-weight: 800; font-size: 21px; color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-3));
    box-shadow: 0 18px 30px rgba(124, 92, 255, 0.26);
}

.brand h1 { margin: 0; font-size: 22px; }
.brand p, .footer-note, .chat-header p, .credit-note { margin: 4px 0 0; color: var(--muted); }

.sidebar-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 18px;
}

.intro-card {
    background: linear-gradient(180deg, rgba(124, 92, 255, 0.10), rgba(56, 189, 248, 0.05));
}

.mini-badge {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(124, 92, 255, 0.18);
    color: #dcd3ff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .3px;
    margin-bottom: 10px;
}

.sidebar-card h3 { margin: 0 0 12px; font-size: 16px; }
.sidebar-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.sidebar-card ul { margin: 0; padding-left: 18px; color: var(--muted); }
.sidebar-card li + li { margin-top: 8px; }

.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.suggestion, .secondary-btn, .primary-btn, .ghost-btn, .icon-btn {
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.suggestion:hover, .secondary-btn:hover, .primary-btn:hover, .ghost-btn:hover, .icon-btn:hover {
    transform: translateY(-1px);
}

.suggestion {
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255,255,255,0.05);
    color: var(--text);
    border: 1px solid var(--border);
}

.suggestion:hover { background: rgba(124, 92, 255, 0.12); }

.secondary-btn {
    margin-top: auto;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255,255,255,0.06);
    color: var(--text);
    border: 1px solid var(--border);
}

.sidebar-footer {
    margin-top: 6px;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

.chat-panel {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 48px);
    overflow: hidden;
}

.chat-header {
    padding: 22px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent);
}

.chat-header h2 { margin: 0; font-size: 26px; }

.header-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    color: var(--text);
    border: 1px solid var(--border);
}

.token-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    color: var(--muted);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.token-icon {
    font-size: 14px;
    opacity: 0.8;
}

.status-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--accent-2);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 28px 24px 12px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    max-width: 82%;
    animation: slideUp .22s ease;
}

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

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

.avatar {
    flex: 0 0 42px;
    width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
    font-size: 12px; font-weight: 800; color: white;
    background: linear-gradient(135deg, var(--accent), var(--accent-3));
    box-shadow: 0 10px 20px rgba(124, 92, 255, 0.18);
}

.message.user .avatar {
    background: linear-gradient(135deg, #00b894, #00cec9);
}

.bubble {
    padding: 15px 17px;
    border-radius: 20px;
    background: var(--bot);
    border: 1px solid var(--border);
    line-height: 1.58;
}

.message.user .bubble {
    background: linear-gradient(135deg, var(--accent), #4f8cff);
    border: none;
}

.bubble p { margin: 0; }
.bubble p + p { margin-top: 10px; }

.typing {
    display: flex;
    gap: 12px;
    padding: 0 24px 18px;
    align-items: center;
}

.typing-bubble {
    display: inline-flex;
    gap: 6px;
    padding: 14px 16px;
    align-items: center;
}

.typing-bubble span {
    width: 8px; height: 8px; border-radius: 50%;
    background: #c4d0ea;
    animation: pulse 1s infinite ease-in-out;
}
.typing-bubble span:nth-child(2) { animation-delay: .15s; }
.typing-bubble span:nth-child(3) { animation-delay: .3s; }

@keyframes pulse {
    0%, 100% { transform: translateY(0); opacity: .5; }
    50% { transform: translateY(-3px); opacity: 1; }
}

.composer {
    padding: 18px 24px 8px;
    border-top: 1px solid var(--border);
    background: rgba(16, 24, 39, 0.72);
}

.composer textarea, .modal-body input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
    font: inherit;
    outline: none;
}

.composer textarea {
    resize: none;
    min-height: 56px;
    max-height: 180px;
}

.composer-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}

.primary-btn, .ghost-btn, .full-btn {
    padding: 12px 16px;
    border-radius: 14px;
    font-weight: 700;
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent), #4f8cff);
    color: white;
    box-shadow: 0 16px 30px rgba(124, 92, 255, 0.20);
}

.ghost-btn {
    background: rgba(255,255,255,0.06);
    color: var(--text);
    border: 1px solid var(--border);
}

.header-email-btn {
    white-space: nowrap;
}

.full-btn { width: 100%; margin-top: 14px; }

.hidden { display: none !important; }

.footer-note, .credit-note {
    padding: 0 24px 18px;
    font-size: 13px;
}

.credit-note { padding-top: 0; opacity: .9; }

.modal {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 24, 0.65);
    display: grid;
    place-items: center;
    padding: 24px;
    z-index: 20;
}

.modal-card {
    width: min(520px, 100%);
    background: #0f172a;
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.modal-header, .modal-body { padding: 18px 20px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; }
.icon-btn {
    background: transparent;
    color: var(--text);
    font-size: 26px;
    line-height: 1;
}

.modal-body label {
    display: block;
    margin: 8px 0 8px;
    color: var(--muted);
    font-size: 14px;
}

.email-feedback {
    margin-top: 12px;
    color: var(--muted);
    min-height: 20px;
    white-space: pre-wrap;
}

@media (max-width: 980px) {
    body { padding: 14px; }
    .app-shell { grid-template-columns: 1fr; min-height: auto; }
    .sidebar { order: 2; }
    .chat-panel { min-height: 70vh; }
    .message { max-width: 100%; }
    .composer-actions { flex-direction: column; }
}