/* Financial Command Center: the Window's styles, ported from reference/demo/css.css.
   Every color is a variable set from the Costume by src/brand.js; the fallbacks below only
   show for a moment before brand.json loads. */
/* Anything marked hidden stays hidden, whatever display a class gives it (the Sign out button was showing
   on the sign-in page because .fc-signout sets display: inline-flex). */
[hidden] { display: none !important; }

:root {
  --pri: #333; --acc: #666; --bg: #f6f6f6; --panel: #fff; --ink: #111; --muted: #595959; --good: #2e7d5b; --bad: #b9412f;
  --line: #ddd; --grid: #eee; --tint: #eee; --on: #fff; --on-acc: #fff; --exbg: #f4f4f4; --exline: #ccc; --zero: #aaa;
  --gtrack: #e6e6e6; --hover: #f8f8f8; --shadow: rgba(0,0,0,.14);
  --head-font: Georgia, serif; --body-font: system-ui, sans-serif;
  --gap-lg: 24px; --gap-md: 16px; --caption: 13px; --body: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: var(--body-font); font-size: var(--body); line-height: 1.5; }
.fc { padding: clamp(16px, 3vw, 40px); border-top: 6px solid var(--pri); min-height: 100vh; overflow-x: clip; }
.fc-wrap { max-width: 1280px; margin-inline: auto; display: grid; gap: var(--gap-lg); min-width: 0; }
.fc-main { display: grid; gap: var(--gap-lg); min-width: 0; outline: none; }
.fc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* header */
.fc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.fc-brand { display: flex; flex-direction: column; gap: 4px; min-height: 64px; justify-content: center; min-width: 0; }
.fc-logo { display: block; height: clamp(52px, 6.5vw, 72px); width: auto; max-width: 100%; }
.fc-wordmark { font-family: var(--head-font); font-size: clamp(24px, 3vw, 32px); font-weight: 700; color: var(--pri); letter-spacing: .01em; line-height: 1.1; }
.fc-wordsub { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.fc-topright { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.fc-switch { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.fc-switch-label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.fc-switch-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.fc-brandbtn, .fc-signout { font: inherit; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; min-height: 32px; }
.fc-brandbtn[aria-pressed="true"] { background: var(--pri); border-color: var(--pri); color: var(--on); }
.fc-brandbtn b { display: inline-block; width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--panel); }
.fc-foot { padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.fc-foot a { color: var(--pri); }

/* sign-in */
.fc-signin { max-width: 30rem; margin: 6vh auto 0; width: 100%; }
.fc-signin h1 { font-size: clamp(26px, 4vw, 34px); }
.fc-form { display: grid; gap: 8px; margin-top: 16px; }
.fc-form label { font-weight: 600; font-size: 14px; }
.fc-form input { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--zero); background: var(--bg); color: var(--ink); min-height: 44px; }
.fc-primary { font: inherit; font-weight: 600; padding: 11px 18px; border-radius: 999px; border: 0; background: var(--pri); color: var(--on); cursor: pointer; min-height: 44px; margin-top: 6px; }
.fc-primary:disabled { opacity: .6; cursor: progress; }
.fc-signin-status, .fc-signin-msg { font-size: 14px; margin: 12px 0 0; }
.fc-signin-msg { color: var(--bad); font-weight: 600; }
.fc-qr { display: block; margin: 14px 0; background: #fff; padding: 8px; border-radius: 10px; }
.fc-secret { font-size: 13px; word-break: break-all; background: var(--exbg); padding: 2px 6px; border-radius: 6px; }

/* type & cards */
h1 { font-family: var(--head-font); font-weight: 600; font-size: clamp(28px, 4vw, 40px); margin: 0; color: var(--pri); letter-spacing: -.005em; }
[data-theme="dark"] h1, [data-theme="dark"] .fc-title, [data-theme="dark"] .fc-big { font-weight: 400; }
.fc-note { margin: 6px 0 0; font-size: var(--caption); color: var(--muted); font-style: italic; }
.fc-take { margin: 14px 0 0; max-width: 64ch; font-size: var(--body); line-height: 1.6; }
.fc .fc-take b { font-weight: 600; color: var(--pri); }
.fc-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: clamp(16px, 2vw, 24px); box-shadow: 0 10px 28px -18px var(--shadow); min-width: 0; }
.fc-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12.5rem), 1fr)); gap: var(--gap-md); }
.fc-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 0; }
.fc-big { display: block; font-family: var(--head-font); font-weight: 600; font-size: clamp(28px, 3vw, 38px); line-height: 1.1; margin: 10px 0 8px; font-variant-numeric: tabular-nums; overflow-wrap: break-word; }
.fc-word { font-size: clamp(22px, 2.3vw, 27px); color: var(--pri); }
.fc-sub { margin: 0; font-size: var(--caption); color: var(--muted); }
.fc .fc-delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.fc-delta.up { color: var(--good); } .fc-delta.down { color: var(--bad); }
.fc-gauge-num { font-family: var(--head-font); font-size: 30px; fill: var(--ink); }
.fc-gauge-tick { font-size: 10px; fill: var(--muted); }
.fc-gaugebox { margin-top: 2px; max-width: 220px; min-height: 96px; }
.fc-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); gap: var(--gap-md); }
.fc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.fc-title { font-family: var(--head-font); font-weight: 600; font-size: 20px; margin: 0; }
.fc-title-sm { font-size: 16px; }
.fc-cardnote { margin: 4px 0 0; font-size: var(--caption); color: var(--muted); }
.fc-badge { flex: none; font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 999px; background: var(--tint); color: var(--pri); border: 1px solid var(--exline); white-space: nowrap; }
.fc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 4px; }
.fc-chip { font: inherit; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; min-height: 32px; }
.fc-chip[aria-pressed="true"] { background: var(--pri); border-color: var(--pri); color: var(--on); }
.fc-sw { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.fc .c1 { background: var(--s1); } .fc .c2 { background: var(--s2); } .fc .c3 { background: var(--s3); } .fc .c4 { background: var(--s4); } .fc .c5 { background: var(--s5); }
.fc .c6 { background: var(--s6); } .fc .c7 { background: var(--s7); } .fc .c8 { background: var(--s8); }
.fc-chart { position: relative; min-height: 240px; margin-top: 8px; }
.fc-chart svg { display: block; overflow: visible; }
.fc-tick { font-size: 11px; fill: var(--muted); }
.fc-tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 24px -12px var(--shadow); padding: 8px 10px; font-size: 12px; min-width: 160px; z-index: 2; color: var(--ink); }
.fc-tip-h { color: var(--muted); margin-bottom: 4px; }
.fc-tip-r { display: flex; align-items: center; gap: 10px; justify-content: space-between; font-variant-numeric: tabular-nums; }
.fc-tip-r span:first-child { display: inline-flex; align-items: center; gap: 6px; }

