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

/* ==========================================================================
   Wozber-Inspired Editorial Design System — VNDIRECT Dividend & Ex-Rights
   Light-first architectural paper & ink palette + Matte Dark theme
   ========================================================================== */

:root,
[data-theme="light"] {
    --font-display: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Surfaces & Canvas */
    --bg-body: #F7F7F5;
    --bg-surface: #FFFFFF;
    --bg-elevated: #FAFAFA;
    --bg-subtle: #F4F4F5;
    --bg-hover: #F4F4F5;
    --bg-input: #FFFFFF;

    /* Crisp 1px Hairline Borders */
    --border-subtle: #E4E4E7;
    --border-strong: #D4D4D8;

    /* Editorial Ink Hierarchy */
    --text-primary: #111827;
    --text-secondary: #52525B;
    --text-muted: #71717A;
    --ink-strong: #18181B;
    --ink-inverse: #FFFFFF;

    /* Restrained Brand Accent (Terracotta-Amber) + Legacy Aliases */
    --brand-accent: #D96B16;
    --brand-accent-hover: #C05B0E;
    --vnd-orange: var(--brand-accent);
    --vnd-orange-soft: rgba(217, 107, 22, 0.09);
    --vnd-orange-border: rgba(217, 107, 22, 0.28);

    /* Semantic Financial Hues (High Contrast on White) */
    --emerald: #047857;
    --emerald-soft: #ECFDF5;
    --emerald-border: rgba(4, 120, 87, 0.22);

    --indigo: #4338CA;
    --indigo-soft: #EEF2FF;
    --indigo-border: rgba(67, 56, 202, 0.22);

    --cyan: #0E7490;
    --cyan-soft: #ECFEFF;
    --cyan-border: rgba(14, 116, 144, 0.22);

    --amber: #B45309;
    --amber-soft: #FFFBEB;
    --amber-border: rgba(180, 83, 9, 0.24);

    --rose: #BE123C;
    --rose-soft: #FFF1F2;
    --rose-border: rgba(190, 18, 60, 0.24);

    --crimson: #DC2626;

    /* Vietnamese Stock Board Semantic Colors */
    --price-ceil: #9333EA;
    --price-up: #15803D;
    --price-ref: #B45309;
    --price-down: #DC2626;
    --price-floor: #0369A1;
    --up-green: #15803D;
    --down-red: #DC2626;
    --ref-yellow: #B45309;

    /* Multi-Layer Subtle Elevation & Geometry (Apple/Linear & Shadcn/Tailwind) */
    --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px -2px rgba(15, 23, 42, 0.05), 0 12px 32px -4px rgba(15, 23, 42, 0.03);
    --shadow-card-hover: 0 4px 12px rgba(15, 23, 42, 0.07), 0 14px 36px -4px rgba(15, 23, 42, 0.09);
    --shadow-popover: 0 4px 16px rgba(15, 23, 42, 0.08), 0 20px 44px -6px rgba(15, 23, 42, 0.12);
    --shadow-modal: 0 12px 32px -4px rgba(9, 10, 15, 0.18), 0 32px 72px -8px rgba(9, 10, 15, 0.24), 0 0 0 1px rgba(15, 23, 42, 0.06);
    --shadow-seg: 0 1px 2px rgba(15, 23, 42, 0.06), 0 2px 6px rgba(15, 23, 42, 0.04);
    --focus-ring: 0 0 0 3px rgba(217, 107, 22, 0.16);
    --glass-filter: blur(16px) saturate(180%);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
    --dur-fast: 200ms;
}

[data-theme="dark"] {
    /* Matte Architectural Dark — Zero Neon Glows */
    --bg-body: #111215;
    --bg-surface: #18191D;
    --bg-elevated: #1E2025;
    --bg-subtle: #23252B;
    --bg-hover: #262830;
    --bg-input: #141519;

    --border-subtle: #27272A;
    --border-strong: #3F3F46;

    --text-primary: #F4F4F5;
    --text-secondary: #A1A1AA;
    --text-muted: #71717A;
    --ink-strong: #F4F4F5;
    --ink-inverse: #111215;

    --brand-accent: #F08832;
    --brand-accent-hover: #F59A4E;
    --vnd-orange: var(--brand-accent);
    --vnd-orange-soft: rgba(240, 136, 50, 0.14);
    --vnd-orange-border: rgba(240, 136, 50, 0.34);

    --emerald: #34D399;
    --emerald-soft: rgba(52, 211, 153, 0.12);
    --emerald-border: rgba(52, 211, 153, 0.26);

    --indigo: #818CF8;
    --indigo-soft: rgba(129, 140, 248, 0.12);
    --indigo-border: rgba(129, 140, 248, 0.26);

    --cyan: #38BDF8;
    --cyan-soft: rgba(56, 189, 248, 0.12);
    --cyan-border: rgba(56, 189, 248, 0.26);

    --amber: #FBBF24;
    --amber-soft: rgba(251, 191, 36, 0.12);
    --amber-border: rgba(251, 191, 36, 0.26);

    --rose: #FB7185;
    --rose-soft: rgba(251, 113, 133, 0.12);
    --rose-border: rgba(251, 113, 133, 0.26);

    --crimson: #F87171;

    --price-ceil: #C084FC;
    --price-up: #22C55E;
    --price-ref: #EAB308;
    --price-down: #F87171;
    --price-floor: #38BDF8;
    --up-green: #22C55E;
    --down-red: #F87171;
    --ref-yellow: #EAB308;

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.32), 0 8px 24px -4px rgba(0, 0, 0, 0.36);
    --shadow-card-hover: 0 6px 18px rgba(0, 0, 0, 0.45), 0 18px 42px -4px rgba(0, 0, 0, 0.52);
    --shadow-popover: 0 8px 24px rgba(0, 0, 0, 0.52), 0 24px 52px -6px rgba(0, 0, 0, 0.58);
    --shadow-modal: 0 16px 40px -4px rgba(0, 0, 0, 0.58), 0 36px 84px -8px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(255, 255, 255, 0.07);
    --shadow-seg: 0 1px 3px rgba(0, 0, 0, 0.44);
    --focus-ring: 0 0 0 3px rgba(240, 136, 50, 0.22);
    --glass-filter: blur(16px) saturate(180%);
}

/* ==========================================================================
   Base Reset & Editorial Typography
   ========================================================================== */

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

html {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

[hidden] {
    display: none !important;
}

/* Strict Tabular Numerals */
.num,
.num-col,
.metric-value,
.kpi-value,
.pct-main,
.pct-sub,
.ratio-val,
.calc-stat-val,
.wl-metric-val,
.hist-card-val,
.rank-val,
.tab-count,
.filter-count-badge,
.welcome-price-pill,
#welcomeStatNewsCount,
#welcomeStatUpcomingCount,
#welcomeStatWatchlistCount {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

/* ==========================================================================
   SVG Icon Contract (.icon-svg)
   ========================================================================== */

.icon-svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    stroke-width: 1.6;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    vertical-align: -2px;
    display: inline-block;
}

.icon-svg.icon-sm {
    width: 13px;
    height: 13px;
    vertical-align: -1.5px;
}

.icon-svg.icon-lg {
    width: 18px;
    height: 18px;
    vertical-align: -3px;
}

.icon-svg.icon-filled {
    fill: currentColor;
}

/* ==========================================================================
   A. Two-Row Editorial Header (.app-header)
   ========================================================================== */

.app-header {
    --header-px: 20px;
    position: sticky;
    top: 0;
    z-index: 60;
    background: rgba(255, 255, 255, 0.86);
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
}

[data-theme="dark"] .app-header {
    background: rgba(24, 25, 29, 0.86);
}

/* ── Row 1: brand + actions; Row 2: full-width nav ── */
.header-inner {
    max-width: 1520px;
    margin: 0 auto;
    padding: 0 var(--header-px);
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Row 1 wrapper */
.header-row1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    padding: 8px 0;
    min-height: 52px;
    flex-wrap: nowrap;
}

.header-left {
    display: flex;
    align-items: center;
    min-width: 0;
    flex-shrink: 0;
}

.brand-group {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    flex-shrink: 0;
    min-width: 0;
}

.brand-logo {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--brand-accent);
    color: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 15px;
    letter-spacing: -0.03em;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
}

.brand-logo svg {
    width: 16px;
    height: 16px;
    display: block;
}

.brand-titles {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    gap: 1px;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    white-space: nowrap;
}

.brand-source {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Legacy brand compatibility */
.brand-titles h1 {
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--vnd-orange-soft);
    color: var(--brand-accent);
    border: 1px solid var(--vnd-orange-border);
}

.brand-sub {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Integrated Primary Navigation (Full-Width Second Row) */
.header-nav {
    position: relative;
    width: calc(100% + var(--header-px) * 2);
    margin: 0 calc(var(--header-px) * -1);
    padding: 0 var(--header-px);
    height: 44px;
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    min-width: 0;
    border-top: 1px solid var(--border-subtle);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-padding-inline: var(--header-px);
}

.header-nav::-webkit-scrollbar {
    display: none;
}

.header-nav .tab-btn {
    position: relative;
    height: 39px;
    margin-top: 4px;
    padding: 0 12px;
    border: none;
    border-bottom: 2.5px solid transparent;
    border-radius: 6px 6px 0 0;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 12.75px;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
    transition: color var(--dur-fast) var(--ease-out),
                background-color var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out),
                transform 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.header-nav .tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    transform: translate3d(0, -1px, 0);
}

.header-nav .tab-btn:active {
    transform: translate3d(0, 0, 0) scale(0.97);
}

.header-nav .tab-btn:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--brand-accent);
}

.header-nav .tab-btn.active {
    color: var(--text-primary);
    font-weight: 700;
    border-bottom-color: var(--brand-accent);
    background: rgba(217, 107, 22, 0.055);
}

[data-theme="dark"] .header-nav .tab-btn.active {
    background: rgba(240, 136, 50, 0.09);
}

.header-nav .tab-btn.active:hover {
    background: rgba(217, 107, 22, 0.09);
}

[data-theme="dark"] .header-nav .tab-btn.active:hover {
    background: rgba(240, 136, 50, 0.14);
}

.header-nav.has-indicator .tab-btn.active {
    border-bottom-color: transparent;
}

.nav-active-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2.5px;
    border-radius: 999px;
    background: var(--brand-accent);
    box-shadow: 0 -1px 6px rgba(217, 107, 22, 0.28);
    pointer-events: none;
    will-change: transform, width;
    transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1),
                width 280ms cubic-bezier(0.22, 1, 0.36, 1),
                opacity 180ms ease;
    opacity: 0;
}

.nav-active-indicator.is-ready {
    opacity: 1;
}

@media (min-width: 1200px) {
    .header-nav {
        gap: 6px;
    }

    .header-nav .tab-btn {
        padding: 0 14px;
        font-size: 13px;
    }
}

