html {
  font-size: 16px;
  scroll-behavior: smooth;
}
/* html.dynamic-font-embed {
  font-size: clamp(16px, 1.05vw, 18px);
} */

body {
    font-family: "Inter", sans-serif;
    background-color: #f8f9fa;
}

.plotly-notifier {
    display: none !important;
}

.form-control {
    font-size: 0.875rem !important;
}
.fs-9 {
    font-size: 0.625rem !important;
}
.fs-10 {
    font-size: 0.625rem !important;
}
.fs-11 {
    font-size: 0.75rem !important;
}
.fs-12 {
    font-size: 0.75rem !important;
}
.fs-13 {
    font-size: 0.8rem !important;
}
.fs-14 {
    font-size: 0.875rem !important;
}
/* Table Export */
.table-export-wrapper {
    position: relative;
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.table-scroll-container {
    overflow-x: auto;
    max-width: 100%;
    width: 100%;
    padding-bottom: 4px;
}
.table-scroll-container::-webkit-scrollbar {
    height: 4px;
}
.table-scroll-container::-webkit-scrollbar-track {
    background: rgba(var(--color-primary-rgb), 0.08);
    border-radius: 4px;
    margin: 0 4px;
}
.table-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(var(--color-primary-rgb), 0.5);
    border-radius: 4px;
    transition: background 200ms ease;
}
.table-scroll-container::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--color-primary-rgb), 0.8);
}
html[data-theme='dark'] .table-scroll-container::-webkit-scrollbar-track {
    background: rgba(var(--color-primary-rgb), 0.1);
}
html[data-theme='dark'] .table-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(var(--color-primary-rgb), 0.5);
}
html[data-theme='dark'] .table-scroll-container::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--color-primary-rgb), 0.8);
}
.table-scroll-container table {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    width: max-content !important;
    min-width: 100%;
}
.table-export-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    margin-top: 0.25rem;
    border-radius: 0.4rem;
    border: 1px solid rgba(2,6,23,0.1);
    background: #fff;
    color: #475569;
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 200ms ease, border-color 200ms ease, color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}
.table-export-wrapper:hover .table-export-btn {
    opacity: 1;
}
.table-export-btn:hover {
    background: #f1f5f9;
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,162,197,0.15);
}
.table-export-btn:active {
    transform: scale(0.95);
}
.table-export-btn.exported {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    color: #fff;
}
html[data-theme='dark'] .table-export-btn {
    background: rgba(255,255,255,0.08);
    border-color: rgba(148,163,184,0.3);
    color: #e2e8f0;
}
html[data-theme='dark'] .table-export-btn:hover {
    background: rgba(0,162,197,0.15);
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(0,162,197,0.3);
}
html[data-theme='dark'] .table-export-btn.exported {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    color: #fff;
}

/* Light mode Table */
.bot-message-bubble table,
table {
    font-size: 0.8rem;
    width: 100%;
    border-spacing: 0;
    border-collapse: separate;
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
    border: none;
    border-radius: 0.5rem;
    overflow: hidden;
}
table thead {
    background: rgba(var(--color-primary-rgb), 0.75);
}
table th {
    font-weight: 600;
    color: #fff;
    padding: 0.55rem 0.75rem;
    text-align: left;
    vertical-align: middle;
    border: none;
}
table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    vertical-align: middle;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}
table tbody tr:last-child td {
    border-bottom: none;
}
table tbody tr:nth-child(odd) {
    background: #fff;
}
table tbody tr:nth-child(even) {
    background: #f8fafc;
}
table tbody tr:hover {
    background: rgba(0,162,197,0.05);
}
/* Dark mode Table */
html[data-theme='dark'] table {
    border-color: #334155;
}
html[data-theme='dark'] table thead {
    background: rgba(var(--color-primary-rgb), 0.75);
}
html[data-theme='dark'] table th {
    color: #fff;
}
html[data-theme='dark'] table td {
    color: #e2e8f0;
    border-bottom-color: #1e293b;
}
html[data-theme='dark'] table tbody tr:nth-child(odd) {
    background: #0f172a;
}
html[data-theme='dark'] table tbody tr:nth-child(even) {
    background: #1e293b;
}
html[data-theme='dark'] table tbody tr:hover {
    background: rgba(0,162,197,0.12);
}

#chat-window {
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chat-card {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#chat-card.standalone {
    max-width: 60vw;
    max-height: 99vh;
    max-height: 99dvh;
    margin-left: auto;
    margin-right: auto;
}
@media screen and (max-width: 768px) {
    #chat-card {
        max-width: unset !important;
        max-height: unset !important;
    }
}
@media screen and (min-width: 1024px) {
    #chat-container {
        padding-inline: 10vw !important;
    }
    .input-box {
        margin-inline: 10vw !important;
    }
}

#chat-container {
    flex-grow: 1;
    scroll-behavior: smooth;
    padding-bottom: 1rem;
}
#hero-input {
    max-height: 120px;
    overflow-y: auto !important;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    line-height: 1.4;
}
/* Hero overlay - initial screen */
.hero-overlay {
    position: absolute;
    inset: 56px 0 0 0; /* leave header space */
    display: flex;
    align-items: safe center;
    justify-content: center;
    overflow-y: auto;
    pointer-events: none;
    opacity: 0;
    transition: opacity 220ms ease;
    z-index: 10;
    padding-bottom: 12%;
}
.hero-overlay .hero-content { pointer-events: none; }
#chat-card.hero-active .hero-overlay {
    opacity: 1;
    pointer-events: auto;
}
#chat-card.hero-active .hero-overlay .hero-content {
    pointer-events: auto;
}
.hero-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    max-width: 680px;
    width: 100%;
    padding-bottom: 2rem;
}
/* Hero icon with glow */
.hero-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
}
.hero-icon-glow {
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    box-shadow: 0 0 8px 2px rgba(0,162,197,0.35);
    animation: pulseGlow 3s ease-in-out infinite;
}
@keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 0.85; }
    50% { transform: scale(1.15); opacity: 1; }
}
.hero-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    position: relative;
    z-index: 1;
}
/* Hero heading */
.hero-heading {
    font-size: clamp(20px, 2.5vw, 26px);
    font-weight: 600;
    color: #0f172a;
    margin: 0;
    margin-top: -0.75rem;
}
/* Hero description */
.hero-description {
    font-size: clamp(13px, 1.4vw, 15px);
    color: #64748b;
    max-width: 420px;
    line-height: 1.5;
}
/* Hero input wrapper - no longer absolute */
.hero-input-wrapper {
    width: min(600px, 92vw);
    display: flex;
    flex-direction: column;
}
.hero-input-group {
    width: 100%;
    align-items: flex-end;
    background: #ffffff;
    border-radius: 2rem;
    border: 1px solid rgba(2,6,23,0.1);
    padding: 0.25rem;
    box-shadow: 0 2px 8px rgba(2,6,23,0.04);
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.hero-input-group:focus-within {
    border-color: rgba(0,162,197,0.4);
    box-shadow: 0 2px 12px rgba(0,162,197,0.1);
    background: #fff;
}
html.embed-false #hero-brand-title .brand-orbit { display: inline; }
.hero-input-group .form-control.user-input {
    background: transparent;
    border-radius: 1.5rem !important;
    resize: none; /* auto-resize via JS */
    overflow-y: auto;
    scrollbar-gutter: stable both-edges; /* keep scrollbar space inside */
    background-clip: padding-box;
    border: none !important;
    box-shadow: none !important;
}
.hero-input-group .form-control.user-input::placeholder {
    color: #94a3b8;
}
.hero-input-group .form-control.user-input:focus {
    background: transparent !important;
    box-shadow: none !important;
}
.hero-input-group .btn {
    border-radius: 50%;
    background: transparent;
    border: none;
}
.input-box {
    border-radius: 1.5rem;
    margin: 0rem 1rem 0.25rem 1rem;
    box-shadow: 0 -4px 8px 0px #0000000d;
}
.input-tip {
    text-align: center;
    font-size: 0.7rem;
    color: #94a3b8;
    padding: 0 1rem;
    line-height: 1.3;
}
html[data-theme='dark'] .input-tip {
    color: #64748b;
}
#chat-card.hero-active .input-tip {
    display: none;
}
.bottom-input-group {
    align-items: flex-end !important;
}
html[data-theme='dark'] .bottom-input-group .form-control.user-input {
    background-color: inherit;
}
/* When hero is active, keep footer hidden and center input */
#chat-card.hero-active .input-box { display: none; }

/* Card header glass effect */
.card-header {
    background: rgba(255,255,255,0.92);
    border-bottom: 1px solid rgba(2,6,23,0.06) !important;
    padding: 0.5rem 0.75rem 0.85rem !important;
    backdrop-filter: blur(6px);
    box-shadow: 0 1px 4px rgba(2,6,23,0.06);
    overflow: visible;
    position: relative;
    z-index: 20;
}
.card-header .d-flex {
    gap: 0.6rem;
}

/* Hide header border on welcome/hero screen */
#chat-card.hero-active .card-header {
    border-bottom-color: transparent !important;
    box-shadow: none;
}

/* Theme toggle visible in embed=false mode */
html.embed-false #theme-toggle-container {
    display: flex !important;
}

.bottom-credit {
    position: absolute;
    bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 8px;
    white-space: pre;
}
.logo-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.powered-by {
    position: absolute;
    bottom: -16px;
    left: 0;
    white-space: nowrap;
}
.brand-logo { height: 24px; vertical-align: middle; }
.big-logo { height: 40px; }
html.embed-false .brand-orbit { display: inline; }
.hidden-copy-session-id-btn {
    position: absolute;
    width: 23px;
    height: 100%;
    cursor: pointer;
}
.welcome-text {
    white-space: pre-line;
    span {
        font-weight: bold;
    }
}
/* Custom scrollbar*/
::-webkit-scrollbar {
    width: 6px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 3px;
}

.map-container .leaflet-control-attribution {
    font-size: 0.58rem;
    background: rgba(255,255,255,0.72);
}

html[data-theme='dark'] .map-container .leaflet-control-attribution {
    background: rgba(15,23,42,0.72);
    color: #cbd5e1;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

#new-chat-btn-1 {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.35rem 0.75rem;
    border-radius: 2rem;
    border: 1px solid rgba(2,6,23,0.15);
    color: #334155;
    background: #fff;
    transition: all 160ms ease;
    text-decoration: none !important;
}
#new-chat-btn-1:hover {
    background: #f8fafc;
    border-color: rgba(2,6,23,0.25);
    color: #0f172a;
    box-shadow: 0 1px 4px rgba(2,6,23,0.08);
}
/* Hide new session button when on welcome/hero screen */
#chat-card.hero-active #new-chat-btn-1 {
    display: none !important;
}
#chat-card.hero-active #new-chat-btn-2 {
    display: none !important;
}
html[data-theme='dark'] #new-chat-btn-1 {
    border-color: rgba(148,163,184,0.2);
    background: rgba(255,255,255,0.04);
    color: #cbd5e1;
}
html[data-theme='dark'] #new-chat-btn-1:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(148,163,184,0.35);
    color: #e5e7eb;
}
#logout-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #64748b;
    padding: 0.3rem 0.5rem;
    border-radius: 0.5rem;
    transition: color 160ms ease, background 160ms ease;
}
#logout-btn:hover {
    color: #334155;
    background: rgba(2,6,23,0.04);
}
#logout-btn img {
    width: 16px;
    height: 16px;
}
html[data-theme='dark'] #logout-btn {
    color: #94a3b8;
}
html[data-theme='dark'] #logout-btn:hover {
    color: #e5e7eb;
    background: rgba(255,255,255,0.05);
}


.blinking-cursor {
    display: inline-block;
    width: 8px;
    height: 1.2rem;
    background-color: #333;
    animation: blink 1s step-end infinite;
}

@keyframes blink {

    from,
    to {
        background-color: transparent;
    }

    50% {
        background-color: #333;
    }
}

