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

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;
    background-color: #ECE5DD; /* Tan background matching Signal dashboard */
    color: #333333;
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5 {
    font-weight: 600;
    color: #333333; /* Text Neutral */
}

/* --- SIDEBAR --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 210px;
    padding: 1rem 0;
    background-color: #132E4A; /* Navy Blue */
    color: #FFFFFF;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    z-index: 1000;
}

.content {
    margin-left: 210px;
    padding: 1rem;
    background-color: #ECE5DD; /* Tan background */
    min-height: 100vh;
}

/* Navigation Links - White text on navy background */
.nav-link {
    color: rgba(255, 255, 255, 0.85) !important;
    font-weight: 500;
    margin-bottom: 0.25rem;
    border-radius: 5px;
    transition: all 0.2s;
    padding: 0.5rem 1rem !important;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #FFFFFF !important;
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: #FFFFFF !important;
    font-weight: 600;
}

/* --- RADIAN CARD (Collapsible) --- */
.radian-card {
    background-color: #FFFFFF;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.radian-card-header {
    background-color: #FFFFFF;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #F0F0F0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.radian-card-title {
    margin: 0;
    font-size: 1.1rem;
    color: #333333;
    font-weight: normal;
}

.radian-card-subtitle {
    margin: 0;
    font-size: 0.85rem;
    color: #757575;
}

/* Card styling matching Signal dashboard */
.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.card-header {
    border-radius: calc(0.375rem - 1px) calc(0.375rem - 1px) 0 0;
}

/* ── Portfolio Company Filter (sidebar multi-select) ───────────────── */
/* Show excluded-company names as small compact pills inside dropdown.  */
.pv-company-filter .Select-multi-value-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 2px;
}
.pv-company-filter .Select-value {
    font-size: 0.65rem !important;
    margin: 1px 1px !important;
    line-height: 1.3;
    max-width: 100%;
}
.pv-company-filter .Select-value-label {
    padding: 1px 4px !important;
    font-size: 0.65rem !important;
}
.pv-company-filter .Select-value-icon {
    padding: 0 2px !important;
    font-size: 0.65rem !important;
}
/* Shrink the search input so it doesn't add a tall empty row */
.pv-company-filter .Select-input {
    height: 20px !important;
}
.pv-company-filter .Select-input > input {
    padding: 0 !important;
    line-height: 20px !important;
}