/* Standalone / Sub-navigation fallback (.nav-tabs, .tab-list) */
.nav-tabs {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 8px;
    flex-wrap: wrap;
}

.tab-list {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 7px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--dur-fast) var(--ease-out);
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.tab-btn.active {
    background: var(--bg-subtle);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

.tab-count {
    font-family: var(--font-sans);
    font-size: 10.5px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 999px;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    line-height: 1.4;
    transition: all var(--dur-fast) var(--ease-out);
}

.header-nav .tab-btn.active .tab-count,
.tab-btn.active .tab-count {
    background: var(--ink-strong);
    color: var(--ink-inverse);
    border-color: var(--ink-strong);
}

@keyframes paneEnterRight {
    from {
        opacity: 0;
        transform: translate3d(18px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes paneEnterLeft {
    from {
        opacity: 0;
        transform: translate3d(-18px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes paneEnterFade {
    from {
        opacity: 0;
        transform: translate3d(0, 6px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes paneEnterReduced {
    from {
        opacity: 0.99;
        transform: none;
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes subViewFade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes subViewEnterRight {
    from {
        opacity: 0;
        transform: translate3d(14px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes subViewEnterLeft {
    from {
        opacity: 0;
        transform: translate3d(-14px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes subViewEnterFade {
    from {
        opacity: 0;
        transform: translate3d(0, 5px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.tab-pane.active.anim-from-right {
    animation: paneEnterRight 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
    will-change: transform, opacity;
}

.tab-pane.active.anim-from-left {
    animation: paneEnterLeft 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
    will-change: transform, opacity;
}

.tab-pane.active.anim-fade {
    animation: paneEnterFade 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
    will-change: transform, opacity;
}

/* Directional Sub-view Entrance Utilities (Company Modal 6 Tabs & Financial Sub-tabs) */
.subview-anim-right,
.fin-section-stack.subview-anim-right {
    animation: subViewEnterRight 230ms cubic-bezier(0.22, 1, 0.36, 1) both;
    will-change: transform, opacity;
}

.subview-anim-left,
.fin-section-stack.subview-anim-left {
    animation: subViewEnterLeft 230ms cubic-bezier(0.22, 1, 0.36, 1) both;
    will-change: transform, opacity;
}

.subview-anim-fade,
.fin-section-stack.subview-anim-fade {
    animation: subViewEnterFade 210ms cubic-bezier(0.22, 1, 0.36, 1) both;
    will-change: transform, opacity;
}

/* Header Right Utility Actions */
.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 6px;
    flex-shrink: 0;
}

.header-actions .btn-sm {
    padding: 0 8px;
    font-size: 12px;
}

@keyframes pulseLive {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 11.25px;
    font-weight: 500;
    white-space: nowrap;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--emerald);
    flex-shrink: 0;
    animation: pulseLive 2s ease-in-out infinite;
}

.live-pill.paused {
    color: var(--text-muted);
}

.live-pill.paused .pulse-dot {
    background: var(--text-muted);
    animation: none;
}

/* Header Responsive Breakpoints */
@media (max-width: 768px) {
    .app-header {
        --header-px: 16px;
    }

    .hide-sm {
        display: none !important;
    }

    #btnExportCsv,
    #btnAccount,
    #btnOpenWelcomeNews {
        width: 32px;
        padding: 0;
    }
}

@media (max-width: 760px) {
    .live-pill {
        display: none;
    }
}

@media (max-width: 560px) {
    .app-header {
        --header-px: 12px;
    }

    #selectLiveInterval {
        display: none;
    }

    .header-row1 {
        padding: 6px 0;
        min-height: 44px;
        gap: 6px;
    }

    .header-actions {
        gap: 5px;
    }

    .brand-group {
        gap: 8px;
    }

    .brand-name {
        font-size: 13.5px;
    }

    .header-nav {
        height: 40px;
    }

    .header-nav .tab-btn {
        height: 36px;
        margin-top: 3px;
        padding: 0 10px;
        font-size: 12.25px;
        gap: 5px;
    }

    #btnVndEco,
    #btnRefreshLive {
        padding: 0 8px;
        font-size: 12px;
    }
}

@media (max-width: 380px) {
    #btnRefreshLive span {
        display: none;
    }

    .brand-group {
        gap: 6px;
    }

    .brand-logo {
        width: 28px;
        height: 28px;
    }

    .brand-name {
        font-size: 13px;
    }

    .header-actions {
        gap: 3px;
    }

    #btnVndEco {
        height: 28px;
        padding: 0 6px;
        font-size: 11px;
        gap: 3px;
    }

    #btnExportCsv,
    #btnThemeToggle,
    #btnAccount,
    #btnOpenWelcomeNews,
    #btnRefreshLive {
        width: 28px;
        height: 28px;
        padding: 0;
    }
}

/* ==========================================================================
   Buttons, Popovers & Form Controls (60fps Micro-Interactions)
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                border-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1),
                opacity 220ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    transform: translate3d(0, -1px, 0);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

[data-theme="dark"] .btn:hover:not(:disabled) {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.32);
}

.btn:active:not(:disabled) {
    transform: translate3d(0, 0, 0) scale(0.97);
    box-shadow: none;
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

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

.btn-primary {
    background: var(--ink-strong);
    color: var(--ink-inverse);
    border-color: var(--ink-strong);
    font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
    background: var(--ink-strong);
    border-color: var(--ink-strong);
    opacity: 0.9;
}

.btn-accent {
    background: var(--brand-accent);
    color: #FFFFFF;
    border-color: var(--brand-accent);
    font-weight: 600;
}

.btn-accent:hover:not(:disabled) {
    background: var(--brand-accent-hover);
    border-color: var(--brand-accent-hover);
    color: #FFFFFF;
}

.btn-ghost {
    background: transparent;
    border-color: var(--border-subtle);
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled),
.btn-ghost[aria-expanded="true"],
.btn-ghost.active {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.btn-sm {
    height: 32px;
    padding: 0 10px;
    font-size: 12.5px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.btn-icon:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

/* Popover Dropdown (.popover-wrap, .popover-menu, .popover-item) */
.popover-wrap {
    position: relative;
    display: inline-flex;
}

.popover-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 256px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-popover);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    padding: 6px;
    z-index: 95;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-4px) scale(0.98);
    transform-origin: top right;
    transition: opacity 220ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
                visibility 220ms;
}

.popover-menu.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.popover-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-primary);
    transition: background-color 200ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.popover-item:hover {
    background: var(--bg-hover);
}

.popover-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.popover-item:hover .popover-item-title {
    color: var(--brand-accent);
}

.popover-item-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.35;
}

/* Inputs & Selects */
.input-box,
.select-box {
    height: 36px;
    padding: 0 11px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1),
                background-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.select-box {
    cursor: pointer;
    padding-right: 26px;
}

.input-box:hover,
.select-box:hover {
    border-color: var(--border-strong);
}

.input-box:focus,
.select-box:focus {
    border-color: var(--brand-accent);
    box-shadow: var(--focus-ring);
}

.select-compact,
.input-compact {
    height: 32px;
    padding: 0 7px;
    font-size: 11.5px;
}

/* ==========================================================================
   Main Container
   ========================================================================== */

.app-container {
    max-width: 1520px;
    margin: 0 auto;
    padding: 20px 20px 56px;
    overflow-x: clip;
}

@media (max-width: 680px) {
    .app-container {
        padding: 14px 14px 44px;
    }
}

/* ==========================================================================
   B. Apple/Linear Bento Grid Metric Ribbon (.metric-ribbon#kpiGrid & .kpi-card)
   ========================================================================== */

.metric-ribbon,
.metric-ribbon#kpiGrid,
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
    margin-bottom: 16px;
}

.kpi-card,
.metric-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    min-width: 0;
    transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 240ms cubic-bezier(0.22, 1, 0.36, 1),
                border-color 200ms ease,
                background-color 200ms ease;
}

.kpi-card:hover,
.metric-item:hover {
    transform: translate3d(0, -2px, 0);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--border-strong);
    background: var(--bg-surface);
}

.kpi-card:active,
.metric-item:active {
    transform: translate3d(0, 0, 0) scale(0.99);
}

.kpi-card.is-active,
.metric-item.is-active {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 1.5px var(--brand-accent), var(--shadow-card-hover);
    background: linear-gradient(180deg, var(--vnd-orange-soft) 0%, var(--bg-surface) 72%);
}

.kpi-card.is-active::before,
.metric-item.is-active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 18px;
    right: 18px;
    height: 2.5px;
    border-radius: 0 0 999px 999px;
    background: var(--brand-accent);
}

.metric-label,
.kpi-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.35;
    text-transform: none;
    letter-spacing: -0.005em;
}

.metric-value,
.kpi-value {
    font-family: var(--font-display);
    font-size: 25px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    line-height: 1.15;
}

.metric-meta,
.kpi-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: wrap;
}

.kpi-link,
.metric-link {
    color: var(--brand-accent);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.kpi-link:hover,
.metric-link:hover {
    text-decoration: underline;
}

@media (max-width: 1200px) {
    .metric-ribbon,
    .metric-ribbon#kpiGrid,
    .kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 760px) {
    .metric-ribbon,
    .metric-ribbon#kpiGrid,
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .kpi-card,
    .metric-item {
        padding: 14px 15px;
    }

    .metric-value,
    .kpi-value {
        font-size: 21px;
    }
}

@media (max-width: 420px) {
    .metric-ribbon,
    .metric-ribbon#kpiGrid,
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   C. Progressive-Disclosure Command & Filter Bar (.command-bar, .filter-bar)
   ========================================================================== */

.filter-bar,
.command-bar,
.control-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 11px 15px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow 240ms cubic-bezier(0.22, 1, 0.36, 1),
                border-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.filter-bar:hover,
.command-bar:hover,
.control-panel:hover {
    border-color: var(--border-strong);
}

.filter-bar:focus-within,
.command-bar:focus-within,
.control-panel:focus-within {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-card-hover);
}

.command-bar-row,
.control-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Instant Search Field with Shortcut Badge */
.search-field {
    position: relative;
    flex: 1 1 250px;
    min-width: 210px;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 11px;
    color: var(--text-muted);
    pointer-events: none;
    display: inline-flex;
    align-items: center;
}

.search-input {
    width: 100%;
    height: 36px;
    padding: 0 58px 0 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-subtle);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: background-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                border-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

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

.search-input:hover {
    border-color: var(--border-strong);
}

.search-input:focus {
    background: var(--bg-input);
    border-color: var(--brand-accent);
    box-shadow: var(--focus-ring);
}

.search-clear {
    position: absolute;
    right: 32px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color 200ms cubic-bezier(0.22, 1, 0.36, 1),
                color 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.search-clear:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.kbd-hint {
    position: absolute;
    right: 8px;
    height: 20px;
    min-width: 20px;
    padding: 0 5px;
    border-radius: 5px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    box-shadow: 0 1px 0 var(--border-subtle);
}

.control-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Editorial Segmented Control (.segmented, .seg-btn) */
.segmented {
    display: inline-flex;
    align-items: center;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 2px;
    min-height: 36px;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}

.segmented::-webkit-scrollbar {
    display: none;
}

.seg-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    height: 30px;
    padding: 0 11px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.seg-btn:hover {
    color: var(--text-primary);
    background: rgba(15, 23, 42, 0.03);
}

[data-theme="dark"] .seg-btn:hover {
    background: rgba(255, 255, 255, 0.04);
}

.seg-btn:active {
    transform: scale(0.97);
}

.seg-btn.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: var(--shadow-seg);
}

@media (max-width: 560px) {
    #yearModeGroup {
        width: 100%;
    }

    #yearModeGroup .seg-btn {
        flex: 1 1 auto;
        min-width: 0;
        padding: 0 6px;
        font-size: 11.5px;
        text-align: center;
    }
}

@media (max-width: 360px) {
    #yearModeGroup .seg-btn {
        font-size: 11px;
        padding: 3px 4px;
        white-space: normal;
        height: auto;
        min-height: 30px;
        line-height: 1.2;
    }
}

