/* Track Properties Page Styles */

/* Navigation active state */
nav ul li a.active {
    color: var(--primary-color);
    font-weight: 600;
}

nav ul li a.active::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 2px;
    background: var(--primary-gradient);
    bottom: -5px;
    left: 0;
    border-radius: 1px;
}

/* Track Hero Section */
.track-hero {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 80px 0 60px;
    text-align: center;
}

.track-hero h1 {
    font-size: 2.8rem;
    margin-bottom: 20px;
    color: var(--text-color);
}

.track-hero .subheadline {
    font-size: 1.2rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Save CTA Banner */
.save-cta-banner {
    background: var(--primary-gradient);
    color: white;
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(51, 102, 255, 0.15);
    position: sticky;
    top: 82px;
    z-index: 90;
    transition: all 0.3s ease;
}

.save-cta-banner.hidden {
    display: none;
}

.cta-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cta-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cta-text strong {
    font-size: 1.1rem;
}

.cta-text span {
    font-size: 0.95rem;
    opacity: 0.9;
}

.btn-secondary.small {
    padding: 8px 20px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid white;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.btn-secondary.small:hover {
    background: white;
    color: var(--primary-color);
}

/* Property Tracker Section */
.property-tracker {
    padding: 60px 0 80px;
}

/* Address Input Section */
.address-input-section {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin-bottom: 40px;
}

.input-wrapper {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

#address-input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

#address-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(51, 102, 255, 0.1);
}

#add-property-btn {
    padding: 15px 25px;
    white-space: nowrap;
    position: relative;
    min-width: 140px;
}

#add-property-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

#add-property-btn:disabled:hover {
    transform: none;
    box-shadow: var(--button-shadow);
}

.btn-loader {
    display: none;
}

.btn-loader.active {
    display: inline;
}

.btn-text.hidden {
    display: none;
}

.input-help {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-left: 5px;
}

/* States */
.loading-state,
.error-state,
.empty-state {
    text-align: center;
    padding: 60px 40px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

.loading-state.hidden,
.error-state.hidden,
.empty-state.hidden {
    display: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.error-state {
    border-left: 4px solid #dc3545;
}

.error-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.6;
}

.empty-state h3 {
    color: var(--text-color);
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--text-light);
    max-width: 500px;
    margin: 0 auto;
}

/* Properties List */
.properties-list {
    margin-top: 40px;
}

.properties-list.hidden {
    display: none;
}

.properties-list h2 {
    text-align: left;
    margin-bottom: 30px;
    color: var(--text-color);
}

.properties-container {
    display: grid;
    gap: 25px;
}

/* Property Card */
.property-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.property-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.property-card-content {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 25px;
    padding: 25px;
    align-items: start;
}

