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

body {
    font-family: Arial, sans-serif;
    background: #f8fafc;
    color: #0f172a;
    min-height: 100vh;
}

/* NAVBAR */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 5%;
    height: 64px;
    background: white;
    border-bottom: 1px solid #e8edf5;
    box-shadow: 0 1px 8px rgba(0,0,0,0.05);
}

.logo {
    font-size: 18px;
    font-weight: 800;
    color: #7c3aed;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: -0.01em;
}

.nav-divider {
    width: 1px;
    height: 28px;
    background: #e2e8f0;
    margin: 0 16px;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border-radius: 9px;
    text-decoration: none;
    color: #64748b;
    font-weight: 500;
    font-size: 13.5px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.nav-link:hover { background: #f1f5f9; color: #7c3aed; }

.nav-link.active {
    background: #ede9fe;
    color: #7c3aed;
    font-weight: 700;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon { stroke: #7c3aed; }

.nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: currentColor;
    transition: stroke 0.15s;
}

.admin-link { background: #fef9c3; color: #92400e; }
.admin-link:hover { background: #fef08a; color: #78350f; }
.admin-link.active { background: #fef08a; color: #78350f; }

.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.lang-toggle {
    display: flex;
    background: #f1f5f9;
    border-radius: 9px;
    padding: 3px;
    gap: 2px;
}

.lang-opt {
    padding: 5px 9px;
    border-radius: 7px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    transition: 0.15s;
}

.lang-opt.active {
    background: white;
    color: #7c3aed;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.lang-opt:not(.active):hover { color: #334155; }

.auth-btn {
    background: linear-gradient(90deg, #7c3aed, #a855f7);
    color: white;
    padding: 8px 16px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    font-size: 13.5px;
    white-space: nowrap;
}

.auth-btn:hover { opacity: 0.9; }

.auth-btn-outline {
    background: transparent;
    border: 1.5px solid #c4b5fd;
    color: #7c3aed;
    padding: 7px 15px;
}

.pro-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: linear-gradient(90deg, #7c3aed, #a855f7);
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 20px;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.upgrade-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: linear-gradient(90deg, #f59e0b, #f97316);
    color: white;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 13px;
    border-radius: 10px;
    text-decoration: none;
    white-space: nowrap;
    transition: opacity 0.15s;
}
.upgrade-link:hover { opacity: 0.88; }

.auth-btn-outline:hover {
    opacity: 1;
    background: #ede9fe;
    border-color: #a78bfa;
}

.hamburger {
    display: none;
    width: auto;
    margin-top: 0;
    padding: 6px 8px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #475569;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.hamburger:hover { background: #f1f5f9; color: #7c3aed; transform: none; }

/* HERO */
.hero {
    text-align: center;
    padding: 44px 20px 24px;
}

.hero h1 {
    font-size: 46px;
    color: #7c3aed;
    margin-bottom: 12px;
}

.hero p {
    max-width: 680px;
    margin: auto;
    color: #475569;
    line-height: 1.7;
    font-size: 17px;
}

/* CONTAINER */
.container {
    width: 90%;
    max-width: 820px;
    margin: 24px auto;
    background: white;
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.07);
}

/* FORM */
label {
    display: block;
    margin-top: 14px;
    margin-bottom: 6px;
    font-weight: 700;
    font-size: 16px;
    color: #0f172a;
}

input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #0f172a;
    font-size: 15px;
    outline: none;
    transition: 0.2s;
}

input::placeholder { color: #94a3b8; opacity: 1; }
input:focus { border-color: #7c3aed; background: white; }

/* BUTTON */
button {
    width: 100%;
    margin-top: 20px;
    padding: 14px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(90deg, #7c3aed, #a855f7);
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}

button:hover { transform: translateY(-2px); }

/* HOME AUTH FORM */
.home-auth { max-width: 480px; margin: 0 auto; }

.tabs {
    display: flex;
    margin-bottom: 22px;
    border-radius: 12px;
    overflow: hidden;
    background: #f1f5f9;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    background: transparent;
    color: #475569;
    transition: 0.2s;
    width: auto;
    margin-top: 0;
    border-radius: 0;
}

.tab-btn.active {
    background: linear-gradient(90deg, #7c3aed, #a855f7);
    color: white;
    transform: none;
}

.form-section { display: none; }
.form-section.active { display: block; }

.submit-btn {
    width: 100%;
    margin-top: 16px;
    padding: 14px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(90deg, #7c3aed, #a855f7);
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}

.submit-btn:hover { transform: translateY(-2px); }

.field-hint { font-weight: 400; color: #94a3b8; font-size: 12px; }

.error { color: #dc2626; margin-top: 6px; font-size: 13px; }

/* RESULTS */
.result { margin-top: 28px; }

.result h2 { color: #7c3aed; margin-bottom: 14px; }

.kundli-box {
    background: #f8fafc;
    padding: 18px;
    border-radius: 16px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
}

pre {
    white-space: pre-wrap;
    line-height: 1.7;
    color: #334155;
    font-size: 14px;
}

.astro-card {
    margin-top: 14px;
    background: white;
    padding: 20px 24px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.card-heading {
    font-size: 17px;
    font-weight: 700;
    color: #7c3aed;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ede9fe;
}

.card-body p {
    line-height: 1.8;
    color: #334155;
    margin-bottom: 6px;
    font-size: 15px;
}

.card-body p:last-child { margin-bottom: 0; }

/* CHART CARD */
.chart-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 18px 18px 14px;
    margin-bottom: 20px;
}

.chart-birth-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 14px;
}

.birth-place-name { font-weight: 700; color: #0f172a; font-size: 15px; }
.birth-coords { color: #94a3b8; font-size: 13px; }

.ascendant-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(90deg, #ede9fe, #faf5ff);
    border: 1px solid #c4b5fd;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 14px;
}

.ascendant-label { font-size: 11px; font-weight: 700; color: #7c3aed; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 3px; }
.ascendant-sign { font-size: 20px; font-weight: 800; color: #0f172a; }
.ascendant-right { text-align: right; }
.ascendant-nakshatra { font-size: 14px; color: #475569; font-weight: 600; margin-bottom: 2px; }
.ascendant-deg { font-size: 13px; color: #94a3b8; }

/* PLANET TABLE */
.planet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.planet-table thead tr {
    background: #ede9fe;
}

.planet-table th {
    padding: 9px 10px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: #7c3aed;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.planet-table th:last-child { text-align: right; }

.planet-table thead tr th:first-child { border-radius: 8px 0 0 8px; }
.planet-table thead tr th:last-child  { border-radius: 0 8px 8px 0; }

.planet-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}

.planet-table tbody tr:last-child { border-bottom: none; }
.planet-table tbody tr:hover { background: #faf5ff; }

.planet-table td { padding: 9px 10px; vertical-align: middle; }

.td-planet { display: flex; align-items: center; gap: 7px; font-weight: 700; color: #0f172a; white-space: nowrap; }
.p-icon { font-size: 16px; line-height: 1; }
.td-sign { color: #7c3aed; font-weight: 600; }
.td-nakshatra { color: #475569; }
.td-deg { color: #94a3b8; font-size: 13px; text-align: right; white-space: nowrap; }

.result-actions {
    display: flex;
    gap: 12px;
    margin-top: 22px;
}

.download-pdf-btn {
    flex: 1;
    padding: 13px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(90deg, #0369a1, #0ea5e9);
    color: white;
    font-weight: bold;
    font-size: 15px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.download-pdf-btn:hover { opacity: 0.88; }
.download-pdf-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.new-kundli-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 13px;
    border-radius: 14px;
    background: linear-gradient(90deg, #7c3aed, #a855f7);
    color: white;
    font-weight: bold;
    font-size: 15px;
    text-decoration: none;
    text-align: center;
}

.new-kundli-btn:hover { opacity: 0.88; }

@media (max-width: 480px) {
    .result-actions { flex-direction: column; }
}

/* FIELD-LEVEL VALIDATION */
.field-err {
    display: none;
    color: #dc2626;
    font-size: 12px;
    margin-top: 4px;
    margin-bottom: 2px;
    padding-left: 2px;
}

.input-invalid {
    border-color: #ef4444 !important;
    background: #fff5f5 !important;
}

.input-invalid:focus { border-color: #ef4444 !important; }

/* ERROR / SUCCESS */
.error-box {
    margin-top: 14px;
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
}

/* FEATURES */
.features {
    width: 90%;
    max-width: 1100px;
    margin: 40px auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.feature {
    background: white;
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.05);
}

.feature h3 { color: #7c3aed; margin-bottom: 10px; font-size: 17px; }

.feature p { color: #475569; line-height: 1.7; font-size: 15px; }

/* MARKDOWN RENDERED CONTENT */
.md-body { line-height: 1.85; color: #334155; font-size: 16px; }

.md-body h1, .md-body h2, .md-body h3, .md-body h4 {
    color: #0f172a;
    font-weight: 800;
    margin: 1.4em 0 0.5em;
    line-height: 1.3;
}
.md-body h1 { font-size: 26px; }
.md-body h2 { font-size: 21px; color: #7c3aed; padding-bottom: 6px; border-bottom: 2px solid #ede9fe; }
.md-body h3 { font-size: 17px; }
.md-body h4 { font-size: 15px; color: #475569; }

.md-body p { margin-bottom: 16px; }
.md-body p:last-child { margin-bottom: 0; }

.md-body strong { font-weight: 700; color: #0f172a; }
.md-body em { font-style: italic; color: #475569; }

.md-body ul, .md-body ol {
    margin: 0 0 16px 1.5em;
    padding: 0;
}
.md-body li { margin-bottom: 6px; }
.md-body li:last-child { margin-bottom: 0; }

.md-body blockquote {
    margin: 18px 0;
    padding: 12px 18px;
    border-left: 4px solid #a855f7;
    background: #faf5ff;
    border-radius: 0 10px 10px 0;
    color: #4c1d95;
    font-style: italic;
}
.md-body blockquote p { margin-bottom: 0; }

.md-body code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 13.5px;
    color: #7c3aed;
}

.md-body pre {
    background: #1e1b4b;
    color: #e2e8f0;
    padding: 16px 18px;
    border-radius: 12px;
    overflow-x: auto;
    margin-bottom: 16px;
}
.md-body pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: 13.5px;
}

.md-body hr {
    border: none;
    border-top: 2px solid #e2e8f0;
    margin: 28px 0;
}

/* FOOTER */
footer {
    margin-top: 40px;
    text-align: center;
    padding: 22px 20px;
    color: #94a3b8;
    font-size: 14px;
    border-top: 1px solid #e2e8f0;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 22px;
    margin-bottom: 8px;
}

.footer-links a {
    color: #64748b;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.15s;
}

.footer-links a:hover { color: #7c3aed; }

/* LOADING OVERLAY */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: radial-gradient(ellipse at 40% 40%, #2d1b69 0%, #1a0a3e 55%, #060010 100%);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    overflow: hidden;
}

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

.loading-bg-stars {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1.5px 1.5px at 10% 15%, rgba(255,255,255,.75) 0%, transparent 100%),
        radial-gradient(1px   1px   at 25% 60%, rgba(255,255,255,.5)  0%, transparent 100%),
        radial-gradient(2px   2px   at 40% 25%, rgba(255,255,255,.6)  0%, transparent 100%),
        radial-gradient(1px   1px   at 55% 80%, rgba(255,255,255,.7)  0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 70% 10%, rgba(255,255,255,.5)  0%, transparent 100%),
        radial-gradient(1px   1px   at 80% 50%, rgba(255,255,255,.65) 0%, transparent 100%),
        radial-gradient(2px   2px   at 90% 30%, rgba(255,255,255,.4)  0%, transparent 100%),
        radial-gradient(1px   1px   at 15% 85%, rgba(255,255,255,.55) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 60% 45%, rgba(255,255,255,.45) 0%, transparent 100%),
        radial-gradient(1px   1px   at 35% 70%, rgba(255,255,255,.6)  0%, transparent 100%),
        radial-gradient(1px   1px   at 92% 70%, rgba(255,255,255,.5)  0%, transparent 100%),
        radial-gradient(2px   2px   at 5%  50%, rgba(255,255,255,.35) 0%, transparent 100%),
        radial-gradient(1px   1px   at 75% 90%, rgba(255,255,255,.6)  0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 48% 5%,  rgba(255,255,255,.5)  0%, transparent 100%);
    animation: stars-drift 40s linear infinite;
    pointer-events: none;
}

@keyframes stars-drift {
    0%   { transform: translateY(0); }
    100% { transform: translateY(-60px); }
}

.loading-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    animation: fade-up 0.5s ease;
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.loading-orb {
    position: relative;
    width: 130px;
    height: 130px;
    margin-bottom: 28px;
}

.loading-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
}

.loading-ring-1 {
    inset: 0;
    border-top-color: #a855f7;
    border-right-color: rgba(168,85,247,.3);
    animation: spin 2s linear infinite;
}

.loading-ring-2 {
    inset: 14px;
    border-top-color: #c084fc;
    border-left-color: rgba(192,132,252,.3);
    animation: spin 3s linear infinite reverse;
}

.loading-ring-3 {
    inset: 28px;
    border-bottom-color: #e879f9;
    border-right-color: rgba(232,121,249,.3);
    animation: spin 4s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 46px;
    animation: glow-pulse 2.4s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(168,85,247,.5)); transform: scale(1); }
    50%       { filter: drop-shadow(0 0 24px rgba(192,132,252,.9)); transform: scale(1.08); }
}

.loading-title {
    color: white;
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.loading-msg {
    color: rgba(255,255,255,.75);
    font-size: 15px;
    min-height: 22px;
    margin-bottom: 22px;
    transition: opacity 0.4s;
    text-align: center;
}

.loading-msg.fade { opacity: 0; }

.loading-dots {
    display: flex;
    gap: 8px;
}

.loading-dots span {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(168,85,247,.7);
    animation: dot-bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: .2s; }
.loading-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes dot-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%            { transform: scale(1.2); opacity: 1; background: #c084fc; }
}

/* DATE / TIME SELECTS */
.date-selects, .time-selects {
    display: grid;
    gap: 8px;
}

.date-selects { grid-template-columns: 72px 1fr 90px; }
.time-selects { grid-template-columns: 1fr 1fr 86px; }

.date-select, .time-select {
    width: 100%;
    padding: 13px 32px 13px 14px;
    border-radius: 14px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #0f172a;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a3b8'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.date-select:focus, .time-select:focus {
    border-color: #7c3aed;
    background-color: white;
}

.date-select.select-error, .time-select.select-error {
    border-color: #ef4444;
    background-color: #fff5f5;
}

@media (max-width: 480px) {
    .date-selects { grid-template-columns: 64px 1fr 82px; }
    .time-selects { grid-template-columns: 1fr 1fr 76px; }
    .date-select, .time-select { font-size: 14px; padding: 11px 28px 11px 12px; }
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .navbar { flex-wrap: wrap; height: auto; padding: 10px 4%; }
    .logo { flex: 1; }
    .nav-divider { display: none; }
    .nav-links {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        width: 100%;
        padding: 8px 0 4px;
        border-top: 1px solid #f1f5f9;
        margin-top: 8px;
        order: 10;
    }
    .nav-links.open { display: flex; }
    .nav-link { padding: 11px 14px; font-size: 15px; gap: 10px; }
    .nav-icon { width: 18px; height: 18px; }
    .hamburger { display: flex; align-items: center; }
    .hero h1 { font-size: 32px; }
    .hero { padding: 28px 16px 16px; }
    .container { padding: 20px; margin: 16px auto; }
    .features { margin: 24px auto; }
    .planet-table th:nth-child(3), .planet-table td:nth-child(3) { display: none; }
    .ascendant-sign { font-size: 17px; }
    .result-actions { flex-direction: column; }
}

@media (max-width: 480px) {
    /* Dashboard prediction buttons stack vertically */
    .btn-today-prediction,
    .btn-monthly-prediction,
    .btn-new-kundali {
        width: 100%;
        justify-content: center;
        font-size: 13px;
        padding: 10px 14px;
    }

    /* Prediction page hero text */
    .pred-hero-left h1 { font-size: 20px; }

    /* Profile page */
    .prof-hero { flex-direction: column; gap: 12px; }
}

/* ============================================================ */
/* FLOATING CHAT WIDGET                                         */
/* ============================================================ */
#chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    border: none;
    cursor: pointer;
    font-size: 26px;
    box-shadow: 0 4px 24px rgba(124,58,237,0.45);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
#chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 30px rgba(124,58,237,0.6); }

#chat-panel {
    position: fixed;
    bottom: 94px;
    right: 24px;
    width: 360px;
    height: 510px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
}
#chat-panel.chat-open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

.chat-header {
    background: linear-gradient(90deg, #7c3aed, #a855f7);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
    flex-shrink: 0;
}
.chat-header-title { font-weight: 700; font-size: 15px; }
.chat-header-sub { font-size: 11px; opacity: 0.8; margin-top: 2px; }
.chat-close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-close-btn:hover { background: rgba(255,255,255,0.35); }

#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
.chat-msg {
    max-width: 85%;
    padding: 10px 13px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.58;
    word-break: break-word;
    white-space: pre-wrap;
}
.chat-msg-ai {
    align-self: flex-start;
    background: #f3f0ff;
    color: #1e1b4b;
    border-bottom-left-radius: 4px;
}
.chat-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-typing {
    align-self: flex-start;
    background: #f3f0ff;
    padding: 10px 14px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 4px;
    align-items: center;
}
.chat-typing span {
    width: 7px;
    height: 7px;
    background: #a855f7;
    border-radius: 50%;
    animation: chat-dot-bounce 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chat-dot-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-5px); opacity: 1; }
}

.chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}
#chat-input {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 9px 12px;
    font-size: 13.5px;
    resize: none;
    outline: none;
    font-family: inherit;
    max-height: 90px;
    overflow-y: auto;
    transition: border-color 0.15s;
    line-height: 1.45;
}
#chat-input:focus { border-color: #a855f7; }
#chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s;
}
#chat-send-btn:disabled { opacity: 0.45; cursor: default; }
#chat-send-btn:not(:disabled):hover { opacity: 0.85; }

@media (max-width: 480px) {
    #chat-panel { right: 10px; left: 10px; width: auto; bottom: 84px; height: 62vh; }
    #chat-fab { right: 16px; bottom: 18px; }
}

/* Chat teaser popup */
#chat-teaser {
    position: fixed;
    bottom: 94px;
    right: 24px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 6px 28px rgba(0,0,0,0.14);
    padding: 14px 16px 14px 14px;
    z-index: 9997;
    max-width: 240px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    transform: translateY(10px);
    opacity: 0;
    transition: transform 0.35s ease, opacity 0.35s ease;
    pointer-events: none;
}
#chat-teaser.teaser-show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}
#chat-teaser::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 26px;
    width: 16px;
    height: 16px;
    background: white;
    transform: rotate(45deg);
    box-shadow: 3px 3px 6px rgba(0,0,0,0.06);
    border-radius: 2px;
}
.teaser-icon {
    font-size: 26px;
    flex-shrink: 0;
    animation: teaser-pulse 2s ease-in-out infinite;
}
@keyframes teaser-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}
.teaser-body { flex: 1; }
.teaser-title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 3px;
}
.teaser-msg {
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
}
.teaser-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 13px;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
}
.teaser-close:hover { color: #475569; }

@media (max-width: 480px) {
    #chat-teaser { right: 16px; max-width: 200px; }
}