.avatar {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

.user-avatar {
    background-color: #63c5e5;
    color: #fff;
    margin-bottom: 4px;
}

.bot-message-bubble {
    background-color: #f8fafc;
    border: 1px solid transparent;
    border-radius: 1rem;
    border-top-left-radius: 0.25rem;
    max-width: 85%;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(2,6,23,0.04);
    background-image: linear-gradient(#f8fafc, #f8fafc), linear-gradient(135deg, rgba(0,162,197,0.3), rgba(34,174,86,0.3), rgba(13,110,253,0.3));
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

.user-message-bubble {
    background: linear-gradient(135deg, #00b4d8 0%, #00a2c5 40%, #0090b0 100%);
    color: white;
    border-radius: 1.25rem;
    border-bottom-right-radius: 0.3rem;
    max-width: 85%;
    box-shadow: 0 4px 14px rgba(0,162,197,0.25), 0 1px 3px rgba(0,0,0,0.08);
}

/* Location chip inside user message bubble */
.user-location-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255,255,255,0.22);
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 999px;
    padding: 0.2rem 0.65rem 0.2rem 0.45rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
}
.user-location-chip-icon {
    font-size: 0.8rem;
    line-height: 1;
}
html[data-theme='dark'] .user-location-chip {
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.28);
}

.bot-message-bubble>*:last-child,
.user-message-bubble>*:last-child {
    margin-bottom: 0;
}

.bot-message-bubble p,
.user-message-bubble p {
    margin: 0;
}

/* Soften headings inside bot messages */
.bot-message-bubble h1,
.bot-message-bubble h2,
.bot-message-bubble h3,
.bot-message-bubble h4,
.bot-message-bubble h5,
.bot-message-bubble h6 {
    font-weight: 600;
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}
.bot-message-bubble h1 { font-size: 1.35rem; }
.bot-message-bubble h2 { font-size: 1.2rem; }
.bot-message-bubble h3 { font-size: 1.1rem; }
.bot-message-bubble h4,
.bot-message-bubble h5,
.bot-message-bubble h6 { font-size: 0.95rem; }
.bot-message-bubble h1 strong,
.bot-message-bubble h2 strong,
.bot-message-bubble h3 strong,
.bot-message-bubble h4 strong,
.bot-message-bubble h5 strong,
.bot-message-bubble h6 strong {
    font-weight: 700;
}
.bot-message-bubble strong {
    font-weight: 600;
}

/* Styles for rendered markdown */
.bot-message-bubble ul,
.bot-message-bubble ol {
    padding-left: 1.5rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Login brand title toggles */
html.embed-false #login-brand-title .brand-orbit { display: inline; }

.bot-message-bubble ul {
    list-style-type: disc;
}

.bot-message-bubble ol {
    list-style-type: decimal;
}

.bot-message-bubble a {
    color: var(--color-quaternary);
    text-decoration: underline;
}

.bot-message-bubble pre {
    position: relative;
    background-color: #212529;
    color: #f8f9fa;
    padding: 1.5rem 1rem 1rem;
    border-radius: 0.5rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    overflow-x: auto;
}

.bot-message-bubble code {
    color: var(--color-tertiary);
    background-color: #f8f9fa;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: monospace;
}

.bot-message-bubble pre code {
    color: inherit;
    background-color: transparent;
    padding: 0;
}

.copy-code-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: #495057;
    color: #f8f9fa;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.75rem;
    transition: background-color 0.2s;
}

.copy-code-btn:hover {
    background-color: #6c757d;
}
.bot-message-bubble.aborted {
    font-style: italic;
}
/* Hover-only buttons under each message bubble */
.chat-message { 
    position: relative; 
}

/* Create an invisible hover zone that extends from the bubble to the buttons */
.chat-message::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 0;
    right: 0;
    height: 24px;
    pointer-events: auto;
    z-index: 1;
}

.chat-message .message-copy-btn,
.chat-message .message-feedback-btn {
    position: absolute;
    bottom: -18px; /* sit just below bubble */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    opacity: 0;
    pointer-events: none; /* only active on hover of parent */
    transition: opacity 120ms ease, transform 120ms ease, color 200ms ease;
    border-radius: 50%;
    z-index: 2; /* Above the hover zone */
}
.chat-message .message-copy-btn img,
.chat-message .message-feedback-btn img { 
    width: 16px; 
    height: 16px; 
    display: block; 
    transition: transform 150ms ease;
}
.chat-message:hover .message-copy-btn,
.chat-message:hover .message-feedback-btn { 
    opacity: 1; 
    pointer-events: auto; 
}

/* Button positioning for bot messages (copy + like + dislike) */
.chat-message.from-bot {
    --left-value: 70px;
    --left-gap: 26px;
    .message-copy-btn { left: var(--left-value); }
    .message-feedback-btn.like-btn { left: calc(var(--left-value) + var(--left-gap)); }
    .message-feedback-btn.dislike-btn { left: calc(var(--left-value) + calc(var(--left-gap) * 2)); }
} 

/* Button positioning for user messages (copy only) */
.chat-message.from-user .message-copy-btn { right: 44px; }

/* Hover effects */
.message-feedback-btn:hover {
    transform: translateY(-1px) scale(1.2);
}
.message-feedback-btn:hover img {
    transform: scale(1.2);
}

.message-feedback-btn.feedback-submitted img {
    transform: scale(1.1);
}

/* Click animation */
.message-feedback-btn:active {
    transform: translateY(0) scale(0.95);
}

/* Pulse animation for feedback buttons */
@keyframes feedbackPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* User message slide-up animation */
@keyframes slideUpFadeIn {
    0% {
        opacity: 0;
        transform: translateY(50px) translateX(50px) scale(0.75);
    }
    100% {
        opacity: 1;
        transform: translateY(0) translateX(0) scale(1);
    }
}

/* Apply animation to user messages */
.chat-message.from-user {
    animation: slideUpFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-fill-mode: both;
}

/* Enhanced user message bubble with smooth entry */
.chat-message.from-user .user-message-bubble {
    transform: translateY(0);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Bot message slide-down animation */
@keyframes slideDownFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-50px) translateX(-50px) scale(0.75);
    }
    100% {
        opacity: 1;
        transform: translateY(0) translateX(0) scale(1);
    }
}

/* Apply animation to bot messages  */
.chat-message.from-bot {
    animation: slideDownFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-fill-mode: both;
}
.chat-message.from-bot .bot-message-bubble {
    transform: translateY(0);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Ensure bubbles have extra bottom spacing to avoid overlap */
.bot-message-bubble, .user-message-bubble { margin-bottom: 4px; }
.user-input {
    /* background-color: #e9ecef; */
    box-shadow: none;
    border-radius: 2rem !important;
    resize: none;
    overflow-y: auto;
    scrollbar-gutter: stable both-edges;
    background-clip: padding-box;
    min-height: 40px !important;
}
.user-input-bottom {
    padding-top: 0.5rem !important;
}
.send-btn {
    border-radius: 50% !important;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 160ms ease, transform 120ms ease;
}
.send-btn:hover {
    background: rgba(0,162,197,0.1);
    transform: scale(1.05);
}
.stop-btn {
    border-radius: 50% !important;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #f1f5f9;
    border: 1px solid rgba(2,6,23,0.1);
    transition: background 160ms ease, transform 120ms ease;
    margin-left: 2px !important;
}
.stop-btn img {
    width: 18px;
    height: 18px;
}
.stop-btn:hover {
    background: #e2e8f0;
    transform: scale(1.05);
}
.stop-btn:hover img {
    opacity: 1;
}
html[data-theme='dark'] .stop-btn {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.12);
    filter: none;
}
html[data-theme='dark'] .stop-btn img {
    filter: invert(1);
}
html[data-theme='dark'] .stop-btn:hover {
    background: rgba(255,255,255,0.14);
}
.form-control:focus {
    box-shadow: 0 0 0 1px rgba(13, 110, 253, .25) !important;
}
.user-input-bottom.form-control:focus {
    box-shadow: none !important;
}

