@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ======================================================
   TRADEGENIE DESIGN SYSTEM (Unified app.css)
   ====================================================== */

:root {
    /* Brand Colors */
    --tg-primary: #1e3a8a;
    --tg-primary-light: #3b82f6;
    --tg-accent: #4ade80;
    /* Vibrant Green from design */
    --tg-accent-hover: #22c55e;

    /* Neutral Colors */
    --tg-bg: #ffffff;
    --tg-bg-alt: #f8fafc;
    --tg-surface: #ffffff;
    --tg-text: #0f172a;
    --tg-text-muted: #64748b;
    --tg-border: #e2e8f0;

    /* Layout Constants */
    --tg-header-height: 80px;
    --tg-container-max: 1200px;
    --tg-radius: 16px;
    --tg-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Status Colors */
    --tg-success: #22c55e;
    --tg-warning: #f59e0b;
    --tg-danger: #ef4444;
    --tg-info: #3b82f6;

    /* Skeleton */
    --tg-skeleton-base: #e2e8f0;
    --tg-skeleton-shine: #f8fafc;
}

/* â”€â”€ Dark Mode â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
[data-theme="dark"] {
    --tg-bg: #0f172a;
    --tg-bg-alt: #1e293b;
    --tg-text: #f1f5f9;
    --tg-text-muted: #94a3b8;
    --tg-border: #334155;
    --tg-primary: #3b82f6;
    --tg-primary-light: #60a5fa;
    --tg-surface: #1e293b;
    --tg-skeleton-base: #1e293b;
    --tg-skeleton-shine: #2d3f55;
    --tg-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

/* Table headers must use explicit text color â€” browsers render th with their own dark-mode
   adjustments that ignore CSS custom properties unless overridden directly. */
[data-theme="dark"] th {
    color: #f1f5f9 !important;
}

/* â”€â”€ Skeleton Loading Shimmer â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@keyframes tg-shimmer {
    0% {
        background-position: -400px 0;
    }

    100% {
        background-position: 400px 0;
    }
}

.tg-skel {
    border-radius: 6px;
    background: linear-gradient(90deg,
            var(--tg-skeleton-base) 25%,
            var(--tg-skeleton-shine) 50%,
            var(--tg-skeleton-base) 75%);
    background-size: 800px 100%;
    animation: tg-shimmer 1.4s infinite linear;
}

.tg-skel-text {
    height: 14px;
    margin-bottom: 8px;
}

.tg-skel-title {
    height: 22px;
    margin-bottom: 10px;
    width: 55%;
}

.tg-skel-badge {
    height: 20px;
    width: 60px;
    border-radius: 20px;
    display: inline-block;
}

.tg-skel-card {
    border-radius: 16px;
    border: 1px solid var(--tg-border);
    padding: 1.25rem 1.5rem;
    margin-bottom: 0.75rem;
    background: var(--tg-bg-alt);
}

/* â”€â”€ Toast Notifications â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.tg-toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    pointer-events: none;
}

.tg-toast {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 260px;
    max-width: 380px;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    pointer-events: all;
    animation: tg-toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

@keyframes tg-toast-in {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.tg-toast-success {
    background: rgba(21, 128, 61, 0.92);
    color: #dcfce7;
    border-left: 4px solid #4ade80;
}

.tg-toast-error {
    background: rgba(153, 27, 27, 0.92);
    color: #fee2e2;
    border-left: 4px solid #f87171;
}

.tg-toast-warning {
    background: rgba(120, 53, 15, 0.92);
    color: #fef3c7;
    border-left: 4px solid #fbbf24;
}

.tg-toast-info {
    background: rgba(30, 58, 138, 0.92);
    color: #dbeafe;
    border-left: 4px solid #60a5fa;
}

.tg-toast-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.tg-toast-msg {
    flex: 1;
    line-height: 1.4;
}

.tg-toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    font-size: 0.8rem;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    transition: opacity 0.15s;
}

.tg-toast-close:hover {
    opacity: 1;
}


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

h1,
h2,
h3,
h4,
h5,
h6 {
    outline: none !important;
    border: none !important;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--tg-text);
    background-color: var(--tg-bg);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
}

/* Utilities */
.tg-container {
    max-width: var(--tg-container-max);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Dark/Light mode toggle button */
.tg-theme-toggle {
    background: none;
    border: 1px solid var(--tg-border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 1.05rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    color: var(--tg-text);
}

.tg-theme-toggle:hover {
    background: var(--tg-bg-alt);
    transform: scale(1.1);
}

.tg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: transform 0.2s, background 0.2s;
}

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



.tg-btn-secondary {
    background: var(--tg-surface);
    border: 1px solid var(--tg-border);
    color: var(--tg-text);
    padding: 0.6rem 1.25rem;
    font-weight: 600;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.tg-btn-secondary::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: var(--tg-bg-alt);
    transition: width 0.3s ease;
    z-index: -1;
}

.tg-btn-secondary:hover::after {
    width: 100%;
}

.tg-btn-secondary:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.tg-btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
    border: none;
    position: relative;
    overflow: hidden;
}

