/* FundedTruth Leverage Explorer — front-end styles. Everything scoped under .fle */

.fle {
  --fle-bg: #ffffff;
  --fle-surface: #f6f8f8;
  --fle-ink: #14201f;
  --fle-muted: #5b6b69;
  --fle-line: #dfe6e5;
  --fle-accent-soft: color-mix(in srgb, var(--fle-accent) 9%, transparent);
  --fle-radius: 10px;
  color: var(--fle-ink);
  font-size: 15px;
  line-height: 1.45;
  margin: 1.5em 0;
  box-sizing: border-box;
}
.fle *, .fle *::before, .fle *::after { box-sizing: border-box; }

.fle-theme-dark {
  --fle-bg: #0f1716; --fle-surface: #172321; --fle-ink: #e8f0ef; --fle-muted: #93a6a3; --fle-line: #263735;
  background: var(--fle-bg); padding: 20px; border-radius: 14px;
}
@media (prefers-color-scheme: dark) {
  .fle-theme-auto {
    --fle-bg: #0f1716; --fle-surface: #172321; --fle-ink: #e8f0ef; --fle-muted: #93a6a3; --fle-line: #263735;
    background: var(--fle-bg); padding: 20px; border-radius: 14px;
  }
}

.fle .fle-head { margin-bottom: 14px; }
.fle .fle-title { margin: 0 0 4px; font-size: 1.5em; line-height: 1.2; }
.fle .fle-sub { margin: 0; color: var(--fle-muted); }
.fle .fle-section { margin-bottom: 26px; }
.fle .fle-section-title { margin: 0 0 12px; font-size: 1.1em; }
.fle .fle-group { margin-bottom: 20px; }
.fle .fle-group-title { margin: 0 0 10px; font-size: 1em; color: var(--fle-muted); }
.fle .fle-empty, .fle .fle-loading { padding: 22px; text-align: center; color: var(--fle-muted); background: var(--fle-surface); border-radius: var(--fle-radius); margin: 0; }
.fle .fle-disclosure { margin: 12px 0 0; font-size: 12.5px; color: var(--fle-muted); }

.fle .fle-v { display: block; font-weight: 600; font-variant-numeric: tabular-nums; }
.fle .fle-v2 { display: block; font-size: 12.5px; color: var(--fle-muted); }
.fle a { color: inherit; }
.fle .fle-plan-name a, .fle .fle-firm-name a { text-decoration: none; }
.fle .fle-plan-name a:hover, .fle .fle-firm-name a:hover { text-decoration: underline; }

.fle .fle-firm { display: inline-flex; align-items: center; gap: 10px; }
.fle .fle-firm-name { font-weight: 700; }
.fle .fle-logo { width: 34px; height: 34px; border-radius: 8px; flex: none; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; background: var(--fle-surface); border: 1px solid var(--fle-line); }
.fle .fle-logo img { width: 100%; height: 100%; object-fit: contain; display: block; margin: 0; }
.fle .fle-logo-ph { font-weight: 700; color: var(--fle-accent); }
.fle .fle-plan-name { display: block; font-weight: 600; }
.fle .fle-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--fle-accent-soft); color: var(--fle-accent); }
.fle-theme-dark .fle-pill { color: var(--fle-ink); }
.fle .fle-rank { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; font-weight: 700; font-size: 13px; background: var(--fle-surface); color: var(--fle-muted); }
.fle .fle-rank-1 { background: var(--fle-accent); color: #fff; }

/* Leverage number — the loud element */
.fle .fle-lev-num { font-size: 1.5em; font-weight: 800; letter-spacing: -0.01em; line-height: 1; color: var(--fle-accent); }
.fle .fle-lev-big { font-size: 2em; }

.fle .fle-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.fle .fle-chip { display: inline-flex; align-items: baseline; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--fle-surface); border: 1px solid var(--fle-line); font-size: 12.5px; color: var(--fle-muted); }
.fle .fle-chip b { color: var(--fle-ink); font-weight: 700; }
.fle .fle-chip-current { background: var(--fle-accent-soft); border-color: transparent; }
.fle .fle-chip-current b { color: var(--fle-accent); }

