/* ==========================================================================
   AG-UI (Agentic UI) Styles for EAssetQ
   ========================================================================== */

/* ==========================================================================
   Layout
   ========================================================================== */

.agui-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: #f8f9fa;
    overflow: hidden;
}

/* Asset detail mode: allow page scrolling */
.agui-layout.agui-layout--detail-mode {
    height: auto;
    min-height: 100vh;
    overflow: visible;
}

.agui-layout.agui-layout--detail-mode .agui-main {
    overflow: visible;
    flex: 1;
}

.agui-layout.agui-layout--detail-mode .agui-canvas-area {
    overflow: visible;
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Content mode: standard scrollable document flow, footer at natural end */
.agui-layout.agui-layout--content-mode {
    height: auto;
    min-height: 100vh;
    overflow: visible;
}

.agui-layout.agui-layout--content-mode .agui-main {
    flex: 1;
    overflow: visible;
}

/* Browse mode: page-scroll with sticky header + sticky sidebar, full-width footer at end */
.agui-layout.agui-layout--browse-mode {
    height: auto;
    min-height: 100vh;
    overflow: visible;
}

/* Keep header pinned so sidebar top value always works */
.agui-layout.agui-layout--browse-mode .agui-header {
    position: sticky;
    top: 0;
    z-index: 50;
}

/* Allow sticky child — must override the base overflow:hidden on ai-main-body */
.agui-layout.agui-layout--browse-mode .ai-main-body {
    min-height: calc(100vh - 3.5rem);
    overflow: visible;
}

@media (min-width: 1024px) {
    .agui-layout.agui-layout--browse-mode .ai-main-sidebar {
        position: sticky;
        top: 3.5rem;
        height: calc(100vh - 3.5rem);
        overflow-y: auto;
        align-self: start;
    }
}

/* Header */
.agui-header {
    flex-shrink: 0;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
    z-index: 40;
}

.agui-header-content {
    max-width: 1920px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.agui-logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.agui-logo-img {
    height: 2.5rem;
    width: auto;
}

.agui-brand {
    display: none;
    flex-direction: column;
    text-decoration: none;
    color: #1f2937;
}

@media (min-width: 768px) {
    .agui-brand {
        display: flex;
    }
}

.agui-brand-name {
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.agui-brand-sub {
    font-size: 0.625rem;
    color: #6b7280;
    margin-top: -2px;
}

/* Navigation */
.agui-nav {
    display: none;
    align-items: center;
    gap: 0.25rem;
}

@media (min-width: 1024px) {
    .agui-nav {
        display: flex;
    }
}

.agui-nav-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    border-radius: 0.375rem;
    transition: all 0.15s;
}

.agui-nav-link:hover {
    color: #111827;
    background-color: rgba(0, 0, 0, 0.06);
}

.agui-nav-link.active {
    color: #111827;
    background-color: rgba(0, 0, 0, 0.08);
}

.agui-nav-link.admin {
    color: #d97706;
}

/* Header Actions */
.agui-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.agui-icon-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    color: #374151;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s;
}

.agui-icon-btn:hover {
    color: #111827;
    background-color: rgba(0, 0, 0, 0.06);
}

.agui-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.25rem;
    font-size: 0.625rem;
    font-weight: 700;
    color: white;
    background-color: #ef4444;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agui-mobile-toggle {
    display: flex;
    color: #374151;
    background: transparent;
    border: none;
    cursor: pointer;
}

@media (min-width: 1024px) {
    .agui-mobile-toggle {
        display: none;
    }
}

/* User Menu Dropdown */
.agui-user-menu details {
    position: relative;
}

.agui-user-menu summary {
    list-style: none;
}

.agui-user-menu summary::-webkit-details-marker {
    display: none;
}

.agui-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    min-width: 14rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    padding: 0.25rem;
    z-index: 50;
}

.agui-dropdown-header {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0.25rem;
}

.agui-dropdown-item {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: #374151;
    text-decoration: none;
    border-radius: 0.375rem;
}

.agui-dropdown-item:hover {
    background-color: #f3f4f6;
}

.agui-dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 0.25rem 0;
}

.agui-bookmark-sub {
    display: block;
}

.agui-bookmark-sub > summary {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: #374151;
    border-radius: 0.375rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.agui-bookmark-sub > summary::-webkit-details-marker {
    display: none;
}

.agui-bookmark-sub > summary:hover {
    background-color: #f3f4f6;
}

.agui-bookmark-chevron {
    margin-left: auto;
    transition: transform 0.15s ease;
}

.agui-bookmark-sub[open] .agui-bookmark-chevron {
    transform: rotate(180deg);
}

.agui-dropdown-item--indented {
    padding-left: 1.5rem;
    font-size: 0.8125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 13rem;
}

.agui-dropdown-empty {
    padding: 0.375rem 0.75rem 0.375rem 1.5rem;
    font-size: 0.8125rem;
    color: #9ca3af;
    font-style: italic;
}

/* Mobile Menu */
.agui-mobile-drawer-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 50;
}

.agui-mobile-drawer {
    position: fixed;
    right: 0;
    top: 0;
    height: 100%;
    width: 18rem;
    max-width: 80vw;
    background: white;
    box-shadow: -4px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 51;
    padding: 1rem;
}

.agui-mobile-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
}

.agui-mobile-drawer-header button {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #6b7280;
}

.agui-mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.agui-mobile-nav-link {
    display: block;
    padding: 0.75rem;
    color: #374151;
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 500;
}

.agui-mobile-nav-link:hover {
    background-color: #f3f4f6;
}

/* Home page body: flex row so context panel spans full height (canvas + prompt) */
.agui-home-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Left column: stacks canvas area and prompt bar */
.agui-home-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* Main Content */
.agui-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

.agui-canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1rem;
    padding-bottom: 0;
}

/* Prompt Area */
.agui-prompt-area {
    flex-shrink: 0;
    background: #f8f9fa;
    border-top: 1px solid #e5e7eb;
    padding: 0.75rem 1rem 1rem;
}

/* ==========================================================================
   Conversation Canvas
   ========================================================================== */

.ai-canvas {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.ai-messages {
    max-width: 48rem;
    margin: 0 auto;
}

/* Welcome State */
.ai-welcome {
    text-align: center;
    padding: 3rem 1rem;
}

.ai-welcome-icon {
    display: inline-flex;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 1rem;
    color: white;
    margin-bottom: 1.5rem;
}

.ai-welcome-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 0.5rem;
}

.ai-welcome-subtitle {
    font-size: 1rem;
    color: #6b7280;
    margin: 0 0 2rem;
}

.ai-quick-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.ai-quick-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
}

