/* ════════════════════════════════════════════════════════
   AIC FA SYSTEM — style.css
   Sector-aware dashboard with live Vietcap API data
   ════════════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
    --bg-dark:       #060912;
    --bg-card:       rgba(14, 21, 42, 0.75);
    --bg-card-hover: rgba(22, 34, 66, 0.9);
    --border-color:  rgba(255, 255, 255, 0.07);
    --glass-shadow:  0 16px 48px 0 rgba(0, 0, 0, 0.55);

    --primary:       #3b82f6;
    --primary-glow:  rgba(59, 130, 246, 0.35);

    --excel-green:   #10b981;
    --excel-glow:    rgba(16, 185, 129, 0.3);

    --text-main:     #f0f2f8;
    --text-muted:    #8892a4;
    --text-dim:      #545f74;

    --color-positive: #10b981;
    --color-neutral:  #f59e0b;
    --color-negative: #ef4444;

    /* Sector accent colours */
    --sector-banks:       #3b82f6;
    --sector-materials:   #f97316;
    --sector-realestate:  #a855f7;
    --sector-technology:  #22c55e;
    --sector-consumer:    #eab308;
    --sector-industrial:  #64748b;
    --sector-generic:     #38bdf8;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59,130,246,0.08) 0%, transparent 60%);
}

/* ════════════════════════════════════════════
   APP SHELL
════════════════════════════════════════════ */
.app-shell {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ════════════════════════════════════════════
   TOP NAVBAR
════════════════════════════════════════════ */
.top-navbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 22px;
    background: rgba(10, 16, 32, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 0 0 18px 18px;
    border-top: none;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 10px;
    transition: background 0.2s;
    flex-shrink: 0;
}
.logo-btn:hover { background: rgba(255,255,255,0.06); }

.logo-img { height: 34px; width: auto; object-fit: contain; }

.logo-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, #60a5fa, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: block;
}
.logo-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: block;
    margin-top: 1px;
}

.home-link-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.home-link-btn:hover {
    background: var(--primary-glow);
    border-color: var(--primary);
    box-shadow: 0 4px 12px var(--primary-glow);
}
.home-link-btn .home-link-icon { font-size: 1rem; line-height: 1; }
.home-link-btn span:last-child {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text-main);
    white-space: nowrap;
}
@media (max-width: 480px) {
    .home-link-btn { padding: 5px 8px; gap: 4px; }
    .home-link-btn .home-link-icon { font-size: 0.9rem; }
    .home-link-btn span:last-child { font-size: 0.66rem; }
}

.nav-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    color: var(--text-muted);
    flex: 1;
}
.breadcrumb-sep { color: var(--text-dim); }
.breadcrumb-sector { font-weight: 600; }
.breadcrumb-ticker {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--text-main);
}

.sector-badge-nav {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    font-size: 0.82rem;
    font-weight: 600;
    background: rgba(255,255,255,0.04);
    white-space: nowrap;
}

.home-text-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.83rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.home-text-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-main); }

/* ════════════════════════════════════════════
   VIEWS
════════════════════════════════════════════ */
.view { display: none; flex-direction: column; gap: 20px; }
.active-view { display: flex; }

/* ════════════════════════════════════════════
   CARDS (shared)
════════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 24px;
    box-shadow: var(--glass-shadow);
}

/* ════════════════════════════════════════════════════════════
   SEARCH BAR
════════════════════════════════════════════════════════════ */
.search-bar-wrap { position: relative; }
.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-radius: 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.search-icon { font-size: 1rem; flex-shrink: 0; }
.search-bar input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
}
.search-bar input::placeholder { color: var(--text-dim); }
.search-clear {
    cursor: pointer;
    color: var(--text-dim);
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.15s;
    user-select: none;
    padding: 2px 4px;
}
.search-clear:hover { color: var(--text-muted); }

/* ════════════════════════════════════════════════════════════
   OVERVIEW VIEW
════════════════════════════════════════════════════════════ */
.overview-hero {
    text-align: center;
    padding: 28px 32px 24px;
    position: relative;
    overflow: hidden;
}
.overview-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 80% at 50% -10%, rgba(59,130,246,0.1), transparent);
    border-radius: 18px;
    pointer-events: none;
}
.hero-icon { font-size: 3rem; margin-bottom: 16px; }
.hero-content h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.9rem;
    font-weight: 800;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #f0f2f8, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-content p {
    color: var(--text-muted);
    max-width: 580px;
    margin: 0 auto;
    line-height: 1.65;
    font-size: 0.95rem;
}