.filter-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--brand-accent);
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

/* Collapsible Advanced Tray */
.adv-filter-panel {
    display: none;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
}

.adv-filter-panel.open {
    display: flex;
    animation: fadeSlideIn 160ms var(--ease-out);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: none;
    letter-spacing: 0;
}

.search-wrap {
    flex: 1 1 240px;
    min-width: 220px;
}

.search-wrap .input-box {
    width: 100%;
}

.preset-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-reset-filters {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all var(--dur-fast) var(--ease-out);
}

.btn-reset-filters:hover {
    color: var(--brand-accent);
    background: var(--bg-hover);
    border-color: var(--border-subtle);
}

/* Subtle 1-Line Workspace Context Strip */
.workspace-meta-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 2px 4px 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.mode-caption,
.mode-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.mode-caption strong,
.mode-hint strong {
    color: var(--text-primary);
    font-weight: 600;
}

.sync-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    white-space: nowrap;
}

@media (max-width: 680px) {
    .sync-meta {
        white-space: normal;
        flex-wrap: wrap;
        row-gap: 2px;
    }

    .mode-caption,
    .mode-hint {
        align-items: flex-start;
    }
}

.meta-sep {
    opacity: 0.5;
}

/* Loading Banner */
.loading-banner {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px 20px;
    margin-bottom: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.loading-banner.show {
    display: flex;
}

.spinner {
    width: 17px;
    height: 17px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--brand-accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

/* ==========================================================================
   D. Watchlist Portfolio Summary Strip (.watchlist-strip)
   ========================================================================== */

.watchlist-strip {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 16px 18px;
    margin-bottom: 14px;
    display: none;
}

.watchlist-strip.open {
    display: block;
    animation: fadeSlideIn 180ms var(--ease-out);
}

.watchlist-strip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
}

.watchlist-strip-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.watchlist-lot-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12.5px;
    color: var(--text-secondary);
}

.wl-upcoming-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--vnd-orange-soft);
    color: var(--brand-accent);
    border: 1px solid var(--vnd-orange-border);
    font-size: 11.5px;
    font-weight: 600;
}

.watchlist-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

@media (max-width: 960px) {
    .watchlist-metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .watchlist-metrics-grid {
        grid-template-columns: 1fr;
    }
}

.wl-metric-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wl-metric-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.wl-metric-val {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.wl-metric-sub {
    font-size: 11.5px;
    color: var(--text-muted);
}

.wl-shares-input {
    width: 84px;
    height: 28px;
    padding: 0 8px;
    border-radius: 5px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 12px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    outline: none;
    transition: border-color var(--dur-fast) var(--ease-out);
}

.wl-shares-input:focus {
    border-color: var(--brand-accent);
    box-shadow: var(--focus-ring);
}

/* ==========================================================================
   E. Data Tables, Filter Pills & Badges (.surface-card, .data-table)
   ========================================================================== */

.surface-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: box-shadow 240ms cubic-bezier(0.22, 1, 0.36, 1),
                border-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.table-toolbar {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--bg-surface);
}

.quick-chips {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.chip,
.filter-pill,
.preset-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                border-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.preset-pills .chip,
.preset-pills .filter-pill,
.preset-pills .preset-pill {
    border-color: var(--border-subtle);
    background: var(--bg-elevated);
}

.chip:hover,
.filter-pill:hover,
.preset-pill:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: translate3d(0, -1px, 0);
}

.chip:active,
.filter-pill:active,
.preset-pill:active {
    transform: translate3d(0, 0, 0) scale(0.97);
}

.chip.active,
.filter-pill.active,
.preset-pill.active {
    background: var(--ink-strong);
    color: var(--ink-inverse);
    border-color: var(--ink-strong);
    font-weight: 600;
    box-shadow: var(--shadow-seg);
}

.toolbar-legend {
    font-size: 11.5px;
    color: var(--text-muted);
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    max-height: 700px;
    overflow-y: auto;
}

table.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1060px;
}

table.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: -0.005em;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    text-align: left;
    user-select: none;
    white-space: nowrap;
    transition: color var(--dur-fast) var(--ease-out);
}

table.data-table thead th.num-col {
    text-align: right;
}

table.data-table thead th.sortable {
    cursor: pointer;
}

table.data-table thead th.sortable:hover {
    color: var(--text-primary);
}

table.data-table thead th.sorted {
    color: var(--text-primary);
    font-weight: 700;
    box-shadow: inset 0 -2px 0 var(--text-primary);
}

.data-table tbody tr,
table.data-table tbody tr {
    transition: background-color 200ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.data-table tbody tr:hover,
table.data-table tbody tr:hover {
    background: var(--bg-hover);
}

table.data-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
    font-size: 13px;
    color: var(--text-primary);
}

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

table.data-table tbody td.num-col {
    text-align: right;
}

/* Stock Symbol Cell */
.stock-cell {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
}

.stock-top {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stock-code {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13.5px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    transition: color var(--dur-fast) var(--ease-out);
}

.stock-cell:hover .stock-code,
.rank-row:hover .stock-code,
.stock-code[data-open-code]:hover {
    color: var(--brand-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.floor-tag {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 4px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    line-height: 1.4;
    border: 1px solid transparent;
}

.floor-HOSE {
    background: #EFF6FF;
    color: #1D4ED8;
    border-color: rgba(29, 78, 216, 0.16);
}

.floor-HNX {
    background: #F5F3FF;
    color: #6D28D9;
    border-color: rgba(109, 40, 217, 0.16);
}

.floor-UPCOM {
    background: #F0FDFA;
    color: #0F766E;
    border-color: rgba(15, 118, 110, 0.16);
}

[data-theme="dark"] .floor-HOSE {
    background: rgba(59, 130, 246, 0.14);
    color: #93C5FD;
    border-color: rgba(147, 197, 253, 0.22);
}

[data-theme="dark"] .floor-HNX {
    background: rgba(168, 85, 247, 0.14);
    color: #D8B4FE;
    border-color: rgba(216, 180, 254, 0.22);
}

[data-theme="dark"] .floor-UPCOM {
    background: rgba(20, 184, 166, 0.14);
    color: #5EEAD4;
    border-color: rgba(94, 234, 212, 0.22);
}

.stock-name {
    font-size: 12px;
    color: var(--text-muted);
    max-width: 230px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Star Watchlist Button */
.star-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--border-strong);
    font-size: 15px;
    line-height: 1;
    padding: 4px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 140ms var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.star-btn:hover {
    color: var(--brand-accent);
    transform: scale(1.14);
}

.star-btn.starred {
    color: var(--brand-accent);
}

/* Percentage Cells, Micro Bars & Yield Pills */
.pct-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.pct-main {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.pct-sub {
    font-size: 11.5px;
    color: var(--text-muted);
}

.mini-bar-track {
    width: 64px;
    height: 3px;
    background: var(--bg-subtle);
    border-radius: 99px;
    overflow: hidden;
    margin-top: 2px;
}

.mini-bar-fill {
    height: 100%;
    border-radius: 99px;
}

.yield-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 12.5px;
}

.yield-high {
    background: var(--emerald-soft);
    color: var(--emerald);
    border: 1px solid var(--emerald-border);
}

.yield-mid {
    background: var(--vnd-orange-soft);
    color: var(--brand-accent);
}

.yield-low {
    color: var(--text-secondary);
    padding: 2px 0;
}

.total-pct-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 5px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
}

/* Event & Timeline Badges (Sentence Case) */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 500;
    text-transform: none;
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge-cash {
    background: var(--emerald-soft);
    color: var(--emerald);
    border-color: var(--emerald-border);
}

.badge-stock {
    background: var(--indigo-soft);
    color: var(--indigo);
    border-color: var(--indigo-border);
}

.badge-bonus {
    background: var(--cyan-soft);
    color: var(--cyan);
    border-color: var(--cyan-border);
}

.badge-issue {
    background: var(--amber-soft);
    color: var(--amber);
    border-color: var(--amber-border);
}

.badge-warn {
    background: var(--rose-soft);
    color: var(--rose);
    border-color: var(--rose-border);
}

.badge-meeting,
.badge-poll,
.badge-neutral {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    border-color: var(--border-subtle);
}

.tl-upcoming_exright {
    background: var(--vnd-orange-soft);
    color: var(--brand-accent);
    border-color: var(--vnd-orange-border);
    font-weight: 600;
}

.tl-waiting_payment {
    background: var(--cyan-soft);
    color: var(--cyan);
    border-color: var(--cyan-border);
}

.tl-delayed {
    background: var(--rose-soft);
    color: var(--rose);
    border-color: var(--rose-border);
}

.tl-done {
    background: var(--bg-subtle);
    color: var(--text-muted);
    border-color: var(--border-subtle);
}

/* Inline Ecosystem & Document Buttons */
.vnd-eco-links {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.eco-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 11.5px;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    transition: all var(--dur-fast) var(--ease-out);
}

.eco-link:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
    background: var(--bg-hover);
}

.eco-link-trade {
    background: var(--vnd-orange-soft);
    color: var(--brand-accent);
    border-color: var(--vnd-orange-border);
    font-weight: 600;
}

.eco-link-trade:hover {
    background: var(--brand-accent);
    color: #FFFFFF;
    border-color: var(--brand-accent);
}

.cbtt-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 11.5px;
    font-weight: 500;
    border: 1px solid var(--border-strong);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    margin-left: 6px;
    vertical-align: middle;
    transition: all var(--dur-fast) var(--ease-out);
}

.cbtt-btn:hover {
    border-color: var(--brand-accent);
    color: var(--brand-accent);
    background: var(--vnd-orange-soft);
}