/* tables */
.fc-tablewrap { overflow-x: auto; margin-top: 14px; max-width: 100%; }
.fc table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; min-width: 900px; }
.fc th { text-align: right; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.fc th:first-child, .fc td:first-child { text-align: left; }
.fc td { text-align: right; padding: 12px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.fc tbody tr { cursor: pointer; }
.fc tbody tr:hover { background: var(--hover); }
.fc tbody tr.fc-sel { background: var(--tint); }
.fc tbody tr:focus-visible { outline: 2px solid var(--acc); outline-offset: -2px; }
.fc td.fc-strong { font-weight: 600; color: var(--pri); }
.fc-namecell { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.fc-mbar { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.fc-mbar i { display: inline-block; height: 6px; border-radius: 3px; }
.fc tr.fc-total td { border-top: 2px solid var(--line); font-weight: 600; background: var(--hover); }

/* explanations */
.fc-explain { font: inherit; font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--exline); background: var(--panel); color: var(--pri); cursor: pointer; min-height: 28px; }
.fc-explain[aria-expanded="true"] { background: var(--pri); color: var(--on); border-color: var(--pri); }
.fc-q { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--tint); color: var(--pri); font-size: 11px; font-weight: 700; }
.fc-explain[aria-expanded="true"] .fc-q { background: transparent; color: var(--on); }
.fc-explainer { margin-top: 12px; padding: 12px 14px; background: var(--exbg); border-left: 3px solid var(--acc); border-radius: 0 10px 10px 0; font-size: 13.5px; line-height: 1.6; }
.fc-explainer p { margin: 0 0 6px; } .fc-explainer p:last-child { margin: 0; }
.fc .fc-explainer b, .fc .fc-svc b { font-weight: 600; color: var(--pri); }
.fc-explainall { font: inherit; font-size: 13px; font-weight: 600; margin-top: 14px; padding: 9px 18px; border-radius: 100px; border: 1px solid var(--acc); background: var(--acc); color: var(--on-acc); cursor: pointer; }
.fc-explainall[aria-pressed="true"] { background: var(--panel); color: var(--ink); }
.fc-hint { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink); font-weight: 600; margin-top: 6px; }

/* every $100 drill-down, mix */
.fc-svc { margin-top: 18px; padding: 18px; border-radius: 12px; background: var(--exbg); border: 1px solid var(--exline); }
.fc-svc h3 { font-family: var(--head-font); font-weight: 600; font-size: 19px; margin: 0; display: flex; align-items: center; gap: 8px; }
.fc-close { font: inherit; font-size: 12px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--exline); background: var(--panel); color: var(--pri); cursor: pointer; }
.fc-svcbar { margin: 16px 0 12px; min-height: 64px; }
.fc-svcseg { display: flex; height: 34px; border-radius: 8px; overflow: hidden; }
.fc-svcleg { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.fc-svcleg span { display: inline-flex; align-items: center; gap: 6px; }
.fc-svc p { margin: 0 0 6px; font-size: 14px; line-height: 1.6; }
.fc-mixrow { display: grid; grid-template-columns: 9.5rem 1fr; gap: 12px; align-items: center; margin-top: 14px; }
.fc-mixlabel { font-size: 13px; }
.fc-mix { display: flex; height: 30px; border-radius: 8px; overflow: hidden; min-height: 30px; }
.fc-mix div, .fc-svcseg div { display: flex; align-items: center; justify-content: center; font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; }
.fc-mix div { font-size: 11px; } .fc-svcseg div { font-size: 12px; }
.fc-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; font-size: 12px; color: var(--muted); }
.fc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.fc details { font-size: 13px; color: var(--muted); }
.fc summary { cursor: pointer; color: var(--pri); font-weight: 600; }
.fc dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 0 0; }
.fc dt { font-weight: 600; color: var(--ink); }
.fc dd { margin: 0; }