.tg-btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.tg-btn-primary:hover::before {
    left: 100%;
}

.tg-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.4);
}

.tg-btn-primary:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.tg-btn-danger-outline {
    background: transparent;
    border: 1px solid #fee2e2;
    color: var(--tg-danger);
    font-size: 0.85rem;
}

.tg-btn-danger-outline:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--tg-danger);
    color: var(--tg-danger);
}

.tg-btn-warning-outline {
    background: transparent;
    border: 1px solid #fde68a;
    color: #f59e0b;
    font-size: 0.85rem;
}

.tg-btn-warning-outline:hover {
    background: rgba(245, 158, 11, 0.1);
    border-color: #f59e0b;
    color: #f59e0b;
}

/* Global Layout */
.tg-header {
    height: var(--tg-header-height);
    background: transparent;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
}

.tg-header.scrolled {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    position: fixed;
    height: 70px;
}

.tg-header-inner {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 1rem;
}

.tg-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
}

.tg-nav-menu {
    display: flex;
    gap: 1.75rem;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.tg-nav-link {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    transition: color 0.3s ease;
}

.tg-nav-link:hover {
    color: var(--tg-accent);
}

/* Muted modifier for secondary/marketing links shown on app pages */
.tg-nav-link-muted {
    opacity: 0.5;
    font-size: 0.82rem;
    font-weight: 400;
}

.tg-nav-link-muted:hover {
    opacity: 1;
    color: var(--tg-accent);
}

.tg-nav-divider {
    display: inline-block;
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.25);
    margin: 0 0.5rem;
    vertical-align: middle;
}

/* â”€â”€ Nav Dropdown â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.tg-nav-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Reset button so it looks identical to an <a class="tg-nav-link"> */
.tg-nav-dropbtn {
    background: none;
    border: none;
    margin: 0;
    padding: 0;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    font-weight: 500;
    line-height: inherit;
    color: rgba(255, 255, 255, 0.9);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.3s ease;
}

.tg-nav-dropbtn:hover {
    color: var(--tg-accent);
}

.tg-nav-caret {
    font-size: 0.65rem;
    opacity: 0.7;
    display: inline-block;
    transition: transform 0.2s ease;
}

.tg-nav-dropdown:hover .tg-nav-caret {
    transform: rotate(180deg);
}

/* Hidden by default â€” use visibility so the element stays in layout
   but is invisible, which is more reliable than display:none in flex */
.tg-nav-dropdown-menu {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: calc(100% + 4px);
    /* small visual gap */
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    min-width: 170px;
    padding: 0.4rem 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    /* fade-in fast, fade-out with a short delay so the mouse has
       time to cross the gap between button and panel */
    transition: opacity 0.15s ease 0s, visibility 0.15s ease 0s;
}

/* Invisible bridge between button bottom edge and the menu top â€”
   fills the gap so the mouse never leaves the hover zone */
.tg-nav-dropdown-menu::before {
    content: '';
    position: absolute;
    bottom: 100%;
    /* above the menu */
    left: 0;
    right: 0;
    height: 16px;
    /* covers the 4px gap + a bit extra */
}

.tg-nav-dropdown:hover .tg-nav-dropdown-menu,
.tg-nav-dropdown:focus-within .tg-nav-dropdown-menu {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0s;
    /* show instantly */
}

/* Delay the hide so mouse can travel across the gap */
.tg-nav-dropdown-menu {
    transition-delay: 80ms;
}

.tg-nav-dropdown-item {
    display: block;
    padding: 0.55rem 1.1rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.tg-nav-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--tg-accent);
}

