/* Field QC inspections (#17) -- Focus on Energy branding.
 *
 * Comment on the ticket: "also using focus branding." The palette is Focus's
 * own, from the 2024 Focus on Energy Brand Guidelines: General Green #00ab4e is
 * the primary, with the umbrella teal, blue, lime and amber as the extended set.
 *
 * Everything here is scoped under `.fq` on purpose. The rest of the demo keeps
 * the Substation palette in `app.css` (a blue #0052ff against a dark sidebar),
 * and this ticket is not a licence to restyle four other people's pages. The
 * shell stays as it is; the section inside it is Focus green.
 */

.fq {
  --fq-green: #00ab4e;
  --fq-green-dk: #00863d;
  --fq-green-bg: #eaf8f0;
  --fq-teal: #00b7ce;
  --fq-blue: #0072bc;
  --fq-lime: #8dc63f;
  --fq-amber: #fdb913;
  --fq-red: #c2410c;
  --fq-red-bg: #fdf0e8;
  --fq-ink: #14301f;
  --fq-line: #dfe8e2;
  --fq-muted: #5a6b61;
}

/* ------------------------------- masthead ------------------------------ */

.fq-head {
  background: linear-gradient(100deg, var(--fq-green) 0%, var(--fq-green-dk) 58%, #04673a 100%);
  color: #fff;
  border-radius: 14px;
  padding: 1.25rem 1.4rem;
}
.fq-head h1 {
  font-size: 1.5rem; font-weight: 700; letter-spacing: -0.015em; line-height: 1.15;
}
.fq-head .fq-lede {
  margin-top: 0.4rem; font-size: 0.9rem; line-height: 1.5;
  color: rgba(255, 255, 255, 0.9); max-width: 62ch;
}
.fq-asof {
  display: inline-flex; align-items: center; gap: 0.45rem;
  margin-top: 0.85rem; padding: 0.3rem 0.65rem;
  background: rgba(255, 255, 255, 0.16); border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
}
.fq-asof .fq-dot {
  width: 0.45rem; height: 0.45rem; border-radius: 999px; background: var(--fq-amber);
}

/* -------------------------------- tabs --------------------------------- */

.fq-tabs { display: flex; gap: 0.35rem; flex-wrap: wrap; border-bottom: 1px solid var(--fq-line); }
.fq-tab {
  padding: 0.5rem 0.85rem; font-size: 0.85rem; font-weight: 600;
  color: var(--fq-muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
  text-decoration: none; white-space: nowrap;
}
.fq-tab:hover { color: var(--fq-ink); }
.fq-tab-on { color: var(--fq-green-dk); border-bottom-color: var(--fq-green); }
.fq-tab .fq-n {
  display: inline-block; margin-left: 0.35rem; padding: 0 0.35rem;
  background: var(--fq-green-bg); color: var(--fq-green-dk);
  border-radius: 999px; font-size: 0.7rem; font-weight: 700;
}
.fq-tab-on .fq-n { background: var(--fq-green); color: #fff; }

/* ------------------------------- filters ------------------------------- */

.fq-filters { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.fq-in {
  border: 1px solid var(--fq-line); border-radius: 8px; background: #fff;
  padding: 0.4rem 0.6rem; font-size: 0.83rem; color: var(--fq-ink);
}
.fq-in:focus { outline: 2px solid var(--fq-green); outline-offset: 1px; }
.fq-clear { font-size: 0.8rem; color: var(--fq-blue); text-decoration: underline; }

/* -------------------------------- cards -------------------------------- */

.fq-card {
  background: #fff; border: 1px solid var(--fq-line); border-radius: 12px;
  padding: 0.9rem 1rem;
}
.fq-card + .fq-card { margin-top: 0.6rem; }
.fq-ally { font-size: 1rem; font-weight: 650; color: var(--fq-ink); letter-spacing: -0.01em; }
.fq-sub { font-size: 0.76rem; color: var(--fq-muted); margin-top: 0.15rem; }

.fq-rule {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem;
  padding: 0.55rem 0; border-top: 1px dashed var(--fq-line); margin-top: 0.6rem;
}
.fq-rule:first-of-type { border-top: 0; }

.fq-pill {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.01em;
}
.fq-pill-random { background: var(--fq-green-bg); color: var(--fq-green-dk); }
.fq-pill-first  { background: #e6f6fa; color: #04697c; }
.fq-pill-high   { background: #fff6e0; color: #8a5a00; }
.fq-pill-owed   { background: var(--fq-red-bg); color: var(--fq-red); }

.fq-frac { font-size: 0.8rem; color: var(--fq-muted); }
.fq-frac strong { color: var(--fq-ink); }

.fq-next {
  margin-left: auto; font-size: 0.78rem; display: flex; align-items: center; gap: 0.4rem;
}
.fq-app {
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.8rem;
  font-weight: 600; color: var(--fq-ink);
}
.fq-src { font-size: 0.68rem; padding: 0.1rem 0.4rem; border-radius: 4px; font-weight: 700; }
.fq-src-review { background: var(--fq-green); color: #fff; }
.fq-src-paid { background: #eef2ef; color: var(--fq-muted); }
.fq-none { font-size: 0.78rem; color: var(--fq-red); font-style: italic; }

/* -------------------------------- table -------------------------------- */

.fq-scroll { overflow-x: auto; border: 1px solid var(--fq-line); border-radius: 12px; background: #fff; }
.fq-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.fq-table th {
  position: sticky; top: 0; background: #f4f8f6; color: var(--fq-muted);
  text-align: left; font-weight: 650; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--fq-line);
  white-space: nowrap;
}
.fq-table td { padding: 0.6rem 0.7rem; border-bottom: 1px solid #eef3f0; vertical-align: top; }
.fq-table tr:last-child td { border-bottom: 0; }
.fq-table tr:hover td { background: #fafcfb; }
.fq-days { font-weight: 700; color: var(--fq-red); white-space: nowrap; }
.fq-days-soft { font-weight: 600; color: var(--fq-muted); white-space: nowrap; }

.fq-reason {
  display: inline-block; padding: 0.1rem 0.45rem; border-radius: 999px;
  font-size: 0.7rem; font-weight: 600; background: #eef2f0; color: var(--fq-muted);
  white-space: nowrap;
}
.fq-reason-waiting { background: #fff6e0; color: #8a5a00; }
.fq-reason-notstarted { background: var(--fq-red-bg); color: var(--fq-red); }
.fq-reason-progress { background: var(--fq-green-bg); color: var(--fq-green-dk); }

/* ------------------------------- actions ------------------------------- */

.fq-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: var(--fq-green); color: #fff; border: 0; border-radius: 8px;
  padding: 0.35rem 0.7rem; font-size: 0.78rem; font-weight: 650;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.fq-btn:hover { background: var(--fq-green-dk); }
.fq-btn-quiet { background: #fff; color: var(--fq-green-dk); border: 1px solid var(--fq-green); }
.fq-btn-quiet:hover { background: var(--fq-green-bg); }

.fq-chased {
  display: block; margin-top: 0.3rem; font-size: 0.7rem; color: var(--fq-muted);
}
.fq-chased strong { color: var(--fq-green-dk); }
.fq-noaddr { display: block; margin-top: 0.25rem; font-size: 0.68rem; color: var(--fq-muted); }

/* ------------------------------- coverage ------------------------------ */

.fq-bar { height: 0.4rem; border-radius: 999px; background: #eef2f0; overflow: hidden; min-width: 5rem; }
.fq-bar span { display: block; height: 100%; background: var(--fq-green); }
.fq-bar.is-over span { background: var(--fq-teal); }
.fq-pct { font-weight: 700; color: var(--fq-ink); white-space: nowrap; }

.fq-block-h {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--fq-muted); padding: 0.5rem 0 0.35rem;
}

/* -------------------------------- notes -------------------------------- */

.fq-note {
  background: var(--fq-green-bg); border: 1px solid #cfe9db; border-radius: 10px;
  padding: 0.7rem 0.85rem; font-size: 0.8rem; color: #14503a; line-height: 1.5;
}
.fq-empty {
  padding: 1.6rem 1rem; text-align: center; font-size: 0.86rem; color: var(--fq-muted);
}
.fq-empty strong { display: block; color: var(--fq-green-dk); font-size: 0.95rem; margin-bottom: 0.25rem; }
.fq-fine { font-size: 0.74rem; color: var(--fq-muted); line-height: 1.55; }
.fq-fine a { color: var(--fq-blue); text-decoration: underline; }

/* -------------------------------- rules --------------------------------
 *
 * The three thresholds, stated where the outcome numbers are. The page used to
 * say "16 trade allies short of a required inspection" without ever saying what
 * they were short of; these cards say the rule, who it applies to and how many
 * miss it, and each one is the filter for the list below.
 */

.fq-ruleshead {
  display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap;
  font-size: 0.78rem; font-weight: 700; color: var(--fq-ink);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem;
}
.fq-ruleshead .fq-fine { text-transform: none; letter-spacing: 0; font-weight: 400; }

.fq-rules { display: grid; gap: 0.7rem; grid-template-columns: repeat(1, minmax(0, 1fr)); }
@media (min-width: 720px) { .fq-rules { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.fq-rulecard {
  display: block; text-decoration: none; color: inherit;
  background: #fff; border: 1px solid var(--fq-line); border-radius: 12px;
  padding: 0.75rem 0.85rem 0.6rem;
  border-left: 3px solid var(--fq-green);
  transition: box-shadow .12s ease, border-color .12s ease, transform .12s ease;
}
.fq-rulecard-first-5 { border-left-color: var(--fq-teal); }
.fq-rulecard-high-value { border-left-color: var(--fq-amber); }

.fq-rulecard:hover {
  box-shadow: 0 2px 10px rgba(20, 48, 31, 0.08);
  transform: translateY(-1px);
}
.fq-rulecard.is-on {
  border-color: var(--fq-green); background: var(--fq-green-bg);
  box-shadow: inset 0 0 0 1px var(--fq-green);
}
.fq-rulecard.is-on .fq-rulecard-applies { color: var(--fq-green-dk); }

.fq-rulecard-top {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.fq-thresh {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem; font-weight: 600; color: var(--fq-muted); white-space: nowrap;
}
.fq-rulecard-blurb {
  margin-top: 0.45rem; font-size: 0.8rem; line-height: 1.4; color: var(--fq-ink);
}
.fq-rulecard-foot {
  margin-top: 0.55rem; display: flex; align-items: baseline; gap: 0.35rem; flex-wrap: wrap;
}
.fq-rulecard-n {
  font-size: 1.3rem; font-weight: 700; line-height: 1; color: var(--fq-red);
  letter-spacing: -0.02em;
}
.fq-rulecard-l { font-size: 0.74rem; color: var(--fq-muted); }
.fq-rulecard-ok { font-size: 0.8rem; font-weight: 600; color: var(--fq-green-dk); }
.fq-rulecard-applies {
  margin-top: 0.5rem; padding-top: 0.45rem; border-top: 1px dashed var(--fq-line);
  font-size: 0.68rem; color: var(--fq-muted); line-height: 1.35;
}

/* The action column on a trade ally row: how many it owes, who to chase about
 * it, and the button that writes the message. Right-aligned and narrow so the
 * contractor's name stays the thing you read first. */
.fq-cardact {
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem;
  text-align: right; flex-shrink: 0;
}
.fq-cardact-row { display: flex; align-items: center; gap: 0.55rem; }
.fq-cardact .fq-sub { margin-top: 0; }
.fq-cardact .fq-chased { margin-top: 0; }

/* Export links sit at the end of the filter bar, because what they hand you is
 * whatever those filters have left on screen. */
.fq-exports { display: inline-flex; align-items: center; gap: 0.35rem; }
.fq-exports a { color: var(--fq-blue); text-decoration: underline; }
