/* Finance (Agency Management, Finance tab). Loaded after styles.css; every class starts with fq-.
   One column, one 16px gutter: the headline strip, what needs attention, the clients table, then the mix.
   Colour sits on data only: good and bad on status and money, gold on the revenue mix. */

.fq {
  --fq-faint: #9A98A1;          /* meta text: 5:1 on --card */
  --fq-rule: #2B2B31;           /* row rules, one step under --line */
  --fq-good: #7DDBAE; --fq-good-bg: rgba(76, 195, 138, .14);
  --fq-bad-t: #F49A9A; --fq-bad-bg: rgba(239, 107, 107, .14);
  --fq-fair: #F0C77E; --fq-fair-bg: rgba(226, 174, 79, .14);
  display: grid; gap: 16px;
}
.fq .num { font-variant-numeric: tabular-nums; text-align: right; }
.fq-bad { color: var(--fq-bad-t); }
.fq .card { padding: 0; overflow: hidden; }
.panel-h .fq-lede { display: block; margin-top: 2px; font-size: 15px; line-height: 1.5; color: var(--text); font-weight: 500; }
.panel-h .fq-lede .fq-bad { font-weight: 600; }
.fq-stamp { font-size: 13px; color: var(--text-3); white-space: nowrap; }
.btn.fq-refresh { width: 36px; padding: 0; }

