:root {
    --bg-dark: #09090b;
    --bg-card: #18181b;
    /* Zinc 900 */
    --primary: #8b5cf6;
    /* Violet 500 */
    --primary-glow: rgba(139, 92, 246, 0.5);
    --secondary: #ec4899;
    /* Pink 500 */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --glass: rgba(24, 24, 27, 0.6);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    line-height: 1.6;
}

/* --- Background Orbs --- */
.background-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.4;
}

.orb-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--primary), transparent);
    animation: float 20s infinite alternate;
}

.orb-2 {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--secondary), transparent);
    animation: float 25s infinite alternate-reverse;
}

@keyframes float {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(30px, 50px);
    }
}

/* --- Layout --- */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--glass);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-main);
}

.new-chat-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.new-chat-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.session-list {
    list-style: none;
    overflow-y: auto;
    flex-grow: 1;
    padding: 10px;
}

.session-item {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid transparent;
}

.session-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.session-item.active {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--primary);
}

.session-info {
    flex-grow: 1;
    overflow: hidden;
}

.session-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.session-item:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    color: var(--secondary);
}

/* Main Content */
.main-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 40px;
    position: relative;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding-bottom: 50px;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 3rem;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    letter-spacing: -1px;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* --- Form --- */
.form-section {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.form-group.relative {
    position: relative;
}

label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

input,
select,
textarea {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

textarea {
    resize: vertical;
}

button[type="submit"] {
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
    border-radius: 8px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    border: none;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

button[type="submit"]:hover {
    filter: brightness(1.1);
    box-shadow: 0 0 20px var(--primary-glow);
}

button[type="submit"]:disabled {
    opacity: 0.7;
    cursor: wait;
}

/* Suggestions List */
.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1e1e24;
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    list-style: none;
    margin-top: 5px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.suggestions-list li {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.suggestions-list li:hover {
    background: var(--primary);
}

.hidden {
    display: none !important;
}

/* --- Loader --- */
#loader {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-top: 15px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 0%;
    transition: width 0.3s ease;
}

/* --- Results Section --- */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.tabs {
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px;
    border-radius: 10px;
    overflow-x: auto;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

.export-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.export-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.tab-content {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 30px;
    min-height: 400px;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Markdown Styles --- */
.markdown-body {
    line-height: 1.8;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    color: white;
}

.markdown-body p {
    margin-bottom: 1em;
    color: #cbd5e1;
}

.markdown-body ul,
.markdown-body ol {
    margin-bottom: 1em;
    padding-left: 20px;
}

.markdown-body li {
    margin-bottom: 0.5em;
}

.markdown-body strong {
    color: var(--secondary);
}

hr.section-divider {
    border: 0;
    height: 1px;
    background: var(--border);
    margin: 30px 0;
}

/* Natal Charts Grid */
.natal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.chart-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.chart-box h4 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.chart-box table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.chart-box th {
    text-align: left;
    color: var(--text-muted);
    padding: 8px;
    border-bottom: 1px solid var(--border);
}

.chart-box td {
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* --- Chat Section --- */
.chat-section {
    margin-top: 30px;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 500px;
}

.chat-history {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-message {
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 0.95rem;
}

.chat-message.user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 2px;
}

.chat-message.assistant {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 2px;
}

.chat-input-area {
    display: flex;
    gap: 10px;
}

.chat-input-area textarea {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 25px;
    padding: 12px 20px;
    min-height: 50px;
}

#sendChatBtn {
    background: var(--primary);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

#sendChatBtn:hover {
    transform: scale(1.1);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .session-list {
        display: none;
        /* Hide history on mobile by default to save space? Or make it toggleable */
    }

    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .results-header {
        flex-direction: column;
        align-items: stretch;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .main-content {
        padding: 20px;
    }
}

/* Mode Switcher */
.mode-switcher {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    background: rgba(255, 255, 255, 0.05);
    padding: 5px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mode-btn {
    flex: 1;
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.mode-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.mode-btn:hover:not(.active) {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.05);
}

/* BTR Events */
.events-container {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.event-row {
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 10px;
}

.small-btn {
    padding: 8px 16px;
    font-size: 0.9em;
}

.delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 5px;
}

.delete-btn:hover {
    color: #ef4444;
}

/* Transit Tab Enhancements */
.transit-dosha-alert {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #fca5a5;
    padding: 8px 12px;
    border-radius: 6px;
    margin: 8px 0;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.transit-dosha-alert strong {
    color: #fca5a5;
}

.transit-gunas {
    display: flex;
    gap: 8px;
    margin: 8px 0;
}

.guna-pill {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    flex: 1;
    text-align: center;
    border: 1px solid transparent;
}

.guna-pill.sattva {
    background: rgba(250, 204, 21, 0.15);
    color: #facc15;
    border-color: rgba(250, 204, 21, 0.3);
}

.guna-pill.rajas {
    background: rgba(244, 63, 94, 0.15);
    color: #fb7185;
    border-color: rgba(244, 63, 94, 0.3);
}

.guna-pill.tamas {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border-color: rgba(99, 102, 241, 0.3);
}

.transit-aspect-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 5px;
    font-style: italic;
}

.transit-interactions {
    margin-top: 5px;
    font-size: 0.85rem;
    color: #cbd5e1;
    border-left: 2px solid var(--border);
    padding-left: 8px;
}

.natal-dosha-alert {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.natal-dosha-alert ul {
    margin: 5px 0 0 20px;
    color: #fca5a5;
    font-size: 0.9rem;
}

/* --- Profile Selector --- */
.profile-selector-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.profile-selector-row select {
    flex: 1;
}

/* --- Sidebar Profiles Section --- */
.sidebar-section {
    border-top: 1px solid var(--border);
    padding: 15px;
}

.sidebar-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.75rem;
}

.add-profile-btn {
    width: 100%;
    padding: 8px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    margin-bottom: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.add-profile-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.profile-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.profile-item {
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid transparent;
}

.profile-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.profile-item:hover .delete-btn {
    opacity: 1;
}

.profile-info {
    flex-grow: 1;
    overflow: hidden;
}

.profile-name {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.empty-msg {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 8px 0;
    text-align: center;
    font-style: italic;
}

/* --- Save Profile Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 30px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px var(--primary-glow);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-box h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.modal-box p {
    color: var(--text-muted);
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.modal-profile-summary {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.modal-profile-summary p {
    margin: 0 0 4px 0;
    color: var(--text-main);
    font-size: 0.9rem;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.primary-btn {
    flex: 1;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.primary-btn:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 15px var(--primary-glow);
}

.secondary-btn {
    flex: 1;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-weight: 500;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* --- Welcome Banner --- */
.welcome-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(236, 72, 153, 0.15));
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 12px;
    font-size: 0.95rem;
    color: #e8e0ff;
    animation: bannerSlideIn 0.5s ease-out;
}

.welcome-banner .welcome-emoji {
    font-size: 1.3rem;
    animation: welcomePulse 2s ease-in-out infinite;
}

@keyframes bannerSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes welcomePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* --- Sidebar Header Actions --- */
.sidebar-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.sidebar-header-actions .new-chat-btn {
    flex: 1;
}

/* --- Logout Button --- */
.logout-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 1.1rem;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    transform: translateY(-1px);
}

/* ── Flatpickr overrides — match app's purple accent ── */
.flatpickr-calendar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.selected:focus {
    background: var(--primary);
    border-color: var(--primary);
}

.flatpickr-day:hover {
    background: rgba(139, 92, 246, 0.2);
}

.flatpickr-time input:hover,
.flatpickr-time input:focus,
.flatpickr-time .flatpickr-am-pm:hover,
.flatpickr-time .flatpickr-am-pm:focus {
    background: rgba(139, 92, 246, 0.15);
}

/* ── Picker input wrapper (date/time fields with icon button) ── */
.picker-input-wrap {
    display: flex;
    align-items: stretch;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s;
    overflow: hidden;
}

.picker-input-wrap input[data-input] {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    flex: 1;
    min-width: 0;
    padding: 12px;
}

.picker-input-wrap input[data-input]:focus {
    outline: none;
    box-shadow: none !important;
}

.picker-input-wrap:focus-within {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.picker-icon-btn {
    background: transparent;
    border: none;
    border-left: 1px solid var(--border);
    padding: 0 12px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.picker-icon-btn:hover {
    color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
}

/* --- Voice Input Mic Button --- */
.mic-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    cursor: pointer;
    display: none;
    /* shown by JS only when SpeechRecognition is available */
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
}

.mic-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
}

.mic-btn.mic-active {
    border-color: #ef4444;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    animation: mic-pulse 1.2s ease-in-out infinite;
}

@keyframes mic-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    50% {
        box-shadow: 0 0 0 7px rgba(239, 68, 68, 0);
    }
}

/* Wrapper for voice-enabled textareas (question field in main form) */
.voice-input-wrap {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.voice-input-wrap textarea {
    flex: 1;
}

/* ── PDF Report Styles ───────────────────────────────────────── */

/* Off-screen mount — contains the rendered report DOM */
#pdf-mount {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 11pt;
    color: #1a1a2e;
    background: #ffffff;
    line-height: 1.65;
}

/* Loading overlay */
#pdf-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    visibility: hidden;
}

.pdf-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(139, 92, 246, 0.3);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Inside #pdf-mount ── */
#pdf-mount .pr-header {
    background: linear-gradient(135deg, #4c1d95, #7c3aed);
    color: #fff;
    padding: 28px 32px 24px;
    border-radius: 6px 6px 0 0;
}

#pdf-mount .pr-header-logo {
    font-size: 22pt;
    font-weight: 700;
    letter-spacing: 1px;
    font-family: 'Arial', sans-serif;
}

#pdf-mount .pr-header-sub {
    font-size: 11pt;
    opacity: 0.85;
    margin-top: 4px;
    font-family: 'Arial', sans-serif;
}

#pdf-mount .pr-header-date {
    font-size: 9pt;
    opacity: 0.7;
    margin-top: 8px;
    font-family: 'Arial', sans-serif;
}

#pdf-mount .pr-card {
    background: #f8f7ff;
    border: 1px solid #e0d9f7;
    border-radius: 0 0 6px 6px;
    padding: 20px 24px;
    margin-bottom: 16px;
}