/* Hero Section */
.tg-hero {
    position: relative;
    background-image:
        linear-gradient(135deg,
            rgba(6, 30, 72, 0.95) 0%,
            rgba(30, 58, 138, 0.85) 50%,
            rgba(6, 30, 72, 0.7) 100%),
        url("/images/hero-bg.png");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: white;
    overflow: hidden;
    /* padding-top: var(--tg-header-height);*/
}

.tg-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 0%, rgba(6, 30, 72, 0.4) 100%);
    pointer-events: none;
}

img {
    max-width: 100%;
    height: auto;
}

.tg-hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    align-items: center;
}

@media (min-width: 900px) {
    .tg-hero-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.tg-hero-content {
    max-width: 650px;
    position: relative;
    z-index: 2;
    animation: fadeInUp 0.8s ease-out forwards;
}

.tg-hero h1 {
    font-size: 3rem;
    font-weight: 400;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
    outline: none;
    border: none;
    background: linear-gradient(135deg, #ffffff 0%, #e0f2fe 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 40px rgba(59, 130, 246, 0.4);
}

.tg-hero p {
    font-size: 1.5rem;
    opacity: 0.9;
    margin-bottom: 3rem;
    font-weight: 400;
    max-width: 500px;
}

.tg-trust-badges {
    margin-top: 3rem;
}

.tg-trust-badges p {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
    opacity: 0.7;
    position: relative;
    display: inline-block;
}

.tg-trust-badges p::before,
.tg-trust-badges p::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40px;
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
}

.tg-trust-badges p::before {
    left: -50px;
}

.tg-trust-badges p::after {
    right: -50px;
}

.tg-brand-logos {
    display: flex;
    gap: 2rem;
    align-items: center;
    opacity: 0.8;
}

/* Feature Cards */
.tg-features {
    padding: 5rem 0;
    margin-top: -8rem;
    position: relative;
    z-index: 10;
}

.tg-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.tg-feature-card {
    background: var(--tg-surface);
    padding: 2.5rem;
    border-radius: var(--tg-radius);
    box-shadow: var(--tg-shadow);
    text-align: center;
    transition: transform 0.3s ease;
}

.tg-feature-card:hover {
    transform: translateY(-10px);
}

.tg-feature-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Why Choose Section */
.tg-why-section {
    /* padding: 5rem 0;*/
    text-align: center;
}

.tg-section-title {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 4rem;
    position: relative;
    display: inline-block;
    color: #1e3a8a;
}

.tg-section-title::before,
.tg-section-title::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 100px;
    height: 2px;
    background: var(--tg-border);
}

.tg-section-title::before {
    left: -120px;
}

.tg-section-title::after {
    right: -120px;
}

/* On mobile, suppress the decorative side-lines so they don't overflow */
@media (max-width: 768px) {
    .tg-section-title::before,
    .tg-section-title::after {
        display: none;
    }
}

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

.tg-why-item h3 {
    margin: 1rem 0;
    font-size: 1.25rem;
}

.tg-why-item p {
    color: var(--tg-text-muted);
    font-size: 0.95rem;
}

/* CTA Footer Section */
.tg-final-cta {
    padding: 6rem 0;
    background: var(--tg-bg-alt);
    text-align: center;
}

.tg-final-cta h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--tg-primary);
    margin-bottom: 1rem;
}

.tg-final-cta p {
    color: var(--tg-text-muted);
    margin-bottom: 2rem;
}

/* Footer */
.tg-footer {
    background: #0f172a;
    color: rgba(255, 255, 255, 0.6);
    padding: 2rem 0;
    text-align: center;
    font-size: 0.875rem;
}

@keyframes glowUpdate {
    0% {
        background-color: rgba(59, 130, 246, 0.08);
        box-shadow: inset 4px 0 0 var(--tg-primary-light);
    }

    100% {
        background-color: transparent;
        box-shadow: inset 0 0 0 transparent;
    }
}

.tg-row-updated td {
    animation: glowUpdate 4s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
}

/* App Styles (Internal Pages) */
.tg-internal-layout {
    background-color: var(--tg-bg-alt);
    min-height: 100vh;
}

.tg-internal-header {
    background: #0f172a;
    position: relative;
    height: 70px;
    overflow: visible;
    /* allow dropdown panel to extend below the header */
    z-index: 100;
}

.tg-page-content {
    padding: 3rem 0;
}



