@import url("https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap");

/* Theme variables. Same names as before so every var(--x) reference in
   dash_app.py keeps working; only the values changed. --pill-active,
   --up and --down are new. --security-text keeps its old tuned blue
   (not part of the redesign) -- the rest of the theme moved to a
   near-black/off-white palette, but the first column of every table
   keeps a blue "pop of color" accent, kept here even though the new
   design's own --security-text just matches --text. */
:root {
    /* Tells the browser which native-control chrome to use (autofill
       panels, form-control icons like the input clear/reveal buttons,
       default scrollbars) -- without it, some of those default to light
       regardless of our own dark styling. */
    color-scheme: dark;
    --bg: #0f0f0e;
    --text: #ecebe6;
    --header: #161615;          /* nav pill track (background) */
    --header-text: #ecebe6;
    --body-text: #9a9890;
    --security-text: #5DADE2;
    --card-bg: #161615;
    --card-bg-2: #1c1c1a;
    --border: #262624;
    --table-header-bg: #161615;
    --pill-active: #2a2a27;
    --up: #4cc38a;
    --down: #e5675a;
    --accent: #4cc38a;
}
:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f7f7f4;
    --text: #1b1b19;
    --header: #ecebe6;
    --header-text: #1b1b19;
    --body-text: #5f5e58;
    --security-text: #2874a6;
    --card-bg: #ffffff;
    --card-bg-2: #f1f0ec;
    --border: #e2e1db;
    --table-header-bg: #ffffff;
    --pill-active: #ffffff;
    --up: #1f8a5a;
    --down: #c2463a;
    --accent: #1f8a5a;
}

html, body {
    background-color: var(--bg);
    color: var(--text);
    font-family: "Instrument Sans", system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    margin: 0;
}
a { color: var(--accent); }
a:hover { color: var(--text); }

h2 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin: 8px 0 4px; }
h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.005em; margin: 28px 0 8px; }
p  { line-height: 1.55; text-wrap: pretty; }

/* Tables: mono tabular figures, first column stays in the UI sans */
.dash-spreadsheet td.dash-cell,
.dash-spreadsheet th.dash-header {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-variant-numeric: tabular-nums;
}
.dash-spreadsheet td.dash-cell.column-0,
.dash-spreadsheet th.dash-header {
    font-family: "Instrument Sans", system-ui, sans-serif;
}
.dash-spreadsheet td.dash-cell.column-0 { font-weight: 500; }
.dash-spreadsheet tr:hover td.dash-cell { background-color: var(--card-bg-2) !important; }
.dash-table-container {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

/* Buttons */
button {
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    background: var(--card-bg-2);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 7px 12px;
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}
button:hover:not(:disabled) { border-color: var(--body-text); }
button:disabled { opacity: .45; cursor: default; }
button[id^="calculate-"] {
    background: var(--accent);
    border-color: var(--accent);
    color: #0f0f0e;
    font-weight: 600;
}

/* Text/number inputs. --card-bg is only a hair lighter than --bg in dark
   mode (#161615 vs #0f0f0e) -- fine for a big card surface sitting next to
   plenty of its own whitespace, but an input that size difference reads as
   just "black" against the page. --pill-active is enough lighter to read
   as its own field. */
input[type="text"], input[type="number"] {
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    background-color: var(--pill-active);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 8px 10px;
    outline: none;
}
/* Edge/IE's native "clear field" (x) and "reveal password" icons render
   with their own light-chrome background regardless of our CSS -- without
   this, a typed value shows a plain white/light box past the text on a
   dark input, since nothing here themes them. */
input[type="text"]::-ms-clear, input[type="text"]::-ms-reveal {
    display: none;
}
/* dash-core-components ships .dash-input-container with its own hardcoded
   white background-color and a purple border/focus outline, and every
   dcc.Input renders as that wrapper div around the actual <input> -- the
   input itself is styled above (including its own green focus ring), but
   dcc.Input's own width (e.g. "220px" set inline on this wrapper) is often
   wider than the <input>'s natural rendered width, leaving a strip of that
   default white showing on one side, and the wrapper's own border/outline
   shows as a second, differently-colored ring around the input's own. */
.dash-input-container, .dash-input-container:focus-within {
    background-color: transparent;
    border: none !important;
    outline: none !important;
}
input[type="text"]:focus, input[type="number"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent);
}
input[type="range"] { accent-color: var(--accent); }
/* dcc.Slider's always-visible value bubble (tooltip={"always_visible": True}
   -- see the DCF assumption sliders) defaults to a white bubble with text
   color inherited from the page (var(--text), near-white), unreadable
   against its own white background. */
.dash-slider-tooltip {
    background-color: var(--card-bg-2) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: 6px !important;
}

/* dcc.Dropdown: Dash 4 renders it as its own <button> trigger (.dash-dropdown)
   plus a virtualized listbox popover (.dash-options-list) when open -- not
   the react-select markup older Dash versions used, and unstyled by
   default (a plain white button with unthemed text, unreadable on a dark
   page). */
.dash-dropdown {
    background-color: var(--pill-active) !important;
    border: 1px solid var(--border) !important;
    border-radius: 7px !important;
    color: var(--text) !important;
}
.dash-dropdown-value, .dash-dropdown-value-item, .dash-dropdown-trigger-icon {
    color: var(--text) !important;
}
.dash-options-list, .dash-dropdown-options,
.dash-dropdown-content, .dash-dropdown-search-container,
.dash-dropdown-search-container:focus-within {
    background-color: var(--card-bg) !important;
    border: 1px solid var(--border) !important;
    outline: none !important;
    border-radius: 7px !important;
}
.dash-options-list-option, .dash-dropdown-option {
    color: var(--text) !important;
}
/* The dropdown's own in-popover filter box, searchable=True -- a separate
   element from the .dash-dropdown trigger above, also unstyled by default.
   Its ancestors (.dash-dropdown-content/.dash-dropdown-search-container,
   above) default to white too, showing through around this input's own
   edges the same way .dash-input-container did earlier. */
.dash-dropdown-search {
    background-color: var(--pill-active) !important;
    color: var(--text) !important;
    border: none !important;
    border-bottom: 1px solid var(--border) !important;
}
.dash-options-list-option:hover, .dash-dropdown-option:hover {
    background-color: var(--card-bg-2) !important;
}

details summary { cursor: pointer; color: var(--body-text); font-size: 13px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; border: 2px solid var(--card-bg); }

/* Ticker search typeahead: show the suggestions dropdown only while focus
   is somewhere inside its wrapper (the input itself, or a suggestion
   button mid-click) — hides on click-away, reappears on refocus, with no
   JS needed. */
.ticker-search-wrap #company-suggestions {
    display: none;
}
.ticker-search-wrap:focus-within #company-suggestions {
    display: block;
}

.manager-search-wrap #manager-suggestions {
    display: none;
}
.manager-search-wrap:focus-within #manager-suggestions {
    display: block;
}

.global-search-wrap #global-search-suggestions {
    display: none;
}
.global-search-wrap:focus-within #global-search-suggestions {
    display: block;
}

/* Politician Tracker's two cross-chamber summary lists (recent trades,
   leaderboard): each row is click-to-select (see select_member_from_summary
   in dash_app.py, and _build_trade_row/_build_leaderboard_row) -- this is
   the only visual affordance for "this is clickable", so it needs to read
   as inviting on its own. */
.pol-row:hover {
    background-color: var(--card-bg-2);
}