/* Stock Price Colors & Live Tick Flash */
.price-ceil  { color: var(--price-ceil); font-weight: 700; }
.price-floor { color: var(--price-floor); font-weight: 700; }
.price-up    { color: var(--price-up); }
.price-down  { color: var(--price-down); }
.price-ref   { color: var(--price-ref); }

@keyframes flashUpAnim {
    0%   { background-color: rgba(21, 128, 61, 0.16); }
    100% { background-color: transparent; }
}

@keyframes flashDownAnim {
    0%   { background-color: rgba(220, 38, 38, 0.16); }
    100% { background-color: transparent; }
}

[data-theme="dark"] .flash-up {
    animation-name: flashUpAnimDark;
}

[data-theme="dark"] .flash-down {
    animation-name: flashDownAnimDark;
}

@keyframes flashUpAnimDark {
    0%   { background-color: rgba(34, 197, 94, 0.24); }
    100% { background-color: transparent; }
}

@keyframes flashDownAnimDark {
    0%   { background-color: rgba(248, 113, 113, 0.24); }
    100% { background-color: transparent; }
}

.flash-up {
    animation: flashUpAnim 1.2s ease-out;
}

.flash-down {
    animation: flashDownAnim 1.2s ease-out;
}

/* Table Pagination Footer */
.table-footer {
    padding: 11px 16px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--bg-elevated);
    font-size: 12.5px;
    color: var(--text-secondary);
}

.pager-btns {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   F. Upgraded Company Detail Modal (#companyModal) & News Reader (#newsModal)
   ========================================================================== */

@keyframes backdropFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: translate3d(0, 10px, 0) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes skeletonShimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton,
.skeleton-line,
.skeleton-pill,
.skeleton-box {
    background: linear-gradient(
        90deg,
        var(--bg-subtle) 25%,
        var(--bg-hover) 50%,
        var(--bg-subtle) 75%
    );
    background-size: 200% 100%;
    animation: skeletonShimmer 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    border-radius: 6px;
}

[data-theme="dark"] .skeleton,
[data-theme="dark"] .skeleton-line,
[data-theme="dark"] .skeleton-pill,
[data-theme="dark"] .skeleton-box {
    background: linear-gradient(
        90deg,
        var(--bg-subtle) 25%,
        #2E313B 50%,
        var(--bg-subtle) 75%
    );
    background-size: 200% 100%;
}

.modal-backdrop,
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(8px) saturate(160%);
    -webkit-backdrop-filter: blur(8px) saturate(160%);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

[data-theme="dark"] .modal-backdrop,
[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.72);
}

.modal-backdrop.open,
.modal-overlay.open,
.modal-overlay.is-open,
.modal-overlay.active {
    display: flex;
    animation: backdropFade 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-dialog {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 1160px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-modal);
    overflow: hidden;
    animation: modalEnter 240ms cubic-bezier(0.22, 1, 0.36, 1);
    transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 260ms cubic-bezier(0.22, 1, 0.36, 1),
                opacity 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--bg-surface);
    flex-wrap: wrap;
    flex-shrink: 0;
}

#newsModal .modal-header {
    align-items: flex-start;
    flex-wrap: nowrap;
}

#newsModal .modal-header > div:first-child {
    flex: 1;
    min-width: 0;
}

#newsModalTitle {
    word-break: break-word;
}

.modal-body {
    padding: 20px 22px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.modal-body > * {
    flex-shrink: 0;
    min-width: 0;
}

#companyModal .modal-body .surface-card,
#companyModal .modal-body .fin-section-card,
#companyModal .modal-body .fin-workspace-shell,
#companyModal .modal-body .fin-section-stack,
#companyModal .modal-body .dossier-card,
#companyModal .modal-body .profile-section-card,
#companyModal .modal-body .multiyear-chart-card {
    flex-shrink: 0;
    overflow: visible;
}

@media (max-width: 680px) {
    .modal-backdrop {
        padding: 10px;
    }

    .modal-header {
        padding: 14px 16px;
    }

    .modal-body {
        padding: 16px;
    }
}

@media (max-width: 600px) {
    #newsModal .modal-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    #newsModal .modal-header > div:first-child {
        flex: 1 1 100%;
    }

    #newsModal .modal-header > div:last-child {
        width: 100%;
        justify-content: space-between;
    }

    #newsModalTitle {
        font-size: 15.5px !important;
        line-height: 1.4 !important;
    }
}

@media (max-width: 560px) {
    .modal-backdrop {
        padding: 8px;
    }

    .modal-dialog {
        max-height: 94vh;
    }

    .modal-header {
        padding: 12px 14px;
        gap: 10px;
    }

    .modal-body {
        padding: 12px 14px;
        gap: 12px;
    }

    #companyModal .modal-header {
        position: relative;
        padding: 12px 14px;
        gap: 8px;
    }

    #companyModal .modal-company-trigger {
        width: 100%;
        min-width: 0;
        padding: 2px 38px 2px 4px;
        margin: -2px 0 -2px -4px;
        gap: 10px;
    }

    #companyModal .company-logo-thumb {
        width: 34px;
        height: 34px;
    }

    #companyModal #modalTitle {
        font-size: 17px !important;
    }

    #companyModal .profile-switch-pill {
        font-size: 10.5px;
        padding: 2px 7px;
    }

    #companyModal .modal-header > div:last-child {
        width: 100%;
        gap: 5px !important;
    }

    #companyModal .modal-header > div:last-child .btn-sm {
        height: 28px;
        padding: 0 8px;
        font-size: 11.5px;
        gap: 4px;
    }

    #companyModal .modal-header > div:last-child .star-btn {
        width: 28px;
        height: 28px;
    }

    #companyModal #btnCloseModal {
        position: absolute;
        top: 10px;
        right: 12px;
        width: 30px;
        height: 30px;
    }
}

.close-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                border-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.close-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
    transform: translate3d(0, -1px, 0);
}

.close-btn:active {
    transform: translate3d(0, 0, 0) scale(0.95);
}

/* Header Identity Trigger */
.modal-company-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 4px 8px;
    margin: -4px -8px;
    border-radius: var(--radius-sm);
    transition: background var(--dur-fast) var(--ease-out);
}

.modal-company-trigger:hover {
    background: var(--bg-hover);
}

#modalTitle {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    transition: color var(--dur-fast) var(--ease-out);
}

.modal-company-trigger:hover #modalTitle {
    color: var(--brand-accent);
}

.company-logo-thumb {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    object-fit: contain;
    background: #FFFFFF;
    padding: 3px;
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.profile-switch-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 500;
    transition: all var(--dur-fast) var(--ease-out);
}

.modal-company-trigger:hover .profile-switch-pill {
    border-color: var(--vnd-orange-border);
    color: var(--brand-accent);
    background: var(--vnd-orange-soft);
}

/* Modal Sub-bar & Consistency Badge */
.modal-subbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 10px;
}

.modal-subtabs {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.subtab-btn,
.modal-subtabs .tab-btn {
    height: 30px;
    padding: 0 12px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.subtab-btn:hover,
.modal-subtabs .tab-btn:hover {
    color: var(--text-primary);
    background: rgba(15, 23, 42, 0.03);
}

[data-theme="dark"] .subtab-btn:hover,
[data-theme="dark"] .modal-subtabs .tab-btn:hover {
    background: rgba(255, 255, 255, 0.04);
}

.subtab-btn:active,
.modal-subtabs .tab-btn:active {
    transform: scale(0.97);
}

.subtab-btn.active,
.modal-subtabs .tab-btn.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: var(--shadow-seg);
}

.consistency-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 999px;
    background: var(--emerald-soft);
    color: var(--emerald);
    border: 1px solid var(--emerald-border);
    font-size: 12px;
    font-weight: 600;
}

.consistency-badge.tier-moderate,
.consistency-badge.consistency-moderate {
    background: var(--vnd-orange-soft);
    color: var(--brand-accent);
    border-color: var(--vnd-orange-border);
}

.consistency-badge.neutral,
.consistency-badge.tier-irregular,
.consistency-badge.tier-none,
.consistency-badge.consistency-irregular,
.consistency-badge.consistency-none {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    border-color: var(--border-subtle);
    font-weight: 500;
}

@media (max-width: 600px) {
    .modal-subbar {
        gap: 8px;
        padding-bottom: 8px;
    }

    .modal-subtabs {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 3px;
        padding: 3px;
    }

    .subtab-btn,
    .modal-subtabs .tab-btn {
        flex: 1 1 auto;
        justify-content: center;
        height: auto;
        min-height: 28px;
        padding: 4px 8px;
        font-size: 11.5px;
        gap: 4px;
        white-space: nowrap;
    }

    .consistency-badge {
        font-size: 11px;
        padding: 3px 9px;
        flex-wrap: wrap;
    }
}

/* 4-Column Editorial History Summary */
.history-5y-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

@media (max-width: 760px) {
    .history-5y-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .history-5y-grid {
        grid-template-columns: 1fr;
    }
}

.hist-year-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 13px 15px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hist-year-card.highlight {
    background: var(--vnd-orange-soft);
    border-color: var(--vnd-orange-border);
}

.hist-card-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.hist-card-val {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.hist-year-card.highlight .hist-card-val {
    color: var(--brand-accent);
}

.hist-card-sub {
    font-size: 11.5px;
    color: var(--text-muted);
}

/* Multi-Year Visual Stacked SVG Bar Chart */
.multiyear-chart-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 18px;
}

.multiyear-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.multiyear-chart-title {
    font-family: var(--font-display);
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
}

.chart-legend {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    font-size: 12px;
    color: var(--text-secondary);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 2px;
    flex-shrink: 0;
}

.legend-dot.cash {
    background: var(--emerald);
}

.legend-dot.stock {
    background: var(--indigo);
}

.legend-dot.issue {
    background: var(--amber);
}

.multiyear-svg-wrap {
    width: 100%;
    overflow-x: auto;
}

.multiyear-svg {
    width: 100%;
    height: auto;
    max-height: 205px;
    display: block;
    overflow: visible;
}

.chart-gridline {
    stroke: var(--border-subtle);
    stroke-width: 1;
    stroke-dasharray: 3 3;
}