/* Dictation (speech input) */
.dictate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--color-primary);
    border: 1px solid transparent;
    border-radius: 3rem !important;
    transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
    position: relative;
    left: 0.5rem !important;
}
.dictate-btn:hover { background: rgba(0,162,197,0.08); }
.dictate-btn.recording { color: #dc3545; }
html[data-theme='dark'] .dictate-btn { color: var(--color-primary); }
html[data-theme='dark'] .dictate-btn:hover { background: rgba(255,255,255,0.08); }
html[data-theme='dark'] .dictate-btn.recording { color: #f87171; }

.dictation-overlay-inline {
    position: absolute;
    right: 0;
    bottom: 100%;
    transform: translateY(-0.5rem);
    background: var(--color-card, #fff);
    border: 1px solid var(--color-border, rgba(0,0,0,0.1));
    padding: .5rem .75rem;
    border-radius: .75rem;
    box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,0.15));
    display: flex;
    flex-direction: column;
    gap: .5rem;
    width: 260px;
    z-index: 2000;
    animation: scaleIn 160ms ease;
}
html[data-theme='dark'] .dictation-overlay-inline { background: #0f172a; }
.dictation-waveform {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 28px;
}
.dictation-waveform .bar {
    flex: 1 0 0;
    background: linear-gradient(180deg, var(--color-primary), var(--color-quaternary));
    width: 4px;
    border-radius: 2px;
    animation: wf 600ms ease-in-out infinite;
    transform-origin: bottom;
}
.dictation-waveform .bar:nth-child(2) { animation-delay: 120ms; }
.dictation-waveform .bar:nth-child(3) { animation-delay: 240ms; }
.dictation-waveform .bar:nth-child(4) { animation-delay: 360ms; }
.dictation-waveform .bar:nth-child(5) { animation-delay: 480ms; }
@keyframes wf { 0%,100% { height: 4px; } 50% { height: 100%; } }
.dictation-actions { display: flex; justify-content: flex-end; gap: .5rem; }
.dictation-actions button {
    border: 1px solid var(--color-border, rgba(0,0,0,0.1));
    background: transparent;
    padding: .25rem .5rem;
    border-radius: .5rem;
    font-size: .75rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--color-primary);
}
.dictation-actions button.confirm { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.dictation-actions button.confirm:hover { background: #008aa7; }
.dictation-actions button.cancel:hover { background: rgba(0,0,0,0.05); }
html[data-theme='dark'] .dictation-actions button.cancel:hover { background: rgba(255,255,255,0.08); }
html[data-theme='dark'] .dictation-actions button { color: var(--color-quaternary); border-color: var(--color-border); }
html[data-theme='dark'] .dictation-actions button.confirm { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* === Inline Dictation Redesigned (waveform inside input area) === */
.dictation-inline {
    position: absolute;
    right: .5rem;
    bottom: .35rem;
    display: flex;
    align-items: center;
    gap: .8rem;
    z-index: 30;
    pointer-events: none;
}
.hero-input-group.dictating textarea::placeholder {
  line-height: 0; /* reset any browser weirdness for placeholder */
}

.dictation-inline .dictation-bars, .dictation-inline .dictation-dots { display:flex; align-items:flex-end; gap:3px; height:28px; width:120px; pointer-events:none; }
.dictation-inline .dictation-bars .bar { width:6px; background:linear-gradient(180deg, var(--color-primary), var(--color-quaternary)); border-radius:3px; height:6px; transition:height 90ms ease; }
html[data-theme='dark'] .dictation-inline .dictation-bars .bar { background:linear-gradient(180deg, var(--color-quaternary), var(--color-primary)); }
.dictation-inline .dictation-dots span { width:6px; height:6px; background:var(--color-primary); border-radius:50%; opacity:.35; animation:dots-blink 1.2s ease-in-out infinite; }
.dictation-inline .dictation-dots span:nth-child(2){ animation-delay:.2s; }
.dictation-inline .dictation-dots span:nth-child(3){ animation-delay:.4s; }
@keyframes dots-blink { 0%,100%{opacity:.2; transform:translateY(0);} 50%{opacity:.9; transform:translateY(-4px);} }
.dictation-inline .dictation-ctrls { display:flex; gap:.4rem; pointer-events:auto; }
.dictation-inline .dictation-ctrls button { width:32px; height:32px; border-radius:50%; border:1px solid var(--color-border, rgba(0,0,0,0.15)); display:inline-flex; align-items:center; justify-content:center; background:var(--color-card,#fff); color:var(--color-primary); cursor:pointer; font-size:16px; line-height:1; transition:background-color 140ms ease, color 140ms ease, box-shadow 140ms ease; }
html[data-theme='dark'] .dictation-inline .dictation-ctrls button { background:#0f172a; color:var(--color-quaternary); }
.dictation-inline .dictation-ctrls button:hover { background:var(--color-primary); color:#fff; }
html[data-theme='dark'] .dictation-inline .dictation-ctrls button:hover { background:var(--color-primary); color:#fff; }
.dictation-inline .dictation-ctrls button.confirm { background:var(--color-primary); color:#fff; }
.dictation-inline .dictation-ctrls button.confirm:hover { filter:brightness(.92); }
.dictation-inline .dictation-ctrls button.cancel:hover { background:#dc3545; color:#fff; }
html[data-theme='dark'] .dictation-inline .dictation-ctrls button.cancel:hover { background:#ef4444; }
/* .input-group.dictating textarea.user-input { padding-right:170px; }
@media (max-width:640px){ .input-group.dictating textarea.user-input { padding-right:140px; } } */

/* Hide mic & send buttons during active dictation */
.input-group.dictating #mic-btn,
.input-group.dictating #send-btn,
.input-group.dictating #hero-mic-btn,
.input-group.dictating #hero-send-btn { opacity:0; visibility:hidden; pointer-events:none; transition:opacity 120ms ease; }
.input-group:not(.dictating) #mic-btn,
.input-group:not(.dictating) #send-btn,
.input-group:not(.dictating) #hero-mic-btn,
.input-group:not(.dictating) #hero-send-btn { opacity:1; visibility:visible; }


.ai-icon-border {
    position: relative;
    top: -10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 43px;
    height: 41px;
}
.ai-icon-border.embedded {
    width: 42px;
}

.ai-icon-border-arc {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    padding: 4px;
    background: conic-gradient(from 135deg,
        var(--color-primary),
        var(--color-secondary),
        var(--color-quaternary),
        var(--color-primary));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    filter: blur(5px);
    animation: orbitai-pulse-glow 1.2s ease-in-out infinite;
}
@keyframes orbitai-pulse-glow {
    0%, 100% { transform: scale(0.95); opacity: 0.22; }
    50% { transform: scale(1.05); opacity: 0.5; }
}

/* Popup notification for session ID copy */
.popup-notification {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-secondary);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 9999;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.5s;
}
.popup-notification.error {
    background: #dc3545;
}

/* ── Regional map: gradient-bordered card ────────────────────────────── */
/* A single brand-gradient border hugs the live map — no inner band. */
.map-iframe-wrapper {
    position: relative;
    display: flex;
    padding: 1.5px;                       /* gradient border thickness */
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg,
        rgba(var(--color-primary-rgb), 1) 0%,
        rgba(34, 174, 86, 0.95) 50%,
        rgba(13, 110, 253, 1) 100%);
}

/* Inner surface holding the iframe — clips the map to the rounded border */
.map-frame {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    border-radius: calc(var(--radius-lg) - 1.5px);
    overflow: hidden;
    background: var(--color-card);
}
.map-frame iframe {
    display: block;
    width: 100%;
    border: 0;
    border-radius: inherit;
    background: var(--color-card);
}
/* Crisp hairline bevel over the map edge, separating it from the border */
.map-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    z-index: 1;
}
html[data-theme='dark'] .map-frame::after {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

/* Floating glass control over the map */
.fullscreen-btn {
    position: absolute;
    top: 0.9rem;
    left: 0.9rem;
    right: auto;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    color: #1e293b;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-pill);
    cursor: pointer;
    line-height: 0;
    box-shadow: var(--shadow-sm);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    backdrop-filter: saturate(1.4) blur(10px);
}
.fullscreen-btn svg { display: block; }

/* Dark theme: glass control adapts to the dark surface */
html[data-theme='dark'] .fullscreen-btn {
    color: #e2e8f0;
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(148, 163, 184, 0.28);
}
/* Animated rotating gradient border for thinking message (Gemini-style) */
@property --shimmer-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: true;
}
.bot-message-bubble.shimmer-background {
    position: relative;
    overflow: visible;
    animation: borderRotate 1.5s infinite linear;
}
/* Soft blurred comet glow that orbits the bubble (Gemini-style) */
.bot-message-bubble.shimmer-background::before {
    content: "";
    position: absolute;
    inset: -4px;
    z-index: -1;
    border-radius: inherit;
    padding: 4px;
    background: conic-gradient(from var(--shimmer-angle),
        color-mix(in srgb, var(--color-primary) 12%, transparent) 0deg,
        color-mix(in srgb, var(--color-secondary) 12%, transparent) 110deg,
        color-mix(in srgb, var(--color-quaternary) 12%, transparent) 200deg,
        var(--color-primary) 280deg,
        var(--color-secondary) 320deg,
        var(--color-quaternary) 352deg,
        color-mix(in srgb, var(--color-primary) 12%, transparent) 360deg);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    filter: blur(6px);
    opacity: 0.75;
    pointer-events: none;
}
/* Thinking/status text styling */
.shimmer-background .status-text {
    color: #4b5563 !important;
    font-size: 0.85rem;
}

@keyframes borderRotate {
    to {
        --shimmer-angle: 360deg;
    }
}

/* Sessions history overlay - left drawer */
.sessions-overlay {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 88%;
    max-width: 500px;
    background: #fff;
    border-right: 1px solid rgba(2,6,23,0.06);
    box-shadow: 4px 0 20px rgba(2,6,23,0.08);
    transform: translateX(-100%);
    transition: transform 280ms ease;
    z-index: 30;
}
.sessions-overlay.open {
    transform: translateX(0);
}

/* Backdrop behind sessions overlay */
.sessions-backdrop {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(15, 23, 42, 0.25); /* slate-900 @ 45% */
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
    z-index: 25; /* above header (20), below overlay (30) */
}
.sessions-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}
.sessions-overlay .overlay-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0.5rem;
}
.sessions-overlay .overlay-header {
    position: sticky;
    top: 0;
    background: rgba(255,255,255,0.98);
    z-index: 1;
    padding: 0.5rem 0.85rem 0.4rem;
}
.sessions-search-toggle,
#close-sessions-overlay,
.sessions-overlay-btn {
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 0.5rem;
    color: #475569;
    border: 1px solid rgba(2,6,23,0.12);
    background: #fff;
    transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}
.sessions-search-toggle svg,
.sessions-overlay-btn svg { width: 16px; height: 16px; }
.sessions-search-toggle:hover, .sessions-search-toggle:focus,
#close-sessions-overlay:hover, #close-sessions-overlay:focus,
.sessions-overlay-btn:hover, .sessions-overlay-btn:focus {
    background: #f1f5f9;
    border-color: rgba(2,6,23,0.2);
    color: #0f172a;
}
html[data-theme='dark'] .sessions-search-toggle,
html[data-theme='dark'] #close-sessions-overlay,
html[data-theme='dark'] .sessions-overlay-btn {
    color: #94a3b8;
    border-color: rgba(148,163,184,0.2);
    background: rgba(255,255,255,0.04);
}
html[data-theme='dark'] .sessions-search-toggle:hover,
html[data-theme='dark'] .sessions-search-toggle:focus,
html[data-theme='dark'] #close-sessions-overlay:hover,
html[data-theme='dark'] #close-sessions-overlay:focus,
html[data-theme='dark'] .sessions-overlay-btn:hover,
html[data-theme='dark'] .sessions-overlay-btn:focus {
    background: rgba(255,255,255,0.08);
    border-color: rgba(148,163,184,0.35);
    color: #e5e7eb;
}
.sessions-search-bar { overflow: hidden; transition: max-height 260ms ease, opacity 200ms ease; max-height:0; opacity:0; }
.sessions-search-bar.open { max-height:120px; opacity:1; }
.sessions-search-bar .search-inner { display:flex; align-items:center; }
.sessions-search-input { padding-right:2rem; background:#f8fafc; }
html[data-theme='dark'] .sessions-search-input { background:#1e293b; color:#f1f5f9; border-color:#334155; }
html[data-theme='dark'] .sessions-search-input:focus { background:#1e293b; color:#fff; }
html[data-theme='dark'] .sessions-search-input::placeholder { color:#64748b; opacity:1; }
/* Empty sessions message styling */
.empty-sessions-msg { color:#475569; }
html[data-theme='dark'] .empty-sessions-msg { color:#cbd5e1; }
.sessions-search-clear { position:absolute; right:.25rem; top:50%; transform:translateY(-50%); color:#64748b; text-decoration:none; font-size:1.1rem; padding:.125rem .25rem; }
.sessions-search-clear:hover { color:#0f172a; }
/* spinner removed */
html[data-theme='dark'] .sessions-search-clear { color:#94a3b8; }
html[data-theme='dark'] .sessions-search-clear:hover { color:#fff; }
/* spinner removed */
.sessions-overlay .overlay-list {
    overflow-y: auto;
    font-size: small;
    height: calc(100% - 48px);
}
.sessions-overlay .list-loading {
    padding: 0.5rem;
    overflow: unset;
}
.sessions-overlay .list-group-item {
    cursor: pointer;
    border: none;
    border-radius: 0.5rem !important;
    padding: 0.65rem 0.75rem;
    margin: 0.2rem 0.5rem;
    transition: background 150ms ease;
}
.sessions-overlay .list-group-item .session-id {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.sessions-overlay .list-group-item.active {
    background-color: rgba(0,162,197,0.08);
    border: none !important;
    color: #0f172a;
    border-left: 3px solid var(--color-primary) !important;
    border-radius: 0 0.5rem 0.5rem 0 !important;
}
.sessions-overlay .list-group-item:not(.active):hover {
    background: rgba(2,6,23,0.03);
}

/* Interaction blocking overlay - blocks all user interaction during loading */
.interaction-blocking-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50; /* above all other overlays */
    cursor: wait;
    user-select: none;
}

.interaction-blocking-overlay.active {
    display: flex;
}

.interaction-blocking-overlay .loading-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: 280px;
    text-align: center;
}

.interaction-blocking-overlay .loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.interaction-blocking-overlay .loading-text {
    color: #334155;
    font-weight: 500;
    font-size: 0.875rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dark mode styles for blocking overlay */
html[data-theme='dark'] .interaction-blocking-overlay .loading-content {
    background: rgba(30, 41, 59, 0.95);
}

html[data-theme='dark'] .interaction-blocking-overlay .loading-text {
    color: #e2e8f0;
}

html[data-theme='dark'] .interaction-blocking-overlay .loading-spinner {
    border-color: #475569;
    border-top-color: var(--color-primary);
}
/* small utility area for actions */
.session-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
/* Session actions: hover-only kebab and dropdown menu */
.list-group-item .session-actions {
    position: relative;
    display: flex;
    align-items: center;
}

.list-group-item .session-actions .kebab-btn {
    background: transparent;
    border: none;
    line-height: 1;
    font-size: 18px;
    padding: 4px 6px;
    border-radius: 6px;
    color: #6c757d; /* muted */
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease, background-color 120ms ease, color 120ms ease;
}

.list-group-item:hover .session-actions .kebab-btn,
.list-group-item .session-actions.open .kebab-btn {
    opacity: 1;
    pointer-events: auto;
}

/* Keep kebab visible for the selected (active) session */
.list-group-item.active .session-actions .kebab-btn {
    opacity: 1;
    pointer-events: auto;
    color: #fff;
}

.list-group-item.active .session-actions .kebab-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.list-group-item .session-actions .kebab-btn:hover {
    background: rgba(0,0,0,0.06);
    color: #343a40;
}

.list-group-item .session-actions .session-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 160px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    padding: 6px 0;
    display: none;
    z-index: 5;
}

.list-group-item .session-actions.open .session-menu {
    display: block;
}

.list-group-item .session-actions .session-menu-item {
    width: 100%;
    background: transparent;
    border: none;
    text-align: left;
    padding: 8px 12px;
    font-size: 14px;
    color: #212529;
    cursor: pointer;
}

.list-group-item .session-actions .session-menu-item:hover {
    background: rgba(0,0,0,0.05);
}
.list-group-item .session-actions .session-menu-item.text-danger { color: #dc3545; }
.list-group-item .session-actions .session-menu-item.text-danger:hover { background: rgba(220,53,69,0.08); }
.session-actions .btn-icon {
    border: none;
    background: transparent;
    color: #64748b;
    padding: 0.125rem 0.25rem;
}
.session-actions .btn-icon:hover {
    color: #0f172a;
}

/* Simple spinner */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Rename modal */
.rename-modal-overlay, .authtoken-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    /* Improve separation from background */
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.rename-modal-overlay.open, .authtoken-modal-overlay.open {
    display: flex;
}
.rename-modal-dialog {
    background: #fff;
    width: min(92vw, 420px);
    border-radius: 0.5rem;
    padding: 0.75rem 0.75rem 0.75rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    /* Subtle boundary in light mode */
    border: 1px solid var(--color-border);
}

/* Login overlay */
.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
.login-card {
    position: relative;
    overflow: hidden;
    width: min(92vw, 400px);
    min-height: 380px;
    border-radius: 0.75rem;
    padding: 1.25rem 1.25rem 1rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.88));
    border: 1px solid rgba(13,110,253,0.08);
    box-shadow: 0 18px 40px rgba(2,6,23,0.18);
    -webkit-backdrop-filter: blur(10px) saturate(1.05);
    backdrop-filter: blur(10px) saturate(1.05);
    display: flex;
    flex-direction: column;
    justify-content: center; /* center content vertically */
    align-items: stretch;
    gap: 1rem; /* consistent spacing between title, error, and form */
}
.login-card::before {
    /* Brand accent bar at the top */
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-quaternary), var(--color-secondary));
}
.login-card::after {
    /* Soft corner glow */
    content: "";
    position: absolute;
    width: 260px; height: 260px;
    right: -140px; bottom: -140px;
    background: radial-gradient(closest-side, rgba(0,162,197,0.22), transparent 70%);
    filter: blur(10px);
    pointer-events: none;
}
/* Subtle heading tint */
.login-card h5, .login-card .card-title {
    color: var(--color-quaternary);
    font-weight: 600;
}
/* Inputs within the login card */
.login-card .form-control {
    background-color: #f8fafc;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 0.5rem;
}
.login-card .form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 .2rem rgba(0, 162, 197, .2) !important;
}
/* Primary action button inside login card */
.login-card #login-submit, .login-card .btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    box-shadow: 0 6px 16px rgba(0, 162, 197, 0.25);
}
.login-card #login-submit:hover, .login-card .btn-primary:hover {
    background-color: #008aa7;
    border-color: #008aa7;
}
.login-card #login-submit:focus-visible, .login-card .btn-primary:focus-visible {
    box-shadow: 0 0 0 .2rem rgba(0, 162, 197, .35) !important;
}
/* Error text */
#login-error { color: var(--color-tertiary); font-weight: 500; min-height: 1.125rem; }
/* Ensure error appears above the login button */
.login-card .d-flex.justify-content-between.align-items-center {
    display: grid !important;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 0.5rem;
}
/* Layout and spacing inside login card */
.login-card h5, .login-card .card-title { margin-bottom: 0.5rem; }
.login-card form {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 0.75rem;
}
@media (min-width: 480px) {
    .login-card form { gap: 1rem; }
}
.login-card label { margin-bottom: 0.25rem; color: #334155; font-weight: 500; }
.login-card .form-group,
.login-card .input-group,
.login-card .form-floating,
.login-card .mb-3 { margin-bottom: 0 !important; }
.login-card .form-control { width: 100%; }
.login-card .btn { width: 100%; min-height: 44px; border-radius: 0.5rem; }
.login-card .btn-row { display: flex; align-items: center; gap: 0.5rem; }
.login-card .btn-row .btn { flex: 1 0 0; }
.login-card #login-error { margin-top: 0.25rem; }
/* Custom button styles */
.custom-primary-btn {
    background-color: var(--color-primary);
    color: #fff;
    border: 1px solid var(--color-primary);
    border-radius: 0.375rem;
}
.custom-primary-btn:hover {
    background-color: #0094b6;
    border-color: #0094b6;
    color: #fff;
}
.custom-primary-btn:focus {
    outline: none;
    box-shadow: 0 0 0 .125rem rgba(0, 162, 197, .25);
}
.custom-primary-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}
/* Hero brand title */
#hero-brand-title {
    font-size: 40px; /* larger */
    font-weight: 600;
    background-image: linear-gradient(to right, #69d9f0 0%, #6be6b3 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
}

/* Slight nudge upward relative to hero content block */
.hero-overlay .hero-content {
    transform: none;
    height: auto;
}

/* Login brand title (smaller to fit card) */
#login-brand-title {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.1;
    background-image: linear-gradient(to right, #69d9f0 0%, #6be6b3 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Keep Orbit word in gradient, color AI #00a2c5 in hero/login when non-embed */
html.embed-false #hero-brand-title .brand-orbit .orbit-word,
html.embed-false #login-brand-title .brand-orbit .orbit-word {
    background-image: linear-gradient(to right, #69d9f0 0%, #6be6b3 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
html.embed-false #hero-brand-title .brand-orbit .orbit-ai,
html.embed-false #login-brand-title .brand-orbit .orbit-ai {
    color: #0d9dfd;
    -webkit-background-clip: initial;
    background-clip: initial;
    font-weight: lighter;
}

/* For Cropin brand (embed=true): keep Cropin in gradient, color "Sage 2.0" as #00a2c5 */
html.embed-true #hero-brand-title .brand-cropin .cropin-word,
html.embed-true #login-brand-title .brand-cropin .cropin-word {
    background-image: linear-gradient(to right, #69d9f0 0%, #6be6b3 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
html.embed-true #hero-brand-title .brand-cropin .cropin-sage,
html.embed-true #login-brand-title .brand-cropin .cropin-sage {
    color: #0d9dfd;
    -webkit-background-clip: initial;
    background-clip: initial;
    font-size: 30px;
}

/* Delete modal (mirrors rename modal) */
.delete-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    /* Improve separation from background */
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.delete-modal-overlay.open { display: flex; }
.delete-modal-dialog {
    /* Subtle boundary in light mode */
    border: 1px solid var(--color-border);
    background: #fff;
    width: min(92vw, 420px);
    border-radius: 0.5rem;
    padding: 0.75rem 0.75rem 0.75rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

/* Feedback modal */
.feedback-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    /* Improve separation from background */
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.feedback-modal-overlay.open { display: flex; }
.feedback-modal-dialog {
    /* Subtle boundary in light mode */
    border: 1px solid var(--color-border);
    background: #fff;
    width: min(92vw, 480px);
    border-radius: 0.75rem;
    padding: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}
.feedback-modal-dialog .form-control {
    background-color: #f8fafc;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 0.5rem;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}
.feedback-modal-dialog .form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 .2rem rgba(0, 162, 197, .2) !important;
}
.feedback-modal-dialog .form-label {
    color: #374151;
    font-weight: 500;
}

/* Dark mode feedback modal */
html[data-theme='dark'] .feedback-modal-dialog {
    background: #0f172a;
    border-color: var(--color-border);
    box-shadow: 0 18px 40px rgba(0,0,0,0.6);
}
html[data-theme='dark'] .feedback-modal-dialog .form-control {
    background-color: #0b1220;
    border-color: var(--color-border);
    color: #e5e7eb;
}
html[data-theme='dark'] .feedback-modal-dialog .form-control::placeholder {
    color: #94a3b8;
}
html[data-theme='dark'] .feedback-modal-dialog .form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 .2rem rgba(0, 162, 197, .28) !important;
}
html[data-theme='dark'] .feedback-modal-dialog .form-label {
    color: #cbd5e1;
}
html[data-theme='dark'] .feedback-modal-overlay {
    background: rgba(2,6,23,0.6);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

/* ==========================
     UI Makeover: Chat Enhancements
     ========================== */
.bot-message-bubble:hover,
.user-message-bubble:hover {
    transform: none !important;
    box-shadow: var(--shadow-sm);
}

/* 2) Sessions list spacing between items */
.sessions-overlay .overlay-list .list-group-item {
    margin: 2px 0;
}

/* 3) Ensure session action menu renders above neighbors */
.list-group-item .session-actions .session-menu {
    z-index: 1002; /* above list items and sticky header */
}
/* Elevate stacking when the actions menu is open */
.list-group-item .session-actions.open {
    position: relative;
    z-index: 1003;
}

/* 3b) Prevent hovered items from creating a higher stacking context than open menus */
.sessions-overlay .list-group-item {
    position: relative; /* enable z-index stacking */
}
/* Remove transform on hover to avoid new stacking contexts overshadowing menus */
.sessions-overlay .list-group-item:not(.active):hover {
    transform: none !important;
}

/* 4) Add breathing room between overlay header and list */
.sessions-overlay .overlay-header {
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(2,6,23,0.06);
}
.sessions-overlay .overlay-list {
    margin-top: 0.25rem;
}

/* === Design System Variables === */
:root {
    --color-primary: #00a2c5;
    --color-primary-rgb: 0,162,197;
    /* --color-primary-new: #69d9f0; */
    --color-secondary: #22ae56;
    /* --color-secondary-new: #6be6b3; */
    --color-tertiary: #d63384;
    --color-quaternary: #0d6efd;
    /* --color-quaternary-new: #4b98ee; */

    --color-bg: #f8f9fa;
    --color-card: #ffffff;
    --color-muted: #64748b;
    --color-border: rgba(2, 6, 23, 0.08);
    --shadow-sm: 0 4px 10px rgba(2, 6, 23, 0.06);
    --shadow-md: 0 10px 25px rgba(2, 6, 23, 0.12);
    --shadow-lg: 0 18px 40px rgba(2, 6, 23, 0.18);
    --radius-sm: .375rem;
    --radius-md: .75rem;
    --radius-lg: 1.25rem;
    --radius-pill: 999px;
}

/* Global background with subtle radial washes */
body {
    background:
        radial-gradient(1200px 800px at 10% -10%, rgba(13,110,253,0.06), transparent 60%),
        radial-gradient(1000px 600px at 110% 10%, rgba(0,162,197,0.08), transparent 60%),
        var(--color-bg);
    color: #0f172a;
}

/* Chat card: soft glassy panel */
#chat-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.86), rgba(255,255,255,0.94));
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    backdrop-filter: saturate(1.05) blur(8px);
}

/* Hero overlay: gentle entrance */
#chat-card.hero-active .hero-overlay {
    animation: fadeSlideIn 260ms ease both;
}

/* Input dock: floating, airy */
.input-box {
    position: relative;
    overflow: visible;
    box-shadow: 0 -2px 12px 0px rgba(0,0,0,0.06);
    background: #ffffff;
    border: 1px solid rgba(2,6,23,0.08);
}

/* Inputs: crisp borders + responsive focus ring */
.form-control.user-input {
    border: 1px solid rgba(2,6,23,0.06);
    transition: box-shadow 160ms ease, border-color 160ms ease, height 160ms ease, background-color 160ms ease;
}
.hero-input-group .form-control.user-input { background: transparent; border: none; }
.hero-input-group .form-control.user-input:focus { background: transparent !important; box-shadow: none !important; border: none !important; }
.form-control:focus {
    box-shadow: 0 0 0 .16rem rgba(13, 110, 253, .20) !important;
    border-color: rgba(13,110,253,.35) !important;
}

/* Fancy brand gradients with a slow shimmer */
#hero-brand-title,
#login-brand-title {
    background-size: 200% auto;
    animation: gradientShift 8s ease infinite;
}

/* Message bubbles: depth + micro-interactions */
/* .bot-message-bubble,
.user-message-bubble { transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease; }
.bot-message-bubble { box-shadow: 0 2px 8px rgba(2,6,23,0.06); }
.user-message-bubble { box-shadow: 0 2px 10px rgba(0,162,197,0.22); }
.bot-message-bubble:hover,
.user-message-bubble:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); } */

/* Chat message mount animation */
.chat-message { animation: messageIn 260ms ease both; }

/* Hover controls polish */
.copy-code-btn { transition: background-color 0.2s, transform 120ms ease; }
.copy-code-btn:hover { transform: translateY(-1px); }
.chat-message .message-copy-btn { transition: opacity 120ms ease, transform 120ms ease; }
.chat-message .message-copy-btn:hover { transform: translateY(-1px) scale(1.02); }

/* Scrollbar: subtle gradient */
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #cbd5e1, #94a3b8);
}

/* Map/image controls */
.fullscreen-btn { transition: box-shadow 180ms ease, background-color 180ms ease, color 180ms ease, border-color 180ms ease; }
.fullscreen-btn:hover { box-shadow: var(--shadow-md); background: var(--color-primary); color: #fff; border-color: transparent; }
html[data-theme='dark'] .fullscreen-btn:hover { background: var(--color-primary); color: #fff; border-color: transparent; }

/* Map card fills the screen cleanly while in fullscreen */
.map-iframe-wrapper:fullscreen { border-radius: 0; padding: 0; background: var(--color-card); box-shadow: none; }
.map-iframe-wrapper:fullscreen .map-frame { padding: 0; border-radius: 0; }
.map-iframe-wrapper:fullscreen iframe { height: 100%; border-radius: 0; }

/* Session drawer: smoother slide and glass effect */
.sessions-overlay {
    transition: transform 320ms cubic-bezier(.2,.8,.2,1);
    box-shadow: 2px 0 18px rgba(0,0,0,0.08);
    backdrop-filter: blur(8px) saturate(1.02);
}
.sessions-overlay .list-group-item {
    border-radius: .5rem;
    transition: background-color 160ms ease, transform 120ms ease, box-shadow 160ms ease;
}
.sessions-overlay .list-group-item:not(.active):hover {
    background-color: rgba(2,6,23,0.035);
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(2,6,23,0.06);
}

/* Active session request indicators */
.session-status { display:inline-flex; align-items:center; margin-left:6px; }
/* Base dot (typing / unseen done) static green */
.session-active-dot { position:relative; display:inline-block; width:8px; height:8px; border-radius:50%; background: var(--color-secondary); color: var(--color-secondary); }
/* Fetching phase: blue + pulse */
.session-active-dot.fetching { background: var(--color-quaternary); color: var(--color-quaternary); }
/* Active selection overrides color for contrast */
.list-group-item.active .session-active-dot { background:#fff; color:#fff; }
/* Static ring */
.session-active-dot::after { content:""; position:absolute; inset:-4px; border-radius:50%; border:2px solid currentColor; opacity:.45; }
/* Animated ring only for fetching */
.session-active-dot.fetching::after { animation:pulseDot 1.1s ease-in-out infinite; }
@keyframes pulseDot { 0% { transform:scale(.55); opacity:.55;} 50% { transform:scale(1); opacity:.15;} 100% { transform:scale(.55); opacity:.55;} }

.list-group-item .session-actions .kebab-btn { transition: opacity 120ms ease, background-color 120ms ease, color 120ms ease, transform 120ms ease; }
.list-group-item .session-actions .kebab-btn:active { transform: scale(0.98); }
.list-group-item .session-actions .session-menu { animation: scaleIn 160ms ease both; }

/* Modals and cards: scale-in */
.rename-modal-dialog,
.delete-modal-dialog,
.login-card { animation: scaleIn 200ms ease both; }

/* Success/error toasts */
.popup-notification {
    top: 12px;
    background: linear-gradient(90deg, var(--color-secondary), #16c172);
    box-shadow: var(--shadow-md);
    transition: opacity 300ms ease, transform 300ms ease;
    transform-origin: top center;
}
.popup-notification.error { background: linear-gradient(90deg, #dc3545, #ef476f); }

/* Keyframes */
@keyframes messageIn { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: translateY(0);} }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.98);} to { opacity: 1; transform: scale(1);} }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: translateY(0);} }
@keyframes gradientShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

/* Accessibility: respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ==========================
     Dark Mode Toggle + Theme
     ========================== */
.theme-toggle-btn {
    color: #334155;
    border-radius: 999px;
    border: 1px solid rgba(2,6,23,0.08);
    background: #fff;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    box-shadow: 0 2px 8px rgba(2,6,23,0.08);
}
.theme-toggle-btn:hover { background: #f8fafc; }
.theme-toggle-btn .icon-sun { display: none; }
.theme-toggle-btn.is-dark .icon-moon { display: none; }
.theme-toggle-btn.is-dark .icon-sun { display: inline-flex; }

/* Settings Button */
.settings-toggle-btn {
    color: #334155;
    border-radius: 999px;
    border: 1px solid rgba(2,6,23,0.08);
    background: #fff;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(2,6,23,0.08);
    transition: all 0.2s ease;
    margin-right: 0.5rem;
}
.settings-toggle-btn:hover {
    background: #f8fafc;
    transform: rotate(90deg);
}
.settings-toggle-btn:active {
    transform: rotate(180deg) scale(0.95);
}
.settings-toggle-btn.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    transform: rotate(90deg);
}

/* Settings Container */
.settings-container {
    position: relative;
}

/* Settings Dropdown */
.settings-dropdown {
    position: absolute;
    top: calc(100% + 0.25rem);
    right: -100%;
    background: #fff;
    border: 1px solid rgba(2,6,23,0.08);
    border-radius: 0.75rem;
    box-shadow: 0 10px 30px rgba(2,6,23,0.15);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    backdrop-filter: blur(8px);
}
.settings-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Settings Content */
.settings-content {
    padding: 0.75rem;
}
.settings-header {
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(2,6,23,0.08);
    margin-bottom: 0.75rem;
}
.settings-header h6 {
    color: #1e293b;
    font-weight: 600;
    font-size: 0.875rem;
    margin: 0;
}
.settings-body {
    min-height: 40px;
}

/* Setting Item */
.setting-item {
    padding: 0.5rem 0;
}
.setting-label {
    color: #334155;
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0;
    cursor: pointer;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
}
.toggle-input {
    opacity: 0;
    position: absolute;
    width: 0;
    height: 0;
}
.toggle-slider {
    display: inline-block;
    width: 44px;
    height: 24px;
    background: #e2e8f0;
    border: 2px solid #e2e8f0;
    border-radius: 24px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    top: 1px;
    left: 1px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.toggle-input:checked + .toggle-slider {
    background: var(--color-primary);
    border-color: var(--color-primary);
}
.toggle-input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background: #fff;
}
.toggle-slider:hover {
    box-shadow: 0 0 0 3px rgba(0, 162, 197, 0.1);
}
.toggle-input:focus + .toggle-slider {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 162, 197, 0.15);
}

/* Light (default) variables already set above; Dark overrides below */
html[data-theme='dark'] {
    --color-bg: #0b1220;
    --color-card: #0f172a;
    --color-muted: #9aa4b2;
    --color-border: rgba(148,163,184,0.18);
    color-scheme: dark;
}

/* Theme reveal animation (directional, performant) */
:root { view-transition-name: root; }
@media (prefers-reduced-motion: no-preference) {
    /* Simple, smooth circular reveal only */
    html.theme-animating::view-transition-old(root) { animation: none; }
        html.theme-animating::view-transition-new(root) {
        will-change: clip-path;
        contain: paint;
            animation: theme-reveal 360ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
        clip-path: circle(0 at var(--vt-x, 100%) var(--vt-y, 0%));
    }
    @keyframes theme-reveal {
        to { clip-path: circle(var(--vt-r, 150vmax) at var(--vt-x, 100%) var(--vt-y, 0%)); }
    }
}

/* Page background */
html[data-theme='dark'] body {
    background:
        radial-gradient(1200px 800px at 10% -10%, rgba(13,110,253,0.12), transparent 60%),
        radial-gradient(1000px 600px at 110% 10%, rgba(0,162,197,0.14), transparent 60%),
        var(--color-bg);
    color: #e5e7eb;
}

/* Chat card */
html[data-theme='dark'] #chat-card {
    background: linear-gradient(180deg, rgba(15,23,42,0.78), rgba(15,23,42,0.86));
    border-color: var(--color-border);
    box-shadow: 0 10px 30px rgba(2,6,23,0.5);
    backdrop-filter: saturate(1.05) blur(8px);
}

/* History button styling */
#history-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem;
    margin-right: 0.5rem;
    border-radius: 0.4rem;
    border: none;
    background: transparent;
    color: #64748b;
    transition: background 150ms ease, color 150ms ease;
}
#history-btn:hover {
    background: rgba(2,6,23,0.05);
    color: #334155;
}
#history-btn img {
    width: 28px;
    height: 28px;
}
html[data-theme='dark'] #history-btn {
    color: #94a3b8;
    background: transparent;
}
html[data-theme='dark'] #history-btn:hover {
    background: rgba(255,255,255,0.06);
    color: #e5e7eb;
}

