/* ============================================================
   Neraca Bank — Indonesian Banking Dashboard
   Design: Clean white, deep teal primary, deep amber accent
   Font: Plus Jakarta Sans (Google Fonts)
   ============================================================ */

/* ── Design Tokens ────────────────────────────────────────── */
:root {
    /* Primary — deep teal */
    --color-primary:       #0e7490;
    --color-primary-dark:  #155e75;
    --color-primary-light: #e0f2fe;

    /* Accent — deep amber */
    --color-accent:        #b45309;
    --color-accent-dark:   #78350f;
    --color-accent-dim:    rgba(180, 83, 9, 0.12);

    /* Surfaces */
    --color-bg:            #ffffff;
    --color-surface:       #f8fafc;
    --color-surface-2:     #f1f5f9;

    /* Text */
    --color-text:          #0f172a;
    --color-text-muted:    #64748b;

    /* Borders */
    --color-border:        #e2e8f0;
    --color-border-strong: #cbd5e1;

    /* Semantic */
    --color-success:       #16a34a;
    --color-success-bg:    rgba(22, 163, 74, 0.1);

    /* Layout */
    --sidebar-width:       250px;
    --nav-height:          54px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.10), 0 4px 8px rgba(15, 23, 42, 0.06);

    /* Border radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', Tahoma, sans-serif;
    background-color: var(--color-surface);
    color: var(--color-text);
    min-height: 100vh;
    line-height: 1.5;
}

/* ── Top Nav ──────────────────────────────────────────────── */
.top-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1100;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px 0 60px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.top-nav a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: .88rem;
    transition: color .2s;
}

.top-nav a:hover { color: var(--color-primary); }
.top-nav .sep { color: var(--color-border-strong); }

.top-nav .logo {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-primary);
}

.top-nav .logo span {
    color: var(--color-accent);
    font-weight: 700;
}

/* standalone .logo used in compare pages */
.logo {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-primary);
}
.logo span {
    color: var(--color-accent);
    font-weight: 700;
}

.top-nav .ticker-label {
    font-size: .95rem;
    font-weight: 700;
    color: var(--color-text);
    border-bottom: 2px solid var(--color-accent);
    padding-bottom: 1px;
}

.top-nav .period-switcher {
    margin-left: auto;
    display: flex;
    gap: 6px;
}

.period-btn {
    padding: 4px 14px;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
    border: 1px solid var(--color-border-strong);
    color: var(--color-text-muted);
    background: transparent;
    text-decoration: none;
    transition: all .18s;
}

.period-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.period-btn.active {
    background: var(--color-accent);
    color: #ffffff;
    border-color: var(--color-accent);
    font-weight: 700;
}

.export-btn {
    padding: 4px 14px;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
    border: 1px solid var(--color-success);
    color: var(--color-success);
    background: transparent;
    text-decoration: none;
    transition: all .18s;
}

.export-btn:hover {
    background: var(--color-success);
    color: #fff;
}

/* ── Hamburger Toggle ─────────────────────────────────────── */
.toggle-btn {
    position: fixed;
    top: 5px;
    left: 8px;
    z-index: 1200;
    background: transparent;
    color: var(--color-primary);
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    cursor: pointer;
    box-shadow: none;
    transition: all .3s ease;
}

.toggle-btn:hover {
    background: var(--color-primary-light);
    transform: translateY(-2px);
}

.toggle-btn.moved { left: 8px; }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
    height: calc(100vh - var(--nav-height));
    position: fixed;
    top: var(--nav-height);
    left: 0;
    width: var(--sidebar-width);
    background: var(--color-bg);
    border-right: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    overflow-y: auto;
    transition: transform .3s ease;
}

.sidebar.hidden {
    transform: translateX(-100%);
}