.chart-axis-label {
    fill: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.chart-bar-val {
    fill: var(--text-primary);
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.multiyear-svg rect {
    transition: opacity var(--dur-fast) ease;
}

.multiyear-svg g:hover rect {
    opacity: 0.85;
}

/* Modal Controls Bar & Consolidated Multi-Year Table */
.modal-controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

.year-summary-row {
    cursor: pointer;
    font-weight: 600;
}

.year-summary-row:hover {
    background: var(--bg-hover) !important;
}

.year-expand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    margin-right: 4px;
    vertical-align: -2px;
    transition: transform var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.year-summary-row:hover .year-expand-icon {
    color: var(--brand-accent);
}

.year-summary-row.expanded .year-expand-icon {
    transform: rotate(90deg);
    color: var(--brand-accent);
}

.year-sub-row {
    display: none;
    background: var(--bg-elevated);
}

.year-sub-row.open {
    display: table-row;
}

.year-sub-row td {
    padding: 8px 14px !important;
    font-size: 12.5px !important;
    color: var(--text-secondary);
    border-bottom: 1px dashed var(--border-subtle) !important;
}

.grand-total-row td {
    position: sticky;
    bottom: 0;
    z-index: 8;
    background: var(--bg-elevated);
    border-top: 2px solid var(--text-primary) !important;
    font-weight: 700 !important;
    padding: 12px 14px !important;
    color: var(--text-primary);
}

/* Company Profile & Stock Ratios Sub-tab */
.profile-grid-2col {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 16px;
}

@media (max-width: 880px) {
    .profile-grid-2col {
        grid-template-columns: 1fr;
    }
}

.profile-section-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
}

.profile-section-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.ratio-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

@media (max-width: 560px) {
    .ratio-metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.ratio-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

.ratio-label {
    font-size: 11.5px;
    color: var(--text-secondary);
    font-weight: 500;
}

.ratio-val {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    margin-top: 3px;
    color: var(--text-primary);
}

.range-52w-wrap {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

.range-52w-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11.5px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.range-52w-track {
    height: 6px;
    background: var(--bg-subtle);
    border-radius: 99px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.range-52w-fill {
    height: 100%;
    background: var(--brand-accent);
    border-radius: 99px;
}

.info-kv-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
}

.info-kv-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.info-kv-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.info-kv-key {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ==========================================================================
   G. Analytics, Calculator & News Feed (Wozber Editorial Refinement)
   ========================================================================== */

/* Analytics Grid & Rankings */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.analytics-grid > * {
    min-width: 0;
}

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

.chart-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    box-shadow: var(--shadow-card);
    min-width: 0;
    overflow: hidden;
}

/* Overflow-safe wrapper & compact card-fitted table (fixes horizontal bleed in Analytics / BCTC) */
.card-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table.card-fit-table {
    width: 100%;
    min-width: 0 !important;
    border-collapse: collapse;
    border-spacing: 0;
}

table.card-fit-table thead th {
    position: static;
    padding: 9px 7px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    white-space: normal;
    vertical-align: bottom;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
    text-align: left;
}

table.card-fit-table thead th.num-col {
    text-align: right;
}

table.card-fit-table tbody td {
    padding: 9px 7px;
    font-size: 12.5px;
    line-height: 1.35;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

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

table.card-fit-table tbody td.num-col {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.chart-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.chart-title {
    font-family: var(--font-display);
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--text-primary);
}

.chart-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.rank-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rank-row {
    display: grid;
    grid-template-columns: 28px 115px 1fr 86px;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease-out);
}

.rank-row:hover {
    background: var(--bg-hover);
}

.rank-idx {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
}

.rank-track {
    height: 8px;
    background: var(--bg-subtle);
    border-radius: 99px;
    overflow: hidden;
}

.rank-fill {
    height: 100%;
    border-radius: 99px;
    background: var(--brand-accent);
}

.rank-val {
    text-align: right;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13px;
}

/* Monthly Vertical Stacked Chart */
.monthly-chart-wrap {
    height: 230px;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 8px;
    align-items: end;
    padding-top: 24px;
}

.m-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    height: 100%;
    justify-content: flex-end;
}

.m-stack {
    width: 100%;
    max-width: 30px;
    display: flex;
    flex-direction: column-reverse;
    border-radius: 4px 4px 2px 2px;
    overflow: hidden;
    background: var(--bg-subtle);
}

.m-seg-cash  { background: var(--emerald); }
.m-seg-stock { background: var(--indigo); }
.m-seg-issue { background: var(--amber); }

.m-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.m-label {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-muted);
}

@media (max-width: 560px) {
    .chart-card {
        padding: 14px;
    }

    .rank-row {
        grid-template-columns: 20px 88px 1fr 62px;
        gap: 6px;
        padding: 6px 4px;
    }

    .rank-row > div {
        display: flex;
        align-items: center;
        gap: 4px;
        min-width: 0;
        white-space: nowrap;
    }

    .rank-row .stock-code {
        font-size: 12.5px;
    }

    .rank-row .floor-tag {
        font-size: 9px;
        padding: 1px 4px;
    }

    .rank-val {
        font-size: 12px;
    }

    .monthly-chart-wrap {
        gap: 3px;
        height: 205px;
        padding-top: 18px;
    }

    .m-col {
        gap: 4px;
        min-width: 0;
    }

    .m-stack {
        max-width: 20px;
    }

    .m-count {
        font-size: 9.5px;
        line-height: 1;
        letter-spacing: -0.02em;
    }

    .m-label {
        font-size: 10px;
        line-height: 1.1;
        letter-spacing: -0.02em;
        white-space: nowrap;
    }
}

/* Dividend Calculator */
.calc-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 18px;
    align-items: start;
}

@media (max-width: 960px) {
    .calc-layout {
        grid-template-columns: 1fr;
    }
}

.calc-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.calc-result-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

@media (max-width: 600px) {
    .calc-result-grid {
        grid-template-columns: 1fr;
    }
}

.calc-stat-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.calc-stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.calc-stat-val {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

/* News Feed & Disclosure Reader */
.news-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 16px;
}

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

.news-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.news-card:hover {
    border-color: var(--border-strong);
    background: var(--bg-elevated);
}

.news-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 11.5px;
    color: var(--text-muted);
}

.news-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.45;
    letter-spacing: -0.01em;
}

.news-card:hover .news-title {
    color: var(--brand-accent);
}

.news-abstract {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-tags {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 6px;
    border-top: 1px solid var(--border-subtle);
}

.tag-code-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 11.5px;
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease-out);
}

.tag-code-pill:hover {
    border-color: var(--vnd-orange-border);
    background: var(--vnd-orange-soft);
    color: var(--brand-accent);
}

.pdf-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--rose-soft);
    color: var(--rose);
    border: 1px solid var(--rose-border);
    font-size: 11px;
    font-weight: 600;
}

.attachments-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.attachments-title {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.news-article-content {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
}

.news-article-content p {
    margin-bottom: 12px;
}

.news-article-content a {
    color: var(--brand-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.news-article-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 10px 0;
    border: 1px solid var(--border-subtle);
}

.news-article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 13px;
}

.news-article-content td,
.news-article-content th {
    border: 1px solid var(--border-subtle);
    padding: 7px 10px;
}

.empty-state {
    padding: 44px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ==========================================================================
   H. Báo cáo tài chính (Financial Statements) & ROA/ROE/ROI Editorial Cards
   ========================================================================== */

.fin-workspace-shell {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.fin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 18px;
}

.fin-ticker-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.fin-code-input {
    width: 108px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.fin-quick-tickers {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.fin-controls-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.fin-header-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
}

.fin-sector-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.fin-capacity-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
}

@media (max-width: 1120px) {
    .fin-capacity-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .fin-capacity-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.fin-cap-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    min-width: 0;
}

.fin-cap-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.35;
    margin-bottom: 4px;
    white-space: normal;
    overflow-wrap: break-word;
}

.fin-cap-val {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.25;
}

.fin-cap-sub {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 3px;
}

.fin-ratios-ribbon {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-subtle);
}

@media (max-width: 1024px) {
    .fin-ratios-ribbon {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .fin-ratios-ribbon {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.fin-ratio-pill-box {
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}

.fin-cafef-keybar {
    display: flex;
    align-items: center;
    gap: 8px 18px;
    flex-wrap: wrap;
    padding: 9px 18px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    font-size: 12.5px;
    color: var(--text-primary);
}

.fin-keybar-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.fin-keybar-lbl {
    color: var(--text-secondary);
    font-weight: 500;
}

.fin-chart-wrap {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
}

.fin-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.fin-subtabs-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-subtle);
}

.fin-table {
    width: 100%;
    min-width: 680px;
    border-collapse: separate;
    border-spacing: 0;
}

.fin-table thead th {
    padding: 10px 12px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
    text-align: right;
    white-space: nowrap;
}

.fin-table thead th:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 6;
    min-width: 280px;
}

.fin-table thead th.col-latest {
    color: var(--brand-accent);
    background: var(--vnd-orange-soft);
}

.fin-table tbody td {
    padding: 9px 12px;
    font-size: 12.5px;
    border-bottom: 1px solid var(--border-subtle);
    text-align: right;
    vertical-align: top;
    font-variant-numeric: tabular-nums;
}

.fin-table tbody td:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 4;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    font-variant-numeric: normal;
}

.fin-table tbody td.col-latest {
    background: rgba(217, 107, 22, 0.035);
    font-weight: 600;
}

[data-theme="dark"] .fin-table tbody td.col-latest {
    background: rgba(240, 136, 50, 0.055);
}

.fin-table tbody tr.row-total td {
    background: var(--bg-elevated);
    font-weight: 700;
    color: var(--text-primary);
}

.fin-table tbody tr.row-total td:first-child {
    background: var(--bg-elevated);
}

.fin-table tbody tr.row-total td.col-latest {
    background: linear-gradient(rgba(217, 107, 22, 0.06), rgba(217, 107, 22, 0.06)), var(--bg-surface);
}

[data-theme="dark"] .fin-table tbody tr.row-total td.col-latest {
    background: linear-gradient(rgba(240, 136, 50, 0.095), rgba(240, 136, 50, 0.095)), var(--bg-elevated);
}

.fin-table tbody tr.row-sub td {
    font-weight: 600;
    color: var(--text-primary);
}

.fin-table tbody tr.row-indent td:first-child {
    padding-left: 24px;
    color: var(--text-secondary);
}

.fin-table tbody tr:hover td {
    background: var(--bg-hover);
}

.fin-yoy {
    display: block;
    font-size: 10.5px;
    font-weight: 500;
    margin-top: 2px;
    line-height: 1.1;
}

.fin-yoy.up {
    color: var(--emerald);
}

.fin-yoy.down {
    color: var(--crimson);
}

.fin-yoy.flat {
    color: var(--text-muted);
}

.fin-pdf-strip {
    padding: 14px 18px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
}

.fin-pdf-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.fin-pdf-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    max-width: 100%;
    transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.fin-pdf-link:hover {
    border-color: var(--brand-accent);
    color: var(--brand-accent);
}

.fin-pdf-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 340px;
}

.ratio-inline-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.ratio-good {
    background: rgba(16, 185, 129, 0.12);
    color: var(--emerald);
}

.ratio-mid {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.ratio-low {
    background: rgba(220, 38, 38, 0.1);
    color: var(--crimson);
}

.calc-health-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
}