/* period bar & books badge */
.fc-intro { display: grid; justify-items: start; }
.fc-intro > h1, .fc-intro > .fc-note, .fc-intro > .fc-take, .fc-intro > .fc-periodbar { justify-self: stretch; }
.fc-periodbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 16px; }
.fc-periods { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); }
.fc-period { font: inherit; font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 999px; border: 0; background: transparent; color: var(--muted); cursor: pointer; min-height: 32px; }
.fc-period[aria-pressed="true"] { background: var(--pri); color: var(--on); }
.fc-showing { font-size: 13px; color: var(--muted); }
.fc .fc-showing b { color: var(--ink); font-weight: 600; }
.fc-recon { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.rc { font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.rc::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.rc.ok { color: var(--good); } .rc.ok::before { background: var(--good); }
.rc.off { color: var(--bad); } .rc.off::before { content: "!"; width: 16px; height: 16px; display: inline-grid; place-items: center; font-size: 11px; color: var(--panel); background: var(--bad); }
.rc-mini { font-size: 13px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); }
.fc-recon-detail { font-size: 13px; color: var(--muted); }
.fc .fc-recon-detail b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* cash */
.fc-cashtiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: var(--gap-md); margin-top: 16px; }
.fc-mini { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--bg); min-width: 0; }
.fc-mini .fc-big { font-size: clamp(24px, 2.6vw, 30px); margin: 6px 0 4px; }
.fc .fc-mini .fc-sub b { color: var(--ink); font-weight: 600; }
.fc-cv { font-weight: 700; }
.fc-cv.cv-healthy { color: var(--good); } .fc-cv.cv-okay { color: var(--pri); } .fc-cv.cv-tight, .fc-cv.cv-critical { color: var(--bad); }
.fc-agerow { display: grid; grid-template-columns: 8.5rem 1fr auto; gap: 10px; align-items: center; font-size: 12.5px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.fc-agetrack { height: 10px; border-radius: 5px; background: var(--grid); overflow: hidden; display: block; }
.fc-agetrack i { display: block; height: 100%; border-radius: 5px; }
.fc-agegrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 12px 28px; margin-top: 10px; }
.fc-agegrid h3 { font-size: 13px; margin: 6px 0 2px; font-weight: 600; }