/* Image Section */
.image-section {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.property-image {
    width: 200px;
    height: 150px;
    border-radius: var(--border-radius);
    object-fit: cover;
    background: #f8f9fa;
}

/* Remove Cross Button */
.remove-btn-cross {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
    line-height: 1;
}

.remove-btn-cross:hover {
    background: #dc3545;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
}

.property-details {
    flex: 1;
}

.property-header {
    display: flex;
    justify-content: flex-start;
    align-items: center; /* align badge and address on the same baseline */
    margin-bottom: 15px;
    gap: 15px;
}

.property-address {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.3;
    flex: 1;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
    order: -1; /* Move to the left */
}

.status-badge.status-owned {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.status-badge.status-researching {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Purchase Price Section */
.purchase-price-section {
    background: #f0f9ff !important;
    border-left-color: #0ea5e9 !important;
}

.purchase-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0;
}

.purchase-price-label {
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 500;
    min-width: 120px;
}

.purchase-price-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.purchase-price-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-right: 8px;
}

.edit-purchase-price-btn {
    background: #f8f9fa;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    padding: 4px 10px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}
.edit-purchase-price-btn:hover {
    background: #e0e7ef;
}

.save-purchase-price-btn {
    background: #22c55e;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    padding: 6px 18px;
    font-weight: 600;
    margin-right: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.save-purchase-price-btn:hover {
    background: #16a34a;
}

.cancel-purchase-price-btn {
    background: #f3f4f6;
    color: #374151;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    padding: 6px 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.cancel-purchase-price-btn:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.property-data {
    display: grid;
    gap: 12px;
}

.data-section {
    padding: 15px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.data-section.compact {
    padding: 12px 15px;
    background: #f8f9fa;
}

.data-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Compact Valuation Styles */
.valuation-compact {
    position: relative;
}

.main-valuation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.valuation-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mid-price {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1;
}

.valuation-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.valuation-date {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Compact Recent Activity Styles */
.recent-activity-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-color);
    line-height: 1.4;
}

.activity-inline {
    color: var(--text-color);
}

.activity-inline strong {
    font-weight: 600;
    color: var(--text-color);
}

.activity-separator {
    color: var(--text-light);
    font-weight: bold;
    margin: 0 4px;
}

/* Confidence Badge Updates */
.confidence-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.confidence-high {
    background: #d4edda;
    color: #155724;
}

.confidence-medium {
    background: #fff3cd;
    color: #856404;
}

.confidence-low {
    background: #f8d7da;
    color: #721c24;
}

.confidence-scenario {
    background: #fef08a;
    color: #854d0e;
    border: 1px solid #eab308;
    text-transform: none;
    letter-spacing: 0.02em;
}

/* Future Metrics Section */
.future-metrics {
    padding: 15px;
    background: #f0f8ff;
    border-radius: var(--border-radius);
    border-left: 4px solid #3366ff;
    margin-top: 12px;
}

.future-metrics.hidden {
    display: none;
}

/* Cash Flow Indicators */
.insight-value.positive {
    color: #059669;
}

.insight-value.negative {
    color: #dc2626;
}

/* Insight Card Hover Effects */
.insight-card {
    position: relative;
    overflow: hidden;
}

.insight-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(102, 126, 234, 0.05) 0%,
        rgba(118, 75, 162, 0.05) 100%
    );
    opacity: 0;
    transition: opacity 0.2s ease;
}

.insight-card:hover::after {
    opacity: 1;
}

/* Insight Value Animations */
.insight-value {
    transition: transform 0.2s ease;
}

.insight-card:hover .insight-value {
    transform: scale(1.05);
}

/* Responsive Design */
@media (max-width: 768px) {
    .track-hero {
        padding: 60px 0 40px;
    }

    .track-hero h1 {
        font-size: 2.2rem;
    }

    .address-input-section {
        padding: 25px;
    }

    .input-wrapper {
        flex-direction: column;
        gap: 10px;
    }

    #add-property-btn {
        min-width: auto;
    }

    .cta-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .property-card-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .image-section {
        order: -1;
    }

    .property-image {
        width: 100%;
        height: 200px;
    }

    .property-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .status-badge {
        align-self: flex-start;
        order: -1; /* Keep it at the top on mobile */
    }

    .purchase-price-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .purchase-price-value {
        text-align: left;
    }

    .main-valuation {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .valuation-meta {
        align-items: flex-start;
    }

    .mid-price {
        font-size: 1.6rem;
    }

    .recent-activity-inline {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .activity-separator {
        display: none;
    }
}

@media (max-width: 480px) {
    .track-hero h1 {
        font-size: 1.8rem;
    }

    .track-hero .subheadline {
        font-size: 1rem;
    }

    .address-input-section {
        padding: 20px;
    }

    .property-card-content {
        padding: 20px;
    }

    .mid-price {
        font-size: 1.4rem;
    }
}

/* Add Details Button */
.add-details-btn {
    position: static;
    width: 100%;
    max-width: 200px;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    opacity: 1;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    margin-top: 10px;
}

.add-details-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

/* User Details Display */
.user-details-display {
    border-top: 2px solid #667eea;
    background: linear-gradient(
        135deg,
        rgba(102, 126, 234, 0.03) 0%,
        rgba(118, 75, 162, 0.03) 100%
    );
}

.user-details-display h4 {
    color: #667eea;
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
}

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

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    border-left: 3px solid #e0e6ed;
}

.detail-item.highlight {
    border-left-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.detail-item.positive {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.detail-item.negative {
    border-left-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.detail-label {
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 500;
}

.detail-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f2937;
}

.detail-item.positive .detail-value {
    color: #065f46;
}

.detail-item.negative .detail-value {
    color: #991b1b;
}

/* Info Icon for tooltips */
.info-icon {
    position: relative;
    display: inline-block;
    margin-left: 6px;
    cursor: help;
    color: #667eea;
    opacity: 0.7;
    transition: all 0.2s ease;
    vertical-align: middle;
}

.info-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

.info-icon svg {
    display: block;
    width: 14px;
    height: 14px;
}

/* Custom tooltip */
.info-icon::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 400;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.info-icon::after {
    content: "";
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
}

.info-icon:hover::before,
.info-icon:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Multiline tooltip for annual cash flow breakdown */
.info-icon--cashflow-breakdown::before {
    white-space: pre-line;
    max-width: min(320px, 92vw);
    width: max-content;
    text-align: left;
    line-height: 1.35;
}

/* Property Details Modal */
.property-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.property-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 600px;
    width: 90vw;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.form-section {
    margin-bottom: 2rem;
}

.form-section:last-child {
    margin-bottom: 0;
}

.form-section h4 {
    margin: 0 0 1rem 0;
    color: #1f2937;
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #374151;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: 1rem;
}

.radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
    flex: 1;
}

.radio-option:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.radio-option input[type="radio"] {
    margin-right: 0.5rem;
    width: auto;
}

.radio-option span {
    font-weight: 500;
    color: #374151;
}

.radio-option:has(input:checked) {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: #f9fafb;
}

.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    border: none;
}

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

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

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

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

/* Enhanced responsive design for modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95vw;
        max-height: 90vh;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .radio-group {
        flex-direction: column;
    }

    .user-details-grid {
        grid-template-columns: 1fr;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
}

/* User Menu Styles */
.user-menu {
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 20px;
    transition: background-color 0.2s ease;
    position: relative;
}

.user-info:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.default-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
}