@media (max-width: 720px) {
    .calc-health-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.toggle-yoy-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.toggle-yoy-label input {
    accent-color: var(--brand-accent);
}

@media (max-width: 640px) {
    .fin-table thead th:first-child {
        min-width: 168px;
        max-width: 184px;
        white-space: normal;
    }

    .fin-table tbody td:first-child {
        max-width: 184px;
    }
}

/* ==========================================================================
   I. CafeF-Inspired Stacked BCTC Summary View + Growth Sparklines
   ========================================================================== */

.btn-export-excel {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid #166534;
    background: #15803d;
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.btn-export-excel:hover {
    background: #166534;
}

.fin-cafef-subbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 0 18px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}

.fin-cafef-tabs {
    display: flex;
    align-items: stretch;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-top: 2px;
}

.fin-cafef-tabs::-webkit-scrollbar {
    display: none;
}

.fin-cafef-tab {
    position: relative;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 11px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
    border-bottom: 2px solid transparent;
    border-radius: 6px 6px 0 0;
    transition: color var(--dur-fast) var(--ease-out),
                background-color var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out),
                box-shadow var(--dur-fast) var(--ease-out),
                transform 150ms cubic-bezier(0.22, 1, 0.36, 1);
}

.fin-cafef-tab:hover {
    color: var(--text-primary);
    transform: translate3d(0, -1px, 0);
}

.fin-cafef-tab:not(.active):hover {
    background: var(--bg-hover);
}

.fin-cafef-tab:active {
    transform: translate3d(0, 0, 0) scale(0.97);
}

.fin-cafef-tab:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--brand-accent);
}

.fin-cafef-tab.active {
    background: #0f3a65;
    color: #ffffff;
    border-bottom-color: #0f3a65;
    border-radius: 6px 6px 0 0;
    box-shadow: 0 2px 6px rgba(15, 58, 101, 0.18);
}

[data-theme="dark"] .fin-cafef-tab.active {
    background: var(--brand-accent);
    color: var(--ink-inverse);
    border-bottom-color: var(--brand-accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.32);
}

.fin-quick-jump {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-muted);
    padding: 6px 0;
}

.fin-jump-pill {
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}

.fin-jump-pill:hover {
    border-color: var(--brand-accent);
    color: var(--brand-accent);
}

.fin-section-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 18px;
    background: var(--bg-subtle);
    animation: subViewFade 180ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (max-width: 640px) {
    .fin-section-stack {
        padding: 10px 8px;
        gap: 12px;
    }
}

.fin-section-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    scroll-margin-top: 108px;
}

@media (max-width: 560px) {
    .fin-section-card {
        scroll-margin-top: 140px;
    }
}

.fin-sec-title {
    color: var(--crimson) !important;
    font-family: var(--font-display);
    font-size: 14px !important;
    font-weight: 700 !important;
    background: var(--bg-surface) !important;
}

.fin-pager-th {
    width: 30px;
    min-width: 30px;
    padding: 6px 4px !important;
    text-align: center !important;
    background: var(--bg-surface) !important;
}

.fin-pager-btn {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.fin-pager-btn:hover:not(:disabled) {
    border-color: var(--brand-accent);
    color: var(--brand-accent);
}

.fin-pager-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.fin-pager-spacer {
    width: 30px;
    min-width: 30px;
    padding: 0 4px !important;
}

.fin-th-main {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
}

.fin-th-sub {
    display: block;
    font-size: 10.5px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 1px;
}

.fin-table thead th.col-latest .fin-th-sub {
    color: var(--text-secondary);
}

.col-group-split {
    border-left: 2px solid var(--border-strong) !important;
}

.fin-table td.val-neg,
.fin-table tbody tr.row-total td.val-neg,
.fin-table tbody tr.row-sub td.val-neg {
    color: var(--crimson);
}

.fin-spark-th {
    text-align: center !important;
    min-width: 78px;
    width: 78px;
}

.fin-spark-cell {
    text-align: center !important;
    vertical-align: middle !important;
    padding: 6px 8px !important;
}

.fin-spark-bars {
    display: inline-flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    height: 22px;
}

.fin-spark-bars.is-mixed {
    align-items: stretch;
    height: 24px;
}

.fin-spark-col {
    width: 7px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
}

.fin-spark-bars.is-mixed .fin-spark-col {
    justify-content: center;
}

.fin-spark-half {
    width: 100%;
    height: 50%;
    display: flex;
    justify-content: center;
}

.fin-spark-half.top {
    align-items: flex-end;
    border-bottom: 1px solid var(--border-subtle);
}

.fin-spark-half.bot {
    align-items: flex-start;
}

.fin-spark-up {
    width: 100%;
    background: var(--emerald);
    border-radius: 1.5px 1.5px 0 0;
    min-height: 2px;
}

.fin-spark-up.is-quarter {
    background: var(--brand-accent);
}

.fin-spark-down {
    width: 100%;
    background: var(--crimson);
    border-radius: 0 0 1.5px 1.5px;
    min-height: 2px;
}

.fin-spark-zero {
    width: 100%;
    height: 2px;
    background: var(--border-strong);
    border-radius: 1px;
}

/* ==========================================================================
   J. CafeF-Inspired 6 Company Dossier Tabs & Components
   (Tổng quan · Thông tin cơ bản · Ban lãnh đạo & Sở hữu · Tài chính · Tin tức · Tài liệu)
   ========================================================================== */

.company-6tabs-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 1px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 100%;
    min-width: 0;
    flex: 1 1 auto;
}

.company-6tabs-bar::-webkit-scrollbar {
    display: none;
}

.company-6tab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border-radius: 8px 8px 6px 6px;
    border: 1px solid #D0E1FD;
    background: #E8F0FE;
    color: #1E3A5F;
    font-family: var(--font-display);
    font-size: 12.75px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
    transition: background-color var(--dur-fast) var(--ease-out),
                color var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out),
                box-shadow var(--dur-fast) var(--ease-out),
                transform 150ms cubic-bezier(0.22, 1, 0.36, 1);
}

.company-6tab-btn:hover {
    background: #D8E6FD;
    color: #0F294A;
    border-color: #B6D0FB;
    transform: translate3d(0, -1px, 0);
}

.company-6tab-btn:active {
    transform: translate3d(0, 0, 0) scale(0.97);
}

.company-6tab-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--brand-accent);
}

.company-6tab-btn.active {
    background: #0F3A65;
    color: #FFFFFF;
    border-color: #0F3A65;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(15, 58, 101, 0.22);
}

[data-theme="dark"] .company-6tab-btn {
    background: #1E293B;
    color: #E2E8F0;
    border-color: #334155;
}

[data-theme="dark"] .company-6tab-btn:hover {
    background: #283548;
    color: #F8FAFC;
    border-color: #475569;
}

[data-theme="dark"] .company-6tab-btn.active {
    background: var(--brand-accent);
    color: var(--ink-inverse);
    border-color: var(--brand-accent);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

@media (max-width: 640px) {
    .company-6tabs-bar {
        width: 100%;
        gap: 5px;
        padding-bottom: 2px;
    }

    .company-6tab-btn {
        height: 32px;
        padding: 0 11px;
        font-size: 12px;
    }
}

/* Dossier 2-Column Grid, Cards & Section Titles */
.dossier-grid-2col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

.dossier-grid-2col > * {
    min-width: 0;
}

@media (max-width: 880px) {
    .dossier-grid-2col {
        grid-template-columns: 1fr;
    }
}

.dossier-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    box-shadow: var(--shadow-card);
    min-width: 0;
}

@media (max-width: 560px) {
    .dossier-card {
        padding: 13px 14px;
    }
}

.dossier-sec-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px 0;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.info-kv-row > * {
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

@media (max-width: 480px) {
    .info-kv-row {
        grid-template-columns: 118px 1fr;
        gap: 8px;
    }
}

/* Company History, Business Lines, Market Position & Strategy HTML Notes */
.company-note-block {
    font-size: 13.25px;
    line-height: 1.68;
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--brand-accent);
    border-radius: var(--radius-sm);
    padding: 12px 15px;
    overflow-wrap: break-word;
    word-break: break-word;
}

.company-note-block + .company-note-block {
    margin-top: 10px;
}

.company-note-block p {
    margin: 0 0 8px 0;
}

.company-note-block p:last-child {
    margin-bottom: 0;
}

.company-note-block ul,
.company-note-block ol {
    margin: 6px 0 10px 18px;
    padding: 0;
}

.company-note-block li {
    margin-bottom: 5px;
    line-height: 1.62;
}

.company-note-block li:last-child {
    margin-bottom: 0;
}

.company-note-block strong,
.company-note-block b {
    color: var(--text-primary);
    font-weight: 600;
}

.company-note-block a {
    color: var(--brand-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.company-note-block table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 12.5px;
}

.company-note-block th,
.company-note-block td {
    border: 1px solid var(--border-subtle);
    padding: 6px 8px;
    text-align: left;
}

/* Stacked Ownership Bar & Legend (State / Foreign / Domestic / Treasury) */
.ownership-bar-track {
    width: 100%;
    height: 14px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    overflow: hidden;
    display: flex;
    align-items: stretch;
    margin: 10px 0 12px;
}

.ownership-seg {
    height: 100%;
    min-width: 2px;
    transition: width 260ms var(--ease-out), opacity var(--dur-fast) ease;
}

.ownership-seg:hover {
    opacity: 0.88;
}

.ownership-seg.seg-state,
.ownership-seg.state {
    background: var(--brand-accent);
}

.ownership-seg.seg-foreign,
.ownership-seg.foreign {
    background: var(--indigo);
}

.ownership-seg.seg-domestic,
.ownership-seg.domestic {
    background: var(--emerald);
}

.ownership-seg.seg-treasury,
.ownership-seg.treasury {
    background: var(--amber);
}

.ownership-seg.seg-other,
.ownership-seg.other {
    background: var(--cyan);
}

.ownership-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

.ownership-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ownership-dot {
    width: 9px;
    height: 9px;
    border-radius: 2px;
    flex-shrink: 0;
    display: inline-block;
}

/* Leadership Group Grid & Officer Cards */
.leader-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
    gap: 12px;
}

@media (max-width: 560px) {
    .leader-group-grid {
        grid-template-columns: 1fr;
    }
}

.leader-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 7px;
    min-width: 0;
    transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.leader-card:hover {
    border-color: var(--border-strong);
    background: var(--bg-hover);
}

.leader-name {
    font-family: var(--font-display);
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
}

.leader-role,
.leader-pos {
    font-size: 12px;
    font-weight: 600;
    color: var(--brand-accent);
    line-height: 1.35;
}

.leader-meta {
    font-size: 11.5px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 6px;
    border-top: 1px dashed var(--border-subtle);
}

/* Inline Shareholder Ownership Bar */
.shareholder-bar-inline {
    display: inline-block;
    vertical-align: middle;
    width: 68px;
    height: 6px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    overflow: hidden;
    margin-left: 6px;
}