/* ── Portfolio Screener ─────────────────────────────────────────────── */
.pv-wrap {
    overflow-x: auto;
    max-width: 100%;
    border: 1px solid #d4d4d4;
    border-radius: 6px;
    background: #fff;
    scrollbar-width: thin;
    scrollbar-color: #999 #eee;
}
.pv-wrap::-webkit-scrollbar        { height: 8px; }
.pv-wrap::-webkit-scrollbar-track  { background: #eee; border-radius: 4px; }
.pv-wrap::-webkit-scrollbar-thumb  { background: #999; border-radius: 4px; }
.pv-wrap::-webkit-scrollbar-thumb:hover { background: #666; }

.pv-t {
    border-collapse: separate;
    border-spacing: 0;
    width: max-content;
    min-width: 100%;
    font-size: 0.76rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
.pv-t th, .pv-t td {
    padding: 4px 12px;
    white-space: nowrap;
    border-bottom: 1px solid #e5e5e5;
    text-align: right;
    vertical-align: middle;
}

/* ── Sticky company column ─────────────────────────────────────────── */
.pv-t .sc {
    position: sticky;
    left: 0;
    z-index: 2;
    text-align: left;
    min-width: 140px;
    max-width: 180px;
    font-weight: 500;
    border-right: 2px solid #c5c5c5;
    background: #fff;
}
.pv-t thead .sc { z-index: 5; background: inherit; }

/* ── Group header row ──────────────────────────────────────────────── */
.pv-t .gh th {
    background: #132E4A;
    color: #fff;
    font-weight: 600;
    font-size: 0.70rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-align: center;
    padding: 7px 12px;
    border-bottom: 2px solid #0c1f33;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}
.pv-t .gh th.sc {
    background: #132E4A;
    text-align: left;
    color: #fff;
}

/* ── Metric header row (navy, white text — matches group header) ──── */
.pv-t .mh th {
    background: #132E4A;
    color: #fff;
    font-weight: 600;
    font-size: 0.70rem;
    padding: 5px 12px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    border-bottom: 2px solid #0c1f33;
}
.pv-t .mh th:hover { background: #1e4468; }
.pv-t .mh th.sc    { background: #132E4A; }

/* ── Summary rows (light blue) ─────────────────────────────────────── */
.pv-t .sr td {
    background: #B3D2DC;
    color: #132E4A;
    font-weight: 600;
    font-size: 0.74rem;
    border-bottom: 1px solid #8fb8c7;
}
.pv-t .sr td.sc { background: #B3D2DC; font-style: italic; }

/* ── Group separator (whitespace between sections) ─────────────────── */
.pv-t .ge        { border-right: 4px solid #ECE5DD !important; }
.pv-t .gh th.ge  { border-right: 4px solid #ECE5DD !important; }
.pv-t .mh th.ge  { border-right: 4px solid #ECE5DD !important; }
.pv-t .sr td.ge  { border-right: 4px solid #ECE5DD !important; }
.pv-t .dr td.ge  { border-right: 4px solid #ECE5DD !important; }

/* ── Data rows (zebra) ─────────────────────────────────────────────── */
.pv-t .dr:nth-child(odd)  td    { background: #ffffff; }
.pv-t .dr:nth-child(even) td    { background: #faf9f7; }
.pv-t .dr:nth-child(odd)  td.sc { background: #ffffff; }
.pv-t .dr:nth-child(even) td.sc { background: #faf9f7; }
.pv-t .dr:hover td              { background: #eef4f7 !important; }

/* ── Conditional formatting ────────────────────────────────────────── */
.qt { color: #557344; font-weight: 600; }
.qb { color: #8F3C35; font-weight: 600; }

/* ── Sort arrow ────────────────────────────────────────────────────── */
.sa { font-size: 0.55rem; margin-left: 2px; opacity: 0.70; }

/* ── Ranked Leaderboard cell (two-line: name + value) ─────────────── */
.rk-name {
    font-weight: 600;
    font-size: 0.76rem;
    line-height: 1.2;
    white-space: nowrap;
}
.rk-val {
    font-weight: 400;
    font-size: 0.72rem;
    color: #555;
    line-height: 1.2;
    white-space: nowrap;
}

/* ── Ranked Leaderboard section heading ───────────────────────────── */
.pv-ranked-heading {
    font-size: 1.15rem;
    font-weight: 600;
    color: #132E4A;
    margin-bottom: 0.15rem;
}
.pv-ranked-sub {
    font-size: 0.78rem;
    color: #757575;
    margin-bottom: 0.75rem;
}

/* ── Chart Title Tooltip ──────────────────────────────────────────── */
.chart-title-tooltip {
    position: relative;
    cursor: help;
    border-bottom: 1px dashed #132E4A;
    display: inline;
}

.chart-title-tooltip .tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    background-color: #2c2c2e;
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.45;
    text-align: center;
    padding: 10px 16px;
    border-radius: 10px;
    white-space: pre-line;
    width: max-content;
    max-width: 260px;
    z-index: 9999;
    pointer-events: none;
    transition: opacity 0.15s ease-in-out, visibility 0.15s ease-in-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Arrow */
.chart-title-tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 7px;
    border-style: solid;
    border-color: #2c2c2e transparent transparent transparent;
}

.chart-title-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* ── Portfolio View – Section header row (top tier of 3-tier thead) ─── */
.pv-t .sh th {
    background: #0c1f33;      /* darker navy than group/metric rows */
    color: #e0e8f0;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    text-align: center;
    padding: 8px 12px;
    border-bottom: 1px solid #1a3a56;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}
.pv-t .sh th.sc {
    background: #0c1f33;
    text-align: left;
    color: #e0e8f0;
}

/* ── Sub-group end separator (thinner than section .ge) ─────────────── */
.pv-t .se        { border-right: 2px solid #c8b89a !important; }
.pv-t .sh th.se  { border-right: 2px solid #1a3a56 !important; }
.pv-t .gh th.se  { border-right: 2px solid #1a3a56 !important; }
.pv-t .mh th.se  { border-right: 2px solid #1a3a56 !important; }
.pv-t .sr td.se  { border-right: 2px solid #c8b89a !important; }
.pv-t .dr td.se  { border-right: 2px solid #c8b89a !important; }

/* ── Portfolio metric header tooltip ────────────────────────────────── */
/* Tooltip appears BELOW the sticky header (not above, to avoid clipping) */
.pv-th-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    cursor: help;
}

.pv-th-tip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: calc(100% + 6px);   /* below the header cell */
    left: 50%;
    transform: translateX(-50%);
    background-color: #2c2c2e;
    color: #ffffff;
    font-size: 0.76rem;
    font-weight: 400;
    line-height: 1.45;
    text-align: left;
    padding: 9px 14px;
    border-radius: 8px;
    white-space: normal;
    width: max-content;
    max-width: 240px;
    z-index: 9999;
    pointer-events: none;
    transition: opacity 0.15s ease-in-out, visibility 0.15s ease-in-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.30);
    text-transform: none;
    letter-spacing: 0;
}

/* Arrow pointing UP (tooltip is below) */
.pv-th-tip::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: transparent transparent #2c2c2e transparent;
}

.pv-th-wrap:hover .pv-th-tip {
    visibility: visible;
    opacity: 1;
}

/* ── Data Dictionary table ───────────────────────────────────────────── */
.pv-dict-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.80rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
.pv-dict-table thead tr th {
    background: #132E4A;
    color: #fff;
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 8px 14px;
    border-bottom: 2px solid #0c1f33;
    text-align: left;
}
.pv-dict-table tbody tr:nth-child(odd)  td { background: #ffffff; }
.pv-dict-table tbody tr:nth-child(even) td { background: #faf9f7; }
.pv-dict-table tbody tr:hover td           { background: #eef4f7; }
.pv-dict-table tbody tr td {
    padding: 7px 14px;
    border-bottom: 1px solid #e5e5e5;
    vertical-align: top;
    color: #333;
    line-height: 1.45;
}
.pv-dict-table tbody tr td:first-child {
    font-weight: 600;
    white-space: nowrap;
    color: #132E4A;
    width: 180px;
}
.pv-dict-table tbody tr td:nth-child(2) {
    white-space: nowrap;
    width: 110px;
}
/* Section badge in data dictionary */
.pv-dict-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.70rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.pv-dict-badge.fin  { background: #d1e8f5; color: #0c3a5c; }
.pv-dict-badge.gtm  { background: #d5ead4; color: #1a4d1a; }
.pv-dict-badge.eff  { background: #f5e6d1; color: #5c3a0c; }

/* ── Year header row (Table 1 – Metrics Over Time) ───────────────────── */
.pv-t .yh th {
    background: #1e4468;     /* mid-navy, lighter than mh/gh #132E4A */
    color: #c8dbe8;
    font-weight: 500;
    font-size: 0.66rem;
    padding: 4px 10px;
    text-align: center;
    border-bottom: 2px solid #0c1f33;
    letter-spacing: 0.3px;
}
.pv-t .yh th.sc { background: #1e4468; text-align: left; }

/* ── Intra-metric year separator (very subtle – between years WITHIN a metric) */
.pv-t .yr-sep        { border-right: 1px solid #ddd8d0 !important; }
.pv-t .yh th.yr-sep  { border-right: 1px solid #3a6888 !important; }
.pv-t .mh th.yr-sep  { border-right: 1px solid #3a6888 !important; }
.pv-t .gh th.yr-sep  { border-right: 1px solid #3a6888 !important; }
.pv-t .sh th.yr-sep  { border-right: 1px solid #3a6888 !important; }

/* ── Metric-level separator (between different metrics within same sub-group) */
.pv-t .m-sep        { border-right: 2px solid #9ab3c3 !important; }
.pv-t .yh th.m-sep  { border-right: 2px solid #4d8ab5 !important; }
.pv-t .mh th.m-sep  { border-right: 2px solid #4d8ab5 !important; }
.pv-t .gh th.m-sep  { border-right: 2px solid #4d8ab5 !important; }
.pv-t .sh th.m-sep  { border-right: 2px solid #4d8ab5 !important; }
.pv-t .dr td.m-sep  { border-right: 2px solid #9ab3c3 !important; }