/* ═══════════════════════════════════════════════════════════════════════
   fbc-ui.css — Franchise App design tokens and shared components.
   System fonts only (no downloads). Linked from index.html, admin-team.html
   and subscribers/*.html (as ../fbc-ui.css). Pages keep their own rules for
   now; the old variable names (--green, --g3, --off …) are mapped to the new
   tokens at the bottom of :root so existing styles pick them up.
   New components use the fx- prefix so they never clash with page classes.
   ═══════════════════════════════════════════════════════════════════════ */
:root {
  /* Brand: Franchise Business Consultancy logo colours — navy, green, gold */
  --navy-900: #091833; --navy: #0E2246; --navy-700: #1B3C78; --navy-50: #EEF2F8;
  --primary: #1B3C78; --primary-hover: #132D5C; --primary-50: #E8EDF7;
  --accent: #0B7A32;                 /* FBC green: white text 5.4:1 */
  --gold: #F2B705; --gold-50: #FFF6D8;  /* FBC gold: use with navy text only */

  /* Surfaces */
  --bg: #F4F6FA; --surface: #FFFFFF; --surface-2: #F8FAFC;
  --border: #E3E8EF; --border-strong: #CBD3DE;

  /* Text */
  --ink: #0F1B2D; --ink-2: #3B4A5E; --muted: #536175;

  /* Status: text on its tint, every pair ≥ 5.6:1 */
  --ok: #0B6B4B;   --ok-bg: #E4F4EC;
  --warn: #8A5300; --warn-bg: #FDF1D8;
  --bad: #B42318;  --bad-bg: #FDECEA;
  --info: #1452A3; --info-bg: #E6EFFB;
  --neu: #3B4A5E;  --neu-bg: #EDF0F5;

  /* Charts: the value is always also given in text */
  --chart-filled: #15803D; --chart-track: #E3E8EF;
  --series-1: #0E2246; --series-2: #2F6DB5; --series-3: #0891B2;
  --series-4: #B7791F; --series-5: #6D28D9; --series-6: #94A3B8;

  /* Scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;
  --r-sm: 6px; --r: 10px; --r-lg: 14px; --r-pill: 999px;
  --sh-1: 0 1px 2px rgba(13,35,64,.06);
  --sh-2: 0 4px 12px rgba(13,35,64,.08);
  --sh-3: 0 12px 32px rgba(13,35,64,.12);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Telugu", sans-serif;
  --t-xs: 12px; --t-sm: 13px; --t-base: 14px; --t-md: 16px; --t-lg: 18px; --t-xl: 22px; --t-2xl: 28px;
  --tap: 44px;

  /* Old names used by the existing page styles */
  --green: var(--accent); --leaf: var(--accent); --blue: var(--primary);
  --amber: var(--warn); --g3: var(--muted); --off: var(--bg); --card: var(--surface);
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.fx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Page header ── */
.fx-page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin: 0 0 var(--s5); }
.fx-page-header h1 { margin: 0; font-size: var(--t-xl); font-weight: 800; line-height: 1.25; color: var(--ink); }
.fx-page-header p { margin: var(--s1) 0 0; font-size: var(--t-sm); color: var(--muted); }

/* ── Section card ── */
.fx-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s4) var(--s5); margin-bottom: var(--s4); box-shadow: var(--sh-1); }
.fx-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
.fx-card-title { margin: 0; font-size: var(--t-sm); font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }

/* ── Stat ── */
.fx-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--s3); }
.fx-stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: var(--s3) var(--s4); min-width: 0; }
.fx-stat-label { font-size: var(--t-xs); font-weight: 600; color: var(--muted); }
.fx-stat-value { font-size: var(--t-xl); font-weight: 800; line-height: 1.2; margin-top: 2px; font-variant-numeric: tabular-nums; color: var(--ink); }
.fx-stat-hint { font-size: var(--t-xs); color: var(--muted); margin-top: 2px; }