.user-info span {
    font-size: 0.9rem;
    color: var(--text-color);
}

.dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 8px 0;
    min-width: 120px;
    display: none;
    z-index: 100;
    margin-top: 5px;
}

.user-info:hover .dropdown {
    display: block;
}

/* Create a hover area that includes both user-info and dropdown */
.user-info:hover::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 0;
    width: 120px;
    height: 100px;
    background: transparent;
}

/* Keep dropdown visible when hovering over it */
.dropdown:hover {
    display: block;
}

.dropdown a {
    display: block;
    padding: 8px 16px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}

.dropdown a:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Ensure Google Autocomplete dropdown appears above the modal backdrop and matches modal input */
.pac-container {
    z-index: 10001 !important;
    max-width: 400px;
    width: 90vw;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* Dashboard specific styles */
.dashboard-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 60px 0;
    text-align: center;
}

.dashboard-hero h1 {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.dashboard-hero .subheadline {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

.properties-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.properties-header h2 {
    margin: 0;
}

/* Loading state styles */
.loading-state {
    text-align: center;
    padding: 40px 0;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Empty state styles */
.empty-state {
    text-align: center;
    padding: 60px 0;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.empty-state h3 {
    margin: 0 0 8px;
    font-size: 1.5rem;
}

.empty-state p {
    color: #666;
    margin-bottom: 24px;
}

/* Error state styles */
.error-state {
    text-align: center;
    padding: 40px 0;
}

.error-icon {
    font-size: 2rem;
    margin-bottom: 16px;
}

.error-state p {
    color: #dc2626;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dashboard-hero {
        padding: 40px 0;
    }

    .dashboard-hero h1 {
        font-size: 2rem;
    }

    .properties-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
}

/* Portfolio Insights Redesign */
.portfolio-insights {
    padding: 2.5rem 0 1.5rem 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
    margin-top: 0.5rem;
}

.insight-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.07),
        0 1.5px 6px rgba(118, 75, 162, 0.04);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem 1.25rem;
    transition: box-shadow 0.2s, transform 0.2s;
    position: relative;
    min-width: 0;
}

.insight-card:hover {
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.13),
        0 3px 12px rgba(118, 75, 162, 0.09);
    transform: translateY(-2px) scale(1.02);
}