.shareholder-bar-inline > span,
.shareholder-bar-inline > div,
.shareholder-bar-fill {
    display: block;
    height: 100%;
    background: var(--brand-accent);
    border-radius: 999px;
}

.shareholder-bar-inline:has(.forecast-progress-track, .shareholder-bar-track) {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    width: auto;
    height: auto;
    background: transparent;
    border: none;
    overflow: visible;
    margin-left: 0;
}

.shareholder-bar-track {
    width: 68px;
    height: 6px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    overflow: hidden;
    flex-shrink: 0;
}

/* Shareholder Quick Filter Pills & 6-Column Detail Table */
.sh-filter-pills {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    padding: 8px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

.sh-filter-pills .filter-pill {
    padding: 4px 10px;
    font-size: 12px;
    border-color: var(--border-subtle);
    background: var(--bg-surface);
    color: var(--text-secondary);
}

.sh-filter-pills .filter-pill:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.sh-filter-pills .filter-pill.active {
    background: var(--ink-strong);
    color: var(--ink-inverse);
    border-color: var(--ink-strong);
}

.sh-filter-pills .sh-filter-count {
    font-size: 11px;
    opacity: 0.78;
}

@media (max-width: 560px) {
    .sh-filter-pills {
        padding: 7px 8px;
        gap: 5px;
    }

    .sh-filter-pills .filter-pill {
        padding: 4px 8px;
        font-size: 11.5px;
    }
}

table.data-table.sh-detail-table {
    min-width: 780px;
}

table.data-table.sh-detail-table thead th:nth-child(1) {
    min-width: 210px;
}

table.data-table.sh-detail-table thead th:nth-child(2) {
    min-width: 155px;
}

table.data-table.sh-detail-table thead th:nth-child(3) {
    min-width: 195px;
}

table.data-table.sh-detail-table thead th:nth-child(4),
table.data-table.sh-detail-table thead th:nth-child(5),
table.data-table.sh-detail-table thead th:nth-child(6) {
    white-space: nowrap;
}

table.data-table.sh-detail-table tbody td {
    vertical-align: top;
    padding: 11px 12px;
}

.sh-name-cell {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.sh-name-text {
    font-weight: 600;
    font-size: 13px;
    line-height: 1.38;
    color: var(--text-primary);
    overflow-wrap: break-word;
}

.sh-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 5px;
}

.sh-meta-row .badge {
    padding: 1px 7px;
    font-size: 11px;
    line-height: 1.45;
}

.sh-type-tag {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.sh-pos-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}

.sh-pos-item {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 5px;
    line-height: 1.35;
}

.sh-pos-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 5px;
    background: var(--vnd-orange-soft);
    border: 1px solid var(--vnd-orange-border);
    color: var(--brand-accent);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.35;
}

.sh-pos-group {
    display: inline-flex;
    align-items: center;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 1px 5px;
    white-space: nowrap;
}

.sh-rel-list {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}

.sh-rel-line {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 6px;
    font-size: 12.25px;
    line-height: 1.42;
    color: var(--text-secondary);
}

.sh-rel-officer {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--indigo-soft);
    border: 1px solid var(--indigo-border);
    color: var(--indigo);
    font-size: 11.25px;
    font-weight: 600;
    white-space: nowrap;
}

.sh-empty-val {
    color: var(--text-muted);
    font-size: 12.5px;
    user-select: none;
}

/* Business Plan / Forecast Progress Track & Fill */
.forecast-progress-track {
    width: 100%;
    min-width: 64px;
    max-width: 130px;
    height: 6px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
}

.forecast-progress-fill {
    display: block;
    height: 100%;
    background: var(--emerald);
    border-radius: 999px;
    transition: width 240ms var(--ease-out);
}

.forecast-progress-fill.is-over,
.forecast-progress-fill.high {
    background: var(--emerald);
}

.forecast-progress-fill.is-mid,
.forecast-progress-fill.mid {
    background: var(--brand-accent);
}

.forecast-progress-fill.is-low,
.forecast-progress-fill.low {
    background: var(--crimson);
}

/* Industry Peer Chips */
.peer-chips-wrap,
.peer-chip-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.peer-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--dur-fast) var(--ease-out),
                color var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out),
                transform var(--dur-fast) var(--ease-out);
}

.peer-chip:hover {
    background: var(--vnd-orange-soft);
    border-color: var(--vnd-orange-border);
    color: var(--brand-accent);
    transform: translateY(-0.5px);
}

.peer-chip.active,
.peer-chip.is-current {
    background: var(--ink-strong);
    color: var(--ink-inverse);
    border-color: var(--ink-strong);
}

/* Document & News Category Filter Bar + Document Type Badges */
.doc-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.doc-filter-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

@media (max-width: 560px) {
    .doc-filter-bar {
        padding: 8px 10px;
        gap: 8px;
    }

    .doc-filter-pills {
        gap: 5px;
    }
}

.doc-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.doc-type-badge.pdf,
.doc-type-badge.type-pdf,
.doc-type-badge.type-bctc,
.doc-type-badge.type-financialstatement {
    background: var(--rose-soft);
    color: var(--rose);
    border-color: var(--rose-border);
}

.doc-type-badge.zip,
.doc-type-badge.type-zip,
.doc-type-badge.type-annual_report,
.doc-type-badge.type-prospectus,
.doc-type-badge.type-charter {
    background: var(--indigo-soft);
    color: var(--indigo);
    border-color: var(--indigo-border);
}

.doc-type-badge.type-resolutions,
.doc-type-badge.type-nq {
    background: var(--emerald-soft);
    color: var(--emerald);
    border-color: var(--emerald-border);
}

.doc-type-badge.type-management_reports,
.doc-type-badge.type-bcqt {
    background: var(--amber-soft);
    color: var(--amber);
    border-color: var(--amber-border);
}

/* ==========================================================================
   Personal Account & Cloud Sync UI (.account-header-btn, #accountModal)
   ========================================================================== */

.account-header-btn {
    position: relative;
    max-width: 170px;
}

.account-header-btn #accountBtnLabel {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 112px;
}

.account-header-btn.is-signed-in {
    border-color: var(--emerald-border);
    background: var(--emerald-soft);
    color: var(--emerald);
    font-weight: 600;
}

.account-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    transition: background var(--dur-fast) var(--ease-out);
}

.account-header-btn.is-signed-in .account-status-dot {
    background: var(--emerald);
}

.account-header-btn.is-syncing .account-status-dot {
    background: var(--brand-accent);
    animation: pulseLive 1s ease-in-out infinite;
}

.account-header-btn.is-sync-error .account-status-dot {
    background: var(--rose);
}

@media (max-width: 768px) {
    .account-header-btn .account-status-dot {
        position: absolute;
        top: 5px;
        right: 5px;
    }
}

.account-modal-dialog {
    max-width: 520px;
}

#accountModal .modal-header {
    flex-wrap: nowrap;
    align-items: flex-start;
}

.account-modal-heading {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.account-heading-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--vnd-orange-soft);
    border: 1px solid var(--vnd-orange-border);
    color: var(--brand-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.account-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.account-tab-btn {
    flex: 1 1 0;
    height: 32px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease-out),
                color var(--dur-fast) var(--ease-out),
                box-shadow var(--dur-fast) var(--ease-out),
                transform 140ms cubic-bezier(0.22, 1, 0.36, 1);
}

.account-tab-btn:hover {
    color: var(--text-primary);
}

.account-tab-btn:active {
    transform: scale(0.97);
}

.account-tab-btn.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-seg);
}

.account-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.account-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.account-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.account-field .input-box {
    width: 100%;
    height: 36px;
}

.account-notice {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    line-height: 1.5;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.account-notice.is-error {
    background: var(--rose-soft);
    border-color: var(--rose-border);
    color: var(--rose);
}

.account-notice.is-success {
    background: var(--emerald-soft);
    border-color: var(--emerald-border);
    color: var(--emerald);
}

.account-notice.is-warn {
    background: var(--amber-soft);
    border-color: var(--amber-border);
    color: var(--amber);
}

.account-oauth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11.5px;
    color: var(--text-muted);
    margin: 4px 0;
}

.account-oauth-divider::before,
.account-oauth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}

.account-oauth-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}

.account-profile-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
}

.account-avatar-badge {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--vnd-orange-soft);
    border: 1px solid var(--vnd-orange-border);
    color: var(--brand-accent);
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.account-meta-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.account-sync-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.account-sync-pill.is-ok {
    background: var(--emerald-soft);
    border-color: var(--emerald-border);
    color: var(--emerald);
}

.account-sync-pill.is-warn {
    background: var(--amber-soft);
    border-color: var(--amber-border);
    color: var(--amber);
}

.account-sync-pill.is-err {
    background: var(--rose-soft);
    border-color: var(--rose-border);
    color: var(--rose);
}

.watchlist-account-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 12px;
    margin-bottom: 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    font-size: 12px;
    color: var(--text-secondary);
}

/* ==========================================================================
   K. Center-Screen Welcome Stock News Briefing Modal (#welcomeNewsModal)
   ========================================================================== */

@keyframes welcomeModalPop {
    0% {
        opacity: 0;
        transform: translate3d(0, 14px, 0) scale(0.955);
    }
    70% {
        opacity: 1;
        transform: translate3d(0, -1px, 0) scale(1.003);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

/* Header Action Button (.welcome-header-btn & .welcome-btn-dot) */
.welcome-header-btn {
    position: relative;
    border-color: var(--vnd-orange-border);
    background: var(--vnd-orange-soft);
    color: var(--brand-accent);
    font-weight: 600;
}

.welcome-header-btn:hover:not(:disabled) {
    background: rgba(217, 107, 22, 0.16);
    border-color: var(--brand-accent);
    color: var(--brand-accent);
}

[data-theme="dark"] .welcome-header-btn:hover:not(:disabled) {
    background: rgba(240, 136, 50, 0.22);
    border-color: var(--brand-accent);
    color: var(--brand-accent);
}

.welcome-btn-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--emerald);
    box-shadow: 0 0 0 2px var(--bg-surface);
    flex-shrink: 0;
    animation: pulseLive 1.8s ease-in-out infinite;
}

.welcome-btn-dot.is-active {
    background: var(--emerald);
}

@media (max-width: 768px) {
    .welcome-header-btn .welcome-btn-dot {
        position: absolute;
        top: 4px;
        right: 4px;
    }
}

/* Glassmorphic Center-Screen Backdrop (#welcomeNewsModal) */
#welcomeNewsModal {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(9, 10, 15, 0.52);
}

[data-theme="dark"] #welcomeNewsModal {
    background: rgba(5, 6, 10, 0.68);
}

#welcomeNewsModal.open,
#welcomeNewsModal.is-open,
#welcomeNewsModal[aria-hidden="false"] {
    display: flex;
    animation: backdropFade 200ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

