:root {
    --bg-dark: #020617;
    --bg-sidebar: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.4);
    --accent-primary: #4285f4;
    --accent-secondary: #ec4899;
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-fill: rgba(255, 255, 255, 0.03);
    --neon-shadow: 0 10px 25px rgba(66, 133, 244, 0.15);
    --input-bg: #020617;
    --sidebar-width: 280px;
}

:root.light-theme {
    --bg-dark: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.8);
    --accent-primary: #4285f4;
    --accent-secondary: #ec4899;
    --text-main: #0f172a;
    --text-dim: #64748b;
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-fill: rgba(0, 0, 0, 0.02);
    --neon-shadow: 0 10px 25px rgba(66, 133, 244, 0.15);
    --input-bg: #f1f5f9;
}

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

body {
    font-family: 'Outfit', 'Inter', sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    height: 100dvh;
    display: flex;
    overflow: hidden;
}

/* ─── Theme Toggle (Fixed, auth page) ─── */
.theme-toggle-fixed {
    position: fixed;
    top: 1rem;
    right: 2rem;
    z-index: 9999;
}

/* ─── Sidebar ─── */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    z-index: 100;
    height: 100%;
}

.sidebar-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-close-btn {
    display: none; /* only visible on mobile */
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    font-size: 1.1rem;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sidebar-close-btn:hover {
    color: var(--accent-secondary);
    border-color: var(--accent-secondary);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2rem;
}

.logo-img {
    height: 22px;
    width: auto;
    object-fit: contain;
    transition: filter 0.3s ease;
}

html:not(.light-theme) .logo-img {
    filter: invert(1) hue-rotate(180deg);
}

.logo span {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
    line-height: 1;
    position: relative;
    top: -2px;
}

.new-chat-btn {
    width: 100%;
    padding: 0.75rem;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 2rem;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.new-chat-btn:hover {
    background: rgba(168, 85, 247, 0.18);
}

.nav-section {
    margin-bottom: 2rem;
    flex: 1;
    overflow-y: auto;
}

.nav-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-bottom: 1rem;
    font-weight: 600;
}

.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.8rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    gap: 8px;
    position: relative;
}

.session-item:hover,
.session-item.active {
    background: rgba(66, 133, 244, 0.1);
    color: var(--text-main);
}

.session-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.delete-session-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    padding: 0.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
}

.session-item:hover .delete-session-btn {
    opacity: 0.6;
}

.delete-session-btn:hover {
    opacity: 1 !important;
    color: var(--accent-secondary) !important;
    transform: scale(1.15);
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.sidebar-user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
}

.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-primary);
    display: grid;
    place-items: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-username {
    font-size: 0.9rem;
    font-weight: 600;
}

.sidebar-version {
    font-size: 0.7rem;
    color: var(--text-dim);
}

.logout-btn {
    width: 100%;
    padding: 0.6rem;
    background: rgba(236, 72, 153, 0.1);
    color: var(--accent-secondary);
    border: 1px solid rgba(236, 72, 153, 0.2);
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(236, 72, 153, 0.2);
}

/* Sidebar Backdrop Overlay */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 199;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

/* ─── Main Content ─── */
.app {
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* prevent flex overflow */
    position: relative;
    height: 100%;
}

/* ─── App Header ─── */
.app-header {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.header-breadcrumb {
    font-size: 0.9rem;
    color: var(--text-dim);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-breadcrumb-active {
    color: var(--text-main);
    font-weight: 600;
}

.header-property-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-left: auto;
}

.header-property-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
    white-space: nowrap;
}

.header-property-select {
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.4rem 0.8rem;
    border-radius: 10px;
    outline: none;
    font-size: 0.85rem;
    font-family: inherit;
    max-width: 220px;
}

.header-theme-btn {
    flex-shrink: 0;
}

/* Hamburger Menu Toggle Button (hidden on desktop) */
.menu-toggle-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 6px 8px;
    cursor: pointer;
    flex-shrink: 0;
}