.insight-icon-bg {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
    flex-shrink: 0;
}

.insight-icon {
    font-size: 1.7rem;
    color: #fff;
    line-height: 1;
}

.insight-content {
    flex: 1;
    min-width: 0;
}

.insight-label {
    font-size: 0.98rem;
    color: #7c3aed;
    font-weight: 500;
    margin-bottom: 0.15rem;
    letter-spacing: 0.01em;
}

/* Disposable income: large annual, hover explainer */
.disposable-income-card {
    overflow: visible;
    z-index: 1;
}

.disposable-income-card:hover {
    z-index: 30;
}

.disposable-income-tooltip {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 40;
    background: #1e293b;
    color: #f1f5f9;
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
    font-size: 0.82rem;
    line-height: 1.45;
    font-weight: 400;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.35);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0.18s ease;
    min-width: 17rem;
}

.disposable-income-tooltip-heading {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    margin-bottom: 0.45rem;
    font-weight: 600;
}

.disposable-income-tooltip-lines {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}

.disposable-income-tooltip-line {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: baseline;
}

.disposable-income-tooltip-line span:first-child {
    color: #cbd5e1;
}

.disposable-income-tooltip-line span:last-child {
    font-weight: 600;
    color: #f8fafc;
    white-space: nowrap;
}

.disposable-income-tooltip-line-total {
    margin-top: 0.35rem;
    padding-top: 0.45rem;
    border-top: 1px solid #334155;
}

.disposable-income-tooltip-line-total span:last-child {
    color: #86efac;
}

.disposable-income-tooltip-line-total.disposable-income-negative span:last-child {
    color: #fca5a5;
}

.disposable-income-tooltip-footnote {
    margin-top: 0.55rem;
    padding-top: 0.45rem;
    border-top: 1px solid #334155;
    font-size: 0.72rem;
    line-height: 1.4;
    color: #94a3b8;
    font-weight: 400;
}

.disposable-income-tooltip-msg {
    margin: 0;
    color: #cbd5e1;
    font-size: 0.82rem;
    line-height: 1.45;
}

.disposable-income-card:hover .disposable-income-tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Annual Outgoings: hover breakdown (annual components) */
.annual-outgoings-card {
    overflow: visible;
    z-index: 1;
}

.annual-outgoings-card:hover {
    z-index: 30;
}

.annual-outgoings-tooltip {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 40;
    background: #1e293b;
    color: #f1f5f9;
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
    font-size: 0.82rem;
    line-height: 1.45;
    font-weight: 400;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.35);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0.18s ease;
    min-width: 14rem;
}

.annual-outgoings-card:hover .annual-outgoings-tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.annual-outgoings-tooltip-heading {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    margin-bottom: 0.45rem;
    font-weight: 600;
}

.annual-outgoings-tooltip-lines {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}

.annual-outgoings-tooltip-line {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: baseline;
}

.annual-outgoings-tooltip-line span:first-child {
    color: #cbd5e1;
}

.annual-outgoings-tooltip-line span:last-child {
    font-weight: 600;
    color: #f8fafc;
    white-space: nowrap;
}

