/* Design Tokens — Tailwind-style app palette */
:root {
    /* Tailwind-like semantic tokens */
    --background:        #00D059;
    --foreground:        #111111;
    --card:              #F8FF1A;
    --card-foreground:   #111111;
    --popover:           #FFFFFF;
    --popover-foreground:#111111;
    --primary:           #FF4D8D;
    --primary-foreground:#FFFFFF;
    --secondary:         #F8FF1A;
    --secondary-foreground:#111111;
    --muted:             #F3F4F6;
    --muted-foreground:  #334155;
    --accent:            #FF4D8D;
    --accent-foreground: #111111;
    --destructive:       #FF4D8D;
    --destructive-foreground:#FFFFFF;
    --border:            #111111;
    --input:             #111111;
    --ring:              #FF4D8D;

    /* Surfaces and legacy aliases */
    --surface:        #FFFFFF;
    --surface-2:      #F8FF1A;
    --surface-dark:   #111111;
    --brand-bg:       var(--background);
    --bg-dark:        var(--background);
    --glass-bg:       var(--surface);
    --glass-border:   var(--border);
    --glass-highlight:#111111;

    /* App accents */
    --accent-light:   #F8FF1A;
    --accent-cta:     var(--primary);
    --highlight:      var(--primary);
    --danger:         var(--primary);
    --positive:       #22C55E;

    /* Legacy neon aliases — kept so existing references don't break */
    --neon-cyan:      var(--accent);
    --neon-purple:    var(--primary);
    --neon-green:     #00C853;
    --neon-orange:    var(--primary);
    --neon-pink:      var(--primary);

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Space Grotesk', var(--font-sans);
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;

    /* Text */
    --text-main:  var(--foreground);
    --text-muted: #334155;

    /* Spacing scale */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-12: 48px;

    /* Radius */
    --radius-sm:   8px;
    --radius-md:   12px;
    --radius-lg:   16px;
    --radius-pill: 999px;

    /* Shadows — soft elevation, not hard comic drop */
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md:   0 4px 12px rgba(0,0,0,0.10);
    --shadow-lg:   0 8px 24px rgba(0,0,0,0.12);

    /* Keep comic shadow as an explicit opt-in token */
    --shadow-comic: 4px 4px 0px #000;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-sans);
}

/* Global touch target floor */
button, [role="button"], input[type="submit"], select {
    min-height: 44px;
}

select {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

h1, h2, h3, h4, .logo h2 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.4px;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    width: 100%;
    min-height: 100dvh;
    height: auto;
}

/* Comic Panel Utilities */
.glass-panel {
    background: var(--glass-bg);
    border: 3px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 6px 6px 0px var(--glass-border); /* Hard solid comic drop shadow */
}

/* Sidebar */
.sidebar {
    width: 280px;
    height: 100%;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    background: #111;
    border-right: 3px solid var(--glass-border);
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
}

.logo h2 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: #fff;
    font-family: var(--font-display);
}

.neon-text {
    color: var(--accent);
    font-size: 1.8rem;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 12px 20px;
    border-radius: 50px;
    cursor: pointer;
    color: #aab7b8;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    font-family: var(--font-display);
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item:hover {
    color: #fff;
    transform: translateX(5px);
}

.nav-item.active {
    background: var(--secondary);
    border: 3px solid #000;
    color: #000;
    font-weight: 800;
    box-shadow: 4px 4px 0px #000;
}

/* Main Content Area */
.content-area {
    flex: 1;
    padding: 2rem 2.5rem;
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 24px;
    min-width: 0;
    width: 100%;
    background: var(--background);
}

.content-area > .tab-content {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    min-width: 0;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.desktop-header {
    padding: 1rem 1.5rem;
    background: #111;
    border-color: var(--glass-border);
    gap: 2rem;
}

.header-logo {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-logo h2 {
    color: #fff;
    margin: 0;
    font-size: 1.5rem;
}

.desktop-nav-links {
    flex-direction: row;
    align-items: center;
    margin: 0;
    padding: 0;
    gap: 1rem;
}

.desktop-nav-links .nav-item {
    border-radius: 50px;
    padding: 8px 16px;
}

.desktop-nav-links .nav-item:hover {
    transform: translateY(-3px);
}

.top-bar h1 {
    font-size: 2.2rem;
    font-weight: 800;
    font-family: var(--font-display);
    letter-spacing: -1px;
}

.pulse-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--surface);
    background: var(--accent);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid #111;
}

/* ── Bento Grid Layout ── */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
}

.bento-item {
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.cache-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 20px;
    border: 2px solid var(--border);
    box-shadow: 2px 2px 0 var(--border);
    font-family: var(--font-display);
}
.cache-badge.hit {
    background-color: var(--secondary);
    color: var(--surface-dark);
}
.cache-badge.miss {
    background-color: var(--accent);
    color: var(--surface);
}


.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--neon-green);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--neon-green);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 200, 83, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(0, 200, 83, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 200, 83, 0); }
}

/* Tabs */
.tab-content {
    display: none;
    padding: 1.5rem 2rem;
    border-radius: 20px;
    animation: fadeIn 0.5s ease-out forwards;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.tab-content h2 {
    margin-bottom: 2rem;
    display: block;
    color: var(--neon-cyan);
}

.tab-content h2 i {
    display: inline-block;
    vertical-align: middle;
    margin-right: 12px;
    font-size: 0.9em;
}

/* Grid for Pillars */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 16px;
    transition: all 0.3s ease;
    cursor: default;
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 0.6s ease-out forwards;
    animation-delay: calc(var(--animation-order) * 0.1s);
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--glass-highlight);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.card-icon {
    font-size: 2rem;
    color: var(--neon-purple);
    margin-bottom: 1rem;
}

