/* ============================================================
 * Harmonious Food Finder — Application Styles
 * Version: 23.5
 * ============================================================ */

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

        body {
            font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            background: #1a2332;
            min-height: 100vh;
            padding: 10px;
            font-size: 18px;
            -webkit-font-smoothing: antialiased;
        }

        #appShell {
            max-width: 390px;
            min-width: 390px;
            width: 390px;
            margin: 20px auto 0;
            background: linear-gradient(135deg, #1e3a8a 0%, #deb426 50%, #3b82f6 100%);
            border-radius: 40px;
            box-shadow: 0 8px 40px rgba(0,0,0,0.5);
            position: relative;
            height: calc(100vh - 40px);
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        #appContent {
            flex: 1;
            overflow-y: auto;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: none; /* Firefox */
            -ms-overflow-style: none; /* IE/Edge */
        }
        #appContent::-webkit-scrollbar {
            display: none; /* Chrome/Safari */
        }

        .container {
            max-width: 100%;
            margin: 0;
        }

        /* Bottom tab navigation */
        .bottom-tab-nav {
            flex-shrink: 0;
            height: 68px;
            background: linear-gradient(180deg, #f8fffe 0%, #ffffff 100%);
            display: flex;
            align-items: center;
            justify-content: space-around;
            border-top: 2px solid rgba(20, 184, 166, 0.15);
            z-index: 900;
            border-radius: 0 0 40px 40px;
        }
        .bottom-tab-nav .tab-btn {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 3px;
            background: none;
            border: none;
            padding: 8px 16px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            color: #94a3b8;
            font-family: inherit;
            transition: color 0.2s;
        }
        .bottom-tab-nav .tab-btn.active {
            color: #0d9488;
            position: relative;
        }
        .bottom-tab-nav .tab-btn.active::after {
            content: '';
            position: absolute;
            top: -2px;
            left: 50%;
            transform: translateX(-50%);
            width: 24px;
            height: 2px;
            background: linear-gradient(90deg, #14b8a6, #0d9488);
            border-radius: 2px;
        }
        .bottom-tab-nav .tab-btn .tab-icon {
            font-size: 24px;
            line-height: 1;
        }

        /* Mobile: full-width, no rounded corners */
        @media (max-width: 430px) {
            body {
                padding: 0;
            }
            #appShell {
                max-width: 100%;
                min-width: 100%;
                width: 100%;
                border-radius: 0;
                margin: 0;
                height: 100vh;
            }
            .bottom-tab-nav {
                border-radius: 0;
                border-top: 2px solid rgba(20, 184, 166, 0.15);
            }
        }

        .header {
            text-align: center;
            color: white;
            margin-bottom: 0;
            padding: 20px 16px 12px;
        }

        .logo-container {
            margin-bottom: 10px;
        }

        .harmony-logo {
            width: 72px;
            height: 72px;
            object-fit: contain;
            border-radius: 50%;
            border: 2px solid rgba(255,255,255,0.3);
            box-shadow: 0 2px 12px rgba(0,0,0,0.15);
        }

        .header h1 {
            font-size: 22px;
            font-weight: 700;
            margin-bottom: 4px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
            line-height: 1.2;
        }

        .header p {
            font-size: 16px;
            opacity: 0.95;
            margin-bottom: 8px;
            line-height: 1.3;
        }

        .harmony-badge {
            background: #deb426;
            color: #1e3a8a;
            padding: 5px 12px;
            border-radius: 15px;
            font-size: 15px;
            font-weight: 600;
            display: inline-block;
            box-shadow: 0 2px 8px rgba(222, 180, 38, 0.4);
        }

        .scanner-card, .results-card {
            background: white;
            padding: 20px;
            border-radius: 16px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.12);
            border: 1px solid #e2e8f0;
            margin: 0 12px 12px;
        }
        .scanner-card:active, .results-card:active {
            background: #eff6ff;
        }

        #reader {
            border-radius: 8px;
            overflow: hidden;
            margin-bottom: 15px;
            max-width: 100%;
        }

        .btn-primary, .btn-secondary, .btn-gold {
            width: 100%;
            padding: 14px;
            border: none;
            border-radius: 14px;
            font-size: 17px;
            font-weight: 600;
            cursor: pointer;
            margin: 6px 0;
            transition: all 0.2s;
            letter-spacing: 0.01em;
        }

        .btn-primary {
            background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
            color: white;
        }

        .btn-secondary {
            background: #64748b;
            color: white;
        }

        .btn-gold {
            background: #deb426;
            color: white;
        }

        .btn-change-location {
            background: #64748b;
            color: white;
            border: none;
            padding: 6px 12px;
            border-radius: 6px;
            font-size: 16px;
            cursor: pointer;
            margin-top: 8px;
        }

        .location-card {
            background: white;
            padding: 20px;
            border-radius: 16px;
            border-left: none;
            margin: 10px 12px 12px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.12);
            border: 1px solid #e2e8f0;
            transition: background 0.15s;
        }
        .location-card:active {
            background: #eff6ff;
        }

        .location-card h3 {
            font-size: 18px;
            color: #0d9488;
            margin-bottom: 8px;
        }

        .location-card p {
            font-size: 16px;
            color: #64748b;
            margin-bottom: 10px;
            line-height: 1.4;
        }

        .location-card input {
            width: 100%;
            padding: 10px;
            border: 2px solid #d1d5db;
            border-radius: 6px;
            font-size: 16px;
            margin-bottom: 10px;
        }

        .results-card h2 {
            font-size: 20px;
            color: #1e3a8a;
            margin-bottom: 12px;
        }

        .product-section {
            background: #f8fafc;
            padding: 12px;
            border-radius: 8px;
            margin-bottom: 12px;
        }

        .product-image-container {
            text-align: center;
            margin-bottom: 12px;
        }

        #productImage {
            max-width: 100%;
            max-height: 200px;
            object-fit: contain;
            border-radius: 8px;
        }

        #productName {
            font-size: 20px;
            font-weight: 700;
            color: #1e40af;
            margin: 8px 0;
            line-height: 1.3;
            word-wrap: break-word;
        }

        #productBrand {
            font-size: 16px;
            color: #64748b;
            margin-bottom: 8px;
        }

        .organic-badge {
            display: inline-block;
            padding: 5px 10px;
            border-radius: 6px;
            font-size: 15px;
            font-weight: 600;
            margin: 4px;
        }

        .organic-badge.organic {
            background: #dcfce7;
            color: #166534;
        }

        .organic-badge.non-organic {
            background: #fee2e2;
            color: #991b1b;
        }

        .organic-badge.non-gmo {
            background: #dbeafe;
            color: #1e40af;
        }

        .ingredients-section {
            background: white;
            padding: 12px;
            border-radius: 8px;
            margin: 12px 0;
        }

        .ingredients-section h3 {
            font-size: 18px;
            color: #0f766e;
            margin-bottom: 8px;
        }

        #ingredientsList {
            font-size: 16px;
            line-height: 1.5;
            color: #475569;
        }

        .concern-item {
            background: #fef2f2;
            padding: 10px;
            border-radius: 6px;
            margin: 8px 0;
            border-left: 3px solid #dc2626;
        }

        .concern-item strong {
            display: block;
            color: #dc2626;
            font-size: 16px;
            margin-bottom: 4px;
        }

        .concern-item p {
            font-size: 15px;
            color: #7f1d1d;
            line-height: 1.4;
            margin: 0;
        }

        .alternatives-section h3 {
            font-size: 18px;
            color: #0d9488;
            margin: 15px 0 10px;
        }

        .alternative-item {
            background: #f8fafc;
            padding: 16px;
            border-radius: 8px;
            margin-bottom: 12px;
            border: 1px solid #e2e8f0;
            overflow: hidden;
        }

        .alternative-image {
            width: 100%;
            max-width: 120px;
            height: 120px;
            object-fit: contain;
            border-radius: 6px;
            margin: 0 auto 10px;
            display: block;
        }

        .alternative-info h4 {
            font-size: 17px;
            color: #1e40af;
            margin-bottom: 4px;
            line-height: 1.3;
            word-wrap: break-word;
        }

        .alternative-info p {
            font-size: 15px;
            color: #64748b;
            margin-bottom: 8px;
        }

        .comparison-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin: 8px 0;
        }

        .tag {
            padding: 4px 8px;
            border-radius: 12px;
            font-size: 15px;
            font-weight: 600;
            white-space: nowrap;
        }

        .tag.organic {
            background: #dcfce7;
            color: #166534;
        }

        .tag.non-gmo {
            background: #dbeafe;
            color: #1e40af;
        }

        .tag.healthier {
            background: #fef3c7;
            color: #92400e;
        }

        .tag.higher-protein {
            background: #e0e7ff;
            color: #3730a3;
        }

        .store-availability {
            margin-top: 10px;
            width: 100%;
        }

        .store-item {
            background: white;
            padding: 14px;
            border-radius: 8px;
            margin: 10px auto;
            border: 2px solid #e2e8f0;
            max-width: 100%;
        }

        .store-name {
            font-size: 17px;
            font-weight: 700;
            color: #0f766e;
            margin-bottom: 6px;
        }

        .store-distance {
            font-size: 16px;
            color: #64748b;
            margin-bottom: 8px;
        }

        .store-directions-link {
            font-size: 17px;
            color: #14b8a6;
            text-decoration: none;
            font-weight: 700;
            display: inline-block;
            margin-top: 6px;
        }

        .store-price {
            font-size: 18px;
            font-weight: 700;
            color: #0d9488;
        }

        .back-to-top {
            position: fixed;
            bottom: 15px;
            right: 15px;
            background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
            color: white;
            width: 45px;
            height: 45px;
            border-radius: 50%;
            border: none;
            cursor: pointer;
            display: none;
            align-items: center;
            justify-content: center;
            font-size: 22px;
            box-shadow: 0 4px 12px rgba(20, 184, 166, 0.4);
            z-index: 1000;
        }

        .back-to-top.show {
            display: flex;
        }

        /* PRO FEATURE STYLES */
        .buy-buttons-container {
            background: #f8fafc;
            padding: 12px;
            border-radius: 8px;
            margin: 12px 0;
            border: 2px solid #e2e8f0;
            width: 100%;
        }

        .buy-buttons-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 10px;
        }

        .buy-buttons-title {
            font-size: 16px;
            font-weight: 600;
            color: #0d9488;
        }

        .pro-badge {
            background: linear-gradient(135deg, #deb426 0%, #f59e0b 100%);
            color: white;
            padding: 3px 8px;
            border-radius: 12px;
            font-size: 14px;
            font-weight: 700;
            letter-spacing: 0.5px;
        }

        .buy-button {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 14px 16px;
            margin: 10px auto;
            border-radius: 8px;
            border: 2px solid #e2e8f0;
            background: white;
            cursor: pointer;
            transition: all 0.2s;
            text-decoration: none;
            color: inherit;
            max-width: 100%;
        }

        .buy-button:hover:not(.disabled) {
            border-color: #14b8a6;
            background: #f0fdfa;
            transform: translateY(-1px);
        }

        .buy-button.disabled {
            opacity: 0.5;
            cursor: not-allowed;
            background: #f8fafc;
        }

        .buy-button-left {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .buy-button-icon {
            font-size: 24px;
        }

        .buy-button-info {
            display: flex;
            flex-direction: column;
        }

        .buy-button-name {
            font-size: 17px;
            font-weight: 700;
            color: #1e40af;
        }

        .buy-button-price {
            font-size: 16px;
            color: #64748b;
        }

        .buy-button-arrow {
            font-size: 20px;
            color: #94a3b8;
        }

        .compare-prices-button {
            background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
            color: white;
            border: none;
            padding: 10px;
            border-radius: 6px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            width: 100%;
            margin-top: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
        }

        .compare-prices-button:hover:not(.disabled) {
            background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
        }

        .compare-prices-button.disabled {
            opacity: 0.5;
            cursor: not-allowed;
            background: #94a3b8;
        }

        .upgrade-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.7);
            display: none;
            align-items: flex-start;
            justify-content: center;
            z-index: 10001;
            padding: 20px;
            overflow-y: auto;
        }

        .upgrade-overlay.show {
            display: flex;
        }

        .upgrade-modal {
            background: white;
            border-radius: 16px;
            padding: 24px;
            max-width: 400px;
            width: 100%;
            box-shadow: 0 20px 60px rgba(0,0,0,0.3);
            max-height: 90dvh;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            position: relative;
        }

        .upgrade-header {
            text-align: center;
            margin-bottom: 20px;
        }

        .upgrade-icon {
            font-size: 50px;
            margin-bottom: 12px;
        }

        .upgrade-title {
            font-size: 24px;
            font-weight: 700;
            color: #1e40af;
            margin-bottom: 8px;
        }

        .upgrade-subtitle {
            font-size: 16px;
            color: #64748b;
            line-height: 1.4;
        }

        .upgrade-features {
            background: #f8fafc;
            padding: 16px;
            border-radius: 10px;
            margin: 20px 0;
        }

        .upgrade-feature {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            margin: 13px 0;
        }

        .upgrade-feature-icon {
            font-size: 24px;
            color: #14b8a6;
            flex-shrink: 0;
        }

        .upgrade-feature-text {
            font-size: 17px;
            color: #1e293b;
            line-height: 1.5;
            font-weight: 400;
        }

        .upgrade-pricing {
            text-align: center;
            margin: 20px 0;
        }

        .upgrade-price {
            font-size: 34px;
            font-weight: 700;
            color: #1e40af;
        }

        .upgrade-price-period {
            font-size: 16px;
            color: #64748b;
        }

        .upgrade-buttons {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .upgrade-btn-primary {
            background: linear-gradient(135deg, #deb426 0%, #f59e0b 100%);
            color: white;
            border: none;
            padding: 14px;
            border-radius: 8px;
            font-size: 18px;
            font-weight: 700;
            cursor: pointer;
        }

        .upgrade-btn-secondary {
            background: transparent;
            color: #64748b;
            border: none;
            padding: 10px;
            font-size: 16px;
            cursor: pointer;
        }

        /* Mobile-specific adjustments */
        @media (max-width: 640px) {
            body {
                padding: 5px;
                font-size: 16px;
            }

            .header h1 {
                font-size: 22px;
            }

            .header p {
                font-size: 15px;
            }

            .scanner-card, .results-card {
                padding: 12px;
                border-radius: 10px;
            }

            .btn-primary, .btn-secondary, .btn-gold {
                padding: 11px;
                font-size: 16px;
            }

            #productName {
                font-size: 18px;
            }

            .alternative-info h4 {
                font-size: 16px;
            }

            .concern-item {
                padding: 8px;
            }

            .concern-item strong {
                font-size: 15px;
            }

            .concern-item p {
                font-size: 15px;
            }
        }

        /* Very small screens */
        @media (max-width: 380px) {
            .harmony-logo {
                width: 60px;
                height: 60px;
            }

            .header h1 {
                font-size: 20px;
            }

            .header p {
                font-size: 15px;
            }

            .tag {
                font-size: 14px;
                padding: 3px 6px;
            }
        }

        .controls {
            display: block;
            margin-bottom: 20px;
        }

        button {
            flex: 1;
            padding: 15px 30px;
            font-size: 18px;
            font-weight: 600;
            border: none;
            border-radius: 10px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .btn-primary {
            background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
            color: white;
            box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(20, 184, 166, 0.4);
            background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
        }

        .btn-gold {
            background: #deb426;
            color: white;
            box-shadow: 0 4px 12px rgba(222, 180, 38, 0.3);
        }

        .btn-gold:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(222, 180, 38, 0.4);
            background: #c9a021;
        }

        .btn-secondary {
            background: #64748b;
            color: white;
        }

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

        .btn-change-location {
            background: #64748b;
            color: white;
            border: none;
            padding: 6px 16px;
            font-size: 16px;
            font-weight: 600;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s;
        }

        .btn-change-location:hover {
            background: #475569;
        }

        .location-card {
            background: #eff6ff;
            padding: 20px;
            border-radius: 12px;
            margin-bottom: 20px;
            border: 2px solid #14b8a6;
        }

        .location-card h3 {
            color: #0d9488;
            margin-bottom: 15px;
        }

        .product-info {
            margin-bottom: 30px;
        }

        .product-header {
            display: flex;
            gap: 12px;
            margin-bottom: 20px;
            align-items: flex-start;
            overflow: hidden;
        }

        .product-image {
            width: 80px;
            height: 80px;
            flex-shrink: 0;
            object-fit: contain;
            border-radius: 10px;
            border: 2px solid #e5e7eb;
        }

        .product-details {
            flex: 1;
            min-width: 0;
            overflow: hidden;
        }

        .product-details h2 {
            color: #0d9488;
            font-size: 20px;
            margin-bottom: 4px;
            word-break: break-word;
            overflow-wrap: break-word;
        }

        .product-details p {
            color: #64748b;
            font-size: 17px;
            margin-bottom: 8px;
        }

        .organic-badge {
            display: inline-block;
            padding: 6px 14px;
            border-radius: 20px;
            font-size: 16px;
            font-weight: 600;
            margin-right: 8px;
        }

        .organic-badge.organic {
            background: #dcfce7;
            color: #166534;
        }

        .organic-badge.non-organic {
            background: #fee2e2;
            color: #991b1b;
        }

        .organic-badge.non-gmo {
            background: #ccfbf1;
            color: #0f766e;
        }

        .ingredient-analysis {
            background: #f8fafc;
            padding: 20px;
            border-radius: 12px;
            margin: 20px 0;
            border: 2px solid #e2e8f0;
        }

        .ingredient-analysis h3 {
            color: #0d9488;
            margin-bottom: 15px;
            font-size: 20px;
        }

        .ingredients-list {
            background: white;
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 15px;
            font-size: 16px;
            line-height: 1.6;
            color: #475569;
        }

        .health-concerns {
            background: #fef3c7;
            border-left: 4px solid #f59e0b;
            padding: 15px;
            border-radius: 8px;
        }

        .health-concerns h4 {
            color: #92400e;
            margin-bottom: 10px;
            font-size: 18px;
        }

        .concern-item {
            background: white;
            padding: 12px;
            margin: 8px 0;
            border-radius: 6px;
            border-left: 3px solid #ef4444;
        }

        .concern-item strong {
            color: #dc2626;
            display: block;
            margin-bottom: 5px;
        }

        .concern-item p {
            color: #64748b;
            font-size: 16px;
            margin: 0;
        }

        .alternatives-section {
            margin-top: 30px;
        }

        .alternatives-section h3 {
            color: #0d9488;
            font-size: 24px;
            margin-bottom: 20px;
        }

        .alternative-item {
            background: #f8fafc;
            padding: 20px;
            border-radius: 12px;
            margin-bottom: 20px;
            display: block;
            border: 2px solid #e2e8f0;
            transition: all 0.3s;
        }

        .alternative-item:hover {
            border-color: #14b8a6;
            box-shadow: 0 4px 12px rgba(20, 184, 166, 0.15);
        }

        .alternative-image {
            width: 120px;
            height: 120px;
            object-fit: contain;
            border-radius: 8px;
            display: block;
            margin: 0 auto 15px auto;
        }

        .alternative-info {
            width: 100%;
        }

        .alternative-info h4 {
            color: #0d9488;
            font-size: 20px;
            margin-bottom: 5px;
        }

        .comparison-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin: 10px 0;
        }

        .tag {
            padding: 5px 12px;
            border-radius: 15px;
            font-size: 15px;
            font-weight: 600;
        }

        .tag.organic {
            background: #dcfce7;
            color: #166534;
        }

        .tag.non-gmo {
            background: #ccfbf1;
            color: #0f766e;
        }

        .tag.healthier {
            background: #fef3c7;
            color: #92400e;
        }

        .tag.higher-protein {
            background: #e0e7ff;
            color: #3730a3;
        }

        .store-availability {
            margin-top: 15px;
            padding-top: 15px;
            border-top: 1px solid #e2e8f0;
        }

        .store-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 0;
            font-size: 16px;
        }

        .store-info-left {
            flex: 1;
        }

        .store-name {
            font-weight: 600;
            color: #0d9488;
        }

        .store-distance {
            color: #64748b;
            font-size: 15px;
        }

        .store-directions-link {
            color: #14b8a6;
            text-decoration: none;
            font-size: 15px;
            font-weight: 600;
            margin-top: 3px;
            display: inline-block;
            transition: color 0.2s;
        }

        .store-directions-link:hover {
            color: #0d9488;
            text-decoration: underline;
        }

        .store-info-right {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
        }

        .store-price {
            font-weight: 700;
            color: #059669;
            font-size: 18px;
        }

        .loading {
            text-align: center;
            padding: 40px;
        }

        .spinner {
            border: 4px solid #e2e8f0;
            border-top: 4px solid #14b8a6;
            border-radius: 50%;
            width: 50px;
            height: 50px;
            animation: spin 1s linear infinite;
            margin: 0 auto 20px;
        }

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

        .location-info {
            background: #ccfbf1;
            padding: 12px;
            border-radius: 10px;
            margin-bottom: 20px;
            color: #0f766e;
            font-size: 16px;
            text-align: center;
            font-weight: 600;
        }

        .results-card {
            display: none;
        }

        .results-card.show {
            display: block;
        }

        input[type="text"] {
            width: 100%;
            padding: 12px;
            border: 2px solid #e2e8f0;
            border-radius: 8px;
            font-size: 16px;
            margin-bottom: 10px;
        }

        input[type="text"]:focus {
            outline: none;
            border-color: #14b8a6;
        }

        details {
            margin-top: 20px;
            cursor: pointer;
        }

        summary {
            color: #64748b;
            font-size: 16px;
            text-align: center;
            padding: 10px;
        }

        summary:hover {
            color: #14b8a6;
        }

        .back-to-top {
            position: fixed;
            bottom: 30px;
            right: 30px;
            background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
            color: white;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            border: none;
            cursor: pointer;
            display: none;
            align-items: center;
            justify-content: center;
            font-size: 26px;
            box-shadow: 0 4px 12px rgba(20, 184, 166, 0.4);
            transition: all 0.3s;
            z-index: 1000;
        }

        .back-to-top:hover {
            transform: translateY(-5px);
            box-shadow: 0 6px 16px rgba(20, 184, 166, 0.5);
        }

        .back-to-top.show {
            display: flex;
        }

        /* ═══ PRO UI v11.0.0 — Agent-First Dual-Tier ═══ */
        #proContent { display: none; }
        body.pro-mode #proContent { display: flex; flex-direction: column; height: 100%; }
        body.pro-mode #freeContent { display: none !important; }
        body.pro-mode #chatFab { display: none !important; }
        body.pro-mode #chatOverlay { display: none !important; }
        body.pro-mode #chatSheet { display: none !important; }
        :root {
            --pro-dropdown-bg: rgba(18,32,52,0.97);
            --pro-dropdown-border: rgba(255,255,255,0.12);
            --pro-dropdown-text: rgba(255,255,255,0.88);
            --pro-dropdown-sub: rgba(255,255,255,0.45);
            --pro-dropdown-hover: rgba(255,255,255,0.07);
            --pro-dropdown-divider: rgba(255,255,255,0.08);
        }
        body.pro-mode.pro-light {
            --pro-dropdown-bg: rgba(255,255,255,0.98);
            --pro-dropdown-border: rgba(0,0,0,0.1);
            --pro-dropdown-text: #0f172a;
            --pro-dropdown-sub: #64748b;
            --pro-dropdown-hover: rgba(0,0,0,0.04);
            --pro-dropdown-divider: rgba(0,0,0,0.07);
        }
        body.pro-mode #appShell {
            background: linear-gradient(160deg, #0c1a2e 0%, #122a4a 30%, #0d3b5e 55%, #0a4f4f 80%, #0f3d2e 100%);
        }
        body.pro-mode #appContent { background: transparent; }

        .pro-header {
            text-align: center;
            padding: 14px 20px 6px;
            flex-shrink: 0;
        }
        .pro-logo { width: 52px; height: 52px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.2); box-shadow: 0 4px 20px rgba(0,0,0,0.3); margin: 0 auto 6px; display: block; }
        .pro-header h1 { font-family: 'DM Sans', -apple-system, sans-serif; font-size: 21px; font-weight: 700; color: #fff; margin: 0 0 2px; letter-spacing: -0.3px; }
        .pro-tagline { font-size: 15px; color: rgba(255,255,255,0.5); margin: 0; }
        .pro-top-bar { display: flex; justify-content: space-between; align-items: center; padding: 0 4px; margin-bottom: 4px; }
        .pro-badge-sm { background: linear-gradient(135deg, #deb426, #f59e0b); color: #1e293b; font-size: 14px; font-weight: 700; padding: 3px 10px; border-radius: 12px; letter-spacing: 0.5px; }
        .pro-top-actions { display: flex; gap: 6px; align-items: center; }
        .pro-icon-btn { width: 32px; height: 32px; border-radius: 10px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); color: rgba(255,255,255,0.7); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 16px; transition: background 0.15s; }
        .pro-icon-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }

        .pro-agent-area { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
        .pro-messages { flex: 1; overflow-y: auto; padding: 8px 14px 6px; display: flex; flex-direction: column; gap: 12px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
        .pro-messages::-webkit-scrollbar { width: 3px; }
        .pro-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

        .pro-welcome { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; text-align: center; }
        .pro-welcome-icon { font-size: 42px; margin-bottom: 10px; }
        .pro-welcome h2 { color: #fff; font-size: 19px; font-weight: 600; margin: 0 0 4px; font-family: 'DM Sans', sans-serif; }
        .pro-welcome p { color: rgba(255,255,255,0.45); font-size: 15px; margin: 0 0 16px; line-height: 1.4; max-width: 260px; }

        .pro-chips { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; padding: 0 14px 10px; flex-shrink: 0; }
        .pro-chip { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); color: rgba(255,255,255,0.75); font-size: 15px; font-weight: 500; padding: 7px 13px; border-radius: 20px; cursor: pointer; transition: all 0.15s; font-family: 'DM Sans', sans-serif; white-space: nowrap; }
        .pro-chip:hover { background: rgba(255,255,255,0.13); border-color: rgba(255,255,255,0.22); color: #fff; }
        .pro-chip:active { transform: scale(0.96); }

        .pro-input-bar { flex-shrink: 0; padding: 6px 12px 8px; display: flex; gap: 8px; align-items: center; }
        .pro-scan-btn { height: 42px; border-radius: 14px; background: linear-gradient(135deg, #14b8a6, #0d9488); border: none; color: white; font-size: 17px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; box-shadow: 0 2px 12px rgba(20,184,166,0.3); transition: transform 0.15s; padding: 0 14px; gap: 5px; }
        .pro-scan-btn:hover { transform: translateY(-1px); }
        .pro-scan-btn:active { transform: scale(0.94); }
        .pro-input-wrap { flex: 1; position: relative; }
        .pro-text-input { width: 100%; padding: 11px 44px 11px 16px; border-radius: 22px; border: 1.5px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.06); color: #fff; font-size: 16px; font-family: 'DM Sans', sans-serif; outline: none; transition: border-color 0.2s; box-sizing: border-box; }
        .pro-text-input::placeholder { color: rgba(255,255,255,0.3); }
        .pro-text-input:focus { border-color: rgba(20,184,166,0.5); background: rgba(255,255,255,0.09); }
        .pro-voice-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; background: none; border: none; color: rgba(255,255,255,0.45); font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: color 0.15s; }
        .pro-voice-btn:hover { color: #fff; }
        .pro-voice-btn.listening { color: #ef4444; animation: proPulse 1.5s infinite; }
        @keyframes proPulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

        /* Pro scanner tab */
        .pro-scanner-view { flex: 1; overflow-y: auto; padding: 12px; -webkit-overflow-scrolling: touch; }
        .pro-scanner-card { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); border-radius: 16px; padding: 16px; margin-bottom: 12px; }
        .pro-scanner-card h3 { color: rgba(255,255,255,0.9); font-size: 17px; font-weight: 600; margin: 0 0 12px; }
        .pro-scanner-card input[type="text"] { width: 100%; padding: 10px 14px; border-radius: 10px; border: 1.5px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.06); color: #fff; font-size: 16px; font-family: 'DM Sans', sans-serif; outline: none; box-sizing: border-box; }
        .pro-scanner-card input[type="text"]::placeholder { color: rgba(255,255,255,0.3); }
        .pro-scanner-card .btn-primary { background: linear-gradient(135deg, #14b8a6, #0d9488); }
        .pro-scanner-card .btn-secondary { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.8); }

        /* Pro profile tab */
        .pro-profile-view { flex: 1; overflow-y: auto; padding: 12px; -webkit-overflow-scrolling: touch; }

        /* Pro results area */
        .pro-results-view { flex: 1; overflow-y: auto; padding: 12px; -webkit-overflow-scrolling: touch; }

        /* Pro bottom nav override */
        body.pro-mode .bottom-tab-nav { background: linear-gradient(180deg, rgba(12,26,46,0.95), rgba(10,20,38,1)); border-top: 1px solid rgba(255,255,255,0.06); }
        body.pro-mode .bottom-tab-nav .tab-btn { color: rgba(255,255,255,0.4); }
        body.pro-mode .bottom-tab-nav .tab-btn.active { color: #14b8a6; }
        body.pro-mode .bottom-tab-nav .tab-btn.active::after { background: linear-gradient(90deg, #14b8a6, #0d9488); }

        /* Pro message bubbles */
        .pro-messages .hc-msg-row { display: flex; gap: 8px; align-items: flex-start; max-width: 92%; animation: hcFadeUp 0.3s ease forwards; }
        .pro-messages .hc-msg-row.user { align-self: flex-end; max-width: 80%; justify-content: flex-end; }
        .pro-messages .hc-bubble { padding: 10px 14px; font-size: 13.5px; line-height: 1.55; border-radius: 16px; word-wrap: break-word; }
        .pro-messages .hc-bubble-agent { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); border-bottom-left-radius: 4px; }
        .pro-messages .hc-bubble-user { background: linear-gradient(135deg, #14b8a6, #0d9488); color: white; border-bottom-right-radius: 4px; }
        .pro-messages .hc-msg-av { width: 24px; height: 24px; border-radius: 50%; overflow: hidden; flex-shrink: 0; margin-top: 2px; }
        .pro-messages .hc-msg-av img { width: 100%; height: 100%; object-fit: cover; }
        .pro-messages .hc-md-h { color: rgba(255,255,255,0.95); font-size: 16px; margin: 6px 0 4px; }
        .pro-messages .hc-md-li { color: rgba(255,255,255,0.8); padding-left: 12px; position: relative; font-size: 16px; }
        .pro-messages .hc-md-li::before { content: '•'; position: absolute; left: 0; color: #14b8a6; }

        /* Pro light mode overrides */
        body.pro-mode.pro-light #appShell {
            background: linear-gradient(160deg, #f0f9ff 0%, #e0f2fe 30%, #f0fdfa 55%, #ecfdf5 80%, #f0fdf4 100%);
        }
        body.pro-mode.pro-light .pro-header h1 { color: #0f172a; }
        body.pro-mode.pro-light .pro-tagline { color: #64748b; }
        body.pro-mode.pro-light .pro-icon-btn { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.1); color: #475569; }
        body.pro-mode.pro-light .pro-icon-btn:hover { background: rgba(0,0,0,0.1); color: #0f172a; }
        body.pro-mode.pro-light .pro-welcome h2 { color: #0f172a; }
        body.pro-mode.pro-light .pro-welcome p { color: #64748b; }
        body.pro-mode.pro-light .pro-chip { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.1); color: #334155; }
        body.pro-mode.pro-light .pro-chip:hover { background: rgba(0,0,0,0.08); border-color: rgba(0,0,0,0.18); color: #0f172a; }
        body.pro-mode.pro-light .pro-text-input { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.12); color: #0f172a; }
        body.pro-mode.pro-light .pro-text-input::placeholder { color: #94a3b8; }
        body.pro-mode.pro-light .pro-text-input:focus { border-color: #14b8a6; background: #fff; }
        body.pro-mode.pro-light .pro-voice-btn { color: #64748b; }
        body.pro-mode.pro-light .pro-voice-btn:hover { color: #0f172a; background: rgba(0,0,0,0.05); }
        body.pro-mode.pro-light .pro-messages .hc-bubble-agent { background: #fff; color: #1e293b; border: 1px solid #e2e8f0; }
        body.pro-mode.pro-light .pro-messages .hc-msg-row .hc-md-h { color: #0f172a; }
        body.pro-mode.pro-light .pro-messages .hc-msg-row .hc-md-li { color: #334155; }
        body.pro-mode.pro-light .pro-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); }
        body.pro-mode.pro-light .pro-scanner-card { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); }
        body.pro-mode.pro-light .pro-scanner-card h3 { color: #0f172a; }
        body.pro-mode.pro-light .pro-scanner-card input[type="text"] { background: #fff; border-color: #d1d5db; color: #0f172a; }
        body.pro-mode.pro-light .pro-scanner-card input[type="text"]::placeholder { color: #94a3b8; }
        body.pro-mode.pro-light .bottom-tab-nav { background: linear-gradient(180deg, #f8fffe, #ffffff); border-top: 2px solid rgba(20,184,166,0.15); }
        body.pro-mode.pro-light .bottom-tab-nav .tab-btn { color: #94a3b8; }
        body.pro-mode.pro-light .bottom-tab-nav .tab-btn.active { color: #0d9488; }
        body.pro-mode.pro-light .pro-voice-btn { color: #64748b !important; background: rgba(0,0,0,0.04) !important; border-color: rgba(0,0,0,0.1) !important; }
        body.pro-mode.pro-light .pro-voice-btn:hover { color: #0f172a !important; background: rgba(0,0,0,0.08) !important; }
        body.pro-mode.pro-light .pro-scan-label { color: #fff; }
        body.pro-mode.pro-light #proUserName { color: #64748b !important; }
        body.pro-mode.pro-light .pro-logout-btn { color: #64748b !important; border-color: rgba(0,0,0,0.15) !important; }

        /* Pro scan button with label */
        .pro-scan-btn { width: auto; padding: 0 14px; gap: 6px; font-size: 16px; font-weight: 600; font-family: 'DM Sans', sans-serif; }
        .pro-scan-label { font-size: 16px; font-weight: 600; color: #fff; }

        /* Pro logout button in header */
        .pro-logout-btn { background: none; border: 1px solid rgba(255,255,255,0.15); color: rgba(255,255,255,0.5); font-size: 15px; font-weight: 500; padding: 4px 10px; border-radius: 8px; cursor: pointer; font-family: 'DM Sans', sans-serif; transition: all 0.15s; }
        .pro-logout-btn:hover { color: rgba(255,255,255,0.8); border-color: rgba(255,255,255,0.3); }

        /* Pro tab content visibility */
        .pro-tab-agent, .pro-tab-scan, .pro-tab-profile { display: none; flex-direction: column; flex: 1; min-height: 0; }
        .pro-tab-agent.active { display: flex; }
        .pro-tab-scan.active { display: flex; }
        .pro-tab-profile.active { display: flex; }

        /* Pro scan results should use the exact same visual styling as Free. */
        body.pro-mode #proMessages #loadingState,
        body.pro-mode #proMessages #errorState,
        body.pro-mode #proMessages #productContent {
            width: 100%;
        }



/* ============================================================
 * Pro UI + Extended Component Styles
 * ============================================================ */

/* ═══════════════════════════════════════════════════════════════
   harmony-chat.css — Harmony Agent Chat UI v9.4.0
   Bottom sheet, tab navigation, voice-first, dark/light themes
   Reusable — include via <link> or inline in <style>
   ═══════════════════════════════════════════════════════════════ */

/* ─── CSS Variables (Light default) ─── */
:root {
    --hc-teal-500: #14b8a6;
    --hc-teal-600: #0d9488;
    --hc-teal-700: #0f766e;
    --hc-gold-400: #deb426;
    --hc-gold-500: #b8960f;
    --hc-slate-50: #f8fafc;
    --hc-slate-100: #f1f5f9;
    --hc-slate-200: #e2e8f0;
    --hc-slate-300: #cbd5e1;
    --hc-slate-400: #94a3b8;
    --hc-slate-500: #64748b;
    --hc-slate-600: #475569;
    --hc-slate-700: #334155;
    --hc-slate-800: #1e293b;
    --hc-slate-900: #0f172a;

    /* Light theme (default) */
    --hc-bg: #ffffff;
    --hc-bg2: var(--hc-slate-50);
    --hc-bg-agent: var(--hc-slate-100);
    --hc-bg-user: var(--hc-teal-600);
    --hc-text: var(--hc-slate-900);
    --hc-text2: var(--hc-slate-500);
    --hc-text-agent: var(--hc-slate-800);
    --hc-text-user: #ffffff;
    --hc-border: var(--hc-slate-200);
    --hc-chip-bg: var(--hc-slate-100);
    --hc-chip-text: var(--hc-slate-700);
    --hc-tab-bg: #ffffff;
    --hc-tab-inactive: var(--hc-slate-400);
    --hc-action-muted: var(--hc-slate-400);
    --hc-overlay: rgba(15, 23, 42, 0.4);
    --hc-sheet-shadow: 0 -8px 40px rgba(0,0,0,0.12);
}

/* ─── Dark theme override ─── */
body.hc-dark, .hc-dark {
    --hc-bg: var(--hc-slate-900);
    --hc-bg2: var(--hc-slate-800);
    --hc-bg-agent: var(--hc-slate-800);
    --hc-bg-user: var(--hc-teal-700);
    --hc-text: var(--hc-slate-100);
    --hc-text2: var(--hc-slate-400);
    --hc-text-agent: var(--hc-slate-200);
    --hc-text-user: #ffffff;
    --hc-border: var(--hc-slate-700);
    --hc-chip-bg: var(--hc-slate-800);
    --hc-chip-text: var(--hc-slate-300);
    --hc-tab-bg: var(--hc-slate-900);
    --hc-tab-inactive: var(--hc-slate-500);
    --hc-action-muted: var(--hc-slate-500);
    --hc-overlay: rgba(0, 0, 0, 0.6);
    --hc-sheet-shadow: 0 -8px 40px rgba(0,0,0,0.4);
}

/* ─── Chat FAB (Floating Action Button) ─── */
#chatFab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--hc-teal-500), var(--hc-teal-700));
    border: none;
    box-shadow: 0 4px 20px rgba(13, 148, 136, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: transform 0.2s, box-shadow 0.2s;
}
#chatFab:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(13, 148, 136, 0.5); }
#chatFab:active { transform: scale(0.95); }
#chatFab .fab-badge {
    position: absolute; top: -2px; right: -2px;
    width: 18px; height: 18px;
    background: var(--hc-gold-400);
    border-radius: 50%;
    border: 2.5px solid white;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: var(--hc-slate-900);
}

/* ─── Sheet Overlay ─── */
#chatOverlay {
    position: fixed; inset: 0;
    background: var(--hc-overlay);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
#chatOverlay.open { opacity: 1; pointer-events: auto; }

/* ─── Bottom Sheet Container ─── */
#chatSheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 9999;
    background: var(--hc-bg);
    border-radius: 20px 20px 0 0;
    box-shadow: var(--hc-sheet-shadow);
    display: flex; flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), height 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    height: 85vh;
    max-height: 85vh;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
#chatSheet.open { transform: translateY(0); }

@media (min-width: 481px) {
    #chatSheet {
        left: auto; right: 24px; bottom: 0;
        width: 400px;
        max-width: calc(100vw - 48px);
        border-radius: 20px 20px 0 0;
    }
}

/* ─── Drag Handle ─── */
.hc-drag {
    padding: 10px 0 4px;
    display: flex; justify-content: center;
    cursor: grab; flex-shrink: 0;
}
.hc-drag-bar {
    width: 36px; height: 4px;
    background: var(--hc-slate-300);
    border-radius: 4px;
}
.hc-dark .hc-drag-bar { background: var(--hc-slate-600); }

/* ─── Chat Header ─── */
.hc-header {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 16px 12px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--hc-border);
}
.hc-header-av {
    width: 32px; height: 32px; border-radius: 50%;
    overflow: hidden; flex-shrink: 0;
}
.hc-header-av img { width: 100%; height: 100%; object-fit: cover; }
.hc-header-info { flex: 1; }
.hc-header-name { font-weight: 600; font-size: 17px; color: var(--hc-text); }
.hc-header-status {
    font-size: 15px; color: var(--hc-teal-500);
    display: flex; align-items: center; gap: 4px;
}
.hc-header-status::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: var(--hc-teal-500); display: inline-block;
}
.hc-header-btn {
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--hc-chip-bg); border: 1px solid var(--hc-border);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--hc-text2); transition: all 0.15s;
    font-size: 16px;
}
.hc-header-btn:hover { background: var(--hc-border); }

/* ─── Messages Area ─── */
.hc-messages {
    flex: 1; overflow-y: auto;
    padding: 12px 14px 6px;
    display: flex; flex-direction: column; gap: 14px;
    background: var(--hc-bg2);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.hc-messages::-webkit-scrollbar { width: 3px; }
.hc-messages::-webkit-scrollbar-thumb { background: var(--hc-slate-300); border-radius: 3px; }
.hc-dark .hc-messages::-webkit-scrollbar-thumb { background: var(--hc-slate-600); }

/* ─── Message Rows ─── */
.hc-msg-row { display: flex; gap: 8px; align-items: flex-start; max-width: 92%; animation: hcFadeUp 0.3s ease forwards; }
.hc-msg-row.user { align-self: flex-end; max-width: 80%; justify-content: flex-end; }
.hc-msg-av {
    width: 24px; height: 24px; border-radius: 50%;
    overflow: hidden; flex-shrink: 0; margin-top: 2px;
}
.hc-msg-av img { width: 100%; height: 100%; object-fit: cover; }
.hc-msg-body { flex: 1; min-width: 0; }

/* ─── Bubbles ─── */
.hc-bubble {
    padding: 10px 14px;
    font-size: 13.5px;
    line-height: 1.55;
    word-wrap: break-word;
}
.hc-bubble-agent {
    background: var(--hc-bg-agent);
    color: var(--hc-text-agent);
    border-radius: 4px 16px 16px 16px;
}
.hc-bubble-user {
    background: linear-gradient(135deg, var(--hc-teal-500), var(--hc-teal-700));
    color: var(--hc-text-user);
    border-radius: 16px 16px 4px 16px;
}

/* ─── Markdown in Agent Bubbles ─── */
.hc-bubble-agent .hc-md-h { font-size: 16px; font-weight: 700; color: var(--hc-teal-600); margin: 4px 0 8px; }
.hc-dark .hc-bubble-agent .hc-md-h { color: var(--hc-teal-500); }
.hc-bubble-agent .hc-md-li { padding-left: 14px; position: relative; margin: 2px 0; }
.hc-bubble-agent .hc-md-li::before { content: '•'; position: absolute; left: 2px; color: var(--hc-teal-500); font-weight: 700; }
.hc-bubble-agent .hc-md-hr { border: none; height: 1px; background: var(--hc-border); margin: 10px 0; }
.hc-bubble-agent .hc-md-gap { height: 6px; }

/* ─── Collapse Toggle ─── */
.hc-collapse-btn {
    display: flex; align-items: center; gap: 6px;
    background: var(--hc-bg-agent); border: 1px solid var(--hc-border);
    border-radius: 10px; padding: 5px 12px;
    font-size: 15px; font-weight: 600; color: var(--hc-teal-600);
    cursor: pointer; margin-bottom: 4px; font-family: inherit;
    transition: border-color 0.15s;
}
.hc-dark .hc-collapse-btn { color: var(--hc-teal-500); }
.hc-collapse-btn:hover { border-color: var(--hc-teal-500); }
.hc-collapse-arrow { transition: transform 0.2s; }
.hc-collapse-arrow.collapsed { transform: rotate(-90deg); }

/* ─── Message Actions (copy, print, share) ─── */
.hc-msg-actions {
    display: flex; gap: 2px; margin-top: 3px;
    opacity: 0; transition: opacity 0.15s;
}
.hc-msg-row:hover .hc-msg-actions { opacity: 1; }
@media (hover: none) { .hc-msg-actions { opacity: 1; } }
.hc-act-btn {
    width: 26px; height: 26px; border-radius: 7px;
    background: none; border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--hc-action-muted);
    transition: all 0.15s;
}
.hc-act-btn:hover { background: var(--hc-chip-bg); color: var(--hc-teal-600); }

/* ─── Typing Indicator ─── */
.hc-typing-dots {
    display: flex; gap: 4px; padding: 12px 16px;
    background: var(--hc-bg-agent);
    border-radius: 4px 16px 16px 16px;
    width: fit-content;
}
.hc-typing-dots span {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--hc-slate-400);
    animation: hcBounce 1.2s infinite;
}
.hc-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.hc-typing-dots span:nth-child(3) { animation-delay: 0.3s; }

/* ─── Quick Reply Chips ─── */
.hc-chips {
    display: flex; gap: 6px; padding: 6px 14px;
    overflow-x: auto; flex-shrink: 0;
    scrollbar-width: none; background: var(--hc-bg);
}
.hc-chips::-webkit-scrollbar { display: none; }
.hc-chip {
    flex-shrink: 0; padding: 7px 14px;
    border-radius: 20px;
    background: var(--hc-chip-bg);
    border: 1px solid var(--hc-border);
    color: var(--hc-chip-text);
    font-size: 15px; font-weight: 500;
    font-family: inherit; cursor: pointer;
    transition: all 0.15s; white-space: nowrap;
}
.hc-chip:hover, .hc-chip:active {
    border-color: var(--hc-teal-500);
    color: var(--hc-teal-600);
}
.hc-dark .hc-chip:hover { color: var(--hc-teal-500); }

/* ─── Voice-First Input Area ─── */
.hc-input-area {
    padding: 8px 12px 12px;
    flex-shrink: 0;
    background: var(--hc-bg);
    border-top: 1px solid var(--hc-border);
}
.hc-voice-center { display: flex; flex-direction: column; align-items: center; }
.hc-mic-btn {
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, var(--hc-teal-500), var(--hc-teal-700));
    border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #fff; flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(13, 148, 136, 0.35);
    transition: transform 0.15s;
}
.hc-mic-btn:active { transform: scale(0.93); }
.hc-mic-btn.listening { animation: hcPulseRing 1.5s infinite; }
.hc-mic-label { font-size: 15px; color: var(--hc-text2); text-align: center; margin-top: 4px; }
.hc-text-toggle {
    background: none; border: none;
    color: var(--hc-text2); font-size: 15px;
    cursor: pointer; font-family: inherit;
    padding: 4px 8px; border-radius: 8px;
}
.hc-text-toggle:hover { color: var(--hc-teal-600); }

/* ─── Text Input Mode ─── */
.hc-text-row { display: flex; gap: 8px; align-items: flex-end; }
.hc-text-field {
    flex: 1; padding: 10px 14px;
    border: 1.5px solid var(--hc-border);
    border-radius: 22px;
    background: var(--hc-bg);
    color: var(--hc-text);
    font-size: 16px; font-family: inherit;
    outline: none; transition: border-color 0.15s;
}
.hc-text-field::placeholder { color: var(--hc-text2); }
.hc-text-field:focus { border-color: var(--hc-teal-500); }
.hc-send-btn {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--hc-teal-500), var(--hc-teal-700));
    border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #fff; flex-shrink: 0;
    transition: transform 0.15s;
}
.hc-send-btn:active { transform: scale(0.92); }
.hc-send-btn:disabled { opacity: 0.4; cursor: default; }
.hc-back-voice {
    background: none; border: none;
    color: var(--hc-text2); font-size: 15px;
    cursor: pointer; font-family: inherit;
    padding: 2px 8px; margin-top: 2px;
}

/* ─── Pro Gate ─── */
.hc-pro-gate {
    display: none; position: absolute; inset: 0;
    background: rgba(255,255,255,0.95);
    z-index: 10;
    flex-direction: column; align-items: center;
    justify-content: center; padding: 32px;
    text-align: center;
}
.hc-dark .hc-pro-gate { background: rgba(15,23,42,0.95); }
.hc-pro-gate h3 { margin: 0 0 8px; color: #92750f; font-size: 20px; }
.hc-dark .hc-pro-gate h3 { color: var(--hc-gold-400); }
.hc-pro-gate p { margin: 0 0 20px; color: var(--hc-text2); font-size: 16px; line-height: 1.5; }
.hc-pro-gate-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--hc-teal-500), var(--hc-teal-700));
    color: white; border: none; border-radius: 10px;
    font-size: 16px; font-weight: 700; cursor: pointer;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

/* ─── Bottom Tab Bar ─── */
.hc-tab-bar {
    display: none; /* hidden until sheet is open */
    background: var(--hc-tab-bg);
    border-top: 1px solid var(--hc-border);
    flex-shrink: 0;
    padding: 4px 0 max(env(safe-area-inset-bottom, 8px), 8px);
}
#chatSheet.open .hc-tab-bar { display: flex; }
.hc-tab {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; gap: 2px;
    padding: 8px 0 0;
    background: none; border: none; cursor: pointer;
    color: var(--hc-tab-inactive);
    font-size: 14px; font-weight: 600;
    font-family: inherit; transition: color 0.15s;
}
.hc-tab.active { color: var(--hc-teal-600); }
.hc-dark .hc-tab.active { color: var(--hc-teal-500); }
.hc-tab-icon { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.hc-tab-dot {
    width: 4px; height: 4px; border-radius: 50%;
    background: var(--hc-teal-500);
    margin-top: 1px; opacity: 0; transition: opacity 0.15s;
}
.hc-tab.active .hc-tab-dot { opacity: 1; }

/* ─── Animations ─── */
@keyframes hcFadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes hcBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}
@keyframes hcPulseRing {
    0% { box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.5); }
    70% { box-shadow: 0 0 0 14px rgba(20, 184, 166, 0); }
    100% { box-shadow: 0 0 0 0 rgba(20, 184, 166, 0); }
}
@keyframes hcPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* ─── Mobile overrides ─── */
@media (max-width: 480px) {
    #chatFab { bottom: 16px; right: 16px; }
    #chatSheet { height: 92vh; max-height: 92vh; }
}

    </style>
