body { margin: 0; background: #f7f7f5; font-family: 'Inter', sans-serif; color: #2c2c2c; }

/* Header: the same as the funding network's (site/network/index.html), change both together */
.tell-header {
    background: #513773; padding: 18px 40px;
    display: flex; align-items: center; gap: 16px;
    font-family: 'Inter', sans-serif;
}
.tell-header .tell-brand { display: flex; align-items: center; flex-shrink: 0; }
.tell-header img { display: block; height: 44px; object-fit: contain; }
/* The page's name, beside the logo after a thin divider */
.tell-header .tell-page-title {
    margin: 0; padding-left: 16px; border-left: 1px solid rgba(255,255,255,0.35);
    display: flex; align-items: center; min-height: 32px;
    color: #fff; font-size: 20px; font-weight: 600; line-height: 1.2;
}
.tell-header .tell-home {
    margin-left: auto; display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 16px; border-radius: 999px; background: #fff; color: #513773;
    font-size: 13px; font-weight: 700; line-height: 1.2; text-decoration: none; white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: background 0.15s, transform 0.15s;
}
.tell-header .tell-home:hover,
.tell-header .tell-home:focus-visible { background: #efe9f7; transform: translateX(-2px); }
.tell-header .tell-home:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.tell-intro { max-width: 860px; margin: 0 auto; padding: 24px 20px 32px; }
.tell-intro h1 { font-size: 2rem; font-weight: 700; color: #513773; line-height: 1.25; margin-bottom: 18px; }
.tell-intro p { font-size: 1rem; line-height: 1.75; color: #444; margin: 0; }
.tell-footer {
    text-align: center; padding: 24px 40px; font-size: 12px;
    color: #999; border-top: 1px solid #e5e5e5; margin-top: 40px;
}
.tell-footer a { color: #54639E; text-decoration: none; }
.tell-footer a:hover { text-decoration: underline; }

/* ── Cards: KPIs, graphs, table ────────────────────────────────────────── */
.tell-card {
    background: #fff;
    border: 1px solid #e9e6ef;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(30, 20, 50, 0.04), 0 4px 16px rgba(30, 20, 50, 0.05);
    overflow: hidden;   /* clips the map and plot corners to the radius */
}
.tell-kpi { flex: 1; padding: 18px 20px; text-align: center; }

/* ── Filter panels ─────────────────────────────────────────────────────── */
.tell-panel {
    background: #fff;
    border: 1px solid #e9e6ef;
    border-radius: 12px;
    padding: 6px;
}
/* Direct child only: the filter's title. Dash 4 also renders each dropdown
   option as a <label> inside this column, and `display: block` from here put
   the option's name on a line below its checkbox. */
.tell-filter-col > label {
    display: block; margin-bottom: 6px;
    font-size: 13px; font-weight: 600; color: #6b6b76;
}

/* Filters: keep the three dropdowns on one row */
.tell-filters { display: flex; flex-wrap: nowrap; align-items: flex-end; }

/* ── Section headings above cards (charts, map, table) ─────────────────── */
.tell-block { display: flex; flex-direction: column; }
.tell-block > .tell-card { flex: 1; }
.tell-block-head { padding: 4px 4px 10px; }
.tell-block-title {
    margin: 0; font-size: 16px; font-weight: 700; color: #513773;
    display: flex; align-items: center; gap: 8px;
}
.tell-block-title::before {   /* small brand accent bar */
    content: ""; width: 4px; height: 16px; border-radius: 2px; background: #513773;
}
.tell-block-sub { margin: 4px 0 0 12px; font-size: 12px; color: #6b6b76; min-height: 15px; }

/* ── Company table ─────────────────────────────────────────────────────── */
.tell-table-card .dash-table-container th.dash-header:first-child { padding-left: 20px !important; }
.tell-table-card .dash-table-container td.dash-cell:first-child { padding-left: 20px !important; }

/* Pagination bar under the table */
.tell-table-card .previous-next-container {
    float: none; display: flex; justify-content: flex-end; align-items: center;
    padding: 10px 16px; font-family: inherit; color: #6b6b76;
}
.tell-table-card .previous-next-container button {
    border: 1px solid #e9e6ef; border-radius: 6px; background: #fff;
    color: #513773; min-width: 30px; height: 30px; margin: 0 2px; cursor: pointer;
}
.tell-table-card .previous-next-container button:disabled { color: #cfcad8; cursor: default; }
.tell-table-card .previous-next-container input.current-page {
    border: 1px solid #e9e6ef; border-radius: 6px; height: 30px; width: 40px;
    text-align: center; font-family: inherit; color: #2c2c2c;
}

/* Never let a graph push the page wider than the screen */
.tell-app, .tell-map-row, .tell-pies { max-width: 100%; }
.tell-map-row .js-plotly-plot,
.tell-pies .js-plotly-plot { max-width: 100% !important; }

/* ── Info mark beside a chart title (explains the chart on hover) ─────── */
.tell-block-title-row { display: flex; align-items: center; gap: 6px; }
.tell-info {
    display: inline-flex; align-items: center; justify-content: center;
    width: 15px; height: 15px; border-radius: 50%;
    background: #e4dcef; color: #513773;
    font-size: 10px; font-weight: 700; font-style: italic;
    cursor: help; user-select: none;
}
.tell-info:hover, .tell-info:focus { background: #513773; color: #fff; outline: none; }
/* The browser's own tooltip never appears on a touch screen, so the text is
   also shown on hover or tap (the mark is focusable). */
.tell-info { position: relative; }
.tell-info::after {
    content: attr(data-note);
    position: absolute; top: 22px; left: 50%; transform: translateX(-45%);
    width: 230px; padding: 9px 11px; border-radius: 8px; z-index: 20;
    background: #2c2c2c; color: #fff; font-size: 11px; font-weight: 400;
    font-style: normal; line-height: 1.45; text-align: left;
    opacity: 0; visibility: hidden; transition: opacity 0.12s;
    pointer-events: none;
}
.tell-info:hover::after, .tell-info:focus::after { opacity: 1; visibility: visible; }

/* ── Keyword chips in the companies table ─────────────────────────────── */
/* The Keywords cell renders one chip per keyword instead of a comma string.
   It lists all of a company's keywords (up to ~60), so the list scrolls inside
   the cell rather than stretching the row to fit. */
.tell-chips {
    display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
    max-height: 76px; overflow-y: auto; padding-right: 4px;
}
.tell-chip {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    background: #f2eff7; border: 1px solid #e4dcef; color: #513773;
    font-size: 11px; line-height: 1.6; white-space: nowrap;
}
/* Keywords the user is filtering on, so it is clear why the row matched */
.tell-chip-on { background: #513773; border-color: #513773; color: #fff; font-weight: 600; }

/* ── Keyword cloud ────────────────────────────────────────────────────── */
/* Words sized by frequency (font size set inline); the three levels set the
   colour, so the most common words also stand out for readers who cannot
   tell the sizes apart at a glance. */
.tell-cloud {
    display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline;
    gap: 4px 14px; padding: 22px 24px; min-height: 120px;
}
.tell-cloud-word {
    background: none; border: none; padding: 2px 4px; border-radius: 6px;
    font-family: inherit; line-height: 1.15; cursor: pointer;
    transition: background-color 0.12s, color 0.12s;
}
.tell-cloud-l1 { color: #513773; font-weight: 700; }
.tell-cloud-l2 { color: #54639E; font-weight: 600; }
.tell-cloud-l3 { color: #6b6b76; font-weight: 500; }
.tell-cloud-word:hover, .tell-cloud-word:focus-visible {
    background: #f2eff7; color: #513773; outline: none;
}
.tell-cloud-word:focus-visible { box-shadow: 0 0 0 2px #513773; }
.tell-cloud-empty { margin: auto; font-size: 13px; color: #6b6b76; }

/* Markdown cells add their own paragraph margins; chips sit flush without them */
.dash-cell .dash-cell-value p { margin: 0; }

/* ── Company profile (opens from a company name in the table) ─────────── */
.tell-profile-overlay {
    position: fixed; inset: 0; z-index: 1000;
    align-items: center; justify-content: center; padding: 24px;
}
.tell-profile-backdrop { position: absolute; inset: 0; background: rgba(35, 25, 50, 0.45); }
.tell-profile {
    position: relative; background: #fff; border-radius: 12px;
    width: 720px; max-width: 100%; max-height: 88vh; overflow-y: auto;
    padding: 28px 32px; box-sizing: border-box;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.tell-profile-close {
    /* z-index: the header below it is painted later and would otherwise cover
       the button, which made it untappable on a phone. */
    position: absolute; top: 10px; right: 10px; z-index: 2;
    background: none; border: none;
    font-size: 26px; line-height: 1; color: #6b6b76; cursor: pointer;
    width: 40px; height: 40px; padding: 0;        /* a finger-sized target */
}
.tell-profile-close:hover { color: #513773; }
.tell-profile-head { padding-right: 32px; margin-bottom: 18px; }
.tell-profile-name { margin: 0 0 8px; font-size: 1.45rem; color: #513773; line-height: 1.25; }
.tell-profile-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 13px; color: #6b6b76; }
.tell-profile-status {
    background: #e8f3ec; color: #2f6b45; border-radius: 10px;
    padding: 1px 9px; font-size: 11px; font-weight: 600;
}
.tell-profile-link { color: #54639E; text-decoration: none; word-break: break-all; }
.tell-profile-link:hover { text-decoration: underline; }
.tell-profile-stats {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px;
}
.tell-profile-stats-2 { grid-template-columns: repeat(2, 1fr); margin-bottom: 0; }
.tell-profile-stat { background: #f7f5fa; border-radius: 8px; padding: 10px 12px; min-width: 0; }
.tell-profile-stat-label {
    display: block; font-size: 10px; font-weight: 600; letter-spacing: 0.6px;
    text-transform: uppercase; color: #6b6b76; margin-bottom: 3px;
}
.tell-profile-stat-value { display: block; font-size: 15px; font-weight: 600; color: #2c2c2c; overflow-wrap: anywhere; }
.tell-profile-section { border-top: 1px solid #eeecf2; padding-top: 14px; margin-top: 14px; }
.tell-profile-section-title {
    margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.7px;
    text-transform: uppercase; color: #513773;
}
.tell-profile-section p { margin: 0 0 4px; font-size: 14px; }
.tell-profile-muted { color: #6b6b76; font-size: 13px; }
.tell-profile-emails { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 6px; }
.tell-profile-email { color: #54639E; font-size: 14px; text-decoration: none; }
.tell-profile-email:hover { text-decoration: underline; }
/* Profiles show every keyword; give the list more room than a table cell */
.tell-profile-keywords { max-height: 180px; }

/* ── Responsive: dashboard on phones ──────────────────────────────────── */
@media (max-width: 768px) {
    .tell-header { padding: 14px 20px; }
    .tell-header img { height: 36px; }
    .tell-header { gap: 12px; }
    .tell-header .tell-page-title { font-size: 15px; padding-left: 12px; }
    /* Tighter outer padding to reclaim screen width */
    .tell-app { padding: 12px !important; }

    .tell-intro { padding: 12px 8px 20px; }
    .tell-intro h1 { font-size: 1.5rem; margin-bottom: 14px; }
    .tell-intro p { font-size: 0.95rem; line-height: 1.65; }

    /* Filters: stack the dropdowns full width. Stretch (not the desktop
       flex-end alignment) and border-box keep the 10px padding inside the
       panel; otherwise the columns stick out on the left. */
    .tell-filters { flex-direction: column !important; align-items: stretch; }
    .tell-filter-col { width: auto !important; box-sizing: border-box; }

    /* Stack the flex rows vertically (override inline display:flex) */
    .tell-kpis,
    .tell-map-row,
    .tell-pies,
    .tell-buttons { flex-direction: column !important; }

    /* Map/region graphs and their wrappers fill the width, shorter height */
    .tell-map-row > div { width: 100% !important; flex: none !important; }
    .tell-map-row .dash-graph,
    .tell-map-row .js-plotly-plot { height: 360px !important; width: 100% !important; }

    /* Distribution charts: full width, one per row */
    .tell-pies > div { width: 100% !important; flex: none !important; }
    .tell-pies .dash-graph,
    .tell-pies .js-plotly-plot { width: 100% !important; height: 320px !important; }

    /* Finger-sized: the info mark and the table's paging buttons are drawn
       for a mouse pointer and are awkward to hit on a phone. */
    .tell-info { width: 20px; height: 20px; font-size: 12px; }
    .tell-info::after { width: 210px; transform: translateX(-60%); }
    .dash-table-container .previous-page,
    .dash-table-container .next-page,
    .dash-table-container .first-page,
    .dash-table-container .last-page {
        /* !important: Dash sets the height with a more specific rule of its own */
        width: 38px; flex: none; height: 38px !important;
    }

    /* Company profile: near full screen, stats two per row */
    .tell-profile-overlay { padding: 8px; }
    .tell-profile { padding: 20px 18px; max-height: 94vh; }
    .tell-profile-stats { grid-template-columns: repeat(2, 1fr); }

    /* Buttons go full width and easier to tap */
    .tell-buttons > a,
    .tell-buttons > button { width: 100% !important; text-align: center; box-sizing: border-box; }
}