.special-card {
    border-color: rgba(255, 0, 122, 0.3);
}
.special-card .card-icon {
    color: var(--neon-pink);
}
.special-card:hover {
    box-shadow: 0 0 20px rgba(255, 0, 122, 0.2);
    border-color: var(--neon-pink);
}

.card h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.card p {
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Timeline for Gates */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 2px;
    background: rgba(255, 255, 255, 0.1);
}

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
    padding-left: 2rem;
    opacity: 0;
    transform: translateX(-20px);
    animation: slideRight 0.5s ease-out forwards;
    animation-delay: calc(var(--animation-order) * 0.15s);
}

.timeline-marker {
    position: absolute;
    left: -25px;
    top: 5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-dark);
    border: 2px solid;
    z-index: 2;
}

.green-glow { border-color: var(--neon-green); box-shadow: 0 0 10px var(--neon-green); }
.blue-glow { border-color: var(--accent); box-shadow: 0 0 10px var(--accent); }
.purple-glow { border-color: var(--secondary); box-shadow: 0 0 10px var(--secondary); }
.orange-glow { border-color: var(--accent); box-shadow: 0 0 10px var(--accent); }
.cyan-glow { border-color: var(--secondary); box-shadow: 0 0 15px var(--secondary); }

.timeline-content {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.timeline-content:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(5px);
}

.timeline-content h3 {
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.timeline-content p {
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Status Grid */
.status-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.status-widget {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 12px;
}

.status-widget h4 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s ease-in-out;
}

.status-widget span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.action-btn {
    background: linear-gradient(45deg, var(--neon-cyan), #0077ff);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.4);
    display: inline-block;
    margin-top: 1rem;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(0, 229, 255, 0.6);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideRight {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Analysis & Actions Specific Styles */
.analysis-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.summary-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.2rem;
}

.summary-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 1.2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
    animation: slideUp 0.5s ease-out forwards;
}

.summary-card:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-3px);
}

.summary-icon {
    font-size: 1.6rem;
}

.summary-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.3rem;
}

.summary-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.search-bar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.search-box {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    transition: border-color 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(255, 77, 141, 0.18);
}

.search-box i {
    color: var(--text-muted);
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    width: 100%;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.stock-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

.data-table th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

.data-table th:hover {
    color: var(--accent);
}

.data-table th i {
    font-size: 0.7rem;
    margin-left: 0.3rem;
    opacity: 0.5;
}

.insights-panel {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.insight-card {
    background: linear-gradient(135deg, rgba(248, 255, 26, 0.35), rgba(255, 77, 141, 0.14));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.1);
    animation: fadeIn 0.8s ease-out forwards;
}

.insight-card i {
    font-size: 2.5rem;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(255, 77, 141, 0.25);
}

.insight-details h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    color: var(--text-main);
}

.insight-details p {
    font-size: 1.1rem;
    color: var(--accent);
    font-weight: 600;
}

.table-container {
    padding: 0;
    overflow: hidden;
    border-radius: 16px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 1.2rem;
    border-bottom: 1px solid var(--glass-border);
}

.data-table th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.data-table td {
    color: var(--text-main);
    font-size: 0.95rem;
}

.highlight-row {
    background: rgba(0, 229, 255, 0.05) !important;
    border-left: 3px solid var(--neon-cyan) !important;
}

.highlight-val {
    color: var(--neon-cyan);
    font-weight: 600;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1rem;
}

.page-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled) {
    background: rgba(0, 229, 255, 0.1);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

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

/* Deep Analysis Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(10, 11, 20, 0.8);

    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: rgba(20, 22, 35, 0.9);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.3rem;
}

.modal-header p {
    font-size: 1.1rem;
    font-weight: 500;
}

.close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-size: 1.2rem;
    width: 40px; height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 0, 85, 0.1);
    color: #ff0055;
    border-color: #ff0055;
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.analysis-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.2rem;
}

.analysis-section h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.metric-box {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.metric-box .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.metric-box .val {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.metric-box .stats-grid p {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--neon-purple);
}

/* Beautiful Pandas Tables for Wasm Output */
.styled-table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 20px;
    font-size: 1rem;
    font-family: var(--font-sans);
    border: 3px solid #000;
    box-shadow: 4px 4px 0px #000;
    background-color: #fff;
}

.styled-table thead tr {
    background-color: #C6FF00;
    color: #000;
    text-align: left;
    font-weight: 800;
    border-bottom: 3px solid #000;
}

.styled-table th,
.styled-table td {
    padding: 12px 15px;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
    color: #000;
    font-weight: 600;
}

.styled-table tbody tr:nth-of-type(even) {
    background-color: #f3f3f3;
}

.metric-box .val.positive {
    color: var(--neon-green);
}

.metric-box .val.negative {
    color: #ff4444;
}

.modal-footer {
    padding: 1.2rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
}

#fundamentals-table-body tr {
    cursor: pointer;
}

#fundamentals-table-body tr:hover td {
    background: rgba(0, 229, 255, 0.05);
}