#pdf-mount .pr-card-title {
    font-size: 10pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6d28d9;
    margin-bottom: 12px;
    font-family: 'Arial', sans-serif;
}

#pdf-mount .pr-profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 24px;
}

#pdf-mount .pr-profile-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

#pdf-mount .pr-label {
    font-size: 8pt;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: 'Arial', sans-serif;
}

#pdf-mount .pr-value {
    font-size: 10.5pt;
    color: #111827;
    font-weight: 600;
    font-family: 'Arial', sans-serif;
}

#pdf-mount .pr-question-box {
    background: #faf5ff;
    border-left: 4px solid #7c3aed;
    border-radius: 4px;
    padding: 14px 18px;
    margin-bottom: 18px;
}

#pdf-mount .pr-question-label {
    font-size: 8pt;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7c3aed;
    font-weight: 700;
    margin-bottom: 6px;
    font-family: 'Arial', sans-serif;
}

#pdf-mount .pr-question-text {
    font-size: 11pt;
    color: #1f2937;
    font-style: italic;
    line-height: 1.5;
}

#pdf-mount .pr-section {
    margin-bottom: 20px;
    page-break-inside: avoid;
}

#pdf-mount .pr-section-title {
    font-size: 13pt;
    font-weight: 700;
    color: #1f2937;
    border-left: 4px solid #7c3aed;
    padding-left: 10px;
    margin-bottom: 10px;
    font-family: 'Arial', sans-serif;
}