/* budget */
.fc-st { font-weight: 700; }
.fc-st.st-ahead, .fc-badge.st-ahead { color: var(--good); }
.fc-st.st-close, .fc-badge.st-close { color: var(--pri); }
.fc-st.st-behind, .fc-badge.st-behind { color: var(--bad); }
.fc-bvtiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: var(--gap-md); margin-top: 14px; }
.fc-olrow { display: grid; grid-template-columns: 8.5rem 1fr auto; gap: 12px; align-items: center; margin-top: 10px; font-size: 13px; font-variant-numeric: tabular-nums; }
.fc-oltrack { display: flex; height: 16px; border-radius: 8px; background: var(--grid); overflow: hidden; }
.fc-oltrack i { display: block; height: 100%; }
.fc-oltrack .ol-budget { background: var(--gtrack); border: 1px solid var(--zero); border-radius: 8px; }
.fc-oltrack .ol-actual { background: var(--pri); }
.fc-oltrack .ol-remaining { background: var(--pri); opacity: .35; }
.fc-olleg { font-size: 12px; color: var(--muted); margin-top: 8px; }
.fc-olnote { font-size: 13.5px; line-height: 1.6; margin: 14px 0 0; }

/* profit leaks */
.fc-leaks { border: 2px solid var(--acc); position: relative; overflow: hidden; padding-left: clamp(24px, 3vw, 32px); }
.fc-leaks::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 8px; background: var(--acc); }
.fc-leaks-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.fc-leaks-eyebrow { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink); font-weight: 800; margin: 0 0 4px; }
.fc-leaks-title { font-family: var(--head-font); font-size: clamp(26px, 3.4vw, 36px); font-weight: 700; margin: 0; line-height: 1.1; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.fc-leaks-title .fc-leaks-count { font-size: clamp(44px, 6vw, 64px); color: var(--pri); line-height: 1; }
.fc-leaks-total { text-align: right; }
.fc-leaks-total .fc-label { margin-bottom: 2px; }
.fc-leaks-total b { font-family: var(--head-font); font-size: clamp(28px, 3.6vw, 40px); font-weight: 700; color: var(--pri); line-height: 1.1; display: block; font-variant-numeric: tabular-nums; }
.fc-leaks-sub { margin: 8px 0 0; color: var(--muted); font-size: 13.5px; }
.fc-leaks-ceiling { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; font-style: italic; }
.fc-leak { display: grid; grid-template-columns: 2.2rem 1fr auto; gap: 14px; align-items: start; padding: 14px 0; border-top: 1px solid var(--line); }
.fc-leak:first-child { border-top: 0; }
.fc-leak-n { display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--acc); color: var(--on-acc); font-weight: 800; font-size: 15px; }
.fc-leak-title { font-size: 16px; font-weight: 700; line-height: 1.3; }
.fc-leak-detail { font-size: 13.5px; color: var(--muted); margin-top: 4px; line-height: 1.55; }
.fc-leak-fix { font-size: 12.5px; color: var(--pri); margin-top: 6px; font-weight: 600; }
.fc-leak-right { text-align: right; min-width: 6rem; }
.fc-leak-amt { font-family: var(--head-font); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fc-leak-amtlab { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.fc-leak-none { font-size: 15px; font-weight: 600; color: var(--good); margin: 10px 0 0; }
.fc-leaklist { margin-top: 10px; min-height: 60px; }

#brand-error { background: #B00020; color: #fff; padding: 14px 20px; font: 14px/1.5 system-ui, sans-serif; }
#brand-error ul { margin: 6px 0 0; padding-left: 20px; }

@media (max-width: 560px) {
  .fc-mixrow { grid-template-columns: 1fr; gap: 6px; } .fc-head { flex-direction: column; }
  .fc-topright, .fc-switch { align-items: flex-start; } .fc-switch-row { justify-content: flex-start; }
  .fc dl { grid-template-columns: 1fr; }
  .fc-leak { grid-template-columns: 2.2rem 1fr; } .fc-leak-right { grid-column: 2; text-align: left; } .fc-leaks-total { text-align: left; }
  .fc-agerow, .fc-olrow { grid-template-columns: 6.5rem 1fr auto; }
}