/* Sidebar Brand */
.sidebar-brand {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-brand h4 {
    color: var(--color-primary);
    margin: 0;
    font-weight: 700;
    font-size: 1rem;
}

.sidebar-brand small {
    color: var(--color-text-muted);
    font-size: .78rem;
}

/* Sidebar Nav Links */
.sidebar .nav-link {
    color: var(--color-text-muted);
    padding: 14px 20px;
    border-radius: 0;
    transition: all .2s ease;
    border-left: 3px solid transparent;
    font-size: .9rem;
    font-weight: 500;
}

.sidebar .nav-link:hover {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    border-left-color: var(--color-primary);
}

.sidebar .nav-link.active {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    border-left-color: var(--color-accent);
    font-weight: 600;
}

.sidebar .nav-link.parent-active {
    color: var(--color-primary);
}

.sidebar .nav-link.parent-active .fa-chevron-down {
    color: var(--color-primary);
}

/* Submenu */
.nav-submenu .nav-link {
    padding: 9px 20px 9px 34px;
    font-size: .85rem;
    color: var(--color-text-muted);
    border-left: 3px solid transparent;
}

.nav-submenu .nav-link:hover {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    border-left-color: rgba(14, 116, 144, 0.4);
}

.nav-submenu .nav-link.active {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    border-left-color: var(--color-accent);
    font-weight: 600;
}

/* Chevron rotation */
.nav-link[aria-expanded="true"] .fa-chevron-down {
    transform: rotate(180deg);
    transition: transform .3s ease;
}

.nav-link[aria-expanded="false"] .fa-chevron-down {
    transform: rotate(0deg);
    transition: transform .3s ease;
}

/* Sidebar Year Filter */
.sidebar-year-filter {
    margin: 16px 12px;
    padding: 14px;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.filter-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.filter-header h6 {
    color: var(--color-primary);
    margin: 0;
    font-weight: 700;
    font-size: .85rem;
    letter-spacing: .3px;
}

.filter-header small {
    color: var(--color-text-muted);
    font-size: .72rem;
}

.filter-active-badge {
    background: var(--color-success-bg);
    color: var(--color-success);
    padding: 2px 9px;
    border-radius: 10px;
    font-size: .7rem;
    font-weight: 600;
    display: inline-block;
    border: 1px solid rgba(22, 163, 74, 0.25);
}

.year-inputs-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    margin-bottom: 12px;
}

.year-input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.year-input-group label {
    color: var(--color-text-muted);
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.year-input {
    width: 100%;
    background: var(--color-bg);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    padding: 7px 4px;
    -moz-appearance: textfield;
    font-family: inherit;
}

.year-input::-webkit-inner-spin-button,
.year-input::-webkit-outer-spin-button { opacity: .5; }

.year-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(14, 116, 144, 0.12);
}

.year-input-sep {
    color: var(--color-text-muted);
    font-size: 1rem;
    padding-bottom: 8px;
}

.filter-buttons { display: flex; gap: 8px; }

.sidebar-year-filter .go-btn {
    background: var(--color-primary);
    color: #fff;
    border: none;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all .2s ease;
    font-size: .82rem;
    flex: 1;
    font-weight: 700;
    font-family: inherit;
}

.sidebar-year-filter .go-btn:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.sidebar-year-filter .reset-btn {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border-strong);
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all .2s ease;
    font-size: .82rem;
    flex: 1;
    font-family: inherit;
}

.sidebar-year-filter .reset-btn:hover {
    background: var(--color-surface);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* Sidebar Backdrop */
.sidebar-backdrop {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.4);
    z-index: 999;
    display: none;
}

.sidebar-backdrop.show { display: block; }

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    padding: calc(var(--nav-height) + 20px) 20px 20px;
    min-height: 100vh;
    transition: margin-left .3s ease;
}

.main-content.expanded { margin-left: 0; }
.content-section { display: none; }
.content-section.active { display: block; }

/* ── Page Headers ─────────────────────────────────────────── */
.section-header {
    color: var(--color-primary);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -.3px;
}