/* section headers */
.fq-h { display: flex; align-items: baseline; gap: 10px; padding: 18px 24px 12px; }
.fq-h h2 { margin: 0; font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.fq-sub { margin-left: auto; font-size: 13px; color: var(--fq-faint); font-variant-numeric: tabular-nums; }
.fq-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--card-3); color: var(--text); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fq-empty { margin: 0 24px 20px; padding: 11px 14px; border: 1px dashed var(--line-2); border-radius: 10px; font-size: 14px; color: var(--text-2); }
.fq-empty.sm { margin: 10px 0 0; font-size: 13px; }
.fq-link { padding: 0; border: 0; background: none; color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* headline strip: one container split by hairlines; the monthly figure leads */
.fq-strip { display: grid; grid-template-columns: 1.35fr 1fr 1fr 1fr; }
.fq-k { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 20px 24px 22px; }
.fq-k + .fq-k { border-left: 1px solid var(--line); }
.fq-kl { font-size: 13.5px; font-weight: 500; color: var(--text-2); }
.fq-kv { display: flex; align-items: center; min-height: 36px; font-size: 24px; font-weight: 700; line-height: 1.15; color: var(--text); letter-spacing: -.015em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fq-lead .fq-kv { font-size: 34px; letter-spacing: -.025em; min-height: 40px; }
.fq-kv.fq-none { color: var(--fq-faint); font-weight: 500; }
.fq-ks { font-size: 13px; color: var(--fq-faint); }
.fq-skel { display: block; width: 104px; height: 24px; border-radius: 6px; background: var(--card-3); }
.fq-note { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 12px 24px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.fq-note svg.i { width: 16px; height: 16px; margin-top: 1px; color: var(--text-3); }

/* needs attention */
.fq-al { list-style: none; margin: 0; padding: 0 0 6px; }
.fq-ar { display: grid; grid-template-columns: minmax(200px, 280px) minmax(0, 1fr) 110px 236px; grid-template-areas: 'who what amt go'; align-items: center; gap: 16px; min-height: 56px; padding: 8px 24px; border-top: 1px solid var(--fq-rule); }
.fq-an { grid-area: who; display: flex; align-items: center; gap: 12px; min-width: 0; }
.fq-an b { font-size: 14.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fq-an:hover b { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.fq-what { grid-area: what; min-width: 0; font-size: 14px; color: var(--text-2); }
.fq-ar.bad .fq-what { color: var(--fq-bad-t); }
.fq-aa { grid-area: amt; font-size: 14.5px; font-weight: 600; color: var(--text); }
.fq-ago { grid-area: go; justify-self: end; gap: 6px; }
.fq-ago .fq-chev { width: 14px; height: 14px; transform: rotate(-90deg); color: var(--text-3); }

/* the avatar slot, one size in every row */
.fq-av { width: 28px; height: 28px; flex: none; border-radius: 8px; object-fit: contain; }
img.fq-av { background: #fff; padding: 2px; }
.fq-ini { display: grid; place-items: center; background: var(--card-3); color: var(--text-2); font-size: 11px; font-weight: 700; }

/* status pills: a pale tint with text of the same hue */
.fq-pill { display: inline-flex; flex: none; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--card-3); color: var(--text-2); }
.fq-pill.good { background: var(--fq-good-bg); color: var(--fq-good); }
.fq-pill.bad { background: var(--fq-bad-bg); color: var(--fq-bad-t); }
.fq-pill.fair { background: var(--fq-fair-bg); color: var(--fq-fair); }
.fq-pill.soft { background: var(--card-2); color: var(--text-2); }

/* clients table: rules, no band, numbers right-aligned on one edge */
.fq-wrap { overflow-x: auto; }
.fq-tbl table { width: 100%; border-collapse: collapse; font-size: 14px; }
.fq-tbl th { height: 38px; padding: 0 12px; border-bottom: 1px solid var(--line-2); font-size: 12.5px; font-weight: 500; color: var(--fq-faint); text-align: left; white-space: nowrap; }
.fq-tbl th.num { text-align: right; }
.fq-tbl td { height: 54px; padding: 0 12px; border-top: 1px solid var(--fq-rule); color: var(--text-2); white-space: nowrap; }
.fq-tbl tbody tr:first-child td { border-top: 0; }
.fq-tbl th:first-child, .fq-tbl td:first-child { padding-left: 24px; }
.fq-tbl th:last-child, .fq-tbl td:last-child { padding-right: 24px; }
.fq-tbl td.fq-c { width: 32%; }
.fq-tbl td.fq-c a { display: flex; align-items: center; gap: 12px; min-width: 0; }
.fq-tbl td.fq-c b { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.fq-tbl td.fq-c a:hover b { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.fq-tbl td.fq-pl { color: var(--text); }
.fq-bsub { display: none; font-size: 12.5px; color: var(--fq-faint); }
.fq-tbl td.fq-amt { font-weight: 700; color: var(--text); font-size: 14.5px; }
.fq-tbl tr.fq-out td.fq-amt { color: var(--fq-faint); font-weight: 500; }
.fq-tbl tr.fq-test td.fq-c b { color: var(--text-2); font-weight: 500; }
.fq-tbl tr.fq-test td { color: var(--fq-faint); }
.fq-dash { color: var(--fq-faint); }
.fq-sort { display: inline-flex; align-items: center; gap: 2px; padding: 0; border: 0; background: none; font: inherit; color: inherit; }
.fq-sort:hover { color: var(--text); }
.fq-tbl th[aria-sort] .fq-sort { color: var(--text-2); }
.fq-arrow { display: inline-block; min-width: 0; }
.fq-tbl tfoot td { height: 52px; border-top: 1px solid var(--line-2); color: var(--text); font-weight: 600; }
.fq-tbl tfoot small { margin-left: 12px; font-size: 12.5px; font-weight: 400; color: var(--fq-faint); }
.fq-ml, .fq-mfoot, .fq-mnote { display: none; }

/* revenue mix: one 100% stacked bar per question, 2px seams, the legend carries the values */
.fq-mixg { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 48px; padding: 4px 24px 20px; }
.fq-mixb h3 { margin: 0 0 10px; font-size: 13.5px; font-weight: 500; color: var(--text-2); }
.fq-bar { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; background: transparent; }
.fq-bar.fq-zero { background: var(--card-3); }
.fq-bar i { display: block; min-width: 3px; }
.fq-bar .s1, .fq-dot.s1 { background: var(--gold); }
.fq-bar .s2, .fq-dot.s2 { background: #A08E6B; }
.fq-bar .s3, .fq-dot.s3 { background: #6E6553; }
.fq-bar .s4, .fq-dot.s4 { background: #4A463F; }
.fq-leg { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 13.5px; }
.fq-leg td { height: 32px; padding: 0; border-top: 1px solid var(--fq-rule); color: var(--text-2); }
.fq-leg tr:first-child td { border-top: 0; }
.fq-leg td.num { width: 96px; color: var(--text); font-weight: 600; }
.fq-leg td.fq-pct { width: 56px; color: var(--fq-faint); font-weight: 500; }
.fq-dot { display: inline-block; width: 8px; height: 8px; margin-right: 10px; border-radius: 2px; vertical-align: 1px; }

/* tablet: billing moves under the plan */
@media (max-width: 1100px) {
  .fq-tbl .fq-bl { display: none; }
  .fq-bsub { display: block; }
  .fq-ar { grid-template-columns: minmax(0, 1fr) 110px auto; grid-template-areas: 'who amt go' 'what amt go'; row-gap: 2px; padding: 10px 24px; }
  .fq-what { padding-left: 40px; font-size: 13px; }
}

/* phone: its own layout */
@media (max-width: 720px) {
  .panel-h .fq-lede { font-size: 14.5px; }
  .fq-stamp { display: none; }
  .fq-h { padding: 16px 16px 10px; }
  .fq-empty { margin: 0 16px 16px; }
  .fq-strip { grid-template-columns: 1fr 1fr; }
  .fq-k { padding: 16px; }
  .fq-k + .fq-k { border-left: 0; }
  .fq-k:nth-child(2n) { border-left: 1px solid var(--line); }
  .fq-k:nth-child(n+3) { border-top: 1px solid var(--line); }
  .fq-kv { font-size: 20px; min-height: 30px; }
  .fq-lead .fq-kv { font-size: 26px; min-height: 30px; }
  .fq-kl, .fq-ks { font-size: 12.5px; }
  .fq-note { padding: 12px 16px; }
  .fq-ar { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'who who' 'what what' 'amt go'; gap: 2px 12px; padding: 12px 16px; }
  .fq-aa { padding-left: 40px; text-align: left; }
  .fq-ago { height: 36px; margin-top: 6px; }
  .fq-refresh { display: none !important; }
  .fq-wrap, .fq-tbl tfoot { display: none; }
  .fq-ml { display: block; list-style: none; margin: 0; padding: 0; }
  .fq-ml li a { display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 12px; row-gap: 3px; padding: 12px 16px; border-top: 1px solid var(--fq-rule); }
  .fq-ml li:first-child a { border-top: 0; }
  .fq-ml .fq-av { grid-row: 1 / span 3; margin-top: 1px; }
  .fq-m1, .fq-m2, .fq-m3 { display: flex; align-items: center; gap: 10px; min-width: 0; grid-column: 2; }
  .fq-m1 b { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .fq-m1 .fq-amt { font-size: 14.5px; font-weight: 700; color: var(--text); }
  .fq-m2 { font-size: 13px; color: var(--text-2); }
  .fq-m3 { justify-content: space-between; margin-top: 3px; font-size: 12.5px; color: var(--fq-faint); font-variant-numeric: tabular-nums; }
  .fq-dates { display: flex; gap: 14px; }
  .fq-ml li.fq-out .fq-amt { color: var(--fq-faint); font-weight: 500; }
  .fq-ml li.fq-test b { color: var(--text-2); font-weight: 500; }
  .fq-mfoot { display: flex; justify-content: space-between; padding: 14px 16px; border-top: 1px solid var(--line-2); font-weight: 600; color: var(--text); }
  .fq-mnote { display: block; margin: -6px 16px 14px; font-size: 12.5px; color: var(--fq-faint); }
  .fq-mixg { grid-template-columns: 1fr; gap: 20px; padding: 4px 16px 16px; }
  .fq-h h2 { font-size: 15.5px; }
}
@media print { .fq-refresh, .fq-ago { display: none !important; } }