#pdf-mount .pr-body {
    font-size: 10.5pt;
    color: #374151;
    line-height: 1.7;
}

#pdf-mount .pr-body h1,
#pdf-mount .pr-body h2,
#pdf-mount .pr-body h3 {
    font-family: 'Arial', sans-serif;
    color: #1f2937;
    margin: 12px 0 6px;
}

#pdf-mount .pr-body h1 {
    font-size: 13pt;
}

#pdf-mount .pr-body h2 {
    font-size: 12pt;
}

#pdf-mount .pr-body h3 {
    font-size: 11pt;
}

#pdf-mount .pr-body strong {
    color: #111827;
}

#pdf-mount .pr-body p,
#pdf-mount .pr-body li,
#pdf-mount .pr-body span,
#pdf-mount .pr-body em,
#pdf-mount .pr-body blockquote {
    color: #374151;
}

#pdf-mount .pr-body a {
    color: #5b21b6;
    text-decoration: underline;
}

#pdf-mount .pr-body h4,
#pdf-mount .pr-body h5,
#pdf-mount .pr-body h6 {
    font-family: 'Arial', sans-serif;
    color: #1f2937;
    margin: 10px 0 5px;
}

#pdf-mount .pr-body code {
    color: #1e1b4b;
    background: #f3f0ff;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 9.5pt;
}

#pdf-mount .pr-body pre {
    color: #1e1b4b;
    background: #f8f7ff;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
}

#pdf-mount .pr-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
}

#pdf-mount .pr-body th {
    color: #1f2937;
    font-weight: 700;
    border-bottom: 2px solid #e5e7eb;
    padding: 6px 8px;
    text-align: left;
}

#pdf-mount .pr-body td {
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    padding: 5px 8px;
}

#pdf-mount .pr-body ul,
#pdf-mount .pr-body ol {
    padding-left: 20px;
    margin: 6px 0;
}

#pdf-mount .pr-body li {
    margin-bottom: 3px;
    color: #374151;
}

#pdf-mount .pr-footer {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #e5e7eb;
    padding-top: 10px;
    margin-top: 24px;
    font-size: 8pt;
    color: #9ca3af;
    font-family: 'Arial', sans-serif;
}