.section-description {
    color: var(--color-text-muted);
    font-size: .95rem;
    margin-bottom: 0;
}

.header-section {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

/* ── Chart Layout ─────────────────────────────────────────── */
.chart-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.chart-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
}

.chart {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    transition: transform .2s ease, box-shadow .2s ease;
}

.chart:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.chart h3 {
    color: var(--color-primary-dark);
    margin-bottom: 15px;
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 10px;
    padding-left: 10px;
    border-left: 3px solid var(--color-accent);
}

.chart-plot {
    width: 100%;
    height: 500px;
}

.chart-plot.scrollable-table {
    overflow-x: auto;
    overflow-y: auto;
    width: 100%;
    max-width: 100%;
    height: 600px;
}

#generalInformationTable {
    min-width: 1400px;
    width: 1400px;
}

#general_information .chart-plot {
    height: auto !important;
    max-height: none !important;
}

.full-width { grid-column: 1 / -1; }
.full-width .chart-plot { height: 450px; }

/* ── Sankey Carousel ──────────────────────────────────────── */
.sankey-carousel-container { margin-top: 20px; margin-bottom: 28px; position: relative; }

.sankey-carousel-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
}

.carousel-btn {
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px; height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all .3s ease;
    box-shadow: var(--shadow-sm);
}

.carousel-btn:hover {
    background: var(--color-primary-dark);
    transform: scale(1.1);
}

.carousel-btn:disabled {
    background: var(--color-border-strong);
    cursor: not-allowed;
    transform: scale(1);
}

.carousel-year-display {
    background: var(--color-accent);
    color: #ffffff;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 1rem;
    min-width: 100px;
    text-align: center;
}

.sankey-carousel { position: relative; width: 100%; overflow: hidden; }
.sankey-slide { display: none; width: 100%; }

.sankey-chart {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    transition: transform .2s ease, box-shadow .2s ease;
}

.sankey-chart:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.sankey-plot {
    width: 100%; height: 600px;
    min-height: 500px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sankey-plot > div { max-width: 100%; margin: 0 auto; }

.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}

.indicator {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--color-border-strong);
    border: none;
    cursor: pointer;
    transition: all .3s ease;
}

.indicator.active {
    background: var(--color-primary);
    transform: scale(1.2);
}

.indicator:hover { background: var(--color-primary); }

/* ── Index / Homepage ─────────────────────────────────────── */
.idx-top-nav {
    position: sticky;
    top: 0;
    z-index: 1100;
    background: var(--color-bg);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nav-height);
    box-shadow: 0 1px 0 var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.idx-compare-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    background: var(--color-accent);
    color: #ffffff;
    border-radius: var(--radius-sm);
    padding: 7px 16px;
    font-size: .85rem;
    font-weight: 700;
    transition: opacity .2s;
}

.idx-compare-btn:hover { opacity: .85; }

.hero {
    padding: 36px 24px 28px;
    text-align: center;
    background: var(--color-primary-light);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 0;
}

.hero-sub {
    color: var(--color-text-muted);
    font-size: .9rem;
    font-weight: 500;
    margin-bottom: 20px;
    margin-top: 0;
    letter-spacing: .1px;
}

.search-wrap {
    position: relative;
    max-width: 540px;
    margin: 0 auto;
}

.search-wrap .fa-magnifying-glass {
    position: absolute;
    left: 18px; top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: 1rem;
    pointer-events: none;
}

#search-input {
    width: 100%;
    padding: 14px 18px 14px 46px;
    font-size: 1rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    box-shadow: var(--shadow-sm);
    font-family: inherit;
}

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

#search-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(14, 116, 144, 0.12);
}

.results-meta {
    text-align: center;
    color: var(--color-text-muted);
    font-size: .85rem;
    padding: 10px 24px 0;
    margin: 0;
    min-height: 20px;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 24px 64px;
}

.company-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}

.company-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-accent);
}

.company-card.hidden { display: none; }