.hamburger-line {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-main);
    border-radius: 2px;
    transition: all 0.3s;
}

/* ─── Chat Container ─── */
.chat-container {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 0; /* critical for flex shrink */
}

.message {
    max-width: 75%;
    padding: 1.15rem 1.4rem;
    border-radius: 20px;
    line-height: 1.6;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    word-break: break-word;
}

.user-message {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 8px 20px rgba(66, 133, 244, 0.2);
}

.ai-message {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-bottom-left-radius: 4px;
    backdrop-filter: blur(10px);
}

/* ─── Input Area ─── */
.input-area {
    padding: 1rem 1.5rem;
    background: linear-gradient(to top, var(--bg-dark), transparent);
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    align-items: center;
    backdrop-filter: blur(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-wrapper:focus-within {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 20px rgba(66, 133, 244, 0.15) !important;
}

textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 0.75rem;
    outline: none;
    resize: none;
    font-size: 1rem;
    font-family: inherit;
    min-width: 0;
}

.send-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    font-family: inherit;
    flex-shrink: 0;
    white-space: nowrap;
}

.send-btn:hover {
    transform: scale(1.05);
}

/* ═══════════════════════════════════════════════
   AUTH OVERLAY & COSMIC TECH GRID
   ═══════════════════════════════════════════════ */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    z-index: 1000;
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    overflow: hidden;
}

.auth-grid-overlay {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(var(--glass-border) 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: 0.6;
    pointer-events: none;
    z-index: 1;
}

.auth-hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 6rem 6rem 4rem 6rem;
    position: relative;
    overflow-y: auto;
    z-index: 2;
}

.auth-hero-content {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    z-index: 2;
    margin-top: 3.5rem;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    color: var(--text-dim);
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 2.5rem;
    z-index: 2;
}

/* Ambient Floating Glow Orbs */
.hero-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.35;
    pointer-events: none;
    z-index: 1;
}

.hero-orb-1 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(66, 133, 244, 0.25), transparent 70%);
    top: -100px;
    left: -100px;
    animation: float-orb 12s ease-in-out infinite;
}

.hero-orb-2 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.2), transparent 70%);
    bottom: -80px;
    right: 20%;
    animation: float-orb 15s ease-in-out infinite reverse;
}

.hero-orb-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(66, 133, 244, 0.15), transparent 70%);
    top: 40%;
    left: 45%;
    animation: float-orb 10s ease-in-out infinite;
}

@keyframes float-orb {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(40px, -30px) scale(1.05); }
    66% { transform: translate(-25px, 20px) scale(0.95); }
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.75); }
}

/* Premium Brand Badge */
.brand-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.9rem;
    background: rgba(66, 133, 244, 0.08);
    border: 1px solid rgba(66, 133, 244, 0.2);
    border-radius: 99px;
    color: var(--accent-primary);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-bottom: 1.5rem;
    width: fit-content;
    z-index: 2;
    box-shadow: 0 0 15px rgba(66, 133, 244, 0.05);
}

:root.light-theme .brand-badge {
    background: rgba(66, 133, 244, 0.06);
    border-color: rgba(66, 133, 244, 0.15);
}

/* High-Fidelity macOS Mockup Window */
.futuristic-mockup {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25);
    margin-bottom: 2.5rem;
    z-index: 2;
    width: 100%;
    transition: all 0.3s ease;
}

:root.light-theme .futuristic-mockup {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.06);
}