/* Header tweaks */
html[data-theme='dark'] .card-header { border-color: var(--color-border) !important; background: rgba(15,23,42,0.6); }
html[data-theme='dark'] .powered-by { color: var(--color-muted) !important; }
html[data-theme='dark'] .theme-toggle-btn { background: #0b1220; color: #cbd5e1; border-color: var(--color-border); box-shadow: 0 2px 10px rgba(2,6,23,0.6); }
html[data-theme='dark'] .theme-toggle-btn:hover { background: #0f172a; }

/* Dark mode Settings Button */
html[data-theme='dark'] .settings-toggle-btn {
    background: #0b1220;
    color: #cbd5e1;
    border-color: var(--color-border);
    box-shadow: 0 2px 10px rgba(2,6,23,0.6);
}
html[data-theme='dark'] .settings-toggle-btn:hover {
    background: #0f172a;
    transform: rotate(90deg);
}
html[data-theme='dark'] .settings-toggle-btn:active {
    background: #0f172a;
    transform: rotate(180deg) scale(0.95);
}
html[data-theme='dark'] .settings-toggle-btn.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* Dark mode Settings Dropdown */
html[data-theme='dark'] .settings-dropdown {
    background: linear-gradient(180deg, rgba(15,23,42,0.95), rgba(15,23,42,0.98));
    border-color: var(--color-border);
    box-shadow: 0 10px 30px rgba(2,6,23,0.7);
    backdrop-filter: blur(12px);
}
html[data-theme='dark'] .settings-header {
    border-bottom-color: var(--color-border);
}
html[data-theme='dark'] .settings-header h6 {
    color: #e5e7eb;
}
html[data-theme='dark'] .setting-label {
    color: #cbd5e1;
}

/* Dark mode Toggle Switch */
html[data-theme='dark'] .toggle-slider {
    background: #374151;
    border-color: #374151;
}
html[data-theme='dark'] .toggle-slider::before {
    background: #d1d5db;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
html[data-theme='dark'] .toggle-input:checked + .toggle-slider {
    background: var(--color-primary);
    border-color: var(--color-primary);
}
html[data-theme='dark'] .toggle-input:checked + .toggle-slider::before {
    background: #fff;
}
html[data-theme='dark'] .toggle-slider:hover {
    box-shadow: 0 0 0 3px rgba(0, 162, 197, 0.15);
}
html[data-theme='dark'] .toggle-input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(0, 162, 197, 0.2);
}

/* Input dock */
html[data-theme='dark'] .input-box {
    background: #1e293b;
    border-color: rgba(148,163,184,0.12) !important;
    box-shadow: none;
}
html[data-theme='dark'] .form-control.user-input,
html[data-theme='dark'] .hero-input-group .form-control.user-input {
    color: #e5e7eb;
    border-color: var(--color-border);
}
html[data-theme='dark'] .form-control.user-input {
    background: transparent;
}
html[data-theme='dark'] .hero-input-group .form-control.user-input {
    background: transparent;
    border: none;
}
html[data-theme='dark'] .form-control.user-input::placeholder,
html[data-theme='dark'] .hero-input-group .form-control.user-input::placeholder { color: #94a3b8; }
html[data-theme='dark'] .form-control:focus { box-shadow: 0 0 0 .16rem rgba(13,110,253,.28) !important; border-color: rgba(13,110,253,.45) !important; }
html[data-theme='dark'] .stop-btn { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.12); }
html[data-theme='dark'] .stop-btn img { filter: invert(1); }

/* Messages */
html[data-theme='dark'] .bot-message-bubble { background-color: #1e293b; color: #e5e7eb; border-color: transparent; box-shadow: 0 1px 4px rgba(0,0,0,0.2); }
html[data-theme='dark'] .user-message-bubble { background: linear-gradient(135deg, #0097b2 0%, #007c94 50%, #006577 100%); color: #fff; box-shadow: 0 4px 16px rgba(0,162,197,0.3), 0 1px 4px rgba(0,0,0,0.3); }
html[data-theme='dark'] .bot-message-bubble pre { background-color: #0f172a; color: #e5e7eb; }
html[data-theme='dark'] .bot-message-bubble code { background-color: #0f172a; color: var(--color-tertiary); }
html[data-theme='dark'] .bot-message-bubble a { color: var(--color-quaternary); }

/* Scrollbar */
html[data-theme='dark'] ::-webkit-scrollbar-track { background: #0b1220; }
html[data-theme='dark'] ::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #334155, #475569); }

/* Sessions overlay */
html[data-theme='dark'] .sessions-overlay { background: #0f172a; border-color: var(--color-border); box-shadow: 4px 0 20px rgba(0,0,0,0.4); }
html[data-theme='dark'] .sessions-overlay .overlay-header { background: #0f172a; box-shadow: 0 1px 0 rgba(148,163,184,0.1); }
html[data-theme='dark'] .sessions-overlay .list-group-item:not(.active):hover { background-color: rgba(255,255,255,0.03); }
html[data-theme='dark'] .list-group-item .session-actions .kebab-btn { color: #bdcee6; }
html[data-theme='dark'] .list-group-item .session-actions .kebab-btn:hover { background: rgba(255,255,255,0.06); color: #e5e7eb; }
html[data-theme='dark'] .list-group-item .session-actions .session-menu { background: #0f172a; border-color: var(--color-border); box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
html[data-theme='dark'] .list-group-item .session-actions .session-menu-item { color: #e5e7eb; }
html[data-theme='dark'] .list-group-item .session-actions .session-menu-item:hover { background: rgba(255,255,255,0.06); }
html[data-theme='dark'] .list-group-item .session-actions .session-menu-item.text-danger { color: #f87171; }
html[data-theme='dark'] .list-group-item .session-actions .session-menu-item.text-danger:hover { background: rgba(248,113,113,0.08); }

/* Modals */
html[data-theme='dark'] .rename-modal-dialog,
html[data-theme='dark'] .delete-modal-dialog,
html[data-theme='dark'] .login-card {
    background: #0f172a;
    border-color: var(--color-border);
    box-shadow: 0 18px 40px rgba(0,0,0,0.6);
}
html[data-theme='dark'] .login-card h5, html[data-theme='dark'] .login-card .card-title { color: var(--color-quaternary); }
html[data-theme='dark'] .login-card .form-control { background-color: #0b1220; border-color: var(--color-border); color: #e5e7eb; }
html[data-theme='dark'] .login-card .form-control::placeholder { color: #94a3b8; }
html[data-theme='dark'] .login-card .form-control:focus { border-color: rgba(13,110,253,.45); box-shadow: 0 0 0 .2rem rgba(13,110,253,.28) !important; }
html[data-theme='dark'] .login-card #login-submit, html[data-theme='dark'] .login-card .btn-primary { background-color: var(--color-primary); border-color: var(--color-primary); color: #fff; box-shadow: 0 6px 20px rgba(0,162,197,0.35); }
html[data-theme='dark'] .custom-primary-btn { background-color: var(--color-primary); border-color: var(--color-primary); color: #fff; }
html[data-theme='dark'] #login-error { color: var(--color-tertiary); }
/* Dark overlay clarity */
html[data-theme='dark'] .rename-modal-overlay,
html[data-theme='dark'] .delete-modal-overlay,
html[data-theme='dark'] .authtoken-modal-overlay {
    background: rgba(2,6,23,0.6);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

/* Toasts */
html[data-theme='dark'] .popup-notification { box-shadow: 0 10px 24px rgba(0,0,0,0.6); }

/* Bot bubble with gradient border in dark mode */
html[data-theme='dark'] .bot-message-bubble {
    background-color: #1f2937;
    background-image: linear-gradient(#1f2937, #1f2937), linear-gradient(135deg, rgba(0,162,197,0.35), rgba(34,174,86,0.35), rgba(13,110,253,0.35));
    background-origin: border-box;
    background-clip: padding-box, border-box;
    border-color: transparent;
}

/* Dark mode keeps the same theme-colored comet glow; brighten slightly for contrast */
html[data-theme='dark'] .bot-message-bubble.shimmer-background::before {
    opacity: 0.9 !important;
}
html[data-theme='dark'] .shimmer-background .status-text {
    color: #c8dce4 !important;
}

/* ==========================
     Dark Mode – Readability Fixes
     ========================== */
/* Hero overlay text */
html[data-theme='dark'] .hero-title { color: #cbd5e1; }
html[data-theme='dark'] .hero-heading { color: #e5e7eb; }
html[data-theme='dark'] .hero-description { color: #94a3b8; }
html[data-theme='dark'] .hero-overlay .hero-content { color: #e5e7eb; }
html[data-theme='dark'] .hero-input-group {
    background: rgba(30,41,59,0.6);
    border-color: var(--color-border);
}
html[data-theme='dark'] .hero-input-group:focus-within {
    background: rgba(30,41,59,0.85);
    border-color: rgba(0,162,197,0.45);
}
html[data-theme='dark'] .hero-icon-glow {
    box-shadow: 0 0 10px 3px rgba(0,162,197,0.5);
}
html[data-theme='dark'] .ai-icon-border-arc {
    filter: blur(4px) brightness(1.15);
}

/* Textarea focus background should not turn white in dark */
html[data-theme='dark'] .form-control.user-input {
    color: #e5e7eb;
    background: transparent;
}
html[data-theme='dark'] .hero-input-group .form-control.user-input {
    background: transparent;
    border: none;
    color: #e5e7eb;
}
html[data-theme='dark'] .form-control.user-input::placeholder,
html[data-theme='dark'] .hero-input-group .form-control.user-input::placeholder { color: #94a3b8; }
html[data-theme='dark'] .form-control.user-input:focus {
    background: rgba(30,41,59,0.75) !important;
    color: #e5e7eb;
}
html[data-theme='dark'] .hero-input-group .form-control.user-input:focus {
    background: transparent !important;
    color: #e5e7eb;
}
html[data-theme='dark'] .form-control:focus { box-shadow: none !important; border-color: rgba(148,163,184,0.15) !important; }

html[data-theme='dark'] .user-message-bubble {
    border: 1px solid rgba(255,255,255,0.1);
}

/* Card header text and controls */
html[data-theme='dark'] .card-header { color: #e5e7eb; }
html[data-theme='dark'] .text-secondary { color: #cbd5e1 !important; }
html[data-theme='dark'] .btn-link { color: #cbd5e1; }
html[data-theme='dark'] .btn-link:hover { color: #ffffff; }

/* Sessions overlay text colors */
html[data-theme='dark'] .sessions-overlay { color: #e5e7eb; }
html[data-theme='dark'] .sessions-overlay .overlay-header h6 { color: #e5e7eb; }
html[data-theme='dark'] .sessions-overlay .list-group-item { color: #e5e7eb; background: transparent; }
html[data-theme='dark'] .sessions-overlay .list-group-item .text-muted { color: #9aa4b2 !important; }
html[data-theme='dark'] .sessions-overlay .list-group-item.active { color: #ffffff; }
html[data-theme='dark'] .sessions-overlay .list-group-item.active .text-muted { color: rgba(255,255,255,0.9) !important; }
html[data-theme='dark'] .sessions-overlay .list-group-item:not(.active):hover { background-color: rgba(255,255,255,0.05); }

/* ==========================
     Dark Mode – Additional Fixes
     ========================== */
/* 1) Session list items borders and backgrounds */
html[data-theme='dark'] .sessions-overlay .list-group-item {
    background: transparent;
    border: none;
}
html[data-theme='dark'] .sessions-overlay .list-group-item.active {
    background-color: rgba(0,162,197,0.12);
    color: #e5e7eb;
    border-left-color: var(--color-primary) !important;
}
html[data-theme='dark'] .sessions-overlay .list-group-item:not(.active):hover {
    background-color: rgba(255,255,255,0.06) !important;
}



/* 3) Rename input should not be white */
html[data-theme='dark'] .rename-modal-dialog .form-control {
    background-color: #0b1220;
    color: #e5e7eb;
    border: 1px solid var(--color-border);
}
html[data-theme='dark'] .rename-modal-dialog .form-control::placeholder { color: #94a3b8; }

/* 4) Delete overlay bottom text visibility */
html[data-theme='dark'] .delete-modal-dialog { color: #e5e7eb; }
html[data-theme='dark'] .delete-modal-dialog .text-muted { color: #9aa4b2 !important; }

/* 5) Close buttons outline removal and visibility */
#close-sessions-overlay:focus, #rename-close:focus, #delete-close:focus { outline: none !important; box-shadow: none !important; }
html[data-theme='dark'] #close-sessions-overlay,
html[data-theme='dark'] #rename-close,
html[data-theme='dark'] #delete-close {
    color: #cbd5e1;
    border-color: var(--color-border);
    background: transparent;
}
html[data-theme='dark'] #close-sessions-overlay:hover,
html[data-theme='dark'] #rename-close:hover,
html[data-theme='dark'] #delete-close:hover { background: rgba(255,255,255,0.06); }

/* 6) Session list (history) button icon visibility */
html[data-theme='dark'] #history-btn img { filter: invert(1); }

/* 7) User message bubble refinement for dark mode */
html[data-theme='dark'] .user-message-bubble {
    background: linear-gradient(180deg, #0796ad, #007c94);
    color: #f8fafc;
    border-color: rgba(255,255,255,0.08);
}
html[data-theme='dark'] .user-message-bubble p,
html[data-theme='dark'] .user-message-bubble a { color: #f8fafc; }
html[data-theme='dark'] .user-message-bubble a { text-decoration: underline; }

/* Related Questions CTA Styles */
.related-questions-container {
    border-top: 1px solid #dee2e6;
    padding-top: 0.75rem;
    margin-top: 1rem;
}

.related-questions-title {
    color: #6c757d;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.related-questions-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.related-question-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: fit-content;
}

.related-question-wrapper:hover .related-question-edit-btn {
    opacity: 1;
    visibility: visible;
}

.related-question-edit-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--color-primary);
    border-radius: 0.375rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
    z-index: 2;
    font-size: 12px;
}

.related-question-edit-btn:hover {
    background: var(--color-primary);
    color: white;
    transform: translateY(-50%) scale(1.05);
}

.related-question-edit-btn:focus {
    opacity: 1;
    visibility: visible;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 162, 197, 0.25);
}

.related-question-edit-btn:disabled,
.related-question-edit-btn.disabled {
    opacity: 0 !important;
    visibility: hidden !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

.related-question-btn {
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    background: transparent;
    border-radius: 0.75rem;
    padding: 0.5rem 2.5rem 0.5rem 0.75rem; /* Added right padding for edit button */
    text-align: left;
    font-size: 0.875rem;
    line-height: 1.4;
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: normal;
    word-wrap: break-word;
    min-height: auto;
    width: fit-content;
    position: relative; /* Ensure proper stacking context */
}

.related-question-btn:hover {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 162, 197, 0.2);
}

.related-question-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 162, 197, 0.3);
}

.related-question-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 162, 197, 0.25);
}

.related-question-btn:disabled,
.related-question-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
    color: var(--color-primary) !important;
}

.related-question-btn:disabled:hover,
.related-question-btn.disabled:hover {
    background-color: transparent !important;
    color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Dark theme styles for related questions */
html[data-theme='dark'] .related-questions-container {
    border-top-color: #374151;
}

html[data-theme='dark'] .related-questions-title {
    color: #9ca3af;
}

html[data-theme='dark'] .related-question-btn {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: transparent;
}

html[data-theme='dark'] .related-question-btn:hover {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

html[data-theme='dark'] .related-question-btn:disabled,
html[data-theme='dark'] .related-question-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    border-color: var(--color-muted) !important;
}

html[data-theme='dark'] .related-question-btn:disabled:hover,
html[data-theme='dark'] .related-question-btn.disabled:hover {
    background-color: transparent !important;
    color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
}

/* Dark theme styles for related question edit buttons */
html[data-theme='dark'] .related-question-edit-btn {
    background: rgba(31, 41, 55, 0.95);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

html[data-theme='dark'] .related-question-edit-btn:hover {
    background: var(--color-primary);
    color: white;
}

/* Thinking Elements Styles */
.thinking-wrapper {
    width: fit-content;
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 162, 197, 0.08);
    transition: all 0.2s ease;
}

.thinking-wrapper:hover {
    box-shadow: 0 4px 8px rgba(0, 162, 197, 0.12);
    transform: translateY(-1px);
}

.thinking-header {
    border: none !important;
    background: linear-gradient(135deg, #e8f4fd 0%, #f0f8ff 100%) !important;
    color: #00a2c5 !important;
    text-decoration: none !important;
    font-size: 0.875rem;
    padding: 4px 8px !important;
    cursor: pointer;
    width: 100%;
    display: flex !important;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid #dee2e6;
    transition: all 0.2s ease;
    font-weight: 500;
}

.thinking-header:hover {
    background: linear-gradient(135deg, #d4e9f7 0%, #e8f4fd 100%) !important;
    color: #0087a8 !important;
    text-decoration: none !important;
}

.thinking-header:focus {
    box-shadow: 0 0 0 3px rgba(0, 162, 197, 0.2) !important;
    outline: none !important;
}

.thinking-chevron {
    font-size: 12px;
    transition: transform 0.2s ease;
    color: #00a2c5;
    display: inline-block;
    width: 12px;
    text-align: center;
    font-weight: bold;
}

.thinking-label {
    font-size: 0.875rem;
    color: #00a2c5 !important;
    font-weight: 600;
    margin: 0;
}

.thinking-wrapper .collapse {
    transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
    overflow: hidden;
    height: 0;
    opacity: 0;
}

.thinking-wrapper .collapse.show {
    height: auto;
    opacity: 1;
}

.thinking-content {
    font-size: 13px;
    line-height: 1.5;
    background: #ffffff;
    padding: 16px;
    border-left: 4px solid #00a2c5 !important;
    color: #495057 !important;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    border-top: 1px solid #f0f0f0;
}

/* Dark mode styles for thinking elements */
html[data-theme='dark'] .thinking-wrapper {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-color: #4a5568;
}

html[data-theme='dark'] .thinking-wrapper:hover {
    box-shadow: 0 4px 8px rgba(34, 174, 86, 0.15);
}

html[data-theme='dark'] .thinking-header {
    background: linear-gradient(135deg, #1e3a47 0%, #2c5aa0 100%) !important;
    color: #22ae56 !important;
    border-bottom-color: #4a5568;
}

html[data-theme='dark'] .thinking-header:hover {
    background: linear-gradient(135deg, #2c5aa0 0%, #1e3a47 100%) !important;
    color: #69d9f0 !important;
}

html[data-theme='dark'] .thinking-chevron {
    color: #22ae56;
}

html[data-theme='dark'] .thinking-label {
    color: #22ae56 !important;
}

html[data-theme='dark'] .thinking-content {
    background: #1a202c;
    color: #e2e8f0 !important;
    border-left: 4px solid #22ae56 !important;
    border-top-color: #4a5568;
}

/* Session Title Container */
.session-title-container {
    flex: 1;
    display: flex;
    justify-content: center;
    margin: 0 0.25rem;
    max-width: 45vw;
}

.session-title-dropdown-wrapper {
    position: relative;
    max-width: 100%;
}

.session-title-btn {
    border-radius: 0.5rem;
    padding: 0.5rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    color: #334155;
    font-size: 0.875rem;
    font-weight: 500;
    height: 36px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.session-title-btn:hover {
    background: #f8fafc;
    border-color: rgba(0, 162, 197, 0.2);
    color: #1e293b;
}

.session-title-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 162, 197, 0.1);
    border-color: var(--color-primary);
}

.session-title-btn.active {
    border-color: var(--color-primary);
    background: rgba(0, 162, 197, 0.05);
}

.session-title-text {
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0.5rem 0;
    min-width: 0;
    line-height: 1;
}

.session-dropdown-arrow {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    color: #64748b;
}

.session-title-btn.active .session-dropdown-arrow {
    transform: rotate(180deg);
}

/* Session Options Dropdown */
.session-options-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%) translateY(-8px) scale(0.95);
    background: #fff;
    border: 1px solid rgba(2,6,23,0.08);
    border-radius: 0.5rem;
    box-shadow: 0 10px 30px rgba(2,6,23,0.15);
    min-width: 140px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050;
    backdrop-filter: blur(8px);
}

.session-options-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}

.session-options-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    color: #334155;
    font-size: 0.813rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    border-radius: 0.5rem;
}

.session-options-dropdown .dropdown-item:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.session-options-dropdown .dropdown-item svg {
    flex-shrink: 0;
    color: #64748b;
}

.session-options-dropdown .dropdown-item:hover svg {
    color: #334155;
}

#session-delete-option {
    color: #dc3545;
}
#session-delete-option svg {
    color: #dc3545;
}
#session-delete-option:hover {
    background: rgba(220,53,69,0.08);
    color: #dc3545;
}
#session-delete-option:hover svg {
    color: #dc3545;
}

/* Dark mode Session Title */
html[data-theme='dark'] .session-title-btn {
    color: #cbd5e1;
    background: transparent;
}

html[data-theme='dark'] .session-title-btn:hover {
    background: rgba(15,23,42,0.8);
    border-color: rgba(0, 162, 197, 0.3);
    color: #e5e7eb;
}

html[data-theme='dark'] .session-title-btn:focus {
    box-shadow: 0 0 0 3px rgba(0, 162, 197, 0.15);
    border-color: var(--color-primary);
}

html[data-theme='dark'] .session-title-btn.active {
    border-color: var(--color-primary);
    background: rgba(0, 162, 197, 0.1);
}

html[data-theme='dark'] .session-dropdown-arrow {
    color: #94a3b8;
}

/* Dark mode Session Options Dropdown */
html[data-theme='dark'] .session-options-dropdown {
    background: linear-gradient(180deg, rgba(15,23,42,0.95), rgba(15,23,42,0.98));
    border-color: var(--color-border);
    box-shadow: 0 10px 30px rgba(2,6,23,0.7);
    backdrop-filter: blur(12px);
}

html[data-theme='dark'] .session-options-dropdown .dropdown-item {
    color: #cbd5e1;
}

html[data-theme='dark'] .session-options-dropdown .dropdown-item:hover {
    background: rgba(30,41,59,0.6);
    color: #e5e7eb;
}

html[data-theme='dark'] .session-options-dropdown .dropdown-item svg {
    color: #94a3b8;
}

html[data-theme='dark'] .session-options-dropdown .dropdown-item:hover svg {
    color: #cbd5e1;
}

html[data-theme='dark'] #session-delete-option {
    color: #f87171;
}
html[data-theme='dark'] #session-delete-option svg {
    color: #f87171;
}
html[data-theme='dark'] #session-delete-option:hover {
    background: rgba(248,113,113,0.08);
    color: #f87171;
}
html[data-theme='dark'] #session-delete-option:hover svg {
    color: #f87171;
}

.input-plus-wrapper {
    display: inline-flex;
    align-items: center;
}

.plus-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50% !important;
    background: transparent;
    color: var(--color-primary);
    border: 1px solid transparent;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
    flex-shrink: 0;
}

.plus-btn:hover {
    background: rgba(0,162,197,0.10);
    border-color: rgba(0,162,197,0.18);
}

.plus-btn.active {
    background: rgba(0,162,197,0.15);
    border-color: rgba(0,162,197,0.3);
    transform: rotate(45deg);
}

html[data-theme='dark'] .plus-btn {
    color: var(--color-primary);
}

html[data-theme='dark'] .plus-btn:hover {
    background: rgba(0,162,197,0.15);
}

.plus-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    min-width: 160px;
    background: var(--color-card, #fff);
    border: 1px solid var(--color-border, rgba(0,0,0,0.1));
    border-radius: 0.625rem;
    box-shadow: var(--shadow-md, 0 10px 25px rgba(2,6,23,0.12));
    padding: 4px 0;
    z-index: 1500;
    animation: scaleIn 140ms ease both;
}

html[data-theme='dark'] .plus-menu {
    background: #0f172a;
    border-color: var(--color-border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.45);
}

.plus-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: transparent;
    border: none;
    text-align: left;
    padding: 8px 14px;
    font-size: 0.875rem;
    color: #212529;
    cursor: pointer;
    transition: background-color 120ms ease;
}

.plus-menu-item:hover {
    background: rgba(0,162,197,0.08);
}

html[data-theme='dark'] .plus-menu-item {
    color: #e5e7eb;
}

html[data-theme='dark'] .plus-menu-item:hover {
    background: rgba(255,255,255,0.06);
}

.plus-menu-item svg {
    color: var(--color-primary);
    flex-shrink: 0;
}

.location-badge {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    background: linear-gradient(135deg, rgba(0,162,197,0.42), rgba(34,174,86,0.38));
    -webkit-backdrop-filter: blur(12px) saturate(1.1);
    backdrop-filter: blur(12px) saturate(1.1);
    color: #ffffff;
    border: 1px solid rgba(0,162,197,0.28);
    border-radius: 1rem;
    padding: 0.5rem 0.75rem 0.5rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    margin-left: 0.5rem;
    max-width: min(360px, calc(100% - 1rem));
    animation: scaleIn 160ms ease both;
    box-shadow: 0 10px 24px rgba(15,23,42,0.08);
}

#bottom-location-badge {
    position: absolute;
    left: 0.5rem;
    bottom: calc(100% + 0.5rem);
    margin: 0;
    width: fit-content;
    max-width: min(360px, calc(100% - 1rem));
    z-index: 3;
    background: linear-gradient(135deg, rgba(0,162,197,0.76), rgba(34,174,86,0.68));
}

.location-badge-thumb {
    width: 46px;
    height: 46px;
    border-radius: 0.85rem;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255,255,255,0.75);
    border: 1px solid rgba(255,255,255,0.75);
}

.location-badge-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.location-badge-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex: 1 1 auto;
}

.location-badge-title {
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.1;
}

.location-badge-meta {
    color: rgba(255,255,255,0.92);
    font-size: 0.7rem;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.location-badge-remove {
    background: rgba(255,255,255,0.75);
    border: none;
    padding: 0;
    margin-left: auto;
    font-size: 0.7rem;
    line-height: 1;
    color: #0f172a;
    opacity: 0.85;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    transition: opacity 120ms ease, background-color 120ms ease;
}

.location-badge-remove:hover {
    opacity: 1;
    background: rgba(0,162,197,0.2);
}

html[data-theme='dark'] .location-badge {
    background: linear-gradient(135deg, rgba(0,162,197,0.28), rgba(34,174,86,0.26));
    border-color: rgba(0,162,197,0.38);
    color: #e2f5fb;
    box-shadow: 0 14px 28px rgba(2,6,23,0.32);
}

html[data-theme='dark'] .location-badge-thumb {
    background: rgba(15,23,42,0.8);
    border-color: rgba(148,163,184,0.18);
}

html[data-theme='dark'] .location-badge-title {
    color: #ffffff;
}

html[data-theme='dark'] .location-badge-meta {
    color: rgba(255,255,255,0.9);
}

html[data-theme='dark'] .location-badge-remove {
    background: rgba(15,23,42,0.7);
    color: #e2e8f0;
}

html[data-theme='dark'] #bottom-location-badge {
    background: linear-gradient(135deg, rgba(0,162,197,0.48), rgba(34,174,86,0.42));
    box-shadow: 0 14px 28px rgba(2,6,23,0.32);
}

#hero-location-badge {
    position: static;
    margin-left: 40px;
    margin-top: 0.5rem;
    margin-bottom: 0;
    width: fit-content;
    max-width: calc(100% - 40px);
    background: linear-gradient(135deg, rgba(0,162,197,0.76), rgba(34,174,86,0.68));
}

.map-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.55);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 5000;
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    padding: 1rem;
    overflow-y: auto;
}

.map-modal-overlay.open {
    display: flex;
    align-items: center;
}

.map-modal-dialog {
    background: var(--color-card, #fff);
    width: min(96vw, 860px);
    max-height: min(92dvh, calc(100dvh - 2rem));
    border-radius: 1rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(2,6,23,0.22);
    border: 1px solid var(--color-border, rgba(0,0,0,0.08));
    animation: scaleIn 200ms ease both;
}

html[data-theme='dark'] .map-modal-dialog {
    background: #0f172a;
    border-color: var(--color-border);
    box-shadow: 0 24px 60px rgba(0,0,0,0.55);
}

.map-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--color-border, rgba(0,0,0,0.08));
    background: rgba(255,255,255,0.96);
    flex-shrink: 0;
}

html[data-theme='dark'] .map-modal-header {
    background: rgba(15,23,42,0.96);
    border-bottom-color: var(--color-border);
    color: #e5e7eb;
}

.map-modal-instructions {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    color: var(--color-muted, #64748b);
    background: rgba(0,162,197,0.04);
    border-bottom: 1px solid var(--color-border, rgba(0,0,0,0.06));
    flex-shrink: 0;
}

html[data-theme='dark'] .map-modal-instructions {
    background: rgba(0,162,197,0.06);
    border-bottom-color: var(--color-border);
}

.map-container-shell {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
}

.map-container {
    flex: 1 1 auto;
    min-height: clamp(260px, 52dvh, 560px);
    position: relative;
    z-index: 1;
}

.map-search-overlay {
    position: absolute;
    top: 0.875rem;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 32rem;
    z-index: 720;
    pointer-events: none;
}

.map-search-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    pointer-events: auto;
}

.map-search-input-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.map-search-lens {
    position: absolute;
    top: 50%;
    left: 0.7rem;
    transform: translateY(-50%);
    color: #94a3b8;
    display: flex;
    align-items: center;
    pointer-events: none;
}

.map-search-input {
    width: 100%;
    height: 2.25rem;
    border-radius: 999px;
    border: 1px solid rgba(100,116,139,0.22);
    padding: 0 2.5rem 0 2.25rem;
    background: rgba(255,255,255,0.96);
    color: #0f172a;
    outline: none;
    font-size: 0.875rem;
    box-shadow: 0 8px 20px rgba(15,23,42,0.11);
}

.map-search-input:focus {
    border-color: rgba(0,162,197,0.45);
    box-shadow: 0 0 0 3px rgba(0,162,197,0.12), 0 10px 22px rgba(15,23,42,0.14);
}

.map-search-clear {
    position: absolute;
    top: 50%;
    right: 0.45rem;
    transform: translateY(-50%);
    width: 1.5rem;
    height: 1.5rem;
    border: 0;
    border-radius: 50%;
    background: rgba(148,163,184,0.16);
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.map-search-clear:hover,
.map-search-clear:focus-visible {
    background: rgba(0,162,197,0.14);
    color: #0f172a;
}

.map-search-results {
    margin-top: 0.5rem;
    border-radius: 1rem;
    background: rgba(255,255,255,0.96);
    box-shadow: 0 18px 38px rgba(15,23,42,0.16);
    border: 1px solid rgba(100,116,139,0.14);
    pointer-events: auto;
    overflow: hidden;
}

.map-search-results-scroll {
    display: grid;
    gap: 0.45rem;
    max-height: min(15rem, calc(100dvh - 20rem));
    overflow-y: auto;
    padding: 0.35rem;
}

.map-search-result {
    width: 100%;
    border: 1px solid rgba(100,116,139,0.16);
    background: rgba(248,250,252,0.96);
    border-radius: 0.85rem;
    padding: 0.65rem 0.8rem;
    text-align: left;
    transition: border-color 140ms, background 140ms, transform 140ms;
}

.map-search-result:hover,
.map-search-result:focus-visible,
.map-search-result.is-active {
    border-color: rgba(0,162,197,0.35);
    background: rgba(240,249,255,0.98);
    transform: translateY(-1px);
}

.map-search-result-title {
    display: block;
    font-size: 0.86rem;
    font-weight: 600;
    color: #0f172a;
}

.map-search-result-meta {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.74rem;
    color: #64748b;
}

.map-search-results-empty {
    font-size: 0.8rem;
    color: #64748b;
    padding: 0.45rem 0.55rem;
}

html[data-theme='dark'] .map-search-lens {
    color: #64748b;
}

html[data-theme='dark'] .map-search-input {
    background: rgba(15,23,42,0.9);
    color: #e2e8f0;
    border-color: rgba(148,163,184,0.24);
}

html[data-theme='dark'] .map-search-input::placeholder {
    color: #94a3b8;
}

html[data-theme='dark'] .map-search-clear {
    background: rgba(148,163,184,0.14);
    color: #cbd5e1;
}

html[data-theme='dark'] .map-search-clear:hover,
html[data-theme='dark'] .map-search-clear:focus-visible {
    background: rgba(0,162,197,0.18);
    color: #f8fafc;
}

html[data-theme='dark'] .map-search-results {
    background: rgba(15,23,42,0.94);
    border-color: rgba(148,163,184,0.14);
    box-shadow: 0 18px 38px rgba(0,0,0,0.36);
}

html[data-theme='dark'] .map-search-result {
    background: rgba(15,23,42,0.72);
    border-color: rgba(148,163,184,0.16);
}

html[data-theme='dark'] .map-search-result:hover,
html[data-theme='dark'] .map-search-result:focus-visible,
html[data-theme='dark'] .map-search-result.is-active {
    background: rgba(0,162,197,0.12);
    border-color: rgba(0,162,197,0.36);
}

html[data-theme='dark'] .map-search-result-title {
    color: #f8fafc;
}

html[data-theme='dark'] .map-search-result-meta,
html[data-theme='dark'] .map-search-results-empty {
    color: #94a3b8;
}

.map-floating-actions {
    position: absolute;
    bottom: 2.5rem;
    right: 0.875rem;
    z-index: 700;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.map-floating-actions .btn {
    pointer-events: auto;
}

.map-floating-btn {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    background: rgba(255,255,255,0.96);
    box-shadow: 0 2px 10px rgba(15,23,42,0.22);
    border: 1px solid rgba(0,162,197,0.28);
    color: var(--color-primary);
    transition: background 140ms, box-shadow 140ms;
}

.map-floating-btn:hover {
    background: #fff;
    box-shadow: 0 4px 16px rgba(0,162,197,0.28);
}

.map-gps-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.map-gps-dot {
    width: 16px;
    height: 16px;
    background: #4285f4;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(66,133,244,0.25);
    animation: gpsPulse 1.8s ease-out infinite;
}

@keyframes gpsPulse {
    0% { box-shadow: 0 0 0 0 rgba(66,133,244,0.45); }
    70% { box-shadow: 0 0 0 10px rgba(66,133,244,0); }
    100% { box-shadow: 0 0 0 0 rgba(66,133,244,0); }
}

html[data-theme='dark'] .map-floating-btn {
    background: rgba(15,23,42,0.9);
    border-color: rgba(0,162,197,0.4);
    color: #69d9f0;
}

html[data-theme='dark'] .map-floating-btn:hover {
    background: rgba(15,23,42,0.98);
}

.map-container .leaflet-top,
.map-container .leaflet-bottom {
    z-index: 500;
}

.map-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--color-border, rgba(0,0,0,0.08));
    background: rgba(255,255,255,0.96);
    flex-shrink: 0;
    gap: 0.75rem;
    flex-wrap: wrap;
}

html[data-theme='dark'] .map-modal-footer {
    background: rgba(15,23,42,0.96);
    border-top-color: var(--color-border);
}

.map-selection-info {
    font-size: 0.75rem;
    color: var(--color-muted, #64748b);
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-selection-info.is-error {
    color: #d63384;
}

.map-current-location-btn.is-loading {
    opacity: 0.7;
    animation: gpsPulse 1s ease-in-out infinite;
}

.map-modal-dialog .btn-outline-secondary {
    border-color: rgba(100,116,139,0.35);
    color: #334155;
}

.map-modal-dialog .btn-outline-secondary:hover,
.map-modal-dialog .btn-outline-secondary:focus-visible {
    background: rgba(148,163,184,0.14);
    border-color: rgba(100,116,139,0.45);
    color: #0f172a;
}

.map-mode-badge {
    font-size: 0.7rem;
    background: rgba(0,162,197,0.1);
    color: var(--color-primary);
    border: 1px solid rgba(0,162,197,0.2);
    border-radius: 2rem;
    padding: 2px 8px;
    font-weight: 500;
}

html[data-theme='dark'] .map-mode-badge {
    background: rgba(0,162,197,0.18);
    border-color: rgba(0,162,197,0.3);
}

.map-close-btn {
    font-size: 0.8rem;
}

html[data-theme='dark'] .map-selection-info.is-error {
    color: #ff8fbd;
}

html[data-theme='dark'] .map-modal-dialog .btn-outline-secondary {
    color: #e2e8f0;
    border-color: rgba(148,163,184,0.28);
    background: rgba(15,23,42,0.72);
}

html[data-theme='dark'] .map-modal-dialog .btn-outline-secondary:hover,
html[data-theme='dark'] .map-modal-dialog .btn-outline-secondary:focus-visible {
    background: rgba(148,163,184,0.16);
    border-color: rgba(148,163,184,0.45);
    color: #f8fafc;
}

html[data-theme='dark'] .leaflet-draw-toolbar a,
html[data-theme='dark'] .leaflet-bar a {
    background-color: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
    box-shadow: 0 6px 18px rgba(2,6,23,0.28);
}

html[data-theme='dark'] .leaflet-bar a:hover,
html[data-theme='dark'] .leaflet-draw-toolbar a:hover {
    background-color: #f8fafc;
}

html[data-theme='dark'] .leaflet-draw-toolbar a.leaflet-draw-toolbar-button-enabled,
html[data-theme='dark'] .leaflet-draw-toolbar a:focus-visible {
    background-color: #c8f1f8;
    border-color: rgba(0,162,197,0.55);
}

html[data-theme='dark'] .leaflet-draw-actions a {
    background: #0f172a;
    color: #e5e7eb;
    border-color: #334155;
}

html[data-theme='dark'] .leaflet-draw-actions a:hover,
html[data-theme='dark'] .leaflet-draw-actions a:focus-visible {
    background: #1e293b;
    color: #f8fafc;
}

html[data-theme='dark'] .leaflet-disabled {
    opacity: 0.55;
}

html[data-theme='dark'] .leaflet-popup-content-wrapper {
    background: #0f172a;
    color: #e5e7eb;
}

html[data-theme='dark'] .leaflet-popup-tip {
    background: #0f172a;
}

.input-group.dictating #plus-btn,
.input-group.dictating #hero-plus-btn {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 120ms ease;
}

.input-group:not(.dictating) #plus-btn,
.input-group:not(.dictating) #hero-plus-btn {
    opacity: 1;
    visibility: visible;
}

@media (max-height: 760px) {
    .map-modal-overlay {
        padding: 0.5rem;
        align-items: flex-start;
    }

    .map-modal-dialog {
        width: min(100vw, 860px);
        max-height: calc(100dvh - 1rem);
        border-radius: 0.875rem;
    }

    .map-modal-header {
        padding: 0.75rem 0.875rem;
    }

    .map-modal-instructions {
        padding: 0.45rem 0.875rem;
        font-size: 0.75rem;
    }

    .map-search-overlay {
        top: 0.625rem;
        width: 80%;
    }

    .map-search-row {
        gap: 0.5rem;
    }

    .map-search-input {
        height: 2.1rem;
    }

    .map-container {
        min-height: clamp(260px, 48dvh, 380px);
    }

    .map-modal-footer {
        padding: 0.625rem 0.875rem;
        align-items: flex-start;
    }

    .map-selection-info {
        max-width: none;
        white-space: normal;
    }
}

@media (min-height: 900px) {
    .map-modal-dialog {
        max-height: min(94dvh, calc(100dvh - 2rem));
    }

    .map-container {
        min-height: clamp(420px, 62dvh, 720px);
    }
}

/* Image Fullscreen Overlay */
.image-fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.image-fullscreen-overlay.show {
    opacity: 1;
}

.image-fullscreen-container {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-fullscreen-img {
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    cursor: default;
    transition: transform 0.2s ease-out;
    transform-origin: center center;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    -webkit-touch-callout: none;
}

.image-fullscreen-img.zoomed {
    cursor: grab;
}

.image-fullscreen-img.zoomed:active,
.image-fullscreen-img.dragging {
    cursor: grabbing !important;
    transition: none; /* Disable transition during drag for immediate response */
}

.image-fullscreen-controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    gap: 8px;
    z-index: 10002;
}

.zoom-control-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    color: #333;
    transition: background 0.2s ease, transform 0.2s ease;
}

.zoom-control-btn:hover {
    background: #f8f9fa;
    transform: scale(1.1);
}

.zoom-control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.image-zoom-indicator {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 10px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10002;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-zoom-indicator.show {
    opacity: 1;
}

.image-fullscreen-close {
    position: fixed;
    top: 40px;
    right: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    color: #333;
    transition: background 0.2s ease, transform 0.2s ease;
}

.image-fullscreen-close:hover {
    background: #f8f9fa;
    transform: scale(1.1);
}

.image-clickable {
    cursor: pointer;
}

/* Inline chat image: same brand-gradient border as the regional map card.
   Two background layers — gradient on the border-box, card colour on the
   padding-box — paint a 1.5px gradient ring around a single <img>. */
.chat-inline-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    border: 1.5px solid transparent;      /* gradient border thickness */
    border-radius: var(--radius-lg);
    background:
        linear-gradient(var(--color-card, #fff), var(--color-card, #fff)) padding-box,
        linear-gradient(135deg,
            rgba(var(--color-primary-rgb), 1) 0%,
            rgba(34, 174, 86, 0.95) 50%,
            rgba(13, 110, 253, 1) 100%) border-box;
    transition: transform 200ms ease;
}

/* Subtle lift cue that the image is clickable (translate stays crisp;
   scaling a raster image would interpolate its pixels and blur it) */
.chat-inline-image:hover {
    transform: translateY(-2px);
}

html[data-theme='dark'] .chat-inline-image {
    background:
        linear-gradient(#1e293b, #1e293b) padding-box,
        linear-gradient(135deg,
            rgba(var(--color-primary-rgb), 1) 0%,
            rgba(34, 174, 86, 0.95) 50%,
            rgba(13, 110, 253, 1) 100%) border-box;
}

/* Dark mode adjustments */
html[data-theme='dark'] .image-fullscreen-close {
    background: #1e293b;
    color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

html[data-theme='dark'] .image-fullscreen-close:hover {
    background: #334155;
}

html[data-theme='dark'] .zoom-control-btn {
    background: #1e293b;
    color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

html[data-theme='dark'] .zoom-control-btn:hover {
    background: #334155;
}

html[data-theme='dark'] .image-zoom-indicator {
    background: rgba(30, 41, 59, 0.9);
    color: #cbd5e1;
}
@media print {
    html, body, #chat-card, #chat-container {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        margin: 0 !important;
        padding-inline: 0.25rem !important;
        width: 100% !important;
        height: auto !important;
    }
    body { margin: 0; height: auto !important; overflow: visible !important; background: var(--bs-body-bg); }
    #chat-window { height: auto !important; overflow: visible !important; }
    #chat-card { width: 297mm; margin: 1rem auto; height: auto !important; max-height: none !important; overflow: visible !important; }
    #chat-container { padding-inline: 1rem !important; height: auto !important; max-height: none !important; overflow: visible !important; overflow-y: visible !important; }
    /* no input box and tip in print view */
    #chat-card .input-box,
    #chat-card .input-tip, 
    #chat-card #history-btn,
    #chat-card #new-chat-btn-1,
    #chat-card #new-chat-btn-2,
    #chat-card #settings-container,
    #chat-card #theme-toggle-container,
    #chat-card #download-pdf-btn,
    #chat-card .session-dropdown-arrow,
    .table-export-btn,
    .fullscreen-btn,
    .related-questions-container {
        display: none !important;
    }
    /* Map iframe: expand to fill available print width/height */
    .map-iframe-wrapper {
        position: static !important;
        width: 100% !important;
        height: auto !important;
    }
    .map-iframe-wrapper iframe {
        display: block !important;
        width: 100% !important;
        height: 500px !important;
        max-width: 100% !important;
        page-break-inside: avoid;
    }
    @page {
        size: A4 landscape;
        margin: 0;
        padding: 0;
    }
}