/* ── Market Intelligence Panels ── */
.intel-section {
    animation: fadeSlideUp 0.5s ease forwards;
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Validation Score Card */
.validation-score-display {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.score-ring {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 800;
    flex-shrink: 0;
}

.score-ring.green { background: rgba(0,255,136,0.15); border: 3px solid #00ff88; color: #00ff88; }
.score-ring.orange { background: rgba(255,170,0,0.15); border: 3px solid #ffaa00; color: #ffaa00; }
.score-ring.red { background: rgba(255,68,68,0.15); border: 3px solid #ff4444; color: #ff4444; }

.score-details {
    flex: 1;
}

.score-details .action-label {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.score-details .gate-list {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.score-details .gate-list span {
    display: block;
}

/* Sentiment Box */
.sentiment-box {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem;
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
}

.sentiment-badge {
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.sentiment-badge.bullish { background: rgba(0,255,136,0.2); color: #00ff88; border: 1px solid #00ff8855; }
.sentiment-badge.bearish { background: rgba(255,68,68,0.2); color: #ff4444; border: 1px solid #ff444455; }
.sentiment-badge.neutral { background: rgba(255,170,0,0.2); color: #ffaa00; border: 1px solid #ffaa0055; }

.sentiment-stats {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Pros & Cons Grid */
.proscons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.pros-col, .cons-col {
    padding: 1rem;
    border-radius: 10px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border);
}

.pros-col h4, .cons-col h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
}

.pros-col h4 { color: #00ff88; }
.cons-col h4 { color: #ff4444; }

.pros-col li, .cons-col li {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    line-height: 1.4;
    list-style: none;
    padding-left: 0.8rem;
    position: relative;
}

.pros-col li::before { content: '✓'; position: absolute; left: 0; color: #00ff88; }
.cons-col li::before { content: '✗'; position: absolute; left: 0; color: #ff4444; }

/* News Feed */
.news-feed {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.news-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    border-radius: 8px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border);
    transition: all 0.2s;
}

.news-item:hover {
    background: rgba(0, 229, 255, 0.05);
    border-color: rgba(0, 229, 255, 0.2);
}

.news-item a {
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.82rem;
    line-height: 1.4;
    flex: 1;
}

.news-item a:hover { color: var(--neon-cyan); }

.news-item .news-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    text-align: right;
    min-width: 80px;
}

.news-item .sentiment-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
    flex-shrink: 0;
    margin-top: 5px;
}

.sentiment-dot.positive { background: #00ff88; }
.sentiment-dot.negative { background: #ff4444; }
.sentiment-dot.neutral { background: #ffaa00; }

/* ── Institutional Quant Grid ── */
.quant-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.quant-grid .metric-box {
    padding: 0.8rem;
    border-radius: 8px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.quant-grid .metric-box .label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quant-grid .metric-box .val {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

.quant-grid .metric-box .val.positive { color: #00ff88; }
.quant-grid .metric-box .val.negative { color: #ff4444; }

/* Steamroller Warning Banner */
.steamroller-banner {
    background: linear-gradient(90deg, rgba(255,170,0,0.15), rgba(255,68,68,0.15));
    border: 1px solid #ff444455;
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-top: 0.5rem;
    animation: steamrollerPulse 2s infinite ease-in-out;
}

.steamroller-banner i {
    font-size: 2rem;
    color: #ffaa00;
}

.steamroller-banner strong {
    color: #ff4444;
    display: block;
    margin-bottom: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.steamroller-banner p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0;
}

@keyframes steamrollerPulse {
    0% { border-color: #ff444455; box-shadow: 0 0 5px rgba(255,68,68,0.1); }
    50% { border-color: #ff4444aa; box-shadow: 0 0 15px rgba(255,68,68,0.3); }
    100% { border-color: #ff444455; box-shadow: 0 0 5px rgba(255,68,68,0.1); }
}

/* ── AWS Premium Knowledge Base Aesthetic ── */
.aws-tab-panel {
    background-color: #0f111a;
    border: none;
    padding: 0;
    box-shadow: none;
}

.aws-header-area {
    padding: 30px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
}

.aws-header-title h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #f1f2f3;
    margin-bottom: 5px;
}

.aws-header-title p {
    color: #aab7b8;
    font-size: 0.95rem;
}

.aws-header-actions {
    display: flex;
    gap: 12px;
}

.aws-btn-secondary {
    background: transparent;
    border: 1px solid #545b64;
    color: #eaeded;
    padding: 8px 16px;
    border-radius: 18px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.aws-btn-secondary:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.05);
    border-color: #d5dbdb;
}

.aws-btn-secondary.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.aws-btn-primary {
    background: #ff9900;
    border: 1px solid #ff9900;
    color: #0f111a;
    padding: 8px 20px;
    border-radius: 18px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.aws-btn-primary:hover {
    background: #ec8c00;
}

.aws-table-container {
    background-color: #16191f;
    border-top: 1px solid #333942;
    min-height: 500px;
}

.aws-table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 40px;
    border-bottom: 1px solid #333942;
}

.aws-search-wrapper {
    position: relative;
    width: 400px;
}

.aws-search-wrapper i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #aab7b8;
    font-size: 0.9rem;
}

.aws-search-wrapper input {
    width: 100%;
    background: transparent;
    border: 1px solid #545b64;
    border-radius: 20px;
    padding: 8px 15px 8px 40px;
    color: #eaeded;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.aws-search-wrapper input:focus {
    border-color: #00a1c9;
}

.aws-pagination span {
    color: #eaeded;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
}

.aws-data-table {
    width: 100%;
    border-collapse: collapse;
}

.aws-data-table th, .aws-data-table td {
    padding: 12px 40px;
    text-align: left;
    border-bottom: 1px solid #282d33;
}

.aws-data-table th {
    color: #aab7b8;
    font-size: 0.85rem;
    font-weight: 600;
    border-bottom: 2px solid #333942;
}

.aws-sort-icon {
    font-size: 0.7rem;
    margin-left: 5px;
    color: #666;
}

.aws-data-table td {
    color: #eaeded;
    font-size: 0.9rem;
    vertical-align: middle;
}

.aws-data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.aws-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.aws-badge.success {
    background: rgba(0, 255, 136, 0.1);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.2);
}

.aws-badge.info {
    background: rgba(0, 229, 255, 0.1);
    color: #00e5ff;
    border: 1px solid rgba(0, 229, 255, 0.2);
}

.aws-truncate {
    max-width: 400px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    color: #aab7b8;
    font-size: 0.85rem;
}

/* ── Search Dropdown Styles ── */
.search-results-dropdown {
    position: relative;
    top: 0;
    background: #fff;
    border: 3px solid var(--glass-border);
    border-radius: 12px;
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
    margin: 0;
    width: 100%;
    box-shadow: var(--shadow-comic);
}

.search-result-item {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 2px solid var(--glass-border);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.search-result-item .title {
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.95rem;
}

.search-result-item .slug {
    color: #fff;
    font-size: 0.8rem;
    background: var(--neon-cyan);
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
}

/* ── Pill Styles (GenZ Neobrutalism) ── */
.mf-pill {
    background: var(--neon-orange);
    border: 3px solid #000;
    padding: 8px 18px;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 800;
    color: #000;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 3px 3px 0px #000;
    animation: fadeIn 0.3s ease;
}

/* Global Input and Button Pop Styles */
.input-group {
    display: flex;
    gap: 10px;
    width: 100%;
}
.input-group input {
    flex: 1;
    background: #fff;
    border: 3px solid #000;
    border-radius: 50px;
    padding: 12px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: inset 3px 3px 0px rgba(0,0,0,0.05);
    outline: none;
}
.input-group input:focus {
    border-color: var(--neon-cyan);
}
.analyze-btn {
    background: var(--neon-cyan);
    color: #fff;
    border: 3px solid #000;
    border-radius: 50px;
    padding: 12px 28px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 4px 4px 0px #000;
    transition: all 0.2s ease;
}
.analyze-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px #000;
}
.analyze-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px #000;
}

.mf-pill .remove {
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

.mf-pill .remove:hover {
    color: #ff4757;
}

/* ── Mobile Responsiveness ── (Consolidated further down the stylesheet) */

/* --- Aesthetic Synthesizer Theme (News/Scraping) --- */
.aesthetic-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background-color: #FFFFFF;
    border: 3px solid var(--border);
    border-radius: 12px;
    margin: 20px 0;
    font-family: var(--font-sans);
    box-shadow: 4px 4px 0px var(--border);
    overflow: hidden;
}
.aesthetic-table thead tr {
    background-color: var(--accent-light);
}
.aesthetic-table th {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 15px 20px;
    border-bottom: 2px solid var(--border);
    letter-spacing: 2px;
}
.aesthetic-table th:nth-child(odd) { color: var(--accent); }
.aesthetic-table th:nth-child(even) { color: var(--surface-dark); }

.aesthetic-table td {
    padding: 15px 20px;
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(17,17,17,0.12);
}
.aesthetic-table tbody tr:last-child td {
    border-bottom: none;
}
.aesthetic-table tbody tr:hover {
    background-color: rgba(255, 77, 141, 0.08);
}

/* Responsive Mobile Adjustments (Consolidated further down the stylesheet) */

/* Base Styles for Segmented Control Tabs (hidden on Desktop) */
.mobile-report-tabs {
    display: none; /* Hidden on desktop */
}

/* Redesigned Segmented Control */
.segmented-control {
    background: var(--accent-light);
    border-radius: 12px;
    padding: 6px;
    border: 3px solid #000;
    box-shadow: inset 3px 3px 6px rgba(0,0,0,0.1);
}

.segmented-control .mobile-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    box-shadow: none;
    color: #475569;
    padding: 12px;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: var(--font-display);
    transition: all 0.3s ease;
    cursor: pointer;
}

.segmented-control .mobile-tab-btn.active {
    background: #fff;
    color: var(--accent);
    border: 2px solid #000;
    box-shadow: 3px 3px 0px #000;
    transform: translateY(-2px);
}

/* Result Cards for Intelligence Report */
.result-card {
    background: #FFFFFF;
    border: 3px solid var(--glass-border);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 6px 6px 0px var(--glass-border);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.result-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 8px 8px 0px var(--glass-border);
}

.ai-card {
    background: #FFF3F8; /* subtle pink tint */
}

.card-content-scroll {
    flex: 1;
    max-height: 500px;
    overflow-y: auto;
    overflow-x: auto;
    white-space: pre-wrap;
    padding: 10px 5px;
}

/* Status Pill */
.status-pill {
    font-size: 0.95rem;
    padding: 8px 20px;
    border-radius: 50px;
    background: var(--positive);
    color: #000;
    border: 2px solid #000;
    font-family: var(--font-display);
    font-weight: 700;
    white-space: normal;
    word-break: break-word;
    text-align: center;
    box-shadow: 3px 3px 0px #000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}


.search-bar-container #aiModeSelect {
    font-size: 1.1rem !important;
    padding: 14px 18px !important;
    font-weight: 700 !important;
    min-height: 56px;
    box-sizing: border-box;
    font-family: var(--font-display);
}
.search-bar-container > button {
    font-size: 1.15rem !important;
    min-height: 56px;
    padding: 14px 28px !important;
    white-space: nowrap;
    box-sizing: border-box;
    font-family: var(--font-display);
}

/* ── Tagify overrides to match dashboard design ── */
.tagify {
    width: 100%;
    border: 3px solid var(--surface-dark) !important;
    border-radius: var(--radius-sm) !important;
    background: var(--surface) !important;
    font-family: var(--font-display) !important;
    min-height: 56px;
    padding: 6px 10px;
    box-sizing: border-box;
    align-items: center;
}
.tagify__input {
    font-size: 1.1rem !important;
    padding: 6px 4px !important;
    font-family: var(--font-display) !important;
    flex-grow: 1 !important;
    min-width: 150px !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
}
.tagify__tag {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    background: #e5e5e5 !important;
    color: var(--surface-dark) !important;
    border: 2px solid var(--surface-dark) !important;
    border-radius: 8px !important;
    box-shadow: 2px 2px 0 var(--surface-dark) !important;
    padding: 6px 12px !important;
    font-weight: 700 !important;
    font-size: 1.05rem !important;
    line-height: 1 !important;
    margin: 2px 6px 2px 0 !important;
    max-width: 100%;
    white-space: nowrap;
}
/* Disable Tagify's internal pseudo-elements and padding that cause overlapping pills */
.tagify__tag > div {
    padding: 0 !important;
}
.tagify__tag > div::before {
    display: none !important;
}
.tagify__tag > * { color: inherit !important; }
.tagify__tag-text {
    color: var(--surface-dark) !important;
    font-family: var(--font-display) !important;
    line-height: 1 !important;
}
.tagify__tag__removeBtn {
    color: var(--surface-dark) !important;
    width: 1.5em !important;
    height: 1.5em !important;
    font-size: 1.15rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-left: 2px !important;
    border-radius: 999px !important;
    background: transparent !important;
}
.tagify__tag__removeBtn:hover {
    background: rgba(17,17,17,0.12) !important;
}

/* Dropdown — positioned by Tagify via JS relative to the input wrapper */
.tagify__dropdown {
    position: absolute !important;
    border: 3px solid #000 !important;
    border-top: none !important;
    box-shadow: var(--shadow-comic) !important;
    border-radius: 0 0 12px 12px !important;
    background: #fff !important;
    max-height: 320px;
    overflow-y: auto;
    z-index: 9999 !important;
    box-sizing: border-box;
    margin: 0 !important;
}
.tagify__dropdown__wrapper {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-height: 320px;
    overflow-y: auto;
}
.tagify__dropdown__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-family: var(--font-sans);
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    background: #fff;
}
.tagify__dropdown__item:last-child { border-bottom: none; }
.tagify__dropdown__item:hover,
.tagify__dropdown__item--active {
    background: var(--secondary) !important;
    color: var(--surface-dark) !important;
}

.tagify__dropdown__item:hover .tag-symbol,
.tagify__dropdown__item--active .tag-symbol,
.tagify__dropdown__item:hover .tag-name,
.tagify__dropdown__item--active .tag-name {
    color: var(--surface-dark) !important;
}

.tagify__dropdown__item:hover .tag-type,
.tagify__dropdown__item--active .tag-type {
    color: var(--surface-dark) !important;
    background: rgba(0, 0, 0, 0.1) !important;
}

.tag-symbol { font-weight: 800; font-size: 0.95rem; color: #000; min-width: 64px; flex-shrink: 0; }
.tag-name   { flex: 1; font-size: 0.8rem; color: #555; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-type   { font-size: 0.7rem; font-weight: 700; color: #888; background: #f5f5f5; padding: 3px 8px; border-radius: 6px; text-transform: uppercase; flex-shrink: 0; }

/* ── Tax & Settings Modal ── */
.log-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.log-panel-card {
    position: relative;
    width: 90%;
    max-width: 440px;
    max-height: 90vh;
    background: var(--glass-bg);
    border: 4px solid #000;
    border-radius: 20px;
    box-shadow: 8px 8px 0px #000;
    padding: 24px;
    color: #000;
    font-family: var(--font-sans);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    animation: settingsModalEnter 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.log-panel-card h3 {
    font-family: var(--font-sans) !important;
    font-size: 1.6rem !important;
    letter-spacing: 0.5px;
    margin: 0;
}

.log-panel-card p {
    font-family: var(--font-sans);
    font-weight: 500;
    line-height: 1.4;
}

.log-panel-card label {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
}

.log-panel-card input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border: 3px solid #000 !important;
    border-radius: 6px !important;
    background: #fff !important;
    cursor: pointer;
    position: relative;
    box-shadow: 2px 2px 0px #000;
    transition: all 0.1s ease;
}

.log-panel-card input[type="checkbox"]:checked {
    background: var(--neon-green) !important;
}

.log-panel-card input[type="checkbox"]:checked::after {
    content: "✓";
    font-size: 14px;
    font-weight: 900;
    color: #000;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.log-panel-card input[type="checkbox"]:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0px #000;
}

.log-panel-card input[type="number"] {
    width: 100%;
    padding: 10px 14px;
    border: 3px solid #000 !important;
    border-radius: 8px !important;
    font-family: var(--font-sans) !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    box-sizing: border-box;
    box-shadow: 3px 3px 0px #000;
    transition: all 0.15s ease;
    background: #fff !important;
    color: #000 !important;
}

.log-panel-card input[type="number"]:focus {
    outline: none;
    box-shadow: 5px 5px 0px #000;
    transform: translate(-1px, -1px);
}

.log-panel-card button#saveSettingsBtn {
    width: 100%;
    background: var(--neon-green) !important;
    color: #000 !important;
    border: 3px solid #000 !important;
    border-radius: 12px !important;
    padding: 12px !important;
    font-family: var(--font-sans) !important;
    font-size: 1.35rem !important;
    letter-spacing: 0.5px;
    box-shadow: 4px 4px 0px #000;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.log-panel-card button#saveSettingsBtn:active {
    transform: translate(2px, 2px) scale(0.97);
    box-shadow: 2px 2px 0px #000;
}

.log-panel-card .close-btn {
    background: #fff !important;
    border: 2px solid #000 !important;
    cursor: pointer;
    font-size: 1.25rem !important;
    color: #000 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50% !important;
    box-shadow: 2px 2px 0px #000;
    transition: all 0.1s ease;
}

.log-panel-card .close-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0px #000;
}

@keyframes settingsModalEnter {
    from {
        opacity: 0;
        transform: translate(-50%, -45%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ============================================ *
 * MOBILE ENHANCEMENT — CRED-Inspired Polish
 * Applied from finance_app design reference
 * ============================================ */

/* ── Mobile Bottom Navigation (hidden on desktop) ── */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 1024px) {
    /* ── Layout Rules from consolidated queries ── */
    .app-container {
        flex-direction: column;
        height: auto;
    }

    .bento-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

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

    .input-group input, .input-group button {
        width: 100%;
        border-radius: 8px !important;
    }

    .input-group button {
        margin-top: 10px;
    }

    .search-results-dropdown {
        position: relative;
        margin-top: 5px;
    }

    #chart-matrix, #chart-network {
        height: 250px !important;
    }

    .aws-header-actions {
        flex-direction: column;
        width: 100%;
    }

    .aws-header-actions button {
        width: 100%;
    }

    /* ── Override: Hide Desktop Sidebar and Nav Links on Mobile ── */
    .sidebar, .desktop-nav-links {
        display: none !important;
    }

    /* ── Show Mobile Bottom Nav ── */
    .mobile-bottom-nav {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        justify-items: center;
        align-items: center;
        align-content: center;
        justify-content: center;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 68px;
        background: #111;
        z-index: 500;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        border-top: 3px solid #000;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
    }

    .mobile-bottom-nav::before {
        content: '';
        position: absolute;
        top: -16px;
        left: 0;
        right: 0;
        height: 16px;
        background: linear-gradient(to top, rgba(0,0,0,0.15), transparent);
        pointer-events: none;
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        padding: 6px 4px;
        color: #666;
        font-family: var(--font-display);
        font-size: 9px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        cursor: pointer;
        transition: color 0.2s ease;
        -webkit-tap-highlight-color: transparent;
        position: relative;
    }

    .mobile-nav-item i {
        font-size: 20px;
        transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .mobile-nav-item.active {
        color: var(--secondary);
    }

    .mobile-nav-item.active i {
        text-shadow: 0 0 12px rgba(248, 255, 26, 0.45);
    }

    .mobile-nav-item:active i {
        transform: scale(0.8);
    }

    /* ── Center FAB Button ── */
    .mobile-fab {
        width: 58px;
        height: 58px;
        border-radius: 50%;
        background: var(--accent);
        border: 3px solid #000;
        box-shadow: 4px 4px 0px #000;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-top: -30px;
        cursor: pointer;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
        position: relative;
        z-index: 2;
    }

    .mobile-fab i {
        font-size: 22px;
        color: #000;
        font-weight: 900;
    }

    .mobile-fab:active {
        transform: scale(0.88);
        box-shadow: 2px 2px 0px #000;
    }

    .mobile-fab-ring {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 66px;
        height: 66px;
        transform: translate(-50%, -50%);
        border-radius: 50%;
        border: 2px dashed rgba(198, 255, 0, 0.4);
        animation: fabRingSpin 6s linear infinite;
        pointer-events: none;
        box-sizing: border-box;
    }

    @keyframes fabRingSpin {
        from { transform: translate(-50%, -50%) rotate(0deg); }
        to { transform: translate(-50%, -50%) rotate(360deg); }
    }

    /* ── Content Area — Generous Spacing ── */
    .app-container {
        flex-direction: column;
        height: auto;
    }

    .content-area {
        padding: 16px 16px calc(110px + env(safe-area-inset-bottom, 0px)) 16px !important;
        align-items: stretch;
        background: var(--surface);
    }

    /* ── Top Bar — Clean Hierarchy ── */
    .top-bar {
        flex-direction: column;
        align-items: flex-start !important;
        text-align: left !important;
        gap: 10px;
        padding-bottom: 16px;
        border-bottom: 2px solid #eee;
        width: 100%;
    }

    .top-bar h1 {
        font-size: 1.35rem !important;
        line-height: 1.3;
        letter-spacing: -0.5px;
    }

    .pulse-indicator {
        font-size: 0.78rem;
        padding: 6px 12px;
    }

    /* ── Search Bar — Pill Shaped, Stacked ── */
    .search-bar-container {
        flex-direction: column;
        align-items: stretch !important;
        border-radius: 20px !important;
        padding: 16px !important;
        gap: 10px !important;
        box-shadow: 4px 4px 0px #000 !important;
        width: 100%;
        max-width: 100%;
    }

    .search-bar-container input[type="text"] {
        border-radius: 50px !important;
        padding: 14px 20px !important;
        font-size: 1rem !important;
        min-height: 48px;
        width: 100% !important;
        box-sizing: border-box;
    }

    .search-bar-container select {
        border-radius: 12px !important;
        padding: 12px 14px !important;
        font-size: 0.9rem !important;
        min-height: 48px;
        width: 100% !important;
        box-sizing: border-box;
        appearance: none;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 14px center;
        padding-right: 36px !important;
    }

    .search-bar-container button {
        border-radius: 50px !important;
        padding: 14px 24px !important;
        font-size: 1rem !important;
        min-height: 50px;
        width: 100% !important;
        box-sizing: border-box;
        transition: transform 0.12s ease, box-shadow 0.12s ease !important;
    }

    .search-bar-container button:active {
        transform: translate(2px, 2px) scale(0.97) !important;
        box-shadow: 2px 2px 0px #000 !important;
    }

    /* ── Suggestions Dropdown — Smooth Entry ── */
    #searchWrapper.suggestions-open #tickerInput {
        border-radius: 24px 24px 0 0 !important;
    }

    #suggestionsBox {
        border-radius: 0 0 24px 24px !important;
        box-shadow: 4px 4px 0px #000 !important;
        animation: suggestSlideDown 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        max-height: 50vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

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

    #suggestionsBox > div.suggestion-card {
        padding: 14px 16px !important;
        gap: 14px !important;
    }

    .suggestion-card-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 1rem !important;
    }

    .suggestion-card-symbol {
        font-size: 1rem !important;
    }

    .suggestion-card-name {
        font-size: 0.82rem !important;
    }

    .suggestion-card-type {
        font-size: 0.68rem !important;
    }

    /* ── AI Manager Card ── */
    .ai-manager-container {
        flex-direction: column;
        align-items: flex-start !important;
        border-radius: 20px !important;
        padding: 16px 18px !important;
        gap: 12px;
        width: 100%;
        max-width: 100%;
    }

    .ai-manager-title {
        font-size: 1rem !important;
    }

    .ai-manager-meta,
    .ai-manager-meta-sub {
        font-size: 0.82rem !important;
    }

    .ai-manager-buttons {
        flex-direction: column;
        width: 100%;
    }

    .ai-manager-buttons button {
        width: 100%;
        border-radius: 12px !important;
        min-height: 46px;
        font-size: 0.88rem !important;
        transition: transform 0.12s ease;
    }

    .ai-manager-buttons button:active {
        transform: scale(0.96);
    }

    /* ── Analysis Output — Better Structure ── */
    #analysisOutputContainer {
        padding: 0 !important;
    }

    #analysisOutputContainer h2 {
        font-size: 1.3rem !important;
        line-height: 1.3;
    }

    .analysis-grid {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
        width: 100%;
        max-width: 100%;
    }

    .analysis-bento {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
        width: 100%;
        max-width: 100%;
    }

    .analysis-grid > div {
        min-width: 0;
        width: 100%;
    }

    .report-column {
        width: 100%;
        min-width: 0;
    }

    /* ── Result Cards — Premium Polish ── */
    .result-card {
        border-radius: 20px !important;
        padding: 18px !important;
        box-shadow: 4px 4px 0px #000 !important;
        transition: transform 0.15s ease, box-shadow 0.15s ease;
    }

    .result-card:hover {
        transform: none !important;
        box-shadow: 4px 4px 0px #000 !important;
    }

    .result-card:active {
        transform: translate(1px, 1px) !important;
        box-shadow: 3px 3px 0px #000 !important;
    }

    .result-card .card-header {
        font-size: 1.05rem !important;
        padding-bottom: 10px !important;
        margin-bottom: 12px !important;
    }

    .card-content-scroll {
        max-height: min(52vh, 420px);
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    #rawReportContainer, #llmOutputContainer {
        overflow-x: auto !important;
        width: 100%;
        box-sizing: border-box;
        word-break: break-word;
    }

    /* ── Segmented Control — Spring Transitions ── */
    .segmented-control {
        border-radius: 16px !important;
        padding: 5px !important;
        margin-bottom: 14px !important;
    }

    .segmented-control .mobile-tab-btn {
        border-radius: 12px !important;
        padding: 12px 16px !important;
        font-size: 0.92rem !important;
        min-height: 44px;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    }

    .segmented-control .mobile-tab-btn.active {
        transform: translateY(-1px) !important;
        box-shadow: 3px 3px 0px #000 !important;
    }

    .segmented-control .mobile-tab-btn:active {
        transform: scale(0.95) !important;
    }

    /* ── Tab Content — Slide Animation ── */
    .report-column {
        display: none !important;
    }

    .report-column.active-mobile-col {
        display: block !important;
        animation: mobileColSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    @keyframes mobileColSlide {
        from { opacity: 0; transform: translateX(16px); }
        to { opacity: 1; transform: translateX(0); }
    }

    /* ── Mobile Report Tabs ── */
    .mobile-report-tabs {
        display: flex !important;
        justify-content: center;
        gap: 8px;
        margin-bottom: 14px;
    }

    /* ── Status Pill — Entrance Animation ── */
    .status-pill {
        font-size: 0.82rem !important;
        padding: 6px 14px !important;
        max-width: 100%;
        border-radius: 50px !important;
        animation: pillBounceIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    @keyframes pillBounceIn {
        from { opacity: 0; transform: scale(0.75); }
        to { opacity: 1; transform: scale(1); }
    }

    /* ── PDF Q&A Panel ── */
    #annualReportQnAPanel {
        border-radius: 20px !important;
        padding: 16px !important;
    }

    #pdfIngestControls {
        gap: 10px !important;
        flex-direction: column;
    }

    #pdfIngestControls select {
        min-width: unset !important;
        width: 100% !important;
        min-height: 46px;
        border-radius: 12px !important;
    }

    #pdfIngestControls button {
        width: 100%;
        min-height: 46px;
        border-radius: 12px !important;
    }

    #pdfChatInput {
        min-height: 48px;
        font-size: 0.95rem !important;
    }

    #btnSendPdfChat {
        min-height: 48px;
    }

    /* ── Philosophy Cards — Stacked & Tappable ── */
    .grid-container {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    .grid-container .card {
        border-radius: 20px !important;
        padding: 20px !important;
        border-width: 2px;
        box-shadow: 4px 4px 0px #000;
    }

    .grid-container .card:active {
        transform: translate(1px, 1px) !important;
        box-shadow: 3px 3px 0px #000 !important;
    }

    /* ── Timeline (Gates) — Mobile Polish ── */
    .tab-content.glass-panel {
        padding: 20px 16px !important;
        border-radius: 20px !important;
    }

    .timeline-content {
        border-radius: 16px !important;
        padding: 16px !important;
    }

    .timeline-content:active {
        transform: translateX(4px) !important;
        background: rgba(255, 255, 255, 0.06);
    }

    .timeline-content h3 {
        font-size: 1.1rem !important;
    }

    /* ── Tables — Horizontal Scroll Container ── */
    .styled-table,
    .aesthetic-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px !important;
    }

    /* ── Loading Overlay — Mobile Sizing ── */
    .boot-doodles, .boot-card-doodle { display: none; }
    #wasm-loading-overlay > div {
        padding: 28px 16px !important;
        margin: 0 14px;
        border-radius: 20px !important;
        max-width: calc(100vw - 28px) !important;
    }

    #wasm-loading-overlay h1 {
        font-size: 1.4rem !important;
        line-height: 1.3 !important;
    }

    #wasm-loading-overlay p {
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
    }

    /* ── Global Heading Sizes ── */
    h1 {
        font-size: 1.4rem !important;
        line-height: 1.3;
    }

    h2 {
        font-size: 1.3rem !important;
    }

    h3 {
        font-size: 1.05rem !important;
    }

    /* ── Section Spacing Helper ── */
    .tab-content {
        padding: 16px 0 !important;
        gap: 16px !important;
        width: 100%;
    }
        padding: 20px 0 !important;
    }
}

/* ── Global: Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ────────────────────────────────────────────────────────── */
/* ── SEARCH GROUNDING BOX & LOADING ANIMATIONS ── */
/* ────────────────────────────────────────────────────────── */

/* Container wrapping the avatar and the box */
.search-grounding-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin: 15px 0;
    width: 100%;
    max-width: 100%;
    font-family: var(--font-sans);
    animation: fadeIn 0.3s ease-out forwards;
}

.search-grounding-main {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

/* AI Agent blue avatar */
.search-agent-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3884ff, #0056d6);
    box-sizing: border-box;
    box-shadow: 0 4px 10px rgba(56, 132, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: transform 0.2s ease;
}

.search-agent-avatar:hover {
    transform: scale(1.08);
}

.search-agent-eye {
    width: 3px;
    height: 8px;
    border-radius: 1.5px;
    background: white;
}

/* Grounding Box */
.search-grounding-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--glass-bg) !important; /* Match panel periwinkle bg */
    border: 2px solid #000 !important; /* Thick Comic outline */
    border-radius: 8px !important;
    padding: 12px 16px;
    color: #000 !important; /* Pure black text */
    box-shadow: 4px 4px 0px #000 !important; /* Hard flat drop shadow */
    font-size: 0.85rem;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.search-grounding-box:hover {
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0px #000 !important;
}

/* Grounding Row */
.search-grounding-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.search-grounding-left {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.search-bullet {
    color: #000 !important;
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1;
    width: 14px;
    text-align: center;
    display: inline-block;
}

.search-icon-q {
    color: #000 !important;
    font-size: 0.85rem;
    width: 14px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-topic-label {
    color: #333 !important;
    font-weight: 600;
}

.search-topic-text {
    color: #000 !important;
    font-weight: 800;
}

.search-chevron {
    color: #000 !important;
    font-size: 0.85rem;
    font-weight: 800;
    font-family: monospace;
    user-select: none;
    margin-left: 8px;
}

/* Dotted vertical connector */
.search-dotted-line {
    height: 14px;
    margin-left: 15px; /* Aligned with bullet/icon center */
    display: flex;
    align-items: center;
}

.search-dotted-line-inner {
    border-left: 2px dotted #000 !important; /* Solid black dotted vertical line */
    height: 100%;
}

/* Muted parts in row 2 */
.search-query-text {
    color: #444 !important;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-results-count {
    color: #000 !important;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    margin-left: auto;
}

/* Spinner section */
.search-spinner-area {
    margin-left: 9px; /* Aligned with the center of 32px avatar */
    margin-top: 10px;
    display: flex;
    align-items: center;
}

/* Outlined Pop spinner */
.search-half-moon-spinner {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #000 !important; /* Black outline */
    border-top-color: var(--neon-purple) !important; /* Pop pink active edge */
    animation: search-spin 0.8s linear infinite;
    box-shadow: 1px 1px 0px #000 !important; /* Hard drop shadow */
}

@keyframes search-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Global raised surface pattern */
:where(.boot-card, .search-bar-container, .ai-manager-container, .result-card, .settings-card, .pdf-panel, .search-details-panel, .log-panel-card, .search-box, .search-mode-select, .btn-analyze, .btn-download-model, .btn-clear-model, .btn-save-settings, .btn-ingest-pdf, .btn-send-pdf-chat, .pdf-select-dropdown, .settings-select, .settings-input, .tagify, .segmented-control, .pulse-indicator, .status-pill) {
    border-width: 3px !important;
    border-style: solid !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow-comic) !important;
}

:where(.result-card:hover, .search-box:focus-within, .search-bar-container button:hover, .btn-analyze:hover, .btn-download-model:hover, .btn-clear-model:hover, .btn-save-settings:hover, .btn-ingest-pdf:hover, .btn-send-pdf-chat:hover) {
    box-shadow: 6px 6px 0px var(--border) !important;
}