.mock-window-header {
    background: rgba(0, 0, 0, 0.15);
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

:root.light-theme .mock-window-header {
    background: rgba(0, 0, 0, 0.02);
}

.mock-dots {
    display: flex;
    gap: 6px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.dot-r { background: #ff5f56; }
.dot-y { background: #ffbd2e; }
.dot-g { background: #27c93f; }

.mock-title {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 600;
    margin-left: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mock-window-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Chat Bubbles inside Mockup */
.mock-bubble {
    padding: 0.95rem 1.25rem;
    border-radius: 16px;
    max-width: 85%;
    font-size: 0.85rem;
    line-height: 1.5;
}

.bubble-user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #ffffff;
    border-bottom-right-radius: 2px;
    box-shadow: 0 4px 15px rgba(66, 133, 244, 0.2);
}

.bubble-tag {
    font-size: 0.65rem;
    font-weight: 700;
    opacity: 0.85;
    display: block;
    margin-bottom: 0.25rem;
    letter-spacing: 0.05em;
}

.bubble-ai {
    align-self: flex-start;
    background: var(--glass-fill);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    border-bottom-left-radius: 2px;
}

.ai-badge-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 0.4rem;
}

.badge-spark {
    color: var(--accent-secondary);
    font-size: 0.85rem;
}

.badge-text {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: 0.05em;
}

/* Simulated Analytics Chart */
.mock-viz-card {
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-top: 0.85rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.viz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
}

.viz-info {
    display: flex;
    flex-direction: column;
}

.viz-metric {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-weight: 500;
}

.viz-val {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.trend-up {
    font-size: 0.75rem;
    color: #22c55e;
    font-weight: 600;
}

.viz-date {
    font-size: 0.7rem;
    color: var(--text-dim);
}

.viz-bars {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.viz-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bar-label {
    font-size: 0.7rem;
    width: 55px;
    color: var(--text-dim);
    font-weight: 500;
}

.bar-track {
    flex: 1;
    height: 6px;
    background: var(--glass-fill);
    border-radius: 3px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--text-dim);
    transition: width 1s ease-out;
}

.bar-pct {
    font-size: 0.7rem;
    width: 25px;
    text-align: right;
    color: var(--text-dim);
    font-weight: 600;
}

/* Typing Demo & Capability Preview Box */
.hero-demo-box {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    width: 100%;
    margin-bottom: 1rem;
    backdrop-filter: blur(10px);
    z-index: 2;
}

.typing-demo-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    font-family: 'Inter', monospace;
    min-height: 1.5rem;
    display: inline-block;
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
    display: inline-block;
    box-shadow: 0 0 8px #22c55e;
    animation: pulse-dot 1.5s infinite;
}

.demo-tag {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 0.08em;
}

/* Right Side Form Panel & Glassmorphic Container */
.auth-form-panel {
    background: linear-gradient(180deg, var(--bg-sidebar), var(--bg-dark));
    border-left: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 4rem 4rem 4rem;
    position: relative;
    z-index: 2;
}

.auth-glass-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
    background: linear-gradient(135deg, var(--text-main) 40%, var(--text-dim));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 2rem;
}

.auth-switch-text {
    font-size: 0.85rem;
    color: var(--text-dim);
    text-align: center;
    margin-top: 1.5rem;
}

.auth-switch-text a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.auth-switch-text a:hover {
    color: var(--accent-secondary);
}

/* Form Signup Row layout */
.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.form-group-half {
    flex: 1;
}

.form-group-half label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.form-group-half input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    color: var(--text-main);
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-group-half input:focus {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.15) !important;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.form-group input,
#signupForm input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    color: var(--text-main);
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-group input:focus,
#signupForm input:focus {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.15) !important;
    background: var(--input-bg);
}

:root.light-theme .form-group input:focus,
:root.light-theme #signupForm input:focus {
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.15) !important;
}

.auth-btn {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(66, 133, 244, 0.25);
    font-family: inherit;
    font-size: 1rem;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 133, 244, 0.4);
    filter: brightness(1.05);
}

.auth-btn:active {
    transform: translateY(-0.5px);
}

/* ═══════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════ */
#toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: calc(100vw - 2rem);
}

.toast {
    padding: 1rem 1.5rem;
    background: var(--bg-sidebar);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInRight 0.3s ease-out;
}