/* Cash flow: hover breakdown by owner + NG benefit */
.cashflow-card {
    overflow: visible;
    z-index: 1;
}

.cashflow-card:hover {
    z-index: 30;
}

.cashflow-tooltip {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 40;
    background: #1e293b;
    color: #f1f5f9;
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
    font-size: 0.82rem;
    line-height: 1.45;
    font-weight: 400;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.35);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0.18s ease;
    min-width: 17rem;
}

.cashflow-card:hover .cashflow-tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.cashflow-tooltip-heading {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    margin-bottom: 0.45rem;
    font-weight: 600;
}

.cashflow-tooltip-lines {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.cashflow-tooltip-section {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}

.cashflow-tooltip-section + .cashflow-tooltip-section {
    margin-top: 0.5rem;
    padding-top: 0.45rem;
    border-top: 1px solid #334155;
}

.cashflow-tooltip-section-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    font-weight: 600;
    margin-bottom: 0.1rem;
}

.cashflow-tooltip-line {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: baseline;
}

.cashflow-tooltip-line span:first-child {
    color: #cbd5e1;
}

.cashflow-tooltip-line span:last-child {
    font-weight: 600;
    color: #f8fafc;
    white-space: nowrap;
}

.cashflow-tooltip-line-total {
    margin-top: 0.2rem;
    padding-top: 0.35rem;
    border-top: 1px solid #334155;
}

.cashflow-tooltip-line-total span:last-child {
    color: #86efac;
}

.cashflow-tooltip-msg {
    margin: 0;
    color: #cbd5e1;
}

.cashflow-tooltip-footnote {
    margin-top: 0.55rem;
    padding-top: 0.45rem;
    border-top: 1px solid #334155;
    font-size: 0.72rem;
    line-height: 1.4;
    color: #94a3b8;
    font-weight: 400;
}

.disposable-income-annual-row {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.15rem;
}

.disposable-annual-suffix {
    font-size: 1rem;
    font-weight: 600;
    color: #64748b;
    line-height: 1.2;
}

.disposable-income-monthly-line {
    font-size: 0.93rem;
}

.disposable-income-monthly-line .positive {
    color: #059669;
}

.disposable-income-monthly-line .negative {
    color: #dc2626;
}

.insight-value {
    font-size: 2.1rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.2rem;
    line-height: 1.1;
    word-break: break-all;
}

.insight-breakdown {
    font-size: 0.93rem;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-weight: 400;
}

.insight-breakdown .separator {
    color: #d1d5db;
}

.insight-value.positive {
    color: #059669;
}

.insight-value.negative {
    color: #dc2626;
}

@media (max-width: 900px) {
    .insights-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .insights-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
    .insight-card {
        padding: 1.1rem 0.9rem;
    }
    .insight-value {
        font-size: 1.4rem;
    }
}

/* Align all card content to the top */
.insight-card.align-top {
    align-items: flex-start;
}

.chart-and-metric {
    display: flex;
    align-items: flex-start;
    gap: 1.1rem;
    width: 100%;
}

.chart-container {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(102, 126, 234, 0.07);
    margin-top: 0.1rem;
}

.metric-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    min-width: 0;
}

.metric-content .insight-label {
    margin-bottom: 0.1rem;
}

.metric-content .insight-value {
    margin-bottom: 0.15rem;
}

@media (max-width: 600px) {
    .chart-and-metric {
        flex-direction: row;
        gap: 0.7rem;
    }
    .chart-container {
        width: 54px;
        height: 54px;
    }
}