#welcomeNewsModal[aria-hidden="true"]:not(.open):not(.is-open) {
    display: none;
}

/* Welcome Modal Dialog Box (.welcome-news-dialog) */
.welcome-news-dialog {
    max-width: 820px;
    width: calc(100vw - 28px);
    max-height: min(86vh, 780px);
    border-radius: 20px;
    box-shadow: var(--shadow-modal);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: welcomeModalPop 300ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Welcome Header (.welcome-news-header & .welcome-live-badge) */
.welcome-news-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border-subtle);
    background: linear-gradient(180deg, var(--vnd-orange-soft) 0%, var(--bg-surface) 100%);
    flex-shrink: 0;
}

.welcome-news-header-left {
    flex: 1 1 auto;
    min-width: 0;
}

.welcome-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--emerald-soft);
    border: 1px solid var(--emerald-border);
    color: var(--emerald);
    font-family: var(--font-display);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.welcome-live-badge .pulse-dot {
    width: 6.5px;
    height: 6.5px;
    background: var(--emerald);
    box-shadow: 0 0 0 2px var(--emerald-soft);
}

#welcomeNewsModalTitle,
.welcome-news-header h2 {
    font-family: var(--font-display);
    font-size: 18.5px;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    line-height: 1.28;
    margin: 0;
}

#welcomeNewsSubtitle,
.welcome-news-header p {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-top: 3px;
}

.welcome-news-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
}

/* 3-Column Mini Bento Strip (.welcome-highlights-bento) */
.welcome-highlights-bento {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.welcome-highlight-card,
.welcome-bento-card,
.welcome-highlights-bento > div {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 3px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    min-width: 0;
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1),
                border-color 200ms ease,
                background-color 200ms ease;
}

.welcome-highlight-card:hover,
.welcome-bento-card:hover,
.welcome-highlights-bento > div:hover {
    transform: translate3d(0, -1.5px, 0);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--border-strong);
}

.welcome-highlight-card:active,
.welcome-bento-card:active {
    transform: translate3d(0, 0, 0) scale(0.99);
}

.welcome-highlight-card.is-active,
.welcome-bento-card.is-active {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 1.5px var(--brand-accent), var(--shadow-card);
    background: linear-gradient(180deg, var(--vnd-orange-soft) 0%, var(--bg-surface) 75%);
}

.welcome-highlight-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.3;
}

.welcome-highlight-value {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    line-height: 1.18;
}

.welcome-highlight-sub {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Welcome Toolbar (.welcome-toolbar, .welcome-cat-pill, .welcome-search-wrap) */
.welcome-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.welcome-cat-bar {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.welcome-cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                border-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.welcome-cat-pill:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
    transform: translate3d(0, -1px, 0);
}

.welcome-cat-pill:active {
    transform: translate3d(0, 0, 0) scale(0.97);
}

.welcome-cat-pill.active,
.welcome-cat-pill.is-active {
    background: var(--ink-strong);
    color: var(--ink-inverse);
    border-color: var(--ink-strong);
    box-shadow: var(--shadow-seg);
}

.welcome-search-wrap {
    position: relative;
    flex: 1 1 210px;
    min-width: 185px;
    max-width: 280px;
    display: flex;
    align-items: center;
}

.welcome-search-icon {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    pointer-events: none;
}

.welcome-search-input,
#inputWelcomeNewsSearch {
    width: 100%;
    height: 32px;
    padding: 0 10px 0 30px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
}

.welcome-search-input:focus,
#inputWelcomeNewsSearch:focus {
    background: var(--bg-input);
}

/* Scrollable Bento News List (.welcome-news-list & .welcome-news-card) */
.welcome-news-list {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-body);
    -webkit-overflow-scrolling: touch;
}

.welcome-news-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 13px 16px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 7px;
    position: relative;
    cursor: pointer;
    transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 240ms cubic-bezier(0.22, 1, 0.36, 1),
                border-color 200ms ease,
                background-color 200ms ease;
}

.welcome-news-card:hover {
    transform: translate3d(0, -2px, 0);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--border-strong);
}

.welcome-news-card:active {
    transform: translate3d(0, 0, 0) scale(0.995);
}

.welcome-news-card.is-skeleton {
    cursor: default;
    pointer-events: none;
}

.welcome-news-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 11.5px;
    color: var(--text-muted);
}

.welcome-ticker-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2.5px 9px;
    border-radius: 7px;
    background: var(--vnd-orange-soft);
    border: 1px solid var(--vnd-orange-border);
    color: var(--brand-accent);
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: -0.01em;
    cursor: pointer;
    line-height: 1.35;
    transition: background-color 200ms cubic-bezier(0.22, 1, 0.36, 1),
                color 200ms cubic-bezier(0.22, 1, 0.36, 1),
                border-color 200ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 200ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.welcome-ticker-chip:hover {
    background: var(--brand-accent);
    color: #FFFFFF;
    border-color: var(--brand-accent);
    transform: translate3d(0, -1px, 0);
    box-shadow: 0 3px 10px rgba(217, 107, 22, 0.25);
}

.welcome-ticker-chip:hover .floor-tag {
    background: rgba(255, 255, 255, 0.22);
    color: #FFFFFF;
    border-color: rgba(255, 255, 255, 0.35);
}

.welcome-ticker-chip:active {
    transform: translate3d(0, 0, 0) scale(0.96);
}

.welcome-price-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2.5px 8px;
    border-radius: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    font-family: var(--font-sans);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.35;
    transition: border-color 200ms cubic-bezier(0.22, 1, 0.36, 1),
                background-color 200ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.welcome-price-pill:hover {
    border-color: var(--border-strong);
    background: var(--bg-hover);
    transform: translate3d(0, -1px, 0);
}

.welcome-cat-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.welcome-cat-tag.is-dividend,
.welcome-cat-tag.cat-dividend {
    background: var(--emerald-soft);
    color: var(--emerald);
    border-color: var(--emerald-border);
}

.welcome-cat-tag.is-financial,
.welcome-cat-tag.cat-financial {
    background: var(--indigo-soft);
    color: var(--indigo);
    border-color: var(--indigo-border);
}

.welcome-cat-tag.is-corporate,
.welcome-cat-tag.cat-corporate {
    background: var(--cyan-soft);
    color: var(--cyan);
    border-color: var(--cyan-border);
}

.welcome-cat-tag.is-watchlist,
.welcome-cat-tag.cat-watchlist {
    background: var(--vnd-orange-soft);
    color: var(--brand-accent);
    border-color: var(--vnd-orange-border);
}

.welcome-news-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.45;
    letter-spacing: -0.01em;
    margin: 0;
    transition: color 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.welcome-news-card:hover .welcome-news-title {
    color: var(--brand-accent);
}

/* Sticky Bottom Footer (.welcome-news-footer) */
.welcome-news-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 20px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.welcome-mute-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.welcome-mute-label input[type="checkbox"] {
    accent-color: var(--brand-accent);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.welcome-footer-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 680px) {
    #welcomeNewsModal {
        padding: 10px;
    }

    .welcome-news-dialog {
        width: calc(100vw - 16px);
        max-height: 92vh;
        border-radius: 16px;
    }

    .welcome-news-header {
        padding: 14px 16px 12px;
    }

    #welcomeNewsModalTitle,
    .welcome-news-header h2 {
        font-size: 16px;
    }

    .welcome-highlights-bento {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        padding: 10px 14px;
    }

    .welcome-highlight-card,
    .welcome-bento-card {
        padding: 8px 10px;
    }

    .welcome-highlight-value {
        font-size: 16px;
    }

    .welcome-toolbar {
        padding: 10px 14px;
    }

    .welcome-search-wrap {
        max-width: 100%;
        flex: 1 1 100%;
    }

    .welcome-news-list {
        padding: 12px 14px;
        gap: 8px;
    }

    .welcome-news-card {
        padding: 11px 13px;
    }

    .welcome-news-footer {
        padding: 10px 14px;
    }

    .welcome-footer-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 460px) {
    .welcome-highlights-bento {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Reduced Motion Support
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .nav-active-indicator,
    .header-nav .tab-btn,
    .seg-btn,
    .subtab-btn,
    .modal-subtabs .tab-btn,
    .fin-cafef-tab,
    .company-6tab-btn,
    .account-tab-btn,
    .btn,
    .kpi-card,
    .metric-item,
    .surface-card,
    .filter-bar,
    .command-bar,
    .control-panel,
    .input-box,
    .select-box,
    .data-table tbody tr,
    .modal-dialog,
    .welcome-news-dialog,
    .welcome-news-card,
    .welcome-highlight-card,
    .welcome-bento-card,
    .welcome-cat-pill,
    .welcome-ticker-chip,
    .welcome-price-pill {
        transition-duration: 0.01ms !important;
    }

    .header-nav .tab-btn:hover,
    .header-nav .tab-btn:active,
    .seg-btn:active,
    .subtab-btn:active,
    .modal-subtabs .tab-btn:active,
    .fin-cafef-tab:hover,
    .fin-cafef-tab:active,
    .company-6tab-btn:hover,
    .company-6tab-btn:active,
    .account-tab-btn:active,
    .btn:hover:not(:disabled),
    .btn:active:not(:disabled),
    .kpi-card:hover,
    .kpi-card:active,
    .metric-item:hover,
    .metric-item:active,
    .welcome-news-card:hover,
    .welcome-news-card:active,
    .welcome-highlight-card:hover,
    .welcome-bento-card:hover,
    .welcome-cat-pill:hover,
    .welcome-ticker-chip:hover,
    .welcome-price-pill:hover {
        transform: none !important;
    }

    .tab-pane.active.anim-from-right,
    .tab-pane.active.anim-from-left,
    .tab-pane.active.anim-fade,
    .subview-anim-right,
    .subview-anim-left,
    .subview-anim-fade,
    .fin-section-stack.subview-anim-right,
    .fin-section-stack.subview-anim-left,
    .fin-section-stack.subview-anim-fade {
        animation: paneEnterReduced 1ms linear both !important;
        will-change: auto !important;
    }

    .fin-section-stack,
    .watchlist-strip.open,
    .adv-filter-panel.open,
    .modal-backdrop.open,
    .modal-overlay.open,
    #welcomeNewsModal.open,
    #welcomeNewsModal.is-open,
    .welcome-news-dialog,
    .skeleton,
    .skeleton-line,
    .skeleton-pill,
    .skeleton-box,
    .pulse-dot,
    .welcome-btn-dot,
    .account-header-btn.is-syncing .account-status-dot {
        animation: none !important;
    }
}

/* Suppress injected Netlify HUD / badge overlays so they do not overlap stock tables */
#nl-badge-frame,
#nl-hud-frame,
iframe#nl-badge-frame,
iframe#nl-hud-frame {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
}