.toast.success { border-color: #22c55e; color: #22c55e; }
.toast.error { border-color: var(--accent-secondary); color: var(--accent-secondary); }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Password Strength Indicator */
.pw-strength { margin-top: 0.6rem; }

.pw-bar {
    width: 100%;
    height: 4px;
    background: var(--glass-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.pw-fill {
    height: 100%;
    width: 0;
    border-radius: 4px;
    transition: width 0.3s, background 0.3s;
}

.pw-rules {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.8rem;
}

.pw-rules span {
    font-size: 0.7rem;
    color: var(--text-dim);
    transition: color 0.2s;
}

/* ─── AI Message Content Styling ─── */
.ai-message table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.85rem;
}

.ai-message th {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 2px solid var(--glass-border);
    color: var(--accent-primary);
}

.ai-message td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
}

.ai-message pre {
    background: #000;
    color: #f8fafc;
    padding: 1rem;
    border-radius: 12px;
    overflow-x: auto;
    margin: 1rem 0;
}

:root.light-theme .ai-message pre {
    background: #1e293b;
}

/* Theme Toggle Icon Button */
.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    padding: 0.5rem;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

:root.light-theme .icon-btn {
    background: rgba(0, 0, 0, 0.03);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 6px;
    padding: 1rem 1.25rem !important;
    width: fit-content;
    align-items: center;
    border: 1px solid var(--accent-primary) !important;
    background: rgba(66, 133, 244, 0.05) !important;
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0% { border-color: var(--accent-primary); box-shadow: 0 0 0 0 rgba(66, 133, 244, 0.4); }
    70% { border-color: var(--accent-secondary); box-shadow: 0 0 0 10px rgba(66, 133, 244, 0); }
    100% { border-color: var(--accent-primary); box-shadow: 0 0 0 0 rgba(66, 133, 244, 0); }
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
    box-shadow: 0 0 10px rgba(66, 133, 244, 0.4);
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.3; }
    40% { transform: scale(1.2); opacity: 1; }
}

/* Suggestion Chips */
.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.suggestion-chip {
    background: rgba(66, 133, 244, 0.08);
    border: 1px solid rgba(66, 133, 244, 0.3);
    color: var(--accent-primary);
    padding: 0.45rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
    line-height: 1.4;
    font-family: inherit;
}

.suggestion-chip:hover {
    background: rgba(66, 133, 244, 0.18);
    border-color: var(--accent-primary);
    box-shadow: 0 0 12px rgba(66, 133, 244, 0.25);
    transform: translateY(-1px);
}

.suggestion-chip:active {
    transform: scale(0.97);
}

:root.light-theme .suggestion-chip {
    background: rgba(66, 133, 244, 0.06);
    border-color: rgba(66, 133, 244, 0.25);
    color: #7c3aed;
}

:root.light-theme .suggestion-chip:hover {
    background: rgba(66, 133, 244, 0.14);
    border-color: #7c3aed;
}

/* Custom Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(66, 133, 244, 0.2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(66, 133, 244, 0.4); }
:root.light-theme ::-webkit-scrollbar-thumb { background: rgba(66, 133, 244, 0.2); }
:root.light-theme ::-webkit-scrollbar-thumb:hover { background: rgba(66, 133, 244, 0.4); }

/* ═══════════════════════════════════════════════
   WELCOME DASHBOARD
   ═══════════════════════════════════════════════ */
.welcome-dashboard {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    animation: fadeIn 0.6s ease-out;
}

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

.welcome-header {
    text-align: center;
    margin-bottom: 0.5rem;
}

.welcome-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.85rem;
    background: rgba(66, 133, 244, 0.08);
    border: 1px solid rgba(66, 133, 244, 0.2);
    border-radius: 99px;
    color: var(--accent-primary);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-bottom: 1.25rem;
    box-shadow: 0 0 15px rgba(66, 133, 244, 0.08);
}

:root.light-theme .welcome-badge {
    background: rgba(66, 133, 244, 0.08);
    border-color: rgba(66, 133, 244, 0.2);
    color: var(--accent-primary);
}