/* Short breakdown below pie chart */
.insight-short-breakdown {
    font-size: 0.98rem;
    color: #6b7280;
    margin-top: 0.1rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* Make value font smaller for portfolio value and mortgage cards */
.insight-card.align-top .insight-value {
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.2;
    word-break: break-all;
}

.rental-pw {
    font-size: 1rem;
    color: #6b7280;
    margin-left: 0.15em;
    vertical-align: middle;
}

.collapsible-header {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.2rem 0 0.2rem 0;
    margin-bottom: 0;
}
.collapsible-header .chevron {
    font-size: 1.1rem;
    margin-right: 0.5em;
    transition: transform 0.2s;
    display: inline-block;
}
.collapsible-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #667eea;
}

.data-section.user-details-display.collapsible {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.user-details-grid {
    gap: 0.5rem;
    margin-top: 0;
}

.annual-expense-summary {
    margin-bottom: 0.5rem;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
}

.annual-expense-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2em;
    font-size: 0.98rem;
    color: #374151;
    align-items: center;
    justify-content: flex-start;
}

/* Modern dropdown for dashboard sorting */
.property-sort-wrapper {
    display: flex;
    align-items: center;
    margin-left: auto;
    margin-right: 1.5em;
}

.modern-dropdown {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: #fff
        url('data:image/svg+xml;utf8,<svg fill="%23667eea" height="20" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>')
        no-repeat right 0.9em center/1.2em 1.2em;
    border: 1.5px solid #e0e7ef;
    border-radius: 8px;
    padding: 0.55em 2.5em 0.55em 1em;
    font-size: 1.05rem;
    color: #222;
    font-family: inherit;
    font-weight: 500;
    box-shadow: 0 1px 4px rgba(102, 126, 234, 0.04);
    transition: border 0.2s, box-shadow 0.2s;
    height: 44px;
    min-width: 260px;
    cursor: pointer;
}
.modern-dropdown:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 2px #667eea22;
}
.modern-dropdown option {
    font-weight: 400;
}

@media (max-width: 700px) {
    .modern-dropdown {
        min-width: 160px;
        font-size: 0.98rem;
        height: 38px;
    }
    .property-sort-wrapper {
        margin-right: 0.5em;
    }
}

/* Tooltip for Annual Outgoings breakdown */
.outgoings-info {
    position: relative;
    display: inline-block;
    cursor: pointer;
    margin-left: 6px;
    vertical-align: middle;
}
.outgoings-tooltip {
    visibility: hidden;
    opacity: 0;
    width: 210px;
    background: #222;
    color: #fff;
    text-align: left;
    border-radius: 8px;
    padding: 12px 16px;
    position: absolute;
    z-index: 10;
    left: 50%;
    top: 120%;
    transform: translateX(-50%);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    font-size: 0.98rem;
    transition: opacity 0.18s, visibility 0.18s;
    pointer-events: none;
}
.outgoings-info:hover .outgoings-tooltip,
.outgoings-info:focus .outgoings-tooltip,
.outgoings-info:active .outgoings-tooltip {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}
.outgoings-tooltip strong {
    color: #fbbf24;
    font-weight: 600;
    font-size: 1.01em;
}

.mortgage-breakdown-compact {
    font-size: 0.95rem;
    color: #6b7280;
    margin-top: 2px;
    margin-bottom: 0;
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1.4;
    white-space: nowrap;
}

.owner-mini-card {
    display: inline-flex;
    align-items: center;
    background: #f3f4f6;
    color: #374151;
    border-radius: 16px;
    padding: 4px 12px 4px 10px;
    font-size: 0.97rem;
    font-weight: 500;
    margin: 2px 2px 2px 0;
    box-shadow: 0 1px 4px rgba(102, 126, 234, 0.06);
    position: relative;
    transition: background 0.18s;
}
.owner-mini-card:hover {
    background: #e0e7ef;
}
.owner-remove-btn {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 1.1em;
    margin-left: 6px;
    cursor: pointer;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s, color 0.18s;
}
.owner-remove-btn:hover {
    background: #fbbf24;
    color: #fff;
}

.owners-inline {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    margin-right: 8px;
}