.fle .fle-btn { display: inline-block; padding: 9px 16px; border-radius: 8px; text-decoration: none !important; white-space: nowrap; background: var(--fle-accent); color: #fff !important; font-weight: 600; font-size: 14px; line-height: 1.2; border: 0; cursor: pointer; transition: filter .15s; }
.fle .fle-btn:hover { filter: brightness(1.1); }
.fle .fle-btn-ghost { background: transparent; color: var(--fle-accent) !important; border: 1px solid var(--fle-line); }
.fle .fle-btn:focus-visible, .fle button:focus-visible, .fle input:focus-visible, .fle select:focus-visible { outline: 2px solid var(--fle-accent); outline-offset: 2px; }

/* Table */
.fle .fle-table-wrap { overflow-x: auto; border: 1px solid var(--fle-line); border-radius: var(--fle-radius); background: var(--fle-bg); }
.fle .fle-table { width: 100%; border-collapse: collapse; margin: 0; border: 0; }
.fle .fle-table th { text-align: left; padding: 11px 14px; font-size: 13px; font-weight: 600; color: var(--fle-muted); background: var(--fle-surface); border: 0; border-bottom: 1px solid var(--fle-line); white-space: nowrap; }
.fle .fle-table td { padding: 13px 14px; vertical-align: middle; border: 0; border-bottom: 1px solid var(--fle-line); background: transparent; }
.fle .fle-table tbody tr:last-child td { border-bottom: 0; }
.fle .fle-table tbody tr:hover td { background: var(--fle-surface); }
.fle .fle-table tr.fle-top td:first-child { box-shadow: inset 3px 0 0 var(--fle-accent); }
.fle .fle-table .fle-c-instruments { min-width: 220px; }
.fle .fle-table .fle-c-rank { width: 1%; }
.fle .fle-table .fle-c-cta { text-align: right; width: 1%; }
.fle .fle-contract-num { font-size: 1.1em; }

@media (max-width: 780px) {
  .fle .fle-table-wrap { border: 0; background: transparent; overflow: visible; }
  .fle .fle-table, .fle .fle-table tbody { display: block; }
  .fle .fle-table thead { display: none; }
  .fle .fle-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; padding: 14px; margin-bottom: 12px; border: 1px solid var(--fle-line); border-radius: var(--fle-radius); background: var(--fle-bg); }
  .fle .fle-table tr.fle-top { border-color: var(--fle-accent); }
  .fle .fle-table td { display: block; padding: 0; border: 0 !important; box-shadow: none !important; background: transparent !important; }
  .fle .fle-table td[data-label]:not([data-label=""])::before { content: attr(data-label); display: block; font-size: 12px; color: var(--fle-muted); margin-bottom: 2px; }
  .fle .fle-table td.fle-c-rank, .fle .fle-table td.fle-c-firm, .fle .fle-table td.fle-c-plan, .fle .fle-table td.fle-c-leverage, .fle .fle-table td.fle-c-instruments, .fle .fle-table td.fle-c-cta { grid-column: 1 / -1; }
  .fle .fle-table td.fle-c-cta .fle-btn { display: block; text-align: center; }
}

/* Cards */
.fle .fle-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.fle .fle-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--fle-line); border-radius: var(--fle-radius); background: var(--fle-bg); }
.fle .fle-card.fle-top { border-color: var(--fle-accent); box-shadow: 0 0 0 1px var(--fle-accent); }
.fle .fle-card-top { display: flex; align-items: center; gap: 10px; }
.fle .fle-facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.fle .fle-facts > div { margin: 0; }
.fle .fle-facts dt { font-size: 12px; color: var(--fle-muted); margin: 0; }
.fle .fle-facts dd { margin: 0; }
.fle .fle-card-cta { margin-top: auto; }
.fle .fle-card-cta .fle-btn { display: block; text-align: center; }