/* Sector group on overview */
.sector-group { margin-bottom: 4px; }
.sector-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.sector-group-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
}
.sector-group-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sector-count-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(255,255,255,0.06);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.stocks-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.stock-card {
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px 4px 12px; /* tight padding, slightly more on left for the sector color bar */
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.stock-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--sector-color, var(--primary));
    opacity: 0.7;
    transition: opacity 0.2s;
}
.stock-card:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.13);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.stock-card:hover::before { opacity: 1; }

.stock-card-ticker {
    font-family: 'Outfit', sans-serif;
    font-size: 0.88rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0;
}
.stock-card-name {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.35;
    margin-bottom: 10px;
    /* Limit to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.stock-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-dim);
}
.stock-card-price {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.8rem;
}
.stock-card-arrow {
    font-size: 0.85rem;
    opacity: 0.35;
    transition: opacity 0.15s, transform 0.15s;
}
.stock-card:hover .stock-card-arrow { opacity: 1; transform: translateX(3px); }

.loading-state {
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
}

/* ════════════════════════════════════════════
   ANALYSIS VIEW — HEADER
════════════════════════════════════════════ */
.view-analysis { padding-top: 0; }

.header-card {
    padding: 22px 28px;
    position: relative;
    overflow: hidden;
}
.sector-ribbon {
    position: absolute;
    top: 0; right: 0;
    background: var(--sector-color, var(--primary));
    color: white;
    font-family: 'Outfit', sans-serif;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    padding: 5px 20px;
    border-radius: 0 18px 0 12px;
    opacity: 0.9;
}
.header-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
}
.header-info { flex: 1; }
.badge {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    padding: 5px 14px;
    border-radius: 8px;
    background: var(--sector-color, var(--primary));
    color: white;
    display: inline-block;
    margin-bottom: 8px;
}
#company-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1.3;
}
.subtitle { color: var(--text-muted); font-size: 0.88rem; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ════════════════════════════════════════════
   BUTTONS
════════════════════════════════════════════ */
.btn {
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 9px;
    font-weight: 600;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    transition: all 0.25s ease;
    border: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { box-shadow: 0 0 18px var(--primary-glow); transform: translateY(-1px); }
.btn-excel { background: var(--excel-green); color: white; }
.btn-excel:hover { box-shadow: 0 0 18px var(--excel-glow); transform: translateY(-1px); }
.btn-secondary {
    background: rgba(255,255,255,0.06);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover { background: rgba(255,255,255,0.12); }

/* ════════════════════════════════════════════
   METRIC CARDS
════════════════════════════════════════════ */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}
.metric-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 20px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    transition: background 0.2s;
    position: relative;
    overflow: hidden;
}
.metric-card.highlight {
    background: rgba(59,130,246,0.06);
    border-color: rgba(59,130,246,0.2);
}
.metric-card.highlight::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--sector-color, var(--primary));
    border-radius: 2px 2px 0 0;
}
.metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 500;
}
.metric-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.65rem;
    font-weight: 700;
    color: #60a5fa;
    line-height: 1;
}
.metric-sub {
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* Vietcap live data badge */
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    color: var(--color-positive);
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(16,185,129,0.1);
    border: 1px solid rgba(16,185,129,0.2);
    margin-top: 4px;
    width: fit-content;
}
.live-dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--color-positive);
    animation: livePulse 1.5s infinite;
}
@keyframes livePulse {
    0%,100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ════════════════════════════════════════════
   TWO-COLUMN GRID
════════════════════════════════════════════ */
.dashboard-grid-two {
    display: grid;
    grid-template-columns: 1.35fr 0.65fr;
    gap: 20px;
}
@media (max-width: 1100px) {
    .dashboard-grid-two { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════
   MOBILE — enlarge charts, stack split layout
════════════════════════════════════════════ */
@media (max-width: 768px) {
    .app-shell { padding: 0 10px 30px; }
    .chart-card-split { padding: 14px; gap: 14px; border-radius: 14px; }
    .chart-split-left { flex: 1 1 100%; min-width: 100%; }
    .chart-split-right {
        flex: 1 1 100%;
        min-width: 100%;
        border-left: none;
        border-top: 3px solid var(--sector-color, var(--primary));
        border-radius: 12px 12px 0 0;
        padding: 14px 4px 4px;
    }
    .chart-container { height: 360px; }
    .card, .chart-card, .moat-card, .valuation-card,
    .thesis-card, .risks-card, .pestle-card,
    .commentary-card, .table-card, .bank-kpi-card { padding: 16px; }
}
@media (max-width: 420px) {
    .chart-container { height: 320px; }
}
.col-left, .col-right { display: flex; flex-direction: column; gap: 20px; }

/* ════════════════════════════════════════════
   CHART CARDS
════════════════════════════════════════════ */
.card h3, .chart-card h3, .moat-card h3, .valuation-card h3,
.thesis-card h3, .risks-card h3, .pestle-card h3,
.commentary-card h3, .table-card h3, .bank-kpi-card h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 18px;
    border-left: 3px solid var(--sector-color, var(--primary));
    padding-left: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.border-red { border-left-color: var(--color-negative) !important; }
.border-blue { border-left-color: var(--primary) !important; }

.chart-container {
    position: relative;
    height: 270px;
    width: 100%;
}

/* Vietcap embed container */
.vietcap-embed {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
}
.vietcap-embed-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ════════════════════════════════════════════
   MOAT SCORECARD
════════════════════════════════════════════ */
.moat-list { display: flex; flex-direction: column; gap: 14px; }
.moat-item { display: flex; flex-direction: column; gap: 5px; }
.moat-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
    font-weight: 600;
}
.moat-score {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--sector-color, var(--primary));
}
.moat-desc { font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; }
.moat-bar-bg {
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: hidden;
}
.moat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--sector-color, #60a5fa), var(--primary));
    border-radius: 3px;
    width: 0%;
    transition: width 1s cubic-bezier(0.4,0,0.2,1);
}