.welcome-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-main) 30%, var(--text-dim));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-header p {
    color: var(--text-dim);
    font-size: 1.05rem;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

.welcome-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.action-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 1.5rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(15px);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.action-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.08), rgba(236, 72, 153, 0.03));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.action-card:hover::before { opacity: 1; }

.action-card:hover {
    transform: translateY(-4px);
    border-color: rgba(66, 133, 244, 0.3);
    box-shadow: var(--neon-shadow);
}

.action-card:active {
    transform: translateY(-1px) scale(0.99);
}

.action-icon {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    background: rgba(66, 133, 244, 0.08);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid rgba(66, 133, 244, 0.15);
    z-index: 1;
}

:root.light-theme .action-icon {
    background: rgba(66, 133, 244, 0.08);
    border-color: rgba(66, 133, 244, 0.15);
}

.action-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    z-index: 1;
}

.action-card p {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.5;
    margin-bottom: 1.25rem;
    z-index: 1;
}

.action-arrow {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    font-size: 1.2rem;
    color: var(--text-dim);
    transition: transform 0.3s ease, color 0.3s ease;
    z-index: 1;
}

.action-card:hover .action-arrow {
    transform: translateX(4px);
    color: var(--accent-primary);
}

/* ═══════════════════════════════════════════════
   CUSTOM DIALOG MODALS
   ═══════════════════════════════════════════════ */
.custom-dialog {
    border: none;
    background: transparent;
    padding: 0;
    overflow: visible;
    margin: auto;
    outline: none;
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), display 0.3s allow-discrete, overlay 0.3s allow-discrete;
}

.custom-dialog[open] { opacity: 1; transform: scale(1); }

@starting-style {
    .custom-dialog[open] { opacity: 0; transform: scale(0.92); }
}

.custom-dialog.is-closing {
    opacity: 0 !important;
    transform: scale(0.92) !important;
}

.custom-dialog-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: 24px;
    padding: 2.25rem;
    width: calc(100vw - 32px);
    max-width: 440px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4), var(--neon-shadow);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.custom-dialog-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.custom-dialog-icon {
    font-size: 1.65rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    filter: drop-shadow(0 2px 8px rgba(66, 133, 244, 0.3));
}

.custom-dialog-title {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.custom-dialog-body {
    font-size: 0.98rem;
    line-height: 1.6;
    color: var(--text-dim);
}

.custom-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 0.5rem;
}

.custom-dialog-btn {
    padding: 0.75rem 1.65rem;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    font-family: inherit;
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
}

.btn-cancel:hover {
    background: var(--glass-fill);
    border-color: var(--text-dim);
    color: var(--text-main);
    transform: translateY(-1px);
}

.btn-cancel:active { transform: scale(0.98); }

.btn-confirm {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(66, 133, 244, 0.25);
}

.btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 133, 244, 0.4);
    filter: brightness(1.05);
}

.btn-confirm:active { transform: scale(0.98); }