.tg-app-card {
    background: var(--tg-surface);
    border-radius: var(--tg-radius);
    border: 1px solid var(--tg-border);
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* HERO: 2-column layout */
.tg-hero-grid {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 3rem;
    align-items: start;
    padding: 6rem 0 8rem;
    min-height: 600px;
    overflow: hidden;
}

.tg-hero-cta {
    padding: 1rem 2rem;
    font-size: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Right mockup */
.tg-hero-mockup {
    display: flex;
    justify-content: flex-end;
    position: relative;
    animation: fadeInRight 1s ease-out 0.2s forwards;
    opacity: 0;
}

.tg-hero-mockup-img {
    max-width: 100%;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.2));
    transform: perspective(1000px) rotateY(-5deg) rotateX(1deg);
    border: none;
    outline: none;
    transition: transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
    opacity: 1;
}

.tg-hero-mockup-img:hover {
    transform: perspective(1000px) rotateY(0deg) rotateX(0deg) scale(1.02);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive */
/* ── Mobile Navigation ─────────────────────────────────────────────────────── */
.tg-mobile-menu-btn {
    display: none; /* Desktop hidden */
    background: none;
    border: none;
    color: #f1f5f9;
    font-size: 1.7rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.2rem;
    margin-left: auto;
}

.tg-mobile-nav-panel {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--tg-border);
    padding: 1.5rem 1.5rem 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    z-index: 99;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.7);
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.tg-mobile-nav-panel .tg-nav-link,
.tg-mobile-nav-panel .tg-nav-link-muted {
    font-size: 1.1rem;
    width: 100%;
    text-align: left;
    display: block;
    opacity: 1;
}

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

@media (max-width: 968px) {

    .tg-card-grid,
    .tg-why-grid {
        grid-template-columns: 1fr;
    }

    .tg-hero-grid {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 4rem 0 6rem;
        gap: 2rem;
    }

    .tg-hero-content {
        margin: 0 auto;
    }

    .tg-hero-mockup {
        justify-content: center;
    }

    .tg-hero-mockup-img {
        width: 100%;
        max-width: 500px;
        transform: none !important;
    }

    .tg-hero h1 {
        font-size: 2.5rem;
    }

    .tg-hero p {
        margin-left: auto;
        margin-right: auto;
        font-size: 1.125rem;
    }

    .tg-nav-menu {
        display: none;
    }
    
    .tg-mobile-menu-btn {
        display: block;
    }
    
    .tg-header-actions {
        display: none; /* Move to mobile menu */
    }

    .tg-hero-cta, .tg-btn-outline {
        width: 100%;
    }

    .tg-table thead th,
    .tg-table tbody td {
        padding: 0.75rem 1rem;
    }

    .tg-summary {
        min-width: 200px;
    }
}

/* ======================================================
   WATCHLIST & APP COMPONENTS
   ====================================================== */

.tg-muted {
    color: var(--tg-text-muted);
    font-size: 0.9rem;
}

/* Cards */
.tg-card {
    background: var(--tg-bg-alt);
    /* Slightly off-white background for contrast with rows */
    border-radius: var(--tg-radius);
    border: none;
    box-shadow: none;
    /* Removed outer shadow as rows have shadows now */
    padding: 1rem 0 2rem;
    overflow: visible;
    /* Allow row transforms to pop out */
    margin-bottom: 2rem;
}

/* Inputs & Controls */
.tg-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
    background: var(--tg-surface, rgba(255, 255, 255, 0.06));
    backdrop-filter: blur(12px);
    padding: 1.5rem;
    border-radius: var(--tg-radius);
    border: 1px solid var(--tg-border, rgba(255, 255, 255, 0.12));
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
}