.ai-quick-btn:hover {
    border-color: #667eea;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.ai-quick-icon {
    font-size: 1.125rem;
}

/* Messages */
.ai-message {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.ai-message.user {
    justify-content: flex-end;
}

.ai-message.user .ai-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 1rem 1rem 0.25rem 1rem;
    max-width: 75%;
}

.ai-message.assistant .ai-message-content {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 1rem 1rem 1rem 0.25rem;
    max-width: 85%;
}

.ai-message-avatar {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.ai-message-content {
    padding: 0.875rem 1rem;
}

.ai-message-text {
    line-height: 1.6;
}

.ai-message-text strong {
    font-weight: 600;
}

/* Inline Assets */
.ai-inline-assets {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.ai-view-all-btn {
    display: block;
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.5rem;
    background: #f3f4f6;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #667eea;
    cursor: pointer;
    transition: background 0.15s;
}

.ai-view-all-btn:hover {
    background: #e5e7eb;
}

/* ==========================================================================
   Prompt Bar
   ========================================================================== */

.ai-prompt-bar {
    max-width: 48rem;
    margin: 0 auto;
}

.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.ai-suggestion-chip {
    padding: 0.375rem 0.75rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    font-size: 0.8125rem;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.15s;
}

.ai-suggestion-chip:hover {
    background: white;
    border-color: #667eea;
    color: #667eea;
}

.ai-input-container {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 1rem;
    padding: 0.5rem 0.75rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ai-input-container:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ai-input-textarea {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 0.9375rem;
    line-height: 1.5;
    max-height: 120px;
    padding: 0.25rem 0;
}

.ai-input-textarea::placeholder {
    color: #4b5563;
}

.ai-input-actions {
    display: flex;
    align-items: flex-end;
    gap: 0.375rem;
}

.ai-action-btn,
.ai-send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.125rem;
    height: 2.125rem;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.15s;
}

.ai-action-btn {
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #6b7280;
}

.ai-action-btn:hover {
    background: #f9fafb;
    color: #374151;
}

.ai-send-btn {
    background: #2e2e2e;
    color: #fff;
}

.ai-send-btn svg {
    width: 2rem;
    height: 2rem;
}

.ai-send-btn:hover:not(:disabled) {
    background: #1f1f1f;
}

.ai-send-btn:disabled {
    background: #d1d5db;
    color: #f9fafb;
    cursor: not-allowed;
}

.ai-status-line {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #9ca3af;
}

.ai-questionnaire-prompt-hint {
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: #d97706;
    text-align: center;
    font-style: italic;
}

@media (prefers-color-scheme: dark) {
    .ai-questionnaire-prompt-hint {
        color: #fbbf24;
    }
}

/* ==========================================================================
   Interactive Questionnaire
   ========================================================================== */

.ai-questionnaire {
    padding-top: 0.25rem;
    min-width: 0;
}

.ai-questionnaire-question {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.875rem;
    line-height: 1.45;
}

.ai-questionnaire-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.875rem;
}

.ai-questionnaire-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    cursor: pointer;
    text-align: left;
    font-size: 0.9rem;
    color: #374151;
    transition: border-color 0.15s, background 0.15s;
    width: 100%;
}

.ai-questionnaire-option:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.ai-questionnaire-option:hover .ai-questionnaire-option-number {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.ai-questionnaire-option-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    background: #ffffff;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #667eea;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.ai-questionnaire-option-label {
    line-height: 1.4;
}

.ai-questionnaire-custom-wrap {
    position: relative;
    margin-top: 0.25rem;
}

.ai-questionnaire-custom-input {
    width: 100%;
    padding: 0.625rem 5rem 0.625rem 0.875rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    background: #f9fafb;
    font-size: 0.875rem;
    color: #111827;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.ai-questionnaire-custom-input:focus {
    border-color: #667eea;
    background: #ffffff;
}

.ai-questionnaire-custom-input::placeholder {
    color: #9ca3af;
}

.ai-questionnaire-custom-hint {
    position: absolute;
    right: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6875rem;
    font-weight: 500;
    color: #9ca3af;
    pointer-events: none;
    white-space: nowrap;
}

.ai-questionnaire-hint {
    margin-top: 0.375rem;
    font-size: 0.6875rem;
    color: #9ca3af;
    padding-left: 0.25rem;
}

/* Dark-mode overrides */
@media (prefers-color-scheme: dark) {
    .ai-questionnaire-question {
        color: #f3f4f6;
    }

    .ai-questionnaire-option {
        background: #1f2937;
        border-color: #374151;
        color: #d1d5db;
    }

    .ai-questionnaire-option:hover {
        background: #1e3a5f;
        border-color: #3b82f6;
        color: #93c5fd;
    }

    .ai-questionnaire-option-number {
        background: #111827;
        border-color: #4b5563;
        color: #818cf8;
    }

    .ai-questionnaire-option:hover .ai-questionnaire-option-number {
        background: #1e3a5f;
        border-color: #3b82f6;
        color: #93c5fd;
    }

    .ai-questionnaire-custom-input {
        background: #1f2937;
        border-color: #374151;
        color: #f3f4f6;
    }

    .ai-questionnaire-custom-input:focus {
        border-color: #667eea;
        background: #111827;
    }
}

.ai-shortcut {
    display: none;
}

@media (min-width: 768px) {
    .ai-shortcut {
        display: inline;
    }
}

/* ==========================================================================
   Thinking Indicator
   ========================================================================== */

.ai-thinking {
    display: none;
}

.ai-thinking.visible {
    display: flex;
}

.ai-thinking-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #6b7280;
}

.ai-thinking-dots {
    display: flex;
    gap: 4px;
}

.ai-thinking-dots span {
    width: 6px;
    height: 6px;
    background-color: #667eea;
    border-radius: 50%;
    animation: ai-dot-bounce 1.4s infinite ease-in-out both;
}

.ai-thinking-dots span:nth-child(1) { animation-delay: -0.32s; }
.ai-thinking-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes ai-dot-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.ai-thinking-text {
    font-size: 0.875rem;
}

/* ==========================================================================
   Asset Card
   ========================================================================== */

.ai-asset-card {
    flex-shrink: 0;
    width: 180px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.15s;
}

.ai-asset-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.ai-asset-card.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.ai-asset-card-image {
    position: relative;
    height: 100px;
    background: #f3f4f6;
}

.ai-asset-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-asset-card-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
}

.ai-asset-card-yield {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: rgba(0, 0, 0, 0.7);
    color: #34d399;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 0.25rem;
}