/* ════════════════════════════════════════════
   VALUATION SCENARIOS
════════════════════════════════════════════ */
.scenarios-grid {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 10px;
}
.scenario-box {
    padding: 16px 8px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border-color);
}
.scenario-box.bear { background: rgba(239,68,68,0.05); border-color: rgba(239,68,68,0.15); }
.scenario-box.base { background: rgba(59,130,246,0.05); border-color: rgba(59,130,246,0.15); }
.scenario-box.bull { background: rgba(16,185,129,0.05); border-color: rgba(16,185,129,0.15); }
.scenario-title { font-size: 0.73rem; font-weight: 700; text-transform: uppercase; margin-bottom: 8px; }
.bear .scenario-title { color: #fca5a5; }
.base .scenario-title { color: #93c5fd; }
.bull .scenario-title { color: #6ee7b7; }
.scenario-price { font-family: 'Outfit', sans-serif; font-size: 1.05rem; font-weight: 700; }

/* ════════════════════════════════════════════
   BANK KPI CARD
════════════════════════════════════════════ */
.bank-kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.bank-kpi-item {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
}
.bank-kpi-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.bank-kpi-value { font-family: 'Outfit', sans-serif; font-size: 1.35rem; font-weight: 700; color: var(--sector-banks); }

/* ════════════════════════════════════════════
   THESIS / RISKS
════════════════════════════════════════════ */
.thesis-ul, .risks-ul {
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 11px;
}
.thesis-ul li { list-style: square; font-size: 0.9rem; line-height: 1.55; }
.risks-ul li { list-style: circle; color: #fca5a5; font-size: 0.9rem; line-height: 1.55; }

/* ════════════════════════════════════════════
   PESTLE
════════════════════════════════════════════ */
.pestle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
}
.pestle-box {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pestle-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 0.88rem;
}
.pestle-box-text { font-size: 0.8rem; line-height: 1.5; color: var(--text-muted); }
.pestle-tag { font-size: 0.7rem; padding: 2px 7px; border-radius: 4px; font-weight: 700; }
.pestle-tag.positive { background: rgba(16,185,129,0.15); color: #34d399; }
.pestle-tag.neutral  { background: rgba(245,158,11,0.15); color: #fbbf24; }
.pestle-tag.negative { background: rgba(239,68,68,0.15); color: #f87171; }

/* ════════════════════════════════════════════
   COMMENTARY
════════════════════════════════════════════ */
.commentary-sections {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.commentary-box {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
}
.commentary-box h4 {
    color: var(--sector-color, var(--primary));
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 0.92rem;
}
.commentary-box p { font-size: 0.88rem; line-height: 1.65; color: var(--text-muted); }

/* ════════════════════════════════════════════
   FINANCIAL TABLE
════════════════════════════════════════════ */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border-color); text-align: left; }
th { color: var(--text-muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; }
td.highlight { color: var(--color-positive); font-weight: 600; }
tr:hover td { background: rgba(255,255,255,0.018); }

/* ════════════════════════════════════════════
   FOOTER
════════════════════════════════════════════ */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-dim);
    font-size: 0.82rem;
    border-top: 1px solid var(--border-color);
    margin-top: 20px;
}

/* ════════════════════════════════════════════
   UTILITIES & UPGRADED COMPONENTS
════════════════════════════════════════════ */
.hidden { display: none !important; }
.margin-top-20 { margin-top: 20px; }

/* ── Split Chart Layout ── */
.chart-card-split {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 24px;
    box-shadow: var(--glass-shadow);
}
.chart-split-left {
    flex: 1 1 60%;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.chart-split-right {
    flex: 1 1 30%;
    min-width: 250px;
    background: rgba(255, 255, 255, 0.015);
    border-left: 3px solid var(--sector-color, var(--primary));
    padding: 16px 20px;
    border-radius: 0 12px 12px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
}
.chart-split-right h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}
.chart-analysis-text {
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-muted);
}

/* ── Quarterly & YTD Evaluation Component ── */
.quarterly-ytd-card {
    background: linear-gradient(135deg, rgba(14, 21, 42, 0.9), rgba(6, 9, 18, 0.9));
    border: 1px solid rgba(59, 130, 246, 0.15);
}
.quarterly-ytd-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 16px;
}
.q-ytd-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.q-ytd-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}
.q-ytd-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
}
.q-ytd-metrics {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}
.q-metric-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}
.q-metric-label {
    color: var(--text-muted);
}
.q-metric-value {
    font-weight: 600;
    color: var(--text-main);
}
.badge-growth {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
}
.badge-growth.up { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-growth.down { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.badge-growth.flat { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

.q-commentary-box {
    margin-top: 14px;
    padding: 12px 14px;
    background: rgba(59, 130, 246, 0.03);
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--text-muted);
    border-left: 2.5px solid var(--primary);
}

/* ── Custom Web Tables & Valuation Snapshot Styles ── */
.val-snapshot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 10px;
}
.val-snap-box {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    padding: 14px 16px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.val-snap-box.highlight {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.25);
}
.val-snap-box .lbl {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}
.val-snap-box .val {
    font-size: 1.25rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
}
.val-snap-box .badge-rec {
    display: inline-block;
    padding: 4px 10px;
    background: var(--primary);
    color: white;
    font-weight: 700;
    font-size: 0.82rem;
    border-radius: 6px;
    width: fit-content;
}

.web-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
    margin-top: 8px;
}
.web-table th, .web-table td {
    padding: 9px 12px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}