/* Beautiful custom backdrop */
.custom-dialog::backdrop {
    background-color: rgba(2, 6, 23, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    transition: background-color 0.3s ease, backdrop-filter 0.3s ease, display 0.3s allow-discrete, overlay 0.3s allow-discrete;
}

.custom-dialog[open]::backdrop {
    background-color: rgba(2, 6, 23, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

:root.light-theme .custom-dialog[open]::backdrop {
    background-color: rgba(15, 23, 42, 0.45);
}

@starting-style {
    .custom-dialog[open]::backdrop {
        background-color: rgba(2, 6, 23, 0);
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }
}

.custom-dialog.is-closing::backdrop {
    background-color: rgba(2, 6, 23, 0) !important;
    backdrop-filter: blur(0px) !important;
    -webkit-backdrop-filter: blur(0px) !important;
}

@media (prefers-reduced-motion: reduce) {
    .custom-dialog {
        transform: none !important;
        transition-duration: 0.1s !important;
    }
    .custom-dialog[open] {
        @starting-style { transform: none !important; }
    }
    .custom-dialog-btn { transition: none !important; transform: none !important; }
    .custom-dialog-btn:hover { transform: none !important; }
}

/* ═══════════════════════════════════════════════
   MERMAID & CHART.JS
   ═══════════════════════════════════════════════ */
.mermaid-container {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    margin: 1.25rem 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), var(--neon-shadow);
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 100%;
    overflow-x: auto;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.mermaid-container:hover {
    border-color: rgba(66, 133, 244, 0.3);
    box-shadow: 0 15px 35px rgba(66, 133, 244, 0.12), var(--neon-shadow);
}

.mermaid {
    width: 100%;
    display: flex;
    justify-content: center;
    background: transparent !important;
}

.mermaid svg {
    max-width: 100% !important;
    height: auto !important;
    font-family: 'Outfit', 'Inter', sans-serif !important;
}

.mermaid svg .label,
.mermaid svg text {
    font-family: 'Outfit', 'Inter', sans-serif !important;
    fill: var(--text-main) !important;
}

.mermaid-error-card {
    background: rgba(236, 72, 153, 0.08);
    border: 1px solid rgba(236, 72, 153, 0.3);
    color: var(--accent-secondary);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.chartjs-container {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.75rem;
    margin: 1.25rem 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), var(--neon-shadow);
    width: 100%;
    max-height: 380px;
    position: relative;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.chartjs-container:hover {
    border-color: rgba(66, 133, 244, 0.3);
    box-shadow: 0 15px 35px rgba(66, 133, 244, 0.12), var(--neon-shadow);
}

.chartjs-container canvas {
    width: 100% !important;
    height: 100% !important;
    max-height: 340px;
}

.chartjs-error-card {
    background: rgba(236, 72, 153, 0.08);
    border: 1px solid rgba(236, 72, 153, 0.3);
    color: var(--accent-secondary);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}


/* ═══════════════════════════════════════════════════════
   RESPONSIVE: TABLET (≤ 1100px)
   ═══════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
    .auth-overlay {
        grid-template-columns: 1.1fr 1fr;
    }

    .auth-hero {
        padding: 6rem 3rem 4rem 3rem;
    }

    .auth-form-panel {
        padding: 6rem 3rem 3rem 3rem;
    }
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE: SMALL TABLET / LARGE PHONE (≤ 968px)
   Auth goes single-column; App sidebar becomes drawer
   ═══════════════════════════════════════════════════════ */
@media (max-width: 968px) {
    /* AUTH OVERLAY: scrollable vertical stack */
    .auth-overlay {
        grid-template-columns: 1fr;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .auth-hero {
        padding: 5rem 2rem 2rem 2rem;
        flex: none;
        align-items: center;
        text-align: center;
        min-height: auto;
        overflow-y: visible;
    }

    .hero-title {
        font-size: 2.5rem;
        margin-top: 2rem;
    }

    .hero-desc {
        margin: 0 auto 2rem auto;
    }

    .brand-badge {
        margin-left: auto;
        margin-right: auto;
    }

    .auth-form-panel {
        padding: 2rem 2rem 4rem 2rem;
        border-left: none;
        border-top: 1px solid var(--glass-border);
        background: var(--bg-dark);
        flex: none;
        min-height: auto;
        align-items: flex-start;
    }

    .auth-glass-card {
        max-width: 500px;
        margin: 0 auto;
    }

    /* APP SIDEBAR: off-canvas drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 200;
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.3);
    }

    .sidebar-close-btn {
        display: flex;
    }

    .logo {
        margin-bottom: 1.5rem;
    }

    /* Show hamburger in header */
    .menu-toggle-btn {
        display: flex;
    }

    /* Hide breadcrumb on small screens to save space */
    .header-breadcrumb {
        display: none;
    }

    .header-property-group {
        margin-left: 0;
        flex: 1;
        min-width: 0;
    }

    .header-property-select {
        max-width: none;
        flex: 1;
        min-width: 0;
    }

    /* Chat sizing */
    .chat-container {
        padding: 1.25rem;
        gap: 1rem;
    }

    .message {
        max-width: 90%;
        padding: 0.9rem 1.1rem;
        font-size: 0.9rem;
    }

    .input-area {
        padding: 0.75rem 1rem;
    }

    /* Welcome */
    .welcome-header h1 {
        font-size: 1.8rem;
    }

    .welcome-header p {
        font-size: 0.95rem;
    }

    .welcome-actions-grid {
        grid-template-columns: 1fr;
    }

    .action-card {
        padding: 1.25rem;
    }
}


/* ═══════════════════════════════════════════════════════
   RESPONSIVE: PHONE (≤ 480px)
   ═══════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    /* Hide the auth theme toggle on very small screens */
    .theme-toggle-fixed {
        top: 0.5rem;
        right: 0.5rem;
    }

    /* AUTH */
    .auth-hero {
        padding: 4rem 1.25rem 1.5rem 1.25rem;
    }

    .hero-title {
        font-size: 2rem;
        margin-top: 1.5rem;
    }

    .hero-desc {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .futuristic-mockup {
        margin-bottom: 1.5rem;
    }

    .mock-window-body {
        padding: 1rem;
    }

    .mock-bubble {
        max-width: 95%;
        font-size: 0.8rem;
        padding: 0.75rem 1rem;
    }

    .mock-viz-card {
        padding: 0.75rem 1rem;
    }

    .viz-val {
        font-size: 0.95rem;
    }

    .auth-form-panel {
        padding: 1.5rem 1.25rem 3rem 1.25rem;
    }

    .auth-glass-card {
        padding: 1.75rem;
        border-radius: 18px;
    }

    .auth-title {
        font-size: 1.5rem;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group-half {
        margin-bottom: 1.25rem;
    }

    /* APP HEADER */
    .app-header {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    .header-property-label {
        display: none;
    }

    .header-property-select {
        font-size: 0.8rem;
        padding: 0.35rem 0.5rem;
    }

    /* Chat */
    .chat-container {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .message {
        max-width: 95%;
        padding: 0.75rem 1rem;
        font-size: 0.88rem;
        border-radius: 16px;
    }

    .input-area {
        padding: 0.5rem 0.5rem;
    }

    .input-wrapper {
        padding: 0.25rem 0.5rem;
        border-radius: 16px;
    }

    textarea {
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    .send-btn {
        padding: 0.5rem 0.9rem;
        font-size: 0.85rem;
        border-radius: 12px;
    }

    /* Welcome */
    .welcome-dashboard {
        margin: 1rem auto;
        padding: 0 0.75rem;
        gap: 1.5rem;
    }

    .welcome-header h1 {
        font-size: 1.5rem;
    }

    .welcome-header p {
        font-size: 0.85rem;
    }

    .action-card {
        padding: 1rem;
    }

    .action-card h3 {
        font-size: 0.95rem;
    }

    .action-card p {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }

    .action-icon {
        width: 40px;
        height: 40px;
        font-size: 1.4rem;
        margin-bottom: 0.75rem;
    }

    /* Toast */
    #toast-container {
        top: 0.5rem;
        right: 0.5rem;
        left: 0.5rem;
    }

    .toast {
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
    }

    /* Suggestion chips wrap better */
    .suggestion-chip {
        font-size: 0.75rem;
        padding: 0.35rem 0.75rem;
    }

    /* Charts & diagrams */
    .chartjs-container {
        padding: 1rem;
        max-height: 280px;
    }

    .chartjs-container canvas {
        max-height: 240px;
    }

    .mermaid-container {
        padding: 0.75rem;
    }

    /* Tables scroll horizontally */
    .ai-message table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        font-size: 0.75rem;
    }

    .ai-message th,
    .ai-message td {
        padding: 0.5rem;
    }
}