/* v0.47.0 layout for the Firms list, firm pages and Compare (dev file v5 6.1-6.6, 7.5).
   Loaded after style.css. Dark surfaces, lime only on the selected control and the main action. */

/* ── full width on desktop: up to 1280 px ───────────────────── */
.wide-firms, .wide-compare { --max: 1280px; }
.wide-firms .main-body, .wide-compare .main-body { max-width: var(--max); }

/* ── firm marks: the firm's own logo only to identify it, or initials in a grey circle ── */
.flogo { flex: 0 0 auto; display: inline-block; border-radius: 8px; object-fit: contain; background: #fff; vertical-align: middle; }
.flogo-32 { width: 32px; height: 32px; }
.flogo-44 { width: 44px; height: 44px; border-radius: 10px; }
.flogo-64 { width: 64px; height: 64px; border-radius: 14px; }
.flogo-ini { display: inline-grid; place-items: center; border-radius: 50%; background: #2A2D40; color: #B7BCD0; font-weight: 750;
  letter-spacing: .02em; font-size: .72rem; }
.flogo-44.flogo-ini { font-size: .9rem; }
.flogo-64.flogo-ini { font-size: 1.3rem; }

/* ── /firms header: one grey text strip, no glowing pills ────── */
.fb-hero { padding-bottom: 28px; }
.fb-hero h1 { font-size: clamp(1.7rem, 3vw, 2.4rem); margin: 0 0 10px; }
.fb-strip { margin: 0; color: var(--muted); font-size: .95rem; }
.fb-strip b { color: var(--ink-2); font-weight: 650; }
.fb-strip a { color: var(--ink-2); }

/* ── the one-line control bar: every control 40 px ──────────── */
.fb-bar { position: static; display: flex; align-items: center; gap: 10px; padding: 4px 0 0; margin: 0 0 6px; overflow: visible; white-space: normal; background: none; }
.fb-bar > * { flex: 0 0 auto; }
.fb-seg { display: inline-flex; height: 40px; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.fb-segb { height: 32px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font: inherit; font-size: .9rem; font-weight: 600;
  cursor: pointer; white-space: nowrap; }
.fb-segb:hover { color: var(--ink); background: rgba(255, 255, 255, .05); }
.fb-segb.on { background: var(--accent); color: #0B0D14; font-weight: 750; }
.fb-ctl { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; box-sizing: border-box; }
.fb-ctl:hover, .fb-ctl:focus-within { border-color: var(--line-2); }
.fb-search { flex: 1 1 220px !important; min-width: 160px; color: var(--muted); cursor: text; font-weight: 500; }
.fb-search:focus-within { border-color: var(--accent-line); }
.fb-search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: transparent; color: var(--ink); font: inherit; outline: none; }
.fb-select { padding: 0; }
.fb-select select { height: 100%; padding: 0 34px 0 14px; border: 0; border-radius: 12px; background: transparent; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239AA0B8' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; }
.fb-select select option { background: var(--surface-2); color: var(--ink); }
.fb-match { display: inline-flex; align-items: center; height: 40px; padding: 0 18px; border-radius: 12px; font-weight: 750; font-size: .9rem; white-space: nowrap;
  color: #0B0D14; background: var(--accent); text-decoration: none; }
.fb-match:hover { background: var(--accent-2); }
.fb-filters { position: relative; }
.fb-filters > summary { list-style: none; user-select: none; }
.fb-filters > summary::-webkit-details-marker { display: none; }
.fb-filters > summary::after { content: ""; width: 7px; height: 7px; margin: -3px 0 0 2px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.fb-filters[open] > summary { border-color: var(--accent-line); }
.fb-fcount { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); font-size: .76rem; font-weight: 750; }
.fb-panel { position: absolute; z-index: 40; top: calc(100% + 8px); left: 0; width: 260px; display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line-2);
  border-radius: 14px; background: var(--surface-2); box-shadow: 0 24px 48px -20px rgba(0, 0, 0, .85); }
.fb-pfield { display: grid; gap: 6px; font-size: .78rem; font-weight: 650; color: var(--muted); }
.fb-pfield select { height: 38px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem; }
.fb-check { display: flex; align-items: center; gap: 10px; font-size: .92rem; color: var(--ink-2); cursor: pointer; }
.fb-check input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }
.fb-panel .linkish { justify-self: start; font-size: .84rem; color: var(--muted); }
.fb-count { margin: 10px 0 10px; color: var(--muted); font-size: .86rem; }

/* ── the wide table (desktop) ───────────────────────────────── */
.fb-table-wrap { display: none; }
.fb-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.fb-table th, .fb-table td { padding: 12px 10px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); background: var(--surface); }
.fb-table thead th { position: sticky; top: var(--header-h); z-index: 5; background: var(--surface-2); color: var(--muted); font-size: .72rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; line-height: 1.3; border-bottom: 1px solid var(--line-2); padding-top: 14px; padding-bottom: 14px; }
.fb-table thead th:first-child { border-top-left-radius: 16px; }
.fb-table thead th:last-child { border-top-right-radius: 16px; }
.fb-table tbody tr:last-child > * { border-bottom: 0; }
.fb-table tbody tr:last-child > :first-child { border-bottom-left-radius: 16px; }
.fb-table tbody tr:last-child > :last-child { border-bottom-right-radius: 16px; }
.fb-table tbody tr:hover > * { background: var(--surface-2); }
.fb-table tbody tr[hidden] { display: none; }
.fb-table tbody th { font-weight: 650; }
.fb-table .num { text-align: left; font-variant-numeric: tabular-nums; }
.fb-table thead button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.fb-table thead button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.fb-table thead th[data-sort] button::after { content: "\2195"; opacity: .45; font-size: .85rem; letter-spacing: 0; }
.fb-table thead th[aria-sort="ascending"] button::after { content: "\2191"; opacity: 1; color: var(--accent-text); }
.fb-table thead th[aria-sort="descending"] button::after { content: "\2193"; opacity: 1; color: var(--accent-text); }
.fb-table thead th[aria-sort="ascending"], .fb-table thead th[aria-sort="descending"] { color: var(--ink-2); }
.fb-td-firm { display: flex; align-items: center; gap: 12px; min-width: 230px; font-weight: 650; }
.fb-firmtxt { display: grid; gap: 1px; min-width: 0; }
.fb-firmtxt a { color: var(--ink); text-decoration: none; font-weight: 700; }
.fb-firmtxt a:hover { color: var(--accent-text); }
.fb-sm { display: block; color: var(--muted); font-size: .78rem; font-weight: 500; line-height: 1.35; }
.fb-table .fb-coverage { font-size: .74rem; }
.fb-tp { color: var(--ink-2); font-size: .84rem; font-weight: 600; text-decoration: none; white-space: nowrap; border-bottom: 1px dotted var(--muted); }
.fb-tp:hover { color: var(--accent-text); }
.fb-mk { min-width: 108px; }
.mk { display: inline-block; white-space: nowrap; padding: 2px 9px; margin: 0 4px 2px 0; border-radius: 999px; font-size: .74rem; font-weight: 700; border: 1px solid var(--line-2); color: var(--ink-2); background: rgba(255, 255, 255, .04); }
.mk-fx { color: var(--accent-text); background: rgba(198, 255, 61, .08); border-color: rgba(198, 255, 61, .2); }
.mk-fut { color: var(--cyan); background: rgba(46, 230, 255, .08); border-color: rgba(46, 230, 255, .22); }
.mk-ins { color: #B9A6FF; background: rgba(124, 92, 255, .14); border-color: rgba(124, 92, 255, .3); }
.fb-pl { color: var(--muted); font-size: .82rem; max-width: 130px; }
.fb-pr b { font-size: 1rem; }
.fb-chk { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; text-decoration: none; white-space: nowrap; border: 1px solid transparent; }
.fb-chk-ok { color: var(--accent-text); background: rgba(198, 255, 61, .07); border-color: rgba(198, 255, 61, .2); }
.fb-chk-amber { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.fb-chk:hover { filter: brightness(1.2); }
.fb-act { white-space: nowrap; text-align: right; }
.fb-act .fb-pick, .fb-act .fb-rules-btn { display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 0 10px; margin-left: 4px; flex: none; font-size: .84rem; }

/* ── buttons shared by table and cards: quiet, lime only when picked ── */
.fb-pick, .fb-rules-btn { border: 1px solid var(--line-2); background: transparent; color: var(--ink); border-radius: 10px; font: inherit; font-weight: 650; cursor: pointer; text-decoration: none; }
.fb-pick:hover, .fb-rules-btn:hover { border-color: var(--accent-line); background: rgba(255, 255, 255, .04); color: var(--ink); }
.fb-pick.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.fb-rules-btn { background: rgba(255, 255, 255, .04); }

/* ── cards: the phone and small-screen view ─────────────────── */
.fb-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.fb-card { border-radius: 16px; }
.fb-card-h { gap: 14px; }
.fb-card .fb-actions .fb-rules-btn { background: rgba(255, 255, 255, .04); color: var(--ink); border-color: var(--line-2); }
.fb-card .fb-tp { font-size: .82rem; }

@media (min-width: 1100px) {
  .fb-table-wrap { display: block; }
  .fb-grid, .fb-more-row { display: none; }
}
@media (max-width: 1099px) {
  .fb-bar { flex-wrap: wrap; }
  .fb-search { flex: 1 1 260px !important; }
  .fb-match { margin-left: auto; }
}
@media (max-width: 640px) {
  .fb-grid { grid-template-columns: 1fr; }
  .fb-seg { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .fb-segb { flex: 1 0 auto; }
  .fb-search { flex: 1 1 100% !important; }
  .fb-filters, .fb-select { flex: 1 1 0; }
  .fb-filters > summary, .fb-select, .fb-select select { width: 100%; }
  .fb-filters > summary { justify-content: space-between; }
  .fb-match { flex: 1 1 100%; justify-content: center; margin: 0; }
  .fb-panel { width: min(300px, calc(100vw - 32px)); }
}

/* firm page header */
.fp-head { display: flex; gap: 16px; align-items: center; margin: 4px 0 8px; }
.fp-head h1 { margin: 0 0 6px; }
.fp-meta { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin: 4px 0; color: var(--muted, #9aa3a0); font-size: .9rem; }
.fp-checked { font-size: .85rem; }
@media (max-width: 640px) { .fp-head { align-items: flex-start; } }

/* compare: one filter bar, full-width table, no cut-off column at 1280 */
.wide-compare { --max: 1280px; }
.cmp-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; }
.cmp-tools .cmp-seg { height: 40px; padding: 3px; border-radius: 12px; }
.cmp-tools .cmp-seg span { padding: 0 14px; line-height: 32px; border-radius: 9px; font-size: .9rem; }
.cmp-tools .cmp-seg input:checked + span { background: var(--accent); color: #0B0D14; font-weight: 750; box-shadow: none; }
.cmp-tools .cmp-search { flex: 1 1 220px; max-width: 360px; }
.cmp-tools .cmp-search input { height: 40px; padding: 0 14px 0 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.cmp-fdet .cmp-panel { width: min(560px, 92vw); grid-template-columns: 1fr 1fr; max-height: 70vh; overflow: auto; }
.cmp-panel .cmp-selects, .cmp-panel .cmp-toggles, .cmp-panel .cmp-sortsel { grid-column: 1 / -1; }
.cmp-panel .cmp-selects { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cmp-panel .cmp-selects input { width: 100%; }
.cmp-panel .cmp-sortsel { display: grid; gap: 4px; font-size: .78rem; font-weight: 650; color: var(--muted); }
.cmp-panel .cmp-toggles { display: grid; gap: 6px; }
.cmp-panel .cmp-toggles label { border: 0; background: none; padding: 2px 0; }
.cmp-tools .cmp-presets { position: relative; margin: 0; }
.cmp-tools .cmp-presets > summary { display: inline-flex; align-items: center; height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.cmp-tools .cmp-presets .nav-more-list { z-index: 40; }
@media (min-width: 641px) {
  .cmp-scroll { max-width: 100%; overflow-x: auto; }
  .cmp-table { min-width: 0; width: 100%; font-size: .82rem; }
  .cmp-table th, .cmp-table td { padding: 10px 6px; }
  .cmp-table thead th { white-space: normal; line-height: 1.2; vertical-align: bottom; font-size: .68rem; }
  .cmp-table .cons, .cmp-table .split, .cmp-table .fee { min-width: 0; }
  .cmp-table .firm-col { min-width: 190px; }
  .cmp-table .fee { min-width: 96px; }
  .cmp-table .act a { display: block; }
  .cmp-table td.opt .ftype { white-space: nowrap; }
}
@media (min-width: 641px) and (max-width: 1099px) { .cmp-table { min-width: 1000px; } }
.cmp-firm { display: flex; gap: 10px; align-items: center; }
@media (min-width: 641px) {
  .cmp-table td.act { width: 128px; min-width: 0; }
  .cmp-table td.act a { white-space: normal; overflow-wrap: anywhere; }
  .cmp-table td.opt .ftype { white-space: normal; display: inline-block; }
  .cmp-table .cons { max-width: 130px; }
}
@media (min-width: 641px) {
  .cmp-table thead th.num, .cmp-table thead th { white-space: normal; }
  .cmp-table th, .cmp-table td { padding: 10px 5px; }
  .cmp-table .firm-col { min-width: 170px; }
}
@media (min-width: 641px) { .cmp-table th, .cmp-table td { padding: 10px 4px; } .cmp-table .pick { width: 40px; } }
@media (min-width: 641px) { .cmp-table .firm-col { min-width: 150px; } .cmp-table .fee { min-width: 80px; } .cmp-table .cons { max-width: 110px; } }
/* 0.47.0 UAT: the links column was squeezed to one letter wide at 1280-1440 (overflow-wrap:anywhere let it shrink).
   Keep it readable and let numbers and sort headers wrap instead, so the table still fits without sideways scroll. */
@media (min-width: 641px) {
  .cmp-table td.act { min-width: 104px; }
  .cmp-table td.act a { overflow-wrap: normal; word-break: normal; }
  .cmp-table td.num, .cmp-table thead th a.sort { white-space: normal; }
}

/* 0.49.9: at phone width the Filters panel hung off the button and ran past the right edge (page scrolled sideways at 375 px).
   Anchor it to the whole filter bar instead, as wide as the bar, one column. */
@media (max-width: 640px) {
  .cmp-tools { position: relative; }
  .cmp-tools .cmp-fdet { position: static; }
  .cmp-fdet .cmp-panel { left: 0; right: 0; width: auto; max-width: 100%; box-sizing: border-box; grid-template-columns: 1fr; }
  .cmp-panel .cmp-selects { grid-template-columns: 1fr; }
  .cmp-panel select, .cmp-panel input { max-width: 100%; min-width: 0; }
}