.card-header-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.ticker {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: .5px;
    flex-shrink: 0;
    border-bottom: 2px solid var(--color-accent);
    padding-bottom: 1px;
}

.company-name {
    font-size: .9rem;
    color: var(--color-text);
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.badges-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.period-badge, .loaded-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: var(--radius-sm);
    padding: 3px 10px;
    font-size: .75rem;
    font-weight: 600;
    width: fit-content;
}

.period-badge {
    background: var(--color-accent-dim);
    color: var(--color-accent-dark);
    border: 1px solid rgba(180, 83, 9, 0.35);
}

.loaded-badge {
    background: rgba(0, 0, 0, .04);
    color: var(--color-text-muted);
    font-weight: 400;
    border: 1px solid var(--color-border);
}

.card-links {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.btn-view {
    flex: 1;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: .8rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: background .2s, color .2s;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
}

.btn-annual {
    background: rgba(14, 116, 144, .07);
    color: var(--color-primary);
    border-color: rgba(14, 116, 144, .2);
}

.btn-annual:hover {
    background: var(--color-primary);
    color: #fff;
}

.btn-quarterly {
    background: rgba(14, 116, 144, .05);
    color: var(--color-primary-dark);
    border-color: rgba(14, 116, 144, .15);
}

.btn-quarterly:hover {
    background: var(--color-primary-dark);
    color: #fff;
}

.sort-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 16px 0 0;
}

.sort-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-right: 4px;
}

.sort-btn {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    border-radius: var(--radius-sm);
    padding: 6px 16px;
    font-size: .82rem;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-sm);
    font-family: inherit;
}

.sort-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.sort-btn.active {
    background: var(--color-accent-dim);
    border-color: var(--color-accent);
    color: var(--color-accent-dark);
    font-weight: 600;
}

#no-results {
    display: none;
    text-align: center;
    color: var(--color-text-muted);
    padding: 60px 24px;
    grid-column: 1 / -1;
}

#no-results i { font-size: 2.5rem; margin-bottom: 16px; opacity: .4; }

footer {
    text-align: center;
    color: var(--color-text-muted);
    font-size: .78rem;
    padding: 28px 24px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
    margin-top: 40px;
}

/* ── Compare Pages ────────────────────────────────────────── */
.page-body {
    max-width: 1000px;
    margin: 0 auto;
    padding: calc(var(--nav-height) + 40px) 24px 80px;
}

.page-body.wide { max-width: 1400px; }
.page-body.combined { max-width: 1300px; }

.page-body h1,
h1.compare-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--color-primary);
}

.page-body .sub {
    color: var(--color-text-muted);
    font-size: .9rem;
    margin-bottom: 32px;
}

.section-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.section-card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-primary);
}

.section-card h2 i { color: var(--color-accent); font-size: .9rem; }

/* Company search in compare */
.company-search { position: relative; margin-bottom: 14px; }

.company-search input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: .88rem;
    outline: none;
    transition: border-color .2s;
    font-family: inherit;
}

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

.company-search input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(14, 116, 144, .1);
}

.company-search i {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: .8rem;
    pointer-events: none;
}

/* Company grid chips */
.company-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 8px;
    max-height: 340px;
    overflow-y: auto;
    padding-right: 4px;
}

.company-grid::-webkit-scrollbar { width: 5px; }
.company-grid::-webkit-scrollbar-track { background: transparent; }
.company-grid::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 10px; }

.company-chip input[type=checkbox] { display: none; }

.company-chip label {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    cursor: pointer;
    transition: all .18s;
    user-select: none;
    width: 100%;
}

.company-chip label:hover { border-color: rgba(14, 116, 144, .3); }