/* Firm page */
.fle .fle-firm-plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.fle .fle-firmplan { border: 1px solid var(--fle-line); border-radius: var(--fle-radius); padding: 16px; background: var(--fle-bg); display: flex; flex-direction: column; gap: 10px; }
.fle .fle-firmplan-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fle .fle-firmplan-main { display: flex; align-items: baseline; gap: 8px; }
.fle .fle-firmplan .fle-btn { align-self: flex-start; margin-top: auto; }

/* Interactive tool (mirrors Ratio Ranker's) */
.fle .fle-ui { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 22px; align-items: start; }
.fle .fle-side { position: sticky; top: 16px; padding: 16px; border: 1px solid var(--fle-line); border-radius: var(--fle-radius); background: var(--fle-surface); max-height: calc(100vh - 32px); overflow: auto; }
.fle .fle-side-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.fle .fle-link { background: none; border: 0; padding: 0; color: var(--fle-accent); cursor: pointer; font-size: 13px; text-decoration: underline; }
.fle .fle-fset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.fle .fle-fset > legend, .fle .fle-flabel { font-size: 13px; font-weight: 700; padding: 0; margin: 0 0 7px; display: block; }
.fle .fle-toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.fle .fle-toggle { border: 1px solid var(--fle-line); background: var(--fle-bg); color: var(--fle-ink); border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; line-height: 1.3; font-family: inherit; }
.fle .fle-toggle small { color: var(--fle-muted); margin-left: 4px; }
.fle .fle-toggle[aria-pressed="true"] { background: var(--fle-accent); border-color: var(--fle-accent); color: #fff; }
.fle .fle-toggle[aria-pressed="true"] small { color: rgba(255,255,255,.8); }
.fle .fle-radio { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 6px; font-size: 13.5px; cursor: pointer; }
.fle .fle-radio input { margin-top: 3px; }
.fle .fle-range { width: 100%; accent-color: var(--fle-accent); margin: 0; }
.fle .fle-firmbox { max-height: 190px; overflow: auto; border: 1px solid var(--fle-line); border-radius: 8px; background: var(--fle-bg); padding: 6px 10px; }
.fle .fle-firmbox label { display: flex; gap: 8px; align-items: center; padding: 3px 0; font-size: 13.5px; cursor: pointer; }
.fle .fle-search { width: 100%; margin: 0 0 6px; padding: 7px 10px; border: 1px solid var(--fle-line); border-radius: 8px; background: var(--fle-bg); color: var(--fle-ink); font-size: 13.5px; font-family: inherit; }

.fle .fle-main { min-width: 0; }
.fle .fle-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.fle .fle-stat { padding: 12px 14px; border-radius: var(--fle-radius); background: var(--fle-surface); }
.fle .fle-stat b { display: block; font-size: 1.3em; font-variant-numeric: tabular-nums; }
.fle .fle-stat span { font-size: 12.5px; color: var(--fle-muted); }
.fle .fle-stat.fle-stat-best { grid-column: span 2; background: var(--fle-accent-soft); }
.fle .fle-stat.fle-stat-best b { font-size: 1.05em; }

.fle .fle-bar-tools { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.fle .fle-count { color: var(--fle-muted); font-size: 14px; }
.fle .fle-tools-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fle .fle-select { padding: 7px 28px 7px 10px; border: 1px solid var(--fle-line); border-radius: 8px; background-color: var(--fle-bg); color: var(--fle-ink); font-size: 13.5px; font-family: inherit; }
.fle .fle-seg { display: inline-flex; border: 1px solid var(--fle-line); border-radius: 8px; overflow: hidden; }
.fle .fle-seg button { border: 0; background: var(--fle-bg); color: var(--fle-ink); padding: 7px 12px; font-size: 13.5px; cursor: pointer; font-family: inherit; }
.fle .fle-seg button[aria-pressed="true"] { background: var(--fle-accent); color: #fff; }
.fle .fle-btn-ghost.fle-tool-btn { border: 1px solid var(--fle-line); background: var(--fle-bg); color: var(--fle-ink); padding: 7px 12px; border-radius: 8px; font-size: 13.5px; cursor: pointer; font-family: inherit; }
.fle .fle-more { display: block; margin: 16px auto 0; }
.fle .fle-filter-toggle { display: none; }

@media (max-width: 900px) {
  .fle .fle-ui { grid-template-columns: 1fr; }
  .fle .fle-side { position: static; max-height: none; display: none; }
  .fle .fle-side.is-open { display: block; }
  .fle .fle-filter-toggle { display: inline-block; }
  .fle .fle-stat.fle-stat-best { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) { .fle * { transition: none !important; } }

/* ------------------------------------------------------------------
 * 1.0.1: force readable text colours.
 * Dark site themes often set link/heading/table colours (e.g. white
 * links) with higher specificity than the plugin, which left firm and
 * plan names white on the light table. These rules win over the theme.
 * ---------------------------------------------------------------- */
html body .fle,
html body .fle .fle-table td,
html body .fle .fle-card,
html body .fle .fle-firmplan,
html body .fle .fle-title,
html body .fle .fle-section-title,
html body .fle .fle-v,
html body .fle .fle-firm-name,
html body .fle .fle-plan-name,
html body .fle .fle-firm-name a,
html body .fle .fle-plan-name a,
html body .fle .fle-table td a:not(.fle-btn),
html body .fle .fle-card a:not(.fle-btn),
html body .fle .fle-firmplan a:not(.fle-btn),
html body .fle .fle-chip b,
html body .fle label,
html body .fle .fle-toggle,
html body .fle .fle-select,
html body .fle .fle-search,
html body .fle .fle-seg button { color: var(--fle-ink) !important; }

html body .fle .fle-firm-name a:visited,
html body .fle .fle-plan-name a:visited,
html body .fle .fle-firm-name a:hover,
html body .fle .fle-plan-name a:hover { color: var(--fle-ink) !important; }

html body .fle .fle-sub,
html body .fle .fle-v2,
html body .fle .fle-group-title,
html body .fle .fle-disclosure,
html body .fle .fle-empty,
html body .fle .fle-loading,
html body .fle .fle-table th,
html body .fle .fle-chip,
html body .fle .fle-count,
html body .fle .fle-facts dt,
html body .fle .fle-stat span { color: var(--fle-muted) !important; }

html body .fle .fle-table th { background: var(--fle-surface) !important; }
html body .fle .fle-table-wrap,
html body .fle .fle-card,
html body .fle .fle-firmplan { background: var(--fle-bg) !important; }
html body .fle .fle-table td { background: transparent !important; }
html body .fle .fle-table tbody tr:hover td { background: var(--fle-surface) !important; }

html body .fle .fle-lev-num,
html body .fle .fle-chip-current b,
html body .fle .fle-logo-ph,
html body .fle .fle-link { color: var(--fle-accent) !important; }
html body .fle .fle-pill { color: var(--fle-accent) !important; }
html body .fle-theme-dark .fle-pill { color: var(--fle-ink) !important; }
html body .fle .fle-rank { color: var(--fle-muted) !important; }
html body .fle .fle-rank-1,
html body .fle .fle-toggle[aria-pressed="true"],
html body .fle .fle-seg button[aria-pressed="true"],
html body .fle a.fle-btn,
html body .fle .fle-btn { color: #fff !important; }
html body .fle a.fle-btn-ghost,
html body .fle .fle-btn-ghost { color: var(--fle-accent) !important; }
html body .fle .fle-btn-ghost.fle-tool-btn { color: var(--fle-ink) !important; }