.tracked-properties-title {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.unfold-btn {
    font-size: 0.97rem;
    padding: 7px 18px;
    height: 36px;
    line-height: 1.1;
    background: none;
    border: none;
    box-shadow: none;
}

/* Capital Gain Styles */
.capital-gain-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding: 6px 0;
    border-top: 1px solid #e9ecef;
}

.capital-gain-label {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
}

.capital-gain-value {
    font-weight: 600;
    font-size: 0.95rem;
}

.capital-gain-value.gain {
    color: #22c55e;
}

.capital-gain-value.loss {
    color: #ef4444;
}

/* Owner Mini Cards */
.owners-inline {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.owner-mini-card {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Annual Expense Summary */
.annual-expense-summary {
    background: #f8f9fa !important;
    border-left-color: #28a745 !important;
}

.annual-expense-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.annual-expense-row span {
    font-size: 0.9rem;
    color: var(--text-color);
}

/* Collapsible Details */
.user-details-display.collapsible {
    border-left-color: #667eea;
}

.collapsible-header {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 0;
    user-select: none;
}

.collapsible-header:hover {
    opacity: 0.8;
}

.chevron {
    font-size: 0.8rem;
    color: var(--text-light);
    transition: transform 0.2s ease;
}

.user-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.detail-item.highlight {
    background: #f0f9ff;
    border-color: #0ea5e9;
}

.detail-item.positive {
    background: #f0fdf4;
    border-color: #22c55e;
}

.detail-item.negative {
    background: #fef2f2;
    border-color: #ef4444;
}

.detail-label {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.detail-value {
    font-weight: 600;
    color: var(--text-color);
}

.info-icon {
    cursor: help;
    opacity: 0.6;
}

.info-icon:hover {
    opacity: 1;
}

/* User Sale Badge */
.user-sale-badge {
    background: #667eea;
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-left: 4px;
}

/* Empty State in Details */
.detail-item.empty-state {
    background: #f8f9fa;
    border: 1px dashed #dee2e6;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    grid-column: 1 / -1;
    margin: 8px 0;
}

.detail-item.empty-state .detail-label {
    display: block;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 4px;
}

.detail-item.empty-state .detail-value {
    display: block;
    color: #868e96;
    font-size: 0.9rem;
}

.detail-item.default-values-note {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    grid-column: 1 / -1;
    margin: 8px 0;
}

.detail-item.default-values-note .detail-label {
    display: block;
    font-weight: 600;
    color: #1976d2;
    margin-bottom: 4px;
}

.detail-item.default-values-note .detail-value {
    display: block;
    color: #42a5f5;
    font-size: 0.9rem;
}

/* Responsive adjustments for new elements */
@media (max-width: 768px) {
    .annual-expense-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .capital-gain-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .user-details-grid {
        grid-template-columns: 1fr;
    }

    .detail-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

.add-to-portfolio-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    width: 100%;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2);
}

.add-to-portfolio-btn:hover {
    background: linear-gradient(135deg, #218838 0%, #1ea085 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.add-to-portfolio-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.add-to-portfolio-btn:disabled:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2);
}

/* Success Message Styling */
.success-message {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    animation: slideInDown 0.3s ease-out;
    z-index: 1000;
}

.success-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1rem;
    font-weight: 500;
}

.success-icon {
    font-size: 1.2rem;
    font-weight: bold;
}

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

/* Responsive adjustments for success message */
@media (max-width: 768px) {
    .success-message {
        margin: 0 16px 16px 16px;
        padding: 14px 16px;
    }

    .success-content {
        font-size: 0.95rem;
    }
}

/* --- Portfolio Chat Widget (Dashboard AI assistant) --- */
.portfolio-chat-widget {
    background: white;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 14px 14px 12px;
    margin-bottom: 34px;
    border: 1px solid rgba(224, 231, 239, 0.9);
    max-height: 33vh;
    display: flex;
    flex-direction: column;
}

.portfolio-chat-unfold-btn {
    appearance: none;
    border: 1px solid rgba(51, 102, 255, 0.25);
    background: rgba(51, 102, 255, 0.08);
    color: #1f3cff;
    padding: 7px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1;
    white-space: nowrap;
    transition: transform 0.12s ease, background 0.12s ease;
}

.portfolio-chat-unfold-btn:hover {
    transform: translateY(-1px);
    background: rgba(51, 102, 255, 0.12);
}

.portfolio-chat-widget.is-collapsed {
    max-height: 78px;
    overflow: hidden;
    padding-bottom: 10px;
}

.portfolio-chat-widget.is-collapsed .portfolio-chat-header {
    margin-bottom: 0;
}

.portfolio-chat-widget.is-collapsed .portfolio-chat-quick-start,
.portfolio-chat-widget.is-collapsed .portfolio-chat-messages,
.portfolio-chat-widget.is-collapsed .portfolio-chat-input-row,
.portfolio-chat-widget.is-collapsed .portfolio-chat-status {
    display: none;
}

.portfolio-chat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.portfolio-chat-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 3px;
}

.portfolio-chat-subtitle {
    font-size: 0.92rem;
    color: var(--text-light);
    line-height: 1.3;
}

.portfolio-chat-messages {
    flex: 1;
    overflow-y: auto;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid rgba(226, 232, 240, 0.95);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
    min-height: 90px;
}

.portfolio-chat-bubble {
    max-width: 92%;
    padding: 11px 13px;
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    line-height: 1.5;
    font-size: 0.95rem;
    word-break: break-word;
}

.portfolio-chat-bubble p {
    margin: 0 0 0.55rem 0;
}

.portfolio-chat-bubble p:last-child {
    margin-bottom: 0;
}

.portfolio-chat-bubble ul {
    margin: 0.25rem 0 0.5rem 1rem;
    padding: 0;
}

.portfolio-chat-bubble li {
    margin: 0.15rem 0;
}

.portfolio-chat-bubble code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        "Liberation Mono", "Courier New", monospace;
    background: rgba(15, 23, 42, 0.07);
    border-radius: 4px;
    padding: 0.1em 0.35em;
    font-size: 0.9em;
}