.company-chip input:checked + label {
    background: rgba(14, 116, 144, .08);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.company-chip.hidden { display: none; }
.chip-ticker { font-size: .85rem; font-weight: 700; flex-shrink: 0; }
.chip-name { font-size: .72rem; color: var(--color-text-muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.company-chip input:checked + label .chip-name { color: rgba(14, 116, 144, .7); }

.selection-count { font-size: .8rem; color: var(--color-text-muted); margin-top: 8px; }
.selection-count span { color: var(--color-primary); font-weight: 700; }

.btn-remove-all {
    background: none; border: none; padding: 0 4px; margin-left: 10px;
    font-size: .78rem; color: #c0392b; cursor: pointer; font-weight: 600;
    opacity: .75; vertical-align: baseline;
}
.btn-remove-all:hover { opacity: 1; text-decoration: underline; }

/* Plot checklist */
.plot-checklist {
    max-height: 480px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
}

.plot-search-wrap {
    position: sticky; top: 0; z-index: 2;
    background: var(--color-bg);
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border);
}

.plot-search-wrap i { color: var(--color-text-muted); font-size: .82rem; }

.plot-search-wrap input {
    flex: 1; border: none; outline: none;
    font-size: .84rem;
    color: var(--color-text);
    background: transparent;
    font-family: inherit;
}

.plot-group-label {
    padding: 5px 12px;
    background: var(--color-surface-2);
    color: var(--color-primary);
    font-size: .72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em;
    position: sticky; top: 37px; z-index: 1;
    cursor: pointer; user-select: none;
    display: flex; align-items: center; justify-content: space-between;
}

.plot-group-label:hover { background: var(--color-primary-light); }
.plot-group-label::after { content: 'select all'; font-size: .65rem; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--color-primary); opacity: .75; }
.plot-group-label.all-selected::after { content: 'deselect all'; }

.plot-item {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 14px; cursor: pointer; font-size: .86rem;
    transition: background .12s;
}

.plot-item:hover { background: var(--color-surface); }
.plot-item input[type=checkbox] { accent-color: var(--color-primary); width: 14px; height: 14px; flex-shrink: 0; }
.plot-item.plot-hidden { display: none !important; }
.plot-item.plot-checked { background: rgba(14, 116, 144, .06); }
.plot-count { font-size: .8rem; color: var(--color-text-muted); margin-top: 6px; }
.plot-count span { color: var(--color-primary); font-weight: 700; }

/* Year range fields */
.year-range { display: flex; align-items: center; gap: 12px; }
.year-field { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.year-field label { font-size: .78rem; color: var(--color-text-muted); font-weight: 600; }

.year-field input[type=number] {
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: .92rem;
    color: var(--color-text);
    background: var(--color-bg);
    outline: none;
    -moz-appearance: textfield;
    transition: border-color .2s;
    font-family: inherit;
}

.year-field input[type=number]::-webkit-inner-spin-button { opacity: .5; }
.year-field input[type=number]:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(14, 116, 144, .1); }
.year-dash { color: var(--color-text-muted); font-size: 1.2rem; margin-top: 20px; }

/* Period toggle */
.period-toggle { display: flex; gap: 8px; }
.period-toggle input { display: none; }

.period-toggle label {
    flex: 1; text-align: center; padding: 9px 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer; font-size: .88rem;
    transition: all .18s;
}

.period-toggle label:hover { border-color: rgba(14, 116, 144, .3); }
.period-toggle input:checked + label { background: rgba(14, 116, 144, .08); border-color: var(--color-primary); color: var(--color-primary); font-weight: 600; }

/* Compare submit button */
.btn-compare {
    width: 100%; padding: 13px; border: none;
    border-radius: var(--radius-md);
    background: var(--color-primary); color: #fff;
    font-size: 1rem; font-weight: 700; cursor: pointer;
    transition: background .2s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-family: inherit;
}

.btn-compare:hover { background: var(--color-primary-dark); }
.btn-compare:disabled { opacity: .4; cursor: not-allowed; }

/* Error banner */
.err-banner {
    background: rgba(220, 53, 69, .06);
    border: 1px solid rgba(220, 53, 69, .22);
    border-radius: var(--radius-sm);
    padding: 12px 16px; color: #842029;
    font-size: .88rem; margin-bottom: 20px;
    display: flex; align-items: center; gap: 8px;
}

/* Mode toggle */
.mode-toggle {
    display: flex; gap: 0; margin-bottom: 24px;
    border-radius: var(--radius-md); overflow: hidden;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.mode-btn {
    flex: 1; padding: 11px 18px; border: none;
    background: var(--color-bg); color: var(--color-text-muted);
    font-size: .9rem; font-weight: 600; cursor: pointer;
    transition: all .18s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-family: inherit;
}

.mode-btn + .mode-btn { border-left: 1px solid var(--color-border); }
.mode-btn.active { background: var(--color-primary); color: #fff; }
.mode-btn:hover:not(.active) { background: var(--color-surface); color: var(--color-primary); }

/* Selected tags */
.selected-tags-wrap {
    min-height: 36px;
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    padding: 8px 12px;
    background: rgba(14, 116, 144, .04);
    border: 1px dashed rgba(14, 116, 144, .25);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.selected-tags-empty { font-size: .8rem; color: var(--color-text-muted); font-style: italic; }

.sel-tag {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px;
    background: rgba(14, 116, 144, .08);
    border: 1px solid rgba(14, 116, 144, .22);
    border-radius: 20px;
    font-size: .8rem; font-weight: 700; color: var(--color-primary);
    cursor: default;
}

.sel-tag-x {
    display: inline-flex; align-items: center; justify-content: center;
    width: 14px; height: 14px; border-radius: 50%;
    background: rgba(14, 116, 144, .14); color: var(--color-primary);
    font-size: .7rem; cursor: pointer; border: none; padding: 0;
    line-height: 1; transition: background .15s;
}

.sel-tag-x:hover { background: rgba(220, 53, 69, .18); color: #dc3545; }

/* ── Compare Results ──────────────────────────────────────── */
.result-header { margin-bottom: 28px; }
.result-header h1 { font-size: 1.35rem; font-weight: 700; margin-bottom: 6px; color: var(--color-primary); }
.result-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.badge-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 11px; border-radius: 20px; font-size: .77rem; font-weight: 600;
    background: var(--color-accent-dim);
    color: var(--color-accent-dark);
    border: 1px solid rgba(180, 83, 9, .35);
}

.badge-period { background: rgba(14, 116, 144, .08); color: var(--color-primary); border-color: rgba(14, 116, 144, .2); }

.back-btn {
    display: inline-flex; align-items: center; gap: 6px;
    text-decoration: none; color: var(--color-text-muted); font-size: .85rem;
    transition: color .2s; margin-bottom: 6px;
}

.back-btn:hover { color: var(--color-primary); }

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
    gap: 20px;
}

.result-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.result-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}

.result-card-header .ticker {
    font-size: 1.1rem; font-weight: 700;
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-accent);
    padding-bottom: 2px;
}

.result-card-body { padding: 4px 8px 12px; }

.error-box {
    margin: 16px; padding: 18px;
    background: rgba(220, 53, 69, .06);
    border: 1px solid rgba(220, 53, 69, .22);
    border-radius: var(--radius-md);
    color: #842029;
    display: flex; align-items: flex-start; gap: 10px; font-size: .88rem;
}

.error-box i { flex-shrink: 0; margin-top: 2px; }

.plot-div { width: 100%; min-height: 400px; }

.plot-section { margin-bottom: 44px; }

.plot-section-title {
    font-size: 1.05rem; font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 14px; padding-bottom: 8px;
    border-bottom: 2px solid rgba(14, 116, 144, .15);
    display: flex; align-items: center; gap: 8px;
}

.no-results { text-align: center; padding: 60px 20px; color: var(--color-text-muted); }
.no-results i { font-size: 2.5rem; margin-bottom: 14px; display: block; }

/* ── Compare Combined ─────────────────────────────────────── */
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.badge-ticker {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 12px; border-radius: 20px; font-size: .78rem; font-weight: 700;
    border: 2px solid;
}

.section-divider {
    display: flex; align-items: center; gap: 12px;
    margin: 36px 0 20px;
}

.section-divider:first-child { margin-top: 0; }

.section-divider-label {
    display: flex; align-items: center; gap: 8px;
    font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: #fff; background: var(--color-primary); border-radius: 20px;
    padding: 4px 14px; white-space: nowrap;
}

.section-divider-line {
    flex: 1; height: 2px;
    background: linear-gradient(to right, rgba(14, 116, 144, .25), transparent);
}

.chart-card {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    padding: 20px 24px;
    margin-bottom: 32px;
}

.chart-card-title {
    font-size: 1.05rem; font-weight: 700; color: var(--color-primary);
    margin-bottom: 14px; padding-bottom: 8px;
    border-bottom: 2px solid rgba(14, 116, 144, .15);
    display: flex; align-items: center; gap: 8px;
}

.combined-plot { width: 100%; height: 480px; }

.err-box {
    background: rgba(220, 53, 69, .06);
    border: 1px solid rgba(220, 53, 69, .22);
    border-radius: var(--radius-sm);
    padding: 14px 18px; color: #842029;
    display: flex; align-items: flex-start; gap: 10px; margin-bottom: 20px;
}

/* Ticker badge colours — retained to align with Plotly chart legend colours */
.c0 { color: #154D71; border-color: #154D71; background: rgba(21, 77, 113, .08); }
.c1 { color: #e05c2a; border-color: #e05c2a; background: rgba(224, 92, 42, .08); }
.c2 { color: #2a9d8f; border-color: #2a9d8f; background: rgba(42, 157, 143, .08); }
.c3 { color: #c77dff; border-color: #c77dff; background: rgba(199, 125, 255, .08); }
.c4 { color: #7a5c00; border-color: #e9c46a; background: rgba(233, 196, 106, .15); }
.c5 { color: #8338ec; border-color: #8338ec; background: rgba(131, 56, 236, .08); }
.c6 { color: #06d6a0; border-color: #06d6a0; background: rgba(6, 214, 160, .08); }
.c7 { color: #ef476f; border-color: #ef476f; background: rgba(239, 71, 111, .08); }

/* QoQ toggle pill */
.qoq-toggle {
    display: flex; gap: 0; margin-bottom: 12px;
    border-radius: 16px; overflow: hidden;
    width: fit-content;
    border: 1.5px solid var(--color-primary);
}

.qoq-btn {
    padding: 3px 16px; font-size: .72rem; font-weight: 700;
    letter-spacing: .04em; border: none; background: transparent;
    color: var(--color-primary); cursor: pointer;
    transition: background .15s, color .15s;
    font-family: inherit;
}

.qoq-btn.active { background: var(--color-primary); color: #fff; }
.qoq-btn:hover:not(.active) { background: rgba(14, 116, 144, .1); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1001;
    }

    .sidebar.show { transform: translateX(0); }

    .main-content {
        margin-left: 0;
        padding-top: calc(var(--nav-height) + 12px);
    }

    .toggle-btn { left: 20px; }
    .toggle-btn.moved { left: 20px; }

    .chart-row { grid-template-columns: 1fr; }
    .chart-plot { height: 400px; }
    .sankey-plot { height: 450px; min-height: 400px; }
    .carousel-year-display { font-size: .9rem; padding: 6px 15px; min-width: 80px; }
    .carousel-btn { width: 35px; height: 35px; }
}

@media (max-width: 480px) {
    .sankey-plot { height: 350px; min-height: 300px; }
    .carousel-year-display { font-size: .8rem; padding: 5px 12px; min-width: 70px; }
    .carousel-btn { width: 30px; height: 30px; }
}