/* AI metadata overlay — bottom-left corner of card image */
.ai-asset-card-meta-overlay {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.ai-asset-risk-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}
.ai-asset-risk-badge.risk-low    { background: #bbf7d0; color: #15803d; }
.ai-asset-risk-badge.risk-medium { background: #fef08a; color: #a16207; }
.ai-asset-risk-badge.risk-high   { background: #fecaca; color: #dc2626; }



.ai-asset-card-content {
    padding: 0.75rem;
}

.ai-asset-card-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-asset-card-address {
    font-size: 0.6875rem;
    color: #9ca3af;
    margin: 0 0 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-asset-card-price .price {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #667eea;
}

.ai-asset-card-meta {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.ai-asset-card-funding {
    margin-top: 0.5rem;
}

.ai-funding-bar {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.ai-funding-bar.large {
    height: 8px;
    border-radius: 4px;
}

.ai-funding-progress {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: inherit;
    transition: width 0.3s;
}

.ai-funding-progress.directsale-progress {
    background: linear-gradient(90deg, #10b981, #059669);
}

.ai-funding-progress.clubdeal-progress {
    background: linear-gradient(90deg, #8b5cf6, #6d28d9);
}

.ai-funding-text {
    font-size: 0.6875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.ai-asset-card-actions {
    display: flex;
    gap: 0.375rem;
    padding: 0 0.75rem 0.75rem;
}

.ai-card-btn {
    flex: 1;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s;
}

.ai-card-btn.primary {
    background: #667eea;
    color: white;
}

.ai-card-btn.primary:hover {
    background: #5a67d8;
}

.ai-card-btn.secondary {
    background: #f3f4f6;
    color: #374151;
}

.ai-card-btn.secondary:hover {
    background: #e5e7eb;
}

/* ==========================================================================
   Context Panel
   ========================================================================== */

.ai-context-panel {
    position: relative;
    flex-shrink: 0;
    width: 0;
    background: white;
    border-left: 1px solid #e5e7eb;
    transition: width 0.3s ease;
    overflow: hidden;
}

.ai-context-panel.open {
    width: 400px;
}

.ai-context-panel.collapsed {
    width: 48px;
}

@media (max-width: 1024px) {
    .ai-context-panel.open {
        position: fixed;
        right: 0;
        top: 3.5rem;
        bottom: 0;
        width: 100%;
        max-width: 400px;
        z-index: 45;
        box-shadow: -4px 0 25px rgba(0, 0, 0, 0.1);
    }
}

/* Panel Rail (Collapsed) */
.ai-panel-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0;
}

.ai-rail-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s;
}

.ai-rail-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Panel Content */
.ai-panel-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ai-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.ai-panel-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #1f2937;
}

.ai-panel-back {
    display: flex;
    padding: 0.25rem;
    background: transparent;
    border: none;
    border-radius: 0.25rem;
    color: #6b7280;
    cursor: pointer;
}

.ai-panel-back:hover {
    background: #f3f4f6;
}

.ai-panel-actions {
    display: flex;
    gap: 0.25rem;
}

.ai-panel-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    background: transparent;
    border: none;
    border-radius: 0.25rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s;
}

.ai-panel-btn:hover,
.ai-panel-btn.active {
    background: #f3f4f6;
    color: #374151;
}

.ai-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.ai-panel-empty {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

/* Persona selector bar — horizontal scroll row of agent chips */
.ai-persona-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    flex-wrap: wrap;
    flex-shrink: 0;
    background: white;
    border-bottom: 1px solid #f3f4f6;
}

.ai-persona-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    background: #f9fafb;
    color: #4b5563;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    flex-shrink: 0;
}
.ai-persona-chip:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #3b82f6;
}
.ai-persona-chip.active {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
    font-weight: 600;
}
.ai-persona-emoji { font-size: 13px; }

/* ── Profile Questionnaire Summary Card ──────────────────────────────── */
.ai-profile-summary {
    padding: 0;
}

.ai-profile-summary-title {
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-profile-summary-title::before {
    content: "🧑";
    font-size: 15px;
}

.ai-prf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    border-radius: 8px;
    overflow: hidden;
}

.ai-prf-table thead th {
    background: #f3f4f6;
    color: #6b7280;
    font-weight: 600;
    padding: 6px 10px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ai-prf-table tbody tr {
    border-top: 1px solid #f3f4f6;
}

.ai-prf-table tbody tr:hover {
    background: #f9fafb;
}

.ai-prf-table tbody td {
    padding: 6px 10px;
    color: #374151;
    vertical-align: top;
}

.ai-prf-table tbody td:first-child {
    color: #6b7280;
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-prf-table tbody td strong {
    color: #1d4ed8;
    font-weight: 600;
}

@media (prefers-color-scheme: dark) {
    .ai-prf-table thead th {
        background: #374151;
        color: #9ca3af;
    }
    .ai-prf-table tbody tr {
        border-top-color: #374151;
    }
    .ai-prf-table tbody td {
        color: #d1d5db;
    }
    .ai-prf-table tbody td:first-child {
        color: #9ca3af;
    }
}

/* ── Profile summary update button ──────────────────────────────────── */
.ai-prf-update-bar {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
}

.ai-prf-update-btn {
    font-size: 12px;
    padding: 4px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #f9fafb;
    color: #374151;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.ai-prf-update-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

@media (prefers-color-scheme: dark) {
    .ai-prf-update-btn {
        background: #374151;
        border-color: #4b5563;
        color: #d1d5db;
    }
    .ai-prf-update-btn:hover {
        background: #4b5563;
    }
}


/* Asset Detail */
.ai-asset-detail {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ai-asset-images {
    border-radius: 0.75rem;
    overflow: hidden;
    background: #f3f4f6;
}

.ai-asset-main-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.ai-asset-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.ai-asset-price-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ai-asset-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

.ai-asset-yield-badge {
    padding: 0.25rem 0.625rem;
    background: #d1fae5;
    color: #059669;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 0.375rem;
}

.ai-asset-address {
    color: #6b7280;
    margin: 0;
}

.ai-asset-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: #4b5563;
}

.ai-funding-section {
    padding: 1rem;
    background: #f9fafb;
    border-radius: 0.75rem;
}

.ai-funding-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: #6b7280;
}

.ai-invest-calc {
    padding: 1rem;
    background: #f9fafb;
    border-radius: 0.75rem;
}

.ai-invest-calc h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
}

.ai-calc-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.ai-calc-row label {
    font-size: 0.875rem;
    color: #4b5563;
}

.ai-calc-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.ai-calc-result {
    display: flex;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
    font-size: 0.875rem;
}

.ai-calc-result strong {
    color: #059669;
}

.ai-asset-actions {
    display: flex;
    gap: 0.75rem;
}

.ai-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
}

.ai-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ai-btn.primary:hover {
    opacity: 0.9;
}

.ai-btn.secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.ai-btn.secondary:hover {
    background: #e5e7eb;
}

.ai-asset-description h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.ai-asset-description p {
    font-size: 0.875rem;
    color: #4b5563;
    line-height: 1.6;
    margin: 0;
}

/* Search Results */
.ai-search-results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ai-results-count {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.ai-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.ai-results-grid .ai-asset-card {
    width: auto;
}

/* Portfolio */
.ai-portfolio-summary {
    text-align: center;
}

/* ════════════════════════════════════════════════════════════════
   AI Detail Card  (AIEAssetDetailCard.razor)
   ════════════════════════════════════════════════════════════════ */

.ai-detail-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--agui-text, #1e293b);
}

.ai-detail-image-wrap {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #e2e8f0;
}

.ai-detail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-detail-yield-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(79, 70, 229, 0.9);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}

.ai-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.ai-detail-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.ai-detail-address {
    font-size: 0.75rem;
    color: #64748b;
    margin: 2px 0 0;
}

.ai-detail-developer {
    font-size: 0.7rem;
    color: #94a3b8;
    margin: 1px 0 0;
}

.ai-investment-model-badge {
    display: inline-block;
    margin-top: 5px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #475569;
}
.ai-investment-model-badge.ai-model-tokenized  { background: #dbeafe; color: #1d4ed8; }
.ai-investment-model-badge.ai-model-directsale { background: #d1fae5; color: #065f46; }
.ai-investment-model-badge.ai-model-clubdeal   { background: #fef3c7; color: #92400e; }

.ai-asset-model-row {
    margin: 6px 0 4px;
}

.ai-detail-price-block {
    text-align: right;
    flex-shrink: 0;
}

.ai-detail-price {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
    color: #1e293b;
}

.ai-detail-yield-sm {
    display: block;
    font-size: 0.7rem;
    color: #059669;
    font-weight: 600;
    margin-top: 1px;
}

/* Specs grid */
.ai-detail-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ai-spec-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    background: #f1f5f9;
    font-size: 0.75rem;
    color: #475569;
}

.ai-spec-icon { flex-shrink: 0; }

/* Funding */
.ai-detail-funding { display: flex; flex-direction: column; gap: 4px; }

.ai-detail-funding-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.ai-detail-funding-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #64748b;
}

/* Token grid */
.ai-detail-tokens { background: #f8fafc; border-radius: 8px; padding: 10px; }

.ai-detail-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin: 0 0 8px;
}

.ai-detail-token-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.ai-token-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ai-token-label { font-size: 0.68rem; color: #94a3b8; }
.ai-token-value { font-size: 0.9rem; font-weight: 700; color: #1e293b; }

/* AI Analysis */
.ai-detail-analysis {
    background: linear-gradient(135deg, #f0f4ff 0%, #faf7ff 100%);
    border: 1px solid #e0e7ff;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-detail-scores {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-score-gauge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-score-label {
    font-size: 0.7rem;
    color: #64748b;
    width: 72px;
    flex-shrink: 0;
}

.ai-score-bar {
    flex: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.ai-score-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.ai-score-fill.risk-low    { background: #22c55e; }
.ai-score-fill.risk-medium { background: #f59e0b; }
.ai-score-fill.risk-high   { background: #ef4444; }
.ai-score-fill.invest-fill { background: linear-gradient(90deg, #6366f1, #8b5cf6); }

.ai-score-num {
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    width: 32px;
    text-align: right;
    flex-shrink: 0;
}

.ai-score-num.risk-text-low    { color: #16a34a; }
.ai-score-num.risk-text-medium { color: #d97706; }
.ai-score-num.risk-text-high   { color: #dc2626; }

.ai-detail-rec-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-detail-confidence-label {
    font-size: 0.7rem;
    color: #94a3b8;
}

.ai-detail-market-insight {
    background: rgba(255,255,255,0.6);
    border-radius: 6px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ai-insight-row {
    display: flex;
    gap: 6px;
    font-size: 0.72rem;
}

.ai-insight-label {
    color: #94a3b8;
    flex-shrink: 0;
    width: 64px;
}

.ai-insight-value { color: #334155; font-weight: 600; }

.ai-insight-context {
    font-size: 0.7rem;
    color: #64748b;
    margin: 4px 0 0;
    font-style: italic;
}

.ai-detail-reasons { display: flex; flex-direction: column; gap: 4px; }

.ai-reasons-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: #6366f1;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0;
}

.ai-reasons-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-left: 14px;
    margin: 0;
}

.ai-reasons-list li {
    font-size: 0.72rem;
    color: #475569;
}

/* Description */
.ai-detail-desc { border-top: 1px solid #f1f5f9; padding-top: 8px; }
.ai-detail-desc-text { font-size: 0.78rem; color: #64748b; line-height: 1.5; margin: 0; }

/* Actions */
.ai-detail-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 6px;
}

.ai-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
}

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

.ai-btn.primary   { background: #4f46e5; color: #fff; }
.ai-btn.primary:hover { background: #4338ca; }
.ai-btn.secondary { background: #ede9fe; color: #4f46e5; }
.ai-btn.secondary:hover { background: #ddd6fe; }
.ai-btn.ghost     { background: transparent; color: #64748b; border: 1px solid #e2e8f0; }
.ai-btn.ghost:hover { background: #f8fafc; }

/* ════════════════════════════════════════════════════════════════
   AI Context Sidebar  (AIContextSidebar.razor)
   ════════════════════════════════════════════════════════════════ */

.ai-ctx-sidebar {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    overflow-y: auto;
    /* Modern browsers */
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
}

/* WebKit fallback for Safari / older Chrome / Samsung Internet */
.ai-ctx-sidebar::-webkit-scrollbar { width: 6px; }
.ai-ctx-sidebar::-webkit-scrollbar-track { background: transparent; }
.ai-ctx-sidebar::-webkit-scrollbar-thumb { background-color: #e2e8f0; border-radius: 3px; }

.ai-ctx-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.ai-ctx-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.ai-ctx-persona-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    color: #6366f1;
    background: #eef2ff;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.ai-ctx-persona-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6366f1;
    flex-shrink: 0;
}

.ai-ctx-processing {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: #6366f1;
    padding: 8px 12px;
    background: #eef2ff;
    border-radius: 8px;
    flex-shrink: 0;
}

.ai-ctx-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #c7d2fe;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: ai-spin 0.7s linear infinite;
    flex-shrink: 0;
}

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

.ai-ctx-section { display: flex; flex-direction: column; gap: 8px; }

.ai-ctx-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-ctx-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin: 0;
}

.ai-ctx-action-link {
    font-size: 0.7rem;
    color: #6366f1;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.ai-ctx-header-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.ai-ctx-hdr-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.375rem;
    height: 1.375rem;
    color: #94a3b8;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.ai-ctx-hdr-icon-btn:hover {
    background: #f1f5f9;
    color: #475569;
    border-color: #e2e8f0;
}

.ai-ctx-hdr-icon-btn.bookmarked {
    color: #6366f1;
    background: #eef2ff;
}

.ai-ctx-hdr-icon-btn.copied {
    color: #16a34a;
}

.ai-ctx-action-link:hover { text-decoration: underline; }

.ai-ctx-results-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-ctx-more {
    font-size: 0.7rem;
    color: #94a3b8;
    text-align: center;
    margin: 4px 0 0;
}

.ai-ctx-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 32px 16px;
    text-align: center;
}

.ai-ctx-empty-icon {
    font-size: 2rem;
    opacity: 0.6;
}

.ai-ctx-empty-text {
    font-size: 0.78rem;
    color: #94a3b8;
    line-height: 1.5;
    margin: 0;
}

.ai-ctx-cta { align-self: center; }

/* Product preview card in AI context sidebar */
.ai-ctx-product-preview {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.ai-ctx-product-img-wrap {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #e2e8f0;
}

.ai-ctx-product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-ctx-product-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px 12px;
}

.ai-ctx-product-preview-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    line-height: 1.3;
}

.ai-ctx-product-preview-price {
    font-size: 0.9rem;
    font-weight: 700;
    color: #6366f1;
    margin: 0;
}

.ai-ctx-product-preview-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}

.ai-ctx-product-tag {
    font-size: 0.68rem;
    font-weight: 500;
    padding: 2px 7px;
    background: #ede9fe;
    color: #7c3aed;
    border-radius: 10px;
    white-space: nowrap;
}

.ai-ctx-stock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
}

.ai-ctx-stock-out {
    background: #fee2e2;
    color: #dc2626;
}

.ai-ctx-stock-low {
    background: #fef3c7;
    color: #d97706;
}

.ai-ctx-product-preview-desc {
    font-size: 0.74rem;
    color: #64748b;
    line-height: 1.45;
    margin: 6px 0 0;
}

.ai-ctx-quick-asks {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 4px;
}

.ai-ctx-quick-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 7px 12px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 0.76rem;
    color: #475569;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.ai-ctx-quick-btn:hover {
    background: #f0f4ff;
    border-color: #c7d2fe;
    color: #4f46e5;
}

/* ════════════════════════════════════════════════════════════════
   AI Main Layout  (AIMainLayout.razor)
   ════════════════════════════════════════════════════════════════ */

.ai-main-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #f8fafc;
}

.ai-main-body {
    flex: 1;
    display: grid;
    grid-template-columns: 7fr 3fr;
    min-height: 0;
    overflow: hidden;
}

@media (max-width: 1023px) {
    .ai-main-body {
        grid-template-columns: 1fr;
    }
}

.ai-main-content {
    overflow-y: auto;
    min-height: 0;
}

.ai-main-sidebar {
    border-left: 1px solid #e2e8f0;
    background: #fff;
    overflow-y: auto;
    min-height: 0;
    position: relative;
    transition: transform 0.25s ease;
}

@media (max-width: 1023px) {
    .ai-main-sidebar {
        position: fixed;
        top: 0;
        right: 0;
        width: 320px;
        height: 100%;
        z-index: 300;
        box-shadow: -4px 0 24px rgba(0,0,0,0.1);
        transform: translateX(100%);
    }

    .ai-main-sidebar.ai-sidebar-visible {
        transform: translateX(0);
    }
}

@media (min-width: 1024px) {
    .ai-main-sidebar.ai-sidebar-hidden { display: none; }
    .ai-main-sidebar.ai-sidebar-visible { display: block; }
}

.ai-main-sidebar-toggle {
    padding: 6px;
    border-radius: 6px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-main-sidebar-toggle:hover { background: rgba(255,255,255,0.2); }

.ai-sidebar-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    color: #64748b;
    z-index: 1;
}

.ai-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 299;
}

@media (min-width: 1024px) {
    .ai-sidebar-overlay { display: none; }
}

.ai-portfolio-summary {
    text-align: center;
    padding: 2rem;
}

.ai-portfolio-total {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    margin: 0.5rem 0;
}

/* Cart Preview */
.ai-cart-preview {
    text-align: center;
    padding: 2rem;
}

.ai-cart-total {
    font-size: 1.25rem;
    font-weight: 700;
    color: #667eea;
    margin: 0.5rem 0 1rem;
}

/* ============================================
   AI Approval Card Styles
   ============================================ */
.ai-approval-card {
    background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 100%);
    border: 2px solid #f59e0b;
    border-radius: 1rem;
    padding: 1.5rem;
    margin: 1rem 0;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.15);
    animation: approval-pulse 2s ease-in-out infinite;
}

@keyframes approval-pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(245, 158, 11, 0.15); }
    50% { box-shadow: 0 4px 25px rgba(245, 158, 11, 0.3); }
}

.ai-approval-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(245, 158, 11, 0.3);
}

.ai-approval-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.ai-approval-icon.reserve { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.ai-approval-icon.cart { background: linear-gradient(135deg, #34d399, #10b981); }
.ai-approval-icon.invest { background: linear-gradient(135deg, #818cf8, #6366f1); }
.ai-approval-icon.payment { background: linear-gradient(135deg, #60a5fa, #3b82f6); }

.ai-approval-title h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #92400e;
}

.ai-approval-title .ai-approval-reason {
    font-size: 0.875rem;
    color: #a16207;
    margin-top: 0.25rem;
}

.ai-approval-details {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.ai-approval-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.ai-approval-detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ai-approval-detail-item .label {
    font-size: 0.75rem;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ai-approval-detail-item .value {
    font-size: 1rem;
    font-weight: 600;
    color: #78350f;
}

.ai-approval-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.ai-approval-timer-icon {
    font-size: 1.25rem;
}

.ai-approval-timer-text {
    font-size: 0.875rem;
    color: #92400e;
    font-weight: 500;
}

.ai-approval-timer-text.warning { color: #dc2626; font-weight: 600; }
.ai-approval-timer-text.danger { color: #dc2626; font-weight: 700; animation: timer-blink 0.5s infinite; }

@keyframes timer-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.ai-approval-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.ai-approval-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-approval-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ai-approval-btn-confirm {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.ai-approval-btn-confirm:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.ai-approval-btn-cancel {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

.ai-approval-btn-cancel:hover:not(:disabled) {
    background: #e5e7eb;
    color: #374151;
}

.ai-approval-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Property Map — 3-Panel Detail+Map+AI layout
   ========================================================================== */

/* Override detail-mode to become a side-by-side layout when map-view is active */
.agui-layout.agui-layout--detail-mode .asset-map-detail-wrapper {
    display: flex;
    flex-direction: row;
    width: 100%;
    min-height: calc(100vh - 56px); /* below header */
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Left scrollable panel — asset detail scroll independently */
.asset-detail-panel {
    width: 420px;
    flex-shrink: 0;
    overflow-y: auto;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}
.asset-detail-panel::-webkit-scrollbar { width: 5px; }
.asset-detail-panel::-webkit-scrollbar-track { background: transparent; }
.asset-detail-panel::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

/* Right map panel — fills remaining space */
.asset-map-panel {
    flex: 1;
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #f1f5f9;
}

/* Map panel header — view toggle + AI toggle */
.asset-map-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.875rem;
    background: rgba(255,255,255,0.95);
    border-bottom: 1px solid #e5e7eb;
    backdrop-filter: blur(4px);
    z-index: 10;
    gap: 0.5rem;
    min-height: 44px;
}

.asset-map-panel-header .map-address-label {
    font-size: 0.8125rem;
    color: #4b5563;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
    flex: 1;
}

.asset-map-panel-header .map-header-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-shrink: 0;
}

/* PropertyMap component containers */
.property-map-container {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.property-map-leaflet {
    flex: 1;
    width: 100%;
    min-height: 400px;
}

/* Placeholder when no coordinates */
.property-map-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    min-height: 300px;
}

.property-map-placeholder__inner {
    text-align: center;
    color: #9ca3af;
    padding: 2rem;
}

.property-map-placeholder__icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 0.75rem;
    opacity: 0.5;
}

.property-map-placeholder__text {
    font-size: 0.9375rem;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.property-map-placeholder__address {
    font-size: 0.8125rem;
    color: #9ca3af;
}

/* Custom Leaflet marker pin */
.property-map-pin {
    background: none;
    border: none;
}

.property-pin-inner svg {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35));
}

/* Leaflet popup styling */
.property-map-popup {
    padding: 0.25rem 0.125rem;
}

.property-map-popup__name {
    font-weight: 600;
    font-size: 0.875rem;
    color: #111827;
    line-height: 1.4;
    margin-bottom: 0.125rem;
}

.property-map-popup__address {
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.4;
}

/* Map view toggle button in the detail page header area */
.btn-map-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid #d1d5db;
    cursor: pointer;
    transition: all 0.15s ease;
    background: #fff;
    color: #374151;
    white-space: nowrap;
}

.btn-map-toggle:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.btn-map-toggle.active {
    background: #1e40af;
    color: #fff;
    border-color: #1e40af;
}

.btn-map-toggle .btn-map-toggle__icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

/* AI toggle button within map panel header */
.btn-ai-panel-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid #6366f1;
    cursor: pointer;
    transition: all 0.15s ease;
    background: #fff;
    color: #6366f1;
    white-space: nowrap;
}

.btn-ai-panel-toggle:hover {
    background: #eef2ff;
}

.btn-ai-panel-toggle.active {
    background: #6366f1;
    color: #fff;
}

/* ---- Responsive ----- */
@media (max-width: 900px) {
    .agui-layout.agui-layout--detail-mode .asset-map-detail-wrapper {
        flex-direction: column;
        min-height: auto;
        overflow: visible;
    }

    .asset-detail-panel {
        width: 100%;
        max-height: none;
        overflow-y: visible;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }

    .asset-map-panel {
        min-height: 340px;
    }

    .property-map-leaflet {
        min-height: 340px;
    }
}


/* ================================================================
   Investment Dashboards — shared global styles (model-dashboard, timeline, action-card, etc.)
   ================================================================ */
/* ================================================================
   Investment Model Dashboards — shared scoped styles
   Used by: DirectSaleDashboard, ClubDealDashboard, TokenizedDashboard
   ================================================================ */

/* ── Page root ────────────────────────────────────────────────── */
.model-dashboard {
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    box-sizing: border-box;
}

/* ── Hero header ──────────────────────────────────────────────── */
.model-dashboard__hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.model-dashboard__icon {
    font-size: 2.25rem;
    line-height: 1;
    flex-shrink: 0;
}

.model-dashboard__hero > div {
    flex: 1;
    min-width: 0;
}

.model-dashboard__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 0.25rem;
}

.model-dashboard__subtitle {
    font-size: 0.9rem;
    color: #6b7280;
    margin: 0;
}

/* ── Per-model accent colors ──────────────────────────────────── */
.model-dashboard--direct-sale .model-dashboard__hero {
    border-left: 4px solid #3b82f6;
}

.model-dashboard--club-deal .model-dashboard__hero {
    border-left: 4px solid #10b981;
}

.model-dashboard--tokenized .model-dashboard__hero {
    border-left: 4px solid #8b5cf6;
}

/* ── Badges ───────────────────────────────────────────────────── */
.model-dashboard__badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 9999px;
    flex-shrink: 0;
    white-space: nowrap;
}

.model-dashboard__badge--blue   { background: #dbeafe; color: #1d4ed8; }
.model-dashboard__badge--green  { background: #d1fae5; color: #065f46; }
.model-dashboard__badge--purple { background: #ede9fe; color: #5b21b6; }

/* ── Section title ────────────────────────────────────────────── */
.model-dashboard__section-title {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin: 0 0 0.875rem;
}

/* ============================================================
   TIMELINE
   ============================================================ */
.model-dashboard__timeline {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

.timeline__step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f3f4f6;
    position: relative;
}

.timeline__step:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.timeline__dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    font-size: 1rem;
    line-height: 1;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    position: relative;
    z-index: 1;
    transition: all 0.2s;
}

.timeline__step--done .timeline__dot {
    background: #d1fae5;
    border-color: #6ee7b7;
    font-size: 0.9rem;
}

.timeline__step--active .timeline__dot {
    background: #dbeafe;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.timeline__step--pending .timeline__dot {
    background: #f9fafb;
    border-color: #d1d5db;
}

.timeline__content {
    flex: 1;
    padding-top: 0.2rem;
    min-width: 0;
}

.timeline__label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.125rem;
}

.timeline__step--pending .timeline__label {
    color: #9ca3af;
}

.timeline__step--active .timeline__label {
    color: #1d4ed8;
}

.timeline__desc {
    font-size: 0.8125rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}

.timeline__step--pending .timeline__desc {
    color: #c4c9d1;
}

/* ============================================================
   QUICK ACTION CARDS
   ============================================================ */
.model-dashboard__actions {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.model-dashboard__action-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

@media (max-width: 640px) {
    .model-dashboard__action-grid {
        grid-template-columns: 1fr;
    }
}

.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.875rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
}

.action-card:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.action-card:active {
    transform: translateY(0) scale(0.98);
}

.action-card--primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: white;
    font-weight: 600;
}

.action-card--primary:hover {
    opacity: 0.92;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.3);
}

.action-card__icon {
    font-size: 1.5rem;
    line-height: 1;
}

.action-card__label {
    line-height: 1.3;
}

/* ============================================================
   INFO BOX
   ============================================================ */
.model-dashboard__info-box {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.125rem 1.25rem;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 0.875rem;
}

.model-dashboard__info-box--purple {
    background: #f5f3ff;
    border-color: #c4b5fd;
}

.model-dashboard__info-icon {
    font-size: 1.375rem;
    line-height: 1;
    flex-shrink: 0;
}

.model-dashboard__info-box strong {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.model-dashboard__info-box p {
    font-size: 0.8125rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* ============================================================
   POOL STATUS (Club Deal)
   ============================================================ */
.model-dashboard__pool-status {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.pool-status {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

@media (max-width: 540px) {
    .pool-status {
        grid-template-columns: 1fr;
    }
}

.pool-status__item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.875rem 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
}

.pool-status__label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #9ca3af;
}

.pool-status__value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1f2937;
}

.pool-status__value--highlight { color: #667eea; }
.pool-status__value--green     { color: #10b981; }

/* ============================================================
   TAX SIMULATOR (Club Deal)
   ============================================================ */
.model-dashboard__simulator {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.tax-sim {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.tax-sim__label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.tax-sim__slider {
    width: 100%;
    height: 6px;
    accent-color: #10b981;
    cursor: pointer;
    border-radius: 9999px;
}

.tax-sim__output {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    overflow: hidden;
}

.tax-sim__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    color: #6b7280;
    background: white;
    border-bottom: 1px solid #f3f4f6;
}

.tax-sim__row:last-child {
    border-bottom: none;
}

.tax-sim__row strong {
    font-weight: 700;
    color: #1f2937;
}

.tax-sim__row--highlight {
    background: #d1fae5;
}

.tax-sim__row--highlight strong {
    color: #065f46;
    font-size: 1rem;
}

/* ============================================================
   TOKEN WALLET (Tokenized)
   ============================================================ */
.model-dashboard__wallet {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.token-wallet {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 0.75rem;
}

@media (max-width: 540px) {
    .token-wallet {
        grid-template-columns: 1fr;
    }
}

.token-wallet__stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.875rem 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
}

.token-wallet__stat--highlight {
    background: #f5f3ff;
    border-color: #c4b5fd;
}

.token-wallet__label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #9ca3af;
}

.token-wallet__stat--highlight .token-wallet__label {
    color: #7c3aed;
}

.token-wallet__value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1f2937;
}

.token-wallet__stat--highlight .token-wallet__value {
    color: #7c3aed;
}

.token-wallet__note {
    font-size: 0.8125rem;
    color: #9ca3af;
    margin: 0;
    text-align: center;
    font-style: italic;
}

/* ==========================================================================
   AI card investment model badge (compact, card context)
   ========================================================================== */

.ai-card-model-badge {
    font-size: 0.6rem;
    padding: 1px 6px;
    margin-top: 0;
}

/* ==========================================================================
   AI detail card — units summary block
   ========================================================================== */

.ai-detail-units-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    color: #334155;
}

.ai-detail-units-types {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 600;
    color: #475569;
}

.ai-detail-units-startprice {
    font-size: 0.8rem;
    font-weight: 700;
    color: #667eea;
}

/* ==========================================================================
   AI detail card — quick actions (Bookmark / Share)
   ========================================================================== */

.ai-detail-quick-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0 0;
    border-top: 1px solid #f1f5f9;
    margin-top: 0.5rem;
}

.ai-quick-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.625rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: #64748b;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s;
}

.ai-quick-action-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #334155;
}

.ai-quick-action-btn.bookmarked {
    color: #667eea;
    border-color: #c7d2fe;
    background: #eef2ff;
}

.ai-quick-action-btn.copied {
    color: #10b981;
    border-color: #a7f3d0;
    background: #ecfdf5;
}


/* ═══════════════════════════════════════════════════════
   Onboarding Nudge Components
   ═══════════════════════════════════════════════════════ */

/* ── Shared button styles ── */
.nudge-btn {
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 6px; font-size: 0.8rem; font-weight: 600;
    cursor: pointer; transition: opacity .15s, transform .1s;
    border: none; text-decoration: none;
}
.nudge-btn:hover { opacity: .85; }
.nudge-btn:active { transform: scale(.97); }
.nudge-btn--primary { background: #f59e0b; color: #1c1917; padding: 6px 14px; }
.nudge-btn--ghost { background: transparent; color: #78716c; padding: 5px 12px; border: 1px solid #d4d0cd; }
.nudge-btn--sm { font-size: 0.75rem; padding: 4px 10px; }
.nudge-btn--full { width: 100%; margin-top: 8px; }

/* ── SoftBanner ── */
.nudge-banner {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 900;
    display: flex; align-items: center; gap: 10px;
    padding: 12px 20px;
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(0,0,0,.08);
    animation: nudge-slide-up .3s ease;
}
.nudge-banner--soft { background: rgba(255,251,235,.95); }
.nudge-banner-icon { font-size: 1.1rem; flex-shrink: 0; }
.nudge-banner-msg { flex: 1; font-size: 0.83rem; color: #44403c; }
.nudge-banner-close {
    background: none; border: none; cursor: pointer;
    color: #9ca3af; font-size: 1rem; line-height: 1; padding: 2px 6px;
}
.nudge-banner-close:hover { color: #374151; }

/* ── ContextualPanel ── */
.nudge-panel {
    background: #fffbeb; border: 1px solid #fcd34d; border-radius: 12px;
    padding: 14px 16px; margin: 12px 0;
}
.nudge-panel-msg { font-size: 0.83rem; color: #44403c; margin: 0 0 10px; }
.nudge-panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── ModalGate ── */
.nudge-modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1200;
    display: grid; place-items: center;
    animation: nudge-fade-in .2s ease;
}
.nudge-modal {
    position: relative; background: #fff; border-radius: 16px;
    width: min(420px, 92vw); padding: 28px 24px 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
}
.nudge-modal-close {
    position: absolute; top: 12px; right: 14px;
    background: none; border: none; cursor: pointer;
    color: #9ca3af; font-size: 1.1rem;
}
.nudge-modal-icon { font-size: 2.5rem; text-align: center; margin-bottom: 12px; }
.nudge-modal-title { font-size: 1.05rem; font-weight: 700; color: #1c1917; text-align: center; margin: 0 0 8px; }
.nudge-modal-msg { font-size: 0.85rem; color: #6b7280; text-align: center; margin: 0 0 16px; }

/* ── AIChatInline ── */
.nudge-ai-inline {
    display: flex; gap: 10px; align-items: flex-start;
    background: #f8faff; border: 1px solid #e0e7ff;
    border-radius: 12px; padding: 12px 14px; margin: 8px 0;
}
.nudge-ai-avatar { font-size: 1.3rem; flex-shrink: 0; }
.nudge-ai-bubble { flex: 1; }
.nudge-ai-bubble p { font-size: 0.83rem; color: #374151; margin: 0 0 8px; }
.nudge-ai-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── FloatingCard ── */
.nudge-floating-card {
    position: fixed; bottom: 80px; right: 20px; z-index: 900;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
    padding: 14px 16px; width: 240px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    animation: nudge-slide-up .3s ease;
}
.nudge-floating-msg { font-size: 0.8rem; color: #44403c; margin: 0 0 10px; }

/* ── KycUpgrade ── */
.nudge-kyc-prompt {
    display: flex; align-items: center; gap: 10px;
    background: #fef3c7; border: 1px solid #fbbf24;
    border-radius: 10px; padding: 10px 14px; margin: 8px 0;
}
.nudge-kyc-icon { font-size: 1.2rem; flex-shrink: 0; }
.nudge-kyc-content { flex: 1; }
.nudge-kyc-content p { font-size: 0.8rem; color: #44403c; margin: 0 0 6px; }

/* ── Profile Completion Banner ── */
.profile-banner {
    position: sticky; top: 0; z-index: 800;
    background: rgba(255,251,235,.97);
    border-bottom: 1px solid #fcd34d;
    padding: 8px 20px;
}
.profile-banner-inner {
    display: flex; align-items: center; gap: 12px;
    max-width: 1200px; margin: 0 auto;
}
.profile-banner-text { display: flex; flex-direction: column; flex: 0 0 auto; }
.profile-banner-label { font-size: 0.78rem; font-weight: 700; color: #1c1917; }
.profile-banner-hint { font-size: 0.72rem; color: #78716c; }
.profile-banner-progress {
    flex: 1; height: 6px; background: #e5e7eb;
    border-radius: 3px; overflow: hidden;
}
.profile-banner-fill {
    height: 100%; background: #f59e0b;
    border-radius: 3px; transition: width .4s ease;
}

/* ── Animations ── */
@keyframes nudge-slide-up {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
@keyframes nudge-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ==========================================================================
   User Profile Badge (UPB) — header progress ring with hover popover
   ========================================================================== */

/* ── Top-mounted soft banner variant for anonymous nudges ── */
.nudge-banner--top {
    top: 52px; bottom: auto;
    border-top: none;
    border-bottom: 1px solid rgba(0,0,0,.08);
    animation: upb-slide-down .3s ease;
}

/* ── Badge container — overlays bottom-right of the account button ── */
.upb {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 26px;
    height: 26px;
    cursor: pointer;
    outline: none;
    z-index: 10;
    /* White backing to separate from account button icon */
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1.5px rgba(255,255,255,.9);
}

/* ── SVG donut ring fills the badge ── */
.upb-ring {
    position: absolute;
    inset: 0;
    width: 26px;
    height: 26px;
    overflow: visible;
    pointer-events: none;
}

.upb-ring-bg {
    fill: none;
    stroke: #e5e7eb;
    stroke-width: 2.5;
}

.upb-ring-fill {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    transition: stroke-dasharray .4s ease;
}

/* Color tiers */
.upb--warn  .upb-ring-fill { stroke: #ef4444; }
.upb--progress .upb-ring-fill { stroke: #f59e0b; }
.upb--good  .upb-ring-fill { stroke: #10b981; }

/* Pulsing ring for low-score warning */
.upb--warn .upb-ring-fill {
    animation: upb-pulse 2.4s ease-in-out infinite;
}

/* ── Score number centered in ring ── */
.upb-score-text {
    fill: #1c1917;
    font-size: 7px;
    font-weight: 700;
    font-family: system-ui, sans-serif;
    letter-spacing: -.3px;
}

.upb--warn     .upb-score-text { fill: #dc2626; }
.upb--progress .upb-score-text { fill: #b45309; }
.upb--good     .upb-score-text { fill: #047857; }

/* ── Hover popover ── */
.upb-popover {
    position: absolute;
    top: calc(100% + 6px);
    right: -4px;
    width: 230px;
    z-index: 1100;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 12px 32px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.06);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity .18s ease, transform .18s ease;
}

.upb:hover .upb-popover,
.upb:focus-within .upb-popover {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Small arrow pointer */
.upb-popover::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 12px;
    width: 10px; height: 10px;
    background: #ffffff;
    border-left: 1px solid #e5e7eb;
    border-top: 1px solid #e5e7eb;
    transform: rotate(45deg);
}

.upb-pop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.upb-pop-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #1c1917;
}

/* KYC tier pill */
.upb-pop-kyc {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
    flex-shrink: 0;
}

.upb-kyc--anon     { background: #fef3c7; color: #92400e; }
.upb-kyc--verified { background: #dbeafe; color: #1e40af; }
.upb-kyc--full     { background: #d1fae5; color: #065f46; }

/* Progress bar inside popover */
.upb-pop-track {
    height: 5px;
    background: #f3f4f6;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 8px;
}

.upb-pop-fill {
    height: 100%;
    border-radius: 99px;
    transition: width .4s ease;
}

.upb--warn     .upb-pop-fill, .upb-pop-fill { background: #f59e0b; }
.upb--progress .upb-pop-fill { background: #f59e0b; }
.upb--good     .upb-pop-fill { background: #10b981; }

.upb-pop-hint {
    font-size: 0.72rem;
    color: #6b7280;
    margin: 0 0 12px;
}

.upb-pop-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.upb-pop-btn {
    display: block;
    width: 100%;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
    border: none;
}

.upb-pop-btn:hover { opacity: .88; transform: scale(.99); }
.upb-pop-btn--primary { background: #f59e0b; color: #1c1917; }
.upb-pop-btn--ghost   { background: transparent; color: #44403c; border: 1px solid #d1d5db; }

/* ── Animations ── */
@keyframes upb-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .45; }
}

@keyframes upb-slide-down {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

/* Account button wrapper — relative context for the badge overlay */
.agui-account-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.agui-user-menu {
    display: flex;
    align-items: center;
    gap: 4px;
}