.portfolio-chat-bubble--user {
    align-self: flex-end;
    background: rgba(51, 102, 255, 0.1);
    border-color: rgba(51, 102, 255, 0.25);
    white-space: pre-wrap;
}

.portfolio-chat-bubble--assistant {
    align-self: flex-start;
    background: #ffffff;
    border-color: #e6e8f0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.portfolio-chat-quick-start {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.portfolio-chat-chip {
    appearance: none;
    border: 1px solid rgba(51, 102, 255, 0.25);
    background: rgba(51, 102, 255, 0.08);
    color: #1f3cff;
    padding: 7px 10px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: transform 0.12s ease, background 0.12s ease;
}

.portfolio-chat-chip:hover {
    transform: translateY(-1px);
    background: rgba(51, 102, 255, 0.12);
}

.portfolio-chat-input-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    align-items: center;
}

#portfolio-chat-input {
    flex: 1;
    border-radius: 10px;
    border: 1.5px solid #e0e7ef;
    padding: 11px 12px;
    font-size: 1rem;
    background: #ffffff;
    outline: none;
}

#portfolio-chat-input:disabled {
    opacity: 0.8;
    cursor: not-allowed;
}

.portfolio-chat-status {
    margin-top: 10px;
    font-size: 0.95rem;
    color: #334155;
}

.portfolio-chat-status.hidden {
    display: none;
}

.portfolio-chat-status--error {
    color: #dc2626;
    font-weight: 600;
}

@media (max-width: 768px) {
    .portfolio-chat-widget {
        margin-bottom: 26px;
    }

    .portfolio-chat-messages {
        min-height: 80px;
    }
}