.tg-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.tg-input {
    padding: 0.75rem 1rem;
    height: 48px;
    /* Fixed height to prevent clipping */
    border: 1px solid var(--tg-border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 260px;
    background: var(--tg-surface);
    color: var(--tg-text);
}

@media (max-width: 768px) {
    .tg-page-header {
        text-align: center;
        margin-bottom: 2rem;
    }

    .tg-controls {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        margin: 0 auto;
    }

    .tg-input {
        width: 100% !important;
        min-width: 0 !important;
    }

    .tg-controls>button {
        width: 100%;
    }

    .tg-controls>div {
        display: none;
        /* Hide the separator line on mobile */
    }

    /* Status Bar Fix */
    .tg-status-bar {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
        text-align: center;
    }

    /* Table to Cards Transformation */
    .tg-table-responsive {
        overflow: visible !important;
    }

    .tg-table, .tg-table tbody, .tg-table tfoot {
        display: block;
        min-width: 0 !important;
        width: 100% !important;
    }

    .tg-table thead {
        display: none;
    }

    .tg-table tbody tr {
        display: block;
        background: var(--tg-surface);
        border-radius: 12px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
        margin-bottom: 1.5rem;
        border: 1px solid var(--tg-border);
    }

    .tg-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 1rem;
        border: none;
        border-bottom: 1px solid var(--tg-border-light);
        text-align: right;
        /* Values align right */
    }

    .tg-table td:last-child {
        border-bottom: none;
        justify-content: flex-end;
    }

    /* Labels */
    .tg-table td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.85rem;
        color: var(--tg-text-muted);
        text-transform: uppercase;
        margin-right: 1rem;
        text-align: left;
    }

    .tg-table td[data-label="Summary"] {
        display: block;
        text-align: left;
    }

    .tg-table td[data-label="Summary"]::before {
        display: block;
        margin-bottom: 0.25rem;
    }
}

/* ── Extra-narrow phone (≤576px) fixes ──────────────────────────────────────── */
@media (max-width: 576px) {

    /* Prevent hero section from creating horizontal scroll */
    .tg-hero {
        overflow: hidden;
    }

    /* Hero buttons stack and fill width */
    .tg-hero-content > div[style] {
        flex-direction: column !important;
    }
    .tg-hero-cta,
    .tg-hero-content .tg-btn {
        width: 100% !important;
        text-align: center;
        justify-content: center;
    }

    /* Hero mockup: hide on very small screens to give text room */
    .tg-hero-mockup {
        display: none;
    }

    /* Hero grid: minimal padding on tiny screens */
    .tg-hero-grid {
        padding: 5rem 0 4rem;
    }

    /* Section titles: smaller font, no pseudo lines */
    .tg-section-title {
        font-size: 1.75rem;
        margin-bottom: 2rem;
    }
    .tg-section-title::before,
    .tg-section-title::after {
        display: none;
    }

    /* How It Works steps: force 1-col from minmax */
    div[style*="minmax(260px"] {
        grid-template-columns: 1fr !important;
    }

    /* Gem preview cards: prevent 3-column stat grid overflowing */
    div[style*="minmax(280px"] {
        grid-template-columns: 1fr !important;
    }

    /* Gem card inner 3-col stat row: wrap to 2 then 1 cols */
    div[style*="1fr 1fr 1fr"] {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Pricing tier row: stack vertically */
    div[style*="justify-content: center"] > div[style*="text-align: center"],
    .tg-pricing-tier {
        min-width: 0 !important;
    }
    div[style*="display: flex"][style*="justify-content: center"][style*="flex-wrap: wrap"] {
        flex-direction: column !important;
        align-items: center !important;
    }

    /* Feature cards grid: 1 col */
    .tg-card-grid {
        grid-template-columns: 1fr !important;
    }

    /* Header: ensure logo doesn't clip */
    .tg-header-inner {
        gap: 0.5rem;
        padding: 0 1rem;
    }
    .tg-logo span {
        font-size: 1rem;
    }

    /* Ensure no child element creates horizontal scroll */
    .tg-container {
        padding: 0 1rem;
        overflow: hidden;
    }
}

.tg-input:focus {
    background: var(--tg-surface);
    border-color: var(--tg-primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}

.tg-btn-secondary {
    background: var(--tg-surface);
    border: 1px solid var(--tg-border);
    color: var(--tg-text);
    padding: 0.6rem 1.25rem;
    font-weight: 600;
}

.tg-btn-secondary:hover {
    background: var(--tg-bg-alt);
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.tg-btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.tg-btn-danger-outline {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--tg-danger);
}

.tg-btn-danger-outline:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--tg-danger);
}

/* Enhanced Tables */
.tg-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 6px;
    /* Row spacing for card effect */
    margin-bottom: 0;
    padding: 0 1rem;
}

.tg-table thead th {
    background: transparent;
    color: var(--tg-text-muted);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.6rem 1rem;
    border: none;
    text-align: left;
    white-space: nowrap;
}

