/* FMP Financial Health Dashboard */
:root {
  --fhd-good: #16a34a;
  --fhd-watch: #d97706;
  --fhd-concern: #dc2626;
  --fhd-muted: #64748b;
  --fhd-border: #e2e8f0;
  --fhd-bg: #f5f7fa;
}

body.fhd-body { background: var(--fhd-bg); }

.fhd-header { background: #0f172a; color: #e2e8f0; }
.fhd-header .fhd-ticker { font-size: 1.6rem; font-weight: 700; letter-spacing: .02em; color: #fff; }
.fhd-header .fhd-meta { color: #94a3b8; font-size: .85rem; }
.fhd-header .fhd-price { font-size: 1.4rem; font-weight: 600; color: #fff; }

.fhd-sectionnav { background: #fff; border-bottom: 1px solid var(--fhd-border); z-index: 1020; }
.fhd-sectionnav .nav-link { font-size: .85rem; padding: .6rem .8rem; color: #334155; white-space: nowrap; }
.fhd-sectionnav .nav-link:hover { color: #2563eb; }
.fhd-sectionnav .nav { flex-wrap: nowrap; overflow-x: auto; }

.fhd-card { border: 1px solid var(--fhd-border); border-radius: .6rem; background: #fff; }
.fhd-card > .card-header { background: #fff; border-bottom: 1px solid var(--fhd-border); font-weight: 600; }
.fhd-card-title { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--fhd-muted); }

.fhd-grade { font-size: 3.2rem; line-height: 1; font-weight: 800; }
.fhd-kpi-value { font-size: 1.35rem; font-weight: 700; }
.fhd-kpi-label { font-size: .75rem; color: var(--fhd-muted); text-transform: uppercase; letter-spacing: .04em; }

.fhd-score-badge { font-size: .85rem; font-weight: 600; padding: .35em .65em; border-radius: 2rem; color: #fff; }

.fhd-tile { border: 1px solid var(--fhd-border); border-left-width: 4px; border-radius: .5rem; padding: .55rem .7rem; height: 100%; background: #fff; }
.fhd-tile.good { border-left-color: var(--fhd-good); }
.fhd-tile.watch { border-left-color: var(--fhd-watch); }
.fhd-tile.concern { border-left-color: var(--fhd-concern); }
.fhd-tile.info, .fhd-tile.stale, .fhd-tile.no_data, .fhd-tile.not_applicable, .fhd-tile.error { border-left-color: #cbd5e1; }
.fhd-tile-label { font-size: .75rem; color: var(--fhd-muted); line-height: 1.2; min-height: 1.8em; }
.fhd-tile-value { font-size: 1.1rem; font-weight: 700; }
.fhd-tile .progress { height: 4px; }

.fhd-chart { min-height: 280px; }
.fhd-chart-sm { min-height: 240px; }
.fhd-chart-title { font-size: .85rem; font-weight: 600; color: #1e293b; }

.fhd-flag { border-left: 4px solid; padding: .45rem .7rem; border-radius: .35rem; background: #fff; font-size: .875rem; }
.fhd-flag.high { border-color: var(--fhd-concern); background: #fef2f2; }
.fhd-flag.medium { border-color: var(--fhd-watch); background: #fffbeb; }
.fhd-flag.low { border-color: #94a3b8; background: #f8fafc; }

.fhd-sec-panel { max-height: calc(100vh - 6rem); overflow-y: auto; }
.fhd-sec-panel .accordion-button { font-size: .875rem; padding: .6rem .8rem; }
.fhd-sec-panel .accordion-body { font-size: .82rem; }
.fhd-sec-panel .reviewed .accordion-button { text-decoration: line-through; color: var(--fhd-muted); }
.fhd-pri-high { background: var(--fhd-concern); }
.fhd-pri-elevated { background: var(--fhd-watch); }
.fhd-pri-standard { background: #64748b; }

.fhd-table { font-size: .82rem; }
.fhd-table td, .fhd-table th { vertical-align: middle; }
.fhd-formula { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .75rem; color: #475569; }

.fhd-dropzone { border: 2px dashed #94a3b8; border-radius: .8rem; padding: 3rem; text-align: center; color: var(--fhd-muted); background: #fff; }
.fhd-dropzone.dragover { border-color: #2563eb; background: #eff6ff; }

@media (min-width: 1200px) {
  .fhd-aside { position: sticky; top: 3.5rem; }
}

/* Filing evidence inside the SEC panel */
.fhd-ev { border-top: 1px dashed var(--fhd-border); padding-top: .5rem; }
.fhd-ev-head { font-weight: 600; font-size: .8rem; color: #0f172a; margin-bottom: .35rem; }
.fhd-ev-sub { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--fhd-muted); margin: .5rem 0 .25rem; }
.fhd-ev-note { font-size: .78rem; color: var(--fhd-muted); font-style: italic; }
.fhd-ev-passage { border-left: 3px solid #93c5fd; background: #f8fafc; padding: .4rem .55rem; border-radius: .25rem; margin-bottom: .4rem; font-size: .78rem; }
.fhd-ev-snippet { margin: .2rem 0; line-height: 1.4; }
.fhd-ev-snippet mark { background: #fef08a; padding: 0 .1em; }
.fhd-ev-meta { font-size: .72rem; color: var(--fhd-muted); }
.fhd-ev-diff { border: 1px solid var(--fhd-border); border-radius: .3rem; padding: .45rem .55rem; font-size: .78rem; }
.fhd-ev-added { border-left: 3px solid var(--fhd-good); background: #f0fdf4; padding: .3rem .5rem; margin-top: .25rem; }
.fhd-ev-removed { border-left: 3px solid var(--fhd-concern); background: #fef2f2; padding: .3rem .5rem; margin-top: .25rem; text-decoration: line-through; text-decoration-color: rgba(220,38,38,.35); }
.fhd-ev-table { font-size: .75rem; }
.fhd-ev-table td, .fhd-ev-table th { padding: .15rem .3rem; }

/* Tone vs health */

/* Header actions (sign-out) */
#fhd-header-actions:empty { display: none !important; }
#fhd-header-actions form { margin: 0; }

/* Footnote on tiles (e.g. returns above 100%) */
.fhd-note-mark { color: var(--fhd-muted); font-weight: 600; margin-left: .1rem; }
.fhd-tile-note { font-size: .68rem; line-height: 1.25; color: var(--fhd-muted); margin-top: .3rem; }

/* Share price panel (first, full width) */
.fhd-chart-price { min-height: 360px; }
.fhd-price-stats { display: flex; flex-wrap: wrap; gap: .75rem 2rem; }
.fhd-price-stat .fw-semibold { font-size: 1.05rem; }
#fhd-price-range .btn.active { background: #334155; border-color: #334155; color: #fff; }

/* Periods: header "data as of" line, tile captions, category notes */
.fhd-asof { font-size: .78rem; color: #cbd5e1; line-height: 1.5; }
.fhd-asof b { color: #fff; font-weight: 600; }
.fhd-asof-sep { margin: 0 .5rem; color: #64748b; }
.fhd-asof-note { color: #94a3b8; cursor: help; }
.fhd-tile-period { font-size: .66rem; color: #64748b; letter-spacing: .01em; margin-top: -.05rem; line-height: 1.3; }
.fhd-cat-period { color: #334155; font-weight: 600; }
.fhd-cat-period.mixed { color: #b45309; }

/* SEC filing markers on the share price chart */
.fhd-filing-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; padding: .35rem 0 .25rem; border-top: 1px solid #eef2f7; }
.fhd-form-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .5rem; border: 1px solid #cbd5e1; border-radius: 999px;
  font-size: .75rem; color: #334155; cursor: pointer; user-select: none; background: #fff; opacity: .55; }
.fhd-form-chip.on { opacity: 1; border-color: #94a3b8; background: #f8fafc; }
.fhd-form-chip input { position: absolute; opacity: 0; pointer-events: none; }
.fhd-form-chip:focus-within { outline: 2px solid #2563eb; outline-offset: 1px; }
.fhd-filing-table summary { cursor: pointer; color: #334155; }
.fhd-filing-scroll { max-height: 280px; overflow: auto; border: 1px solid #eef2f7; border-radius: 6px; }
.fhd-filing-scroll thead th { position: sticky; top: 0; background: #f8fafc; z-index: 1; }
.fhd-filing-scroll tbody tr { cursor: pointer; }
.fhd-form-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 2px; margin-right: .35rem; vertical-align: middle; }

/* Category groups: info popover and collapsible chart group */
.fhd-info-btn { border: 0; background: none; padding: 0 .15rem; line-height: 1; color: #64748b; cursor: pointer; border-radius: 50%; }
.fhd-info-btn:hover, .fhd-info-btn[aria-expanded="true"] { color: #2563eb; }
.fhd-info-btn:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.fhd-pop { position: absolute; z-index: 1080; background: #fff; border: 1px solid #cbd5e1; border-radius: .5rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .15); padding: .8rem 2rem .7rem .9rem; font-size: .875rem; color: #1e293b; }
.fhd-pop-close { position: absolute; top: .55rem; right: .55rem; width: .6rem; height: .6rem; }
.fhd-pop-title { font-weight: 600; margin-bottom: .35rem; }
.fhd-pop-list { padding-left: 1.1rem; margin: 0; font-size: .8rem; }
.fhd-pop-list li { margin-bottom: .3rem; }
details.fhd-chart-group { border-top: 1px solid #eef2f7; }
details.fhd-chart-group > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem;
  padding: .6rem 0 0; font-size: .9rem; color: #334155; }
details.fhd-chart-group > summary::-webkit-details-marker { display: none; }
details.fhd-chart-group > summary:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; border-radius: 4px; }
details.fhd-chart-group > summary:hover .fw-semibold { color: #2563eb; }
.fhd-chev { transition: transform .15s ease; font-size: .8rem; }
details.fhd-chart-group[open] .fhd-chev { transform: rotate(90deg); }
.fhd-chart-group-list { flex-basis: 100%; padding-left: 1.15rem; }
details.fhd-chart-group[open] .fhd-chart-group-list { display: none; }

/* Caption in front of period / source strings ("Period:", "Data period:", "Source:") */
.fhd-src-label { color: #64748b; font-weight: 400; }

/* Filing popup */
.fhd-fm-card { background: #fff; }
.fhd-fm-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: #64748b; font-weight: 600; margin-bottom: .25rem; }
.fhd-fm-items { padding-left: 1.1rem; margin: .15rem 0 0; font-size: .85rem; }
.fhd-fm-items li { margin-bottom: .1rem; }
.fhd-fm-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem; border-top: 1px solid #eef2f7; margin-top: .75rem; padding-top: .75rem; }
/* Filing Insights reports: list in the filing popup, reader for one report */
.fhd-fi-list .fhd-fi-item { text-align: left; }
.fhd-fi-bar { position: sticky; top: -1rem; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  background: #fff; padding: .5rem 0; margin: -.5rem 0 .5rem; border-bottom: 1px solid #eef2f7; }
.fhd-fi-bar .fhd-fi-pick { max-width: 22rem; }
.fhd-fi-bar .fhd-fi-toc { max-width: 18rem; }
.fhd-fi-doc { font-size: .92rem; line-height: 1.6; color: #1e293b; max-width: 60rem; }
.fhd-fi-doc h1, .fhd-fi-doc h2, .fhd-fi-doc h3, .fhd-fi-doc h4 { scroll-margin-top: 4rem; margin-top: 1.4em; margin-bottom: .5em; font-weight: 650; line-height: 1.3; }
.fhd-fi-doc h1 { font-size: 1.35rem; margin-top: .25rem; }
.fhd-fi-doc h2 { font-size: 1.15rem; padding-bottom: .25rem; border-bottom: 1px solid #e2e8f0; }
.fhd-fi-doc h3 { font-size: 1rem; }
.fhd-fi-doc h4 { font-size: .92rem; }
.fhd-fi-doc table { font-size: .85rem; width: auto; min-width: 50%; }
.fhd-fi-doc th { background: #f8fafc; }
.fhd-fi-doc blockquote { border-left: 3px solid #cbd5e1; padding: .25rem 0 .25rem .9rem; color: #475569; margin: 1em 0; }
.fhd-fi-doc code { font-size: .85em; background: #f1f5f9; padding: .1em .3em; border-radius: .25rem; color: #0f172a; }
.fhd-fi-doc pre { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: .375rem; padding: .75rem; overflow: auto; }
.fhd-fi-doc pre code { background: none; padding: 0; }
.fhd-fi-doc hr { margin: 1.5rem 0; color: #cbd5e1; }
.fhd-fi-doc img { border-radius: .25rem; }
@media (max-width: 575.98px) { .fhd-fi-bar .fhd-fi-pick, .fhd-fi-bar .fhd-fi-toc { max-width: none; flex: 1 1 100%; } }
.fhd-fm-note { color: #475569; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: .375rem; padding: .35rem .6rem; }

/* Key under the share price chart: solid = Filing Insights report, hollow = not analyzed */
.fhd-fi-key { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; padding: .15rem 0 .1rem; }
.fhd-fi-key span { display: inline-flex; align-items: center; gap: .35rem; }

/* "Analyzed by Filing Insights" toggle in the filing filter row */
.fhd-fi-toggle { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .6rem; font-size: .75rem; font-weight: 600;
  color: #1d4ed8; background: #fff; border: 1px solid #93c5fd; border-radius: 999px; cursor: pointer; line-height: 1.5; }
.fhd-fi-toggle:hover:not(:disabled) { background: #eff6ff; }
.fhd-fi-toggle[aria-pressed="true"] { color: #fff; background: #2563eb; border-color: #2563eb; }
.fhd-fi-toggle[aria-pressed="true"]:hover { background: #1d4ed8; }
.fhd-fi-toggle:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.fhd-fi-toggle:disabled { color: #94a3b8; border-color: #e2e8f0; cursor: not-allowed; }
.fhd-fi-count { font-weight: 500; padding: 0 .4rem; border-radius: 999px; background: #dbeafe; color: #1e3a8a; font-size: .7rem; }
.fhd-fi-toggle[aria-pressed="true"] .fhd-fi-count { background: rgba(255,255,255,.25); color: #fff; }
.fhd-fi-toggle:disabled .fhd-fi-count { background: #f1f5f9; color: #94a3b8; }
.fhd-filing-sep { width: 1px; align-self: stretch; background: #e2e8f0; margin: .1rem .15rem; }
.fhd-fi-key-filtered { display: none !important; color: #1d4ed8; font-weight: 600; }
.fhd-fi-key.filtered .fhd-fi-key-filtered { display: inline-flex !important; }
.fhd-fi-key.filtered .fhd-fi-key-hollow { display: none !important; }