/* ── Table (stacks into cards under 640px; give each td a data-label) ── */
.fx-table-wrap { overflow-x: auto; }
.fx-table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.fx-table th { text-align: left; padding: var(--s2) var(--s3); background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: var(--t-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.fx-table td { padding: var(--s3); border-bottom: 1px solid var(--border); vertical-align: top; }
.fx-table tr:last-child td { border-bottom: 0; }
.fx-table .num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .fx-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .fx-table, .fx-table tbody, .fx-table tr, .fx-table td { display: block; width: 100%; }
  .fx-table tr { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: var(--s2) var(--s3); margin-bottom: var(--s2); }
  .fx-table td { display: flex; justify-content: space-between; gap: var(--s3); border: 0; padding: var(--s1) 0; text-align: right; }
  .fx-table td::before { content: attr(data-label); flex: none; font-size: var(--t-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; text-align: left; }
  .fx-table td[data-label=""]::before { content: none; }
}

/* ── Badge / status chip ── */
.fx-chip { display: inline-flex; align-items: center; gap: var(--s1); padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--t-xs); font-weight: 700; line-height: 1.6; white-space: nowrap; background: var(--neu-bg); color: var(--neu); }
.fx-chip--ok { background: var(--ok-bg); color: var(--ok); }
.fx-chip--warn { background: var(--warn-bg); color: var(--warn); }
.fx-chip--bad { background: var(--bad-bg); color: var(--bad); }
.fx-chip--info { background: var(--info-bg); color: var(--info); }

/* ── Buttons (44px tall on phones and touch screens) ── */
.fx-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 36px; padding: 0 var(--s4); border: 1px solid transparent; border-radius: var(--r); font: inherit; font-size: var(--t-sm); font-weight: 700; line-height: 1.2; text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s; background: var(--surface); color: var(--ink); }
.fx-btn--primary { background: var(--primary); color: #fff; }
.fx-btn--primary:hover { background: var(--primary-hover); }
.fx-btn--secondary { background: var(--surface); border-color: var(--border-strong); color: var(--ink); }
.fx-btn--secondary:hover { border-color: var(--primary); }
.fx-btn--ghost { background: transparent; color: var(--primary); }
.fx-btn--ghost:hover { background: var(--primary-50); }
.fx-btn--danger { background: var(--bad); color: #fff; }
.fx-btn--sm { min-height: 32px; padding: 0 var(--s3); font-size: var(--t-xs); }
.fx-btn--block { display: flex; width: 100%; }
.fx-btn:disabled, .fx-btn[aria-disabled="true"] { opacity: .45; cursor: default; }
@media (max-width: 860px), (pointer: coarse) { .fx-btn, .fx-btn--sm { min-height: var(--tap); } }

/* ── Empty state ── */
.fx-empty { text-align: center; padding: var(--s8) var(--s5); color: var(--muted); }
.fx-empty-icon { font-size: 32px; line-height: 1; margin-bottom: var(--s3); }
.fx-empty-title { margin: 0 0 var(--s1); font-size: var(--t-md); font-weight: 700; color: var(--ink); }
.fx-empty p { margin: 0 auto var(--s4); max-width: 36ch; font-size: var(--t-sm); line-height: 1.5; }

/* ── Skeleton loader ── */
.fx-skeleton { display: block; min-height: 12px; border-radius: var(--r-sm); background: linear-gradient(90deg, var(--border) 25%, var(--surface-2) 37%, var(--border) 63%); background-size: 400% 100%; animation: fx-shimmer 1.4s ease infinite; }
.fx-skeleton--text { height: 12px; margin: var(--s2) 0; }
.fx-skeleton--stat { height: 64px; border-radius: var(--r); }
@keyframes fx-shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* ── Ring and bar helpers (fill shown as a ring arc or a bar; label it in text) ──
   <svg class="fx-ring" viewBox="0 0 36 36" aria-hidden="true">
     <circle class="fx-ring-track" cx="18" cy="18" r="15.9"/>
     <circle class="fx-ring-value" cx="18" cy="18" r="15.9" pathLength="100" stroke-dasharray="21 100"/>
   </svg>
   <div class="fx-bar"><span style="width:21%"></span></div>                      */
.fx-ring { width: 44px; height: 44px; flex: none; }
.fx-ring circle { fill: none; stroke-width: 4; }
.fx-ring-track { stroke: var(--chart-track); }
.fx-ring-value { stroke: var(--chart-filled); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }
.fx-bar { height: 6px; border-radius: var(--r-pill); background: var(--chart-track); overflow: hidden; }
.fx-bar > span { display: block; height: 100%; max-width: 100%; border-radius: inherit; background: var(--chart-filled); }

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .fx-skeleton { animation: none; background: var(--border); }
}