.tg-table tbody td {
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--tg-border);
    border-bottom: 1px solid var(--tg-border);
    font-size: 0.9rem;
    color: var(--tg-text);
    vertical-align: middle;
    background: var(--tg-surface);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.tg-table tbody tr td:first-child {
    border-left: 1px solid var(--tg-border);
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.tg-table tbody tr td:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.tg-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

/* Fancy Row Styles */
.tg-row {
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tg-row-clickable {
    cursor: pointer;
}

.tg-row:hover {
    transform: translateY(-2px);
    z-index: 10;
    position: relative;
}

.tg-row:hover td {
    border-color: #cbd5e1;
    background: var(--tg-surface);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Strong Signal Highlight */
.tg-row-highlight td {
    background: linear-gradient(90deg, rgba(34,197,94,0.08) 0%, var(--tg-surface) 100%);
    border-color: #bbf7d0;
}

.tg-row-highlight:hover td {
    background: linear-gradient(90deg, rgba(34,197,94,0.15) 0%, var(--tg-surface) 100%) !important;
    border-color: #86efac;
}

.tg-row-highlight td:first-child {
    box-shadow: inset 6px 0 0 var(--tg-success);
}

.tg-table tbody tr:last-child td {
    border-bottom: none;
}

.tg-table tbody tr:hover {
    background-color: var(--tg-bg-alt);
}

/* Badges */
.tg-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0.02em;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.tg-bullish {
    background: #dcfce7;
    color: #166534;
}

.tg-bearish {
    background: #fee2e2;
    color: #991b1b;
}

.tg-neutral {
    background: #f1f5f9;
    color: #475569;
}

.tg-strength {
    background: #e0f2fe;
    color: #075985;
}

.tg-weak {
    background: #fff7ed;
    color: #9a3412;
}

.tg-secondary-metric {
    font-size: 0.85rem;
    color: var(--tg-text-muted);
    font-weight: 500;
}

/* Progress */
.tg-progress {
    height: 6px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
    flex-grow: 1;
}

.tg-progress-bar {
    height: 100%;
    border-radius: 99px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.tg-summary {
    min-width: 250px;
    line-height: 1.4;
    font-size: 0.9rem;
    color: var(--tg-text-muted);
}

/* â”€â”€ Analyst consensus bar (Analysis page) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.an-analyst-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    background: var(--tg-bg-alt);
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: 0.83rem;
}

.an-analyst-label {
    font-weight: 600;
    color: var(--tg-text-muted);
    margin-right: 0.25rem;
}

.an-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.22rem 0.7rem;
    border-radius: 99px;
    font-weight: 700;
    font-size: 0.8rem;
}

.an-buy {
    background: rgba(16, 185, 129, 0.12);
    color: var(--tg-success);
}

.an-hold {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

.an-sell {
    background: rgba(239, 68, 68, 0.12);
    color: var(--tg-danger);
}

.an-analyst-target {
    margin-left: auto;
    font-size: 0.83rem;
    color: var(--tg-text);
}

.an-upside-pos {
    color: var(--tg-success);
    font-weight: 700;
}

.an-upside-neg {
    color: var(--tg-danger);
    font-weight: 700;
}

/* â”€â”€ 52-Week Range bar (Watchlist table) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.wl-range-bar {
    min-width: 100px;
}

.wl-range-track {
    position: relative;
    height: 5px;
    background: var(--tg-border);
    border-radius: 99px;
    margin-bottom: 3px;
}

.wl-range-fill {
    position: absolute;
    height: 100%;
    background: var(--tg-primary);
    border-radius: 99px;
    transition: width 0.4s ease;
}

.wl-range-dot {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--tg-primary);
    border: 2px solid var(--tg-bg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.wl-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--tg-text-muted);
}

/* â”€â”€ Live price cells (shared: Gems + Watchlist) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.gem-price-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
}

.gem-price-val {
    font-family: monospace;
    font-weight: 700;
    font-size: 0.95rem;
}

.gem-change-pill {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 99px;
}

.gem-change-up {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.gem-change-dn {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* â”€â”€ Sparkline charts (Gap 2) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.tg-sparkline {
    display: inline-block;
    vertical-align: middle;
}

.tg-sparkline polyline {
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tg-spark-up {
    stroke: #10b981;
}

.tg-spark-dn {
    stroke: #ef4444;
}

.tg-spark-bg {
    fill: rgba(99, 102, 241, 0.04);
    stroke: none;
}