.web-table th:first-child, .web-table td:first-child {
    text-align: left;
    font-weight: 600;
}
.web-table th {
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1.5px solid var(--border-color);
    font-size: 0.78rem;
    text-transform: uppercase;
}
.web-table tbody tr:hover {
    background: rgba(255,255,255,0.02);
}
.web-table td.highlight-cell {
    font-weight: 700;
    color: var(--primary);
}

.ri-summary-box {
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.82rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}
.ri-summary-box strong {
    color: var(--text-main);
}
.table-container {
    overflow-x: auto;
}
.text-blue { color: #3b82f6 !important; }
.text-green { color: #10b981 !important; }
.text-red { color: #ef4444 !important; }
.chart-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 20px;
    margin-top: 15px;
}
.chart-gallery-item {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid var(--border);
    text-align: center;
    transition: border-color 0.2s;
}
.chart-gallery-item:hover {
    border-color: var(--sector-color, #3b82f6);
}
.chart-gallery-item img {
    width: 100%;
    height: auto;
    border-radius: 6px;
}
.chart-gallery-item .chart-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-top: 8px;
    font-weight: 600;
}

/* ════════════════════════════════════════════════════
   MACRO & THANH KHOẢN SECTION
   ════════════════════════════════════════════════════ */
.macro-liq-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.macro-liq-section:last-child { border-bottom: none; margin-bottom: 0; }

.macro-liq-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 14px;
}

/* ADTV grid */
.macro-adtv-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.macro-adtv-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    padding: 10px 14px;
    min-width: 90px;
    text-align: center;
    transition: background 0.2s;
}
.macro-adtv-item:hover { background: rgba(255, 255, 255, 0.07); }
.macro-adtv-item.forecast {
    border-color: rgba(96, 165, 250, 0.25);
    background: rgba(96, 165, 250, 0.05);
}
.macro-adtv-year {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.macro-adtv-val {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}
.macro-adtv-item.forecast .macro-adtv-val { color: #60a5fa; }

/* FVTPL grid */
.macro-fvtpl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}
.macro-fvtpl-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 14px 16px;
    transition: background 0.2s;
}
.macro-fvtpl-item:hover { background: rgba(255, 255, 255, 0.07); }
.macro-fvtpl-item.highlight {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.05);
}
.macro-fvtpl-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}
.macro-fvtpl-val {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}
.macro-fvtpl-rate {
    font-size: 0.72rem;
    color: var(--text-dim);
}

/* Note styling */
.macro-liq-note {
    font-size: 0.78rem;
    color: var(--text-dim);
    background: rgba(245, 158, 11, 0.07);
    border-left: 3px solid rgba(245, 158, 11, 0.5);
    padding: 6px 10px;
    border-radius: 0 6px 6px 0;
    margin-top: 8px;
}
