/* The Budget Analyst Workstation — iFAMS training environment.
   Windows-style desktop (the house design system, kept): login, desktop icons,
   draggable windows, taskbar, mail + spreadsheet windows, calendar, about.
   The iFAMS window (and its login card) is the P2.5 pass: the CGI Momentum
   design language — tokens sampled from 12 public CGI screenshots (--m-*),
   the 16-component inventory (icon rail, top bar, classification strip,
   app-tile launcher, card, KPI tile, data table, activity steppers, vertical
   workflow stepper, funding bar, donut, bar chart, detail form, document
   toolbar, page navigation, flat tabs). The budget-execution screens are a
   labeled extrapolation in that documented language (the About page says so).
   No web fonts (system stack). */

:root {
  /* house palette (desktop shell, mail, spreadsheet) */
  --ink: #1c2733;
  --muted: #5c6b7a;
  --accent: #1f3a5f;
  --accent-soft: #e8eef5;
  --line: #d4dbe3;
  --win-bg: #ffffff;
  --titlebar: #f2f5f8;
  --taskbar: #22303f;
  --taskbar-ink: #e8edf2;
  --ok: #1e7a46;
  --warn: #a3541c;
  --bad: #8a2b2b;
  --desk-1: #cfd9e4;
  --desk-2: #b8c6d6;

  /* Momentum palette (P2.5) — sampled from the public CGI screenshots,
     blends of small elements rounded to canonical (the design spec, 2026-09-19) */
  --m-navy: #0F4773;      /* S4 icon rail (6,272 px) */
  --m-primary: #337AA4;   /* S5 KPI digits + tile icons (1,417 px) */
  --m-blue-lt: #EAF3FA;   /* S4 row tint */
  --m-green: #3E9F4F;     /* S4 stepper dots (canonical) */
  --m-amber: #E8A33D;     /* pending/warning (canonical) */
  --m-red: #C90009;       /* S4 status red (264 px) */
  --m-bg: #F4F6F8;        /* app background */
  --m-card: #FFFFFF;      /* card surface */
  --m-border: #D6D8D9;    /* card/table borders */
  --m-text: #3C3B3B;      /* primary text */
  --m-text-2: #656464;    /* secondary text */
  --m-strip: #F0F2F4;     /* classification strip */
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: #0b1420;
  overflow: hidden;
}
/* the hidden attribute must beat every display rule (e.g. .login { display: flex }) */
[hidden] { display: none !important; }

/* ============ LOGIN (house) ============ */
.login {
  position: absolute; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #243b55, #14202e 70%);
}
.login-card {
  width: 360px; background: var(--win-bg); border-radius: 10px; padding: 28px 30px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.login-seal { color: var(--accent); margin-bottom: 10px; }
.login-title { margin: 6px 0 2px; font-size: 21px; font-weight: 600; letter-spacing: .2px; }
.login-sub { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }
#login-form label {
  font-size: 12.5px; font-weight: 600; color: var(--ink);
  display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px;
}
#login-form input {
  font-size: 13.5px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink);
}
#login-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
#login-form button {
  margin-top: 6px; font-size: 14px; font-weight: 600; padding: 9px 14px; border: 0; border-radius: 6px;
  background: var(--accent); color: #fff; cursor: pointer;
}
#login-form button:hover { background: #27466f; }
.login-hint { font-size: 12.5px; color: var(--muted); margin: 16px 0 0; line-height: 1.5; }

/* ============ DESKTOP (house) ============ */
.desktop {
  position: absolute; inset: 0 0 48px 0;
  background: linear-gradient(150deg, var(--desk-1), var(--desk-2));
}
.icon-tray {
  position: absolute; top: 18px; left: 18px;
  display: flex; flex-direction: column; gap: 6px;
}
.desk-icon {
  position: relative; width: 92px; border: 0; background: transparent; border-radius: 8px;
  padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer;
}
.desk-icon:hover { background: rgba(255, 255, 255, .5); }
.desk-icon:active { background: rgba(255, 255, 255, .75); }
.desk-icon span {
  font-size: 11.5px; color: #17222e; background: rgba(255, 255, 255, .72);
  padding: 2px 8px; border-radius: 999px; box-shadow: 0 1px 2px rgba(10, 20, 35, .18);
}
/* the mail badge — unread count, top-right of the icon */
#mail-badge {
  position: absolute; top: 2px; right: 8px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: var(--m-red); color: #fff; font-size: 10.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(10, 20, 35, .4);
}

/* ============ WINDOWS (house) ============ */
.win {
  position: absolute; display: flex; flex-direction: column;
  background: var(--win-bg); border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(10, 20, 35, .35); min-width: 300px; min-height: 180px;
}
.win.focused { border-color: var(--accent); box-shadow: 0 18px 48px rgba(10, 20, 35, .5); }
.win-titlebar {
  height: 34px; flex: none; display: flex; align-items: center; gap: 6px;
  background: var(--titlebar); border-bottom: 1px solid var(--line);
  padding: 0 6px 0 12px; cursor: grab; user-select: none;
}
.win-titlebar:active { cursor: grabbing; }
.win:not(.focused) .win-titlebar { background: #eef1f4; color: var(--muted); }
.win-title { font-size: 13.5px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-btn {
  width: 26px; height: 24px; border: 0; border-radius: 5px; background: transparent;
  color: var(--muted); font-size: 13px; cursor: pointer;
}
.win-btn:hover { background: #dbe3ea; color: var(--ink); }
.win-btn.close:hover { background: #c43b3b; color: #fff; }
.win-body { flex: 1; overflow: auto; padding: 12px 14px; }

/* replica banner — every screen that speaks about the system carries it */
.replica-banner {
  display: flex; gap: 8px; align-items: flex-start;
  background: #fbf4e6; border: 1px solid #ecd9b0; border-radius: 6px;
  padding: 7px 10px; font-size: 11.5px; color: #6b5320; line-height: 1.45; margin-bottom: 10px;
}
.replica-banner .dot { width: 8px; height: 8px; border-radius: 50%; background: #c98a1b; flex: none; margin-top: 3px; }

/* stub placeholder */
.stub {
  border: 1px dashed var(--line); border-radius: 8px; background: #fbfcfe;
  padding: 18px 20px; font-size: 13px; color: var(--muted); line-height: 1.55; margin: 8px 0;
}
.stub b { color: var(--ink); }

/* ============ TASKBAR (house) ============ */
#taskbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 48px; z-index: 40;
  background: var(--taskbar); color: var(--taskbar-ink);
  display: flex; align-items: center; gap: 8px; padding: 0 8px;
}
.start-btn {
  height: 34px; padding: 0 14px; border: 0; border-radius: 6px; background: rgba(255,255,255,.1);
  color: var(--taskbar-ink); font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.start-btn:hover, .start-btn.open { background: rgba(255, 255, 255, .14); }
.start-menu {
  position: absolute; bottom: 54px; left: 8px; z-index: 45;
  background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 12px 32px rgba(10, 20, 35, .4); padding: 6px; display: flex; flex-direction: column; gap: 2px; width: 240px;
}
.start-menu button {
  border: 0; background: transparent; text-align: left; padding: 8px 10px; border-radius: 6px;
  font-size: 13.5px; color: var(--ink); cursor: pointer;
}
.start-menu button:hover { background: var(--accent-soft); }
.start-menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
#task-runners { display: flex; gap: 6px; flex: 1; overflow-x: auto; }
.runner {
  position: relative; display: flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px; border: 0; border-radius: 6px; background: rgba(255,255,255,.08);
  color: var(--taskbar-ink); font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.runner:hover { background: rgba(255, 255, 255, .18); }
.runner.active { background: rgba(255, 255, 255, .22); box-shadow: inset 0 -2px 0 var(--accent-soft); }
.runner-mail-badge {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--m-red); color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.clock { text-align: right; color: var(--taskbar-ink); line-height: 1.25; padding-left: 10px; }
#clock-time { font-size: 14.5px; font-weight: 600; }
#clock-date { font-size: 11.5px; opacity: .85; }

/* ============ APP: MAIL (house chrome, P2 layout) ============ */
.mail-body { padding: 10px 12px; display: flex; flex-direction: column; }
.mail-layout { flex: 1; display: flex; min-height: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.mail-list { width: 40%; min-width: 200px; border-right: 1px solid var(--line); overflow-y: auto; background: #fff; }
.mail-msg-row {
  display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px;
  border-bottom: 1px solid #edf0f3; cursor: pointer;
}
.mail-msg-row:hover { background: #f5f9fc; }
.mail-msg-row.unread { background: #f5f9fc; }
.mail-msg-row.unread .from, .mail-msg-row.unread .subj { font-weight: 700; color: var(--ink); }
.mail-msg-row.unread .mail-dot { color: var(--m-primary); }
.mail-msg-row.read .mail-dot { visibility: hidden; }
.mail-dot { font-size: 9px; margin-top: 4px; flex: none; }
.mail-msg-main { flex: 1; min-width: 0; }
.mail-msg-main .from { font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-msg-main .subj { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.mail-time { font-size: 10.5px; color: var(--muted); flex: none; margin-top: 2px; }
.mail-read { flex: 1; min-width: 0; overflow-y: auto; padding: 12px 16px; background: #fff; }
.mail-read-head { border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 10px; }
.mail-read-head .from { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.mail-read-head .subj { font-size: 13.5px; color: var(--ink); margin-top: 3px; line-height: 1.4; }
.mail-read-head .mail-time { margin-top: 4px; }
.mail-body-text { font-size: 13px; line-height: 1.6; color: var(--ink); white-space: pre-wrap; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--accent-soft);
  padding: 7px 11px; font-size: 12.5px; font-weight: 600; color: var(--accent); cursor: pointer;
}
.attach-chip:hover { border-color: var(--accent); background: #dfe9f4; }
.mail-applied { margin-top: 10px; font-size: 12.5px; font-weight: 700; color: var(--ok); }

/* ============ APP: SPREADSHEET (house chrome, P2 surface) ============ */
.sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.sheet-title { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.sheet-fbar {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; padding: 4px 8px; margin-bottom: 8px; font-size: 12px;
}
.sheet-ref { background: var(--accent-soft); color: var(--accent); font-weight: 700; padding: 2px 8px; border-radius: 4px; }
.sheet-fx { flex: 1; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-grid { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; width: 100%; }
.sheet-grid table { border-collapse: collapse; width: 100%; }
.sheet-grid th, .sheet-grid td {
  border: 1px solid #e4e9ef; padding: 5px 8px; font-size: 12px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px;
}
.sheet-grid th { background: var(--accent-soft); color: var(--accent); font-weight: 600; text-align: center; }
.sheet-grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.sheet-rownum { text-align: center; background: #f6f8fa; color: var(--muted); font-size: 11px; }
.sheet-title-cell { font-weight: 700; font-size: 12.5px; }
.sheet-hcell { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: #f6f8fa; }
.sheet-req {
  width: 96px; text-align: right; font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, Menlo, monospace;
  font-size: 12px; padding: 3px 6px; border: 1px solid #c9cfd6; border-radius: 4px; background: #fff; color: var(--ink);
}
.sheet-req:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.sheet-sum {
  margin-top: 8px; border: 1px solid var(--line); border-radius: 6px; background: #f8fafc;
  padding: 6px 10px; font-size: 12.5px; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.sheet-sum.flash { background: #fdf3e3; border-color: #e5c89a; color: #9a6a1b; }
.sheet-row-synthetic td { background: #f4f7fa; }

/* ============ APP: CALENDAR (house) ============ */
.cal-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.cal-head h3 { margin: 0; font-size: 16px; }
.cal-head span { color: var(--muted); font-size: 12.5px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { font-size: 11px; color: var(--muted); text-align: center; padding: 4px 0; text-transform: uppercase; letter-spacing: .5px; }
.cal-day {
  border: 1px solid var(--line); border-radius: 6px; min-height: 44px; padding: 4px 6px;
  font-size: 12px; color: var(--ink); background: #fff;
}
.cal-day.out { opacity: .38; }
.cal-day.today { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.cal-day .mark { display: block; height: 5px; width: 5px; border-radius: 50%; background: var(--warn); margin-top: 4px; }

/* ============ APP: ABOUT (house) ============ */
.about h3 { margin: 0 0 6px; font-size: 15px; }
.about section { margin-bottom: 18px; }
.about p { margin: 6px 0; font-size: 13.5px; line-height: 1.6; }
.about ul { margin: 6px 0; padding-left: 20px; font-size: 13.5px; line-height: 1.65; }
.about a { color: var(--accent); }
.about .facts { font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 18px; padding-top: 12px; }

/* ============ APP: iFAMS (sys) — P2.5: the CGI Momentum design language ============ */
.k { font-size: 12.5px; color: var(--m-text-2); line-height: 1.5; }
.mono { font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, Menlo, monospace; font-variant-numeric: tabular-nums; }

/* --- classification strip (token 3) --- */
.m-strip {
  background: var(--m-strip); color: var(--m-text-2);
  font-size: 10.5px; font-weight: 600; letter-spacing: .6px;
  padding: 3px 12px; border-bottom: 1px solid var(--m-border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* --- top bar (token 2) --- */
.m-topbar {
  display: flex; align-items: center; gap: 12px;
  background: var(--m-card); border-bottom: 1px solid var(--m-border);
  padding: 7px 14px; flex: none;
}
.m-search {
  flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px;
  background: var(--m-bg); border: 1px solid var(--m-border); border-radius: 999px;
  padding: 5px 12px; color: var(--m-text-2); font-size: 12.5px;
}
.m-search-ico { color: var(--m-text-2); font-size: 14px; }
.m-search-ph { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.m-bell { position: relative; font-size: 15px; color: var(--m-text-2); cursor: default; }
.m-bell-count {
  position: absolute; top: -6px; right: -8px;
  min-width: 15px; height: 15px; padding: 0 3px; border-radius: 999px;
  background: var(--m-red); color: #fff; font-size: 9.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.m-star { color: var(--m-text-2); font-size: 14px; }
.m-avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--m-navy); color: #fff;
  font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none;
}
.m-user { font-size: 12.5px; font-weight: 600; color: var(--m-text); }

/* --- system login card (token 3 strip + card on the navy field) --- */
.m-login { height: 100%; display: flex; flex-direction: column; background: var(--m-navy); }
.m-login .m-strip { border-bottom: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); color: #c9d6e2; }
.m-login-body { flex: 1; display: flex; align-items: center; justify-content: center; padding: 18px; overflow: auto; }
.sys-login-card {
  width: 420px; max-width: 100%; background: var(--m-card); border-radius: 6px;
  padding: 22px 26px; box-shadow: 0 18px 48px rgba(4, 22, 38, .5);
}
.sys-sysname { font-size: 30px; font-weight: 800; letter-spacing: .5px; color: var(--m-navy); }
.sys-fullname { font-size: 13px; font-weight: 600; color: var(--m-text); margin: 2px 0 12px; line-height: 1.4; }
.sys-plat { font-size: 12.5px; color: var(--m-text-2); line-height: 1.55; margin: 0 0 12px; }
.sys-sor {
  font-size: 12px; font-weight: 600; color: var(--m-text);
  background: var(--m-blue-lt); border: 1px solid #cfe3f2; border-radius: 6px; padding: 8px 10px; margin-bottom: 10px; line-height: 1.45;
}
.sys-synth {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  color: var(--m-amber); background: #fdf3e3; border: 1px solid #e5c89a; border-radius: 999px; padding: 3px 9px; margin-bottom: 14px;
}
#sys-login-form { display: flex; flex-direction: column; gap: 12px; }
#sys-login-form label { font-size: 12.5px; font-weight: 600; color: var(--m-text); display: flex; flex-direction: column; gap: 5px; }
#sys-login-form input {
  font-size: 13.5px; padding: 8px 10px; border: 1px solid var(--m-border); border-radius: 6px; background: #fff; color: var(--m-text);
}
#sys-login-form input:focus { outline: 2px solid var(--m-primary); outline-offset: 1px; border-color: var(--m-primary); }
#sys-login-form button { margin-top: 4px; }
.sys-hint { font-size: 12px; margin-top: 14px; }

/* --- the shell: navy icon rail (token 1) + main pane --- */
.sys-shell { display: flex; height: 100%; background: var(--m-bg); }
.sys-rail {
  width: 158px; flex: none; background: var(--m-navy); color: #fff;
  display: flex; flex-direction: column; padding: 10px 8px; overflow-y: auto;
}
.sys-rail-brand { font-size: 15px; font-weight: 800; color: #fff; letter-spacing: .5px; padding: 0 8px 12px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 10px; }
.sys-rail-btn {
  display: flex; align-items: center; gap: 9px; width: 100%;
  border: 0; border-left: 3px solid transparent; border-radius: 5px;
  background: transparent; color: #c9d6e2; font-size: 12.5px; text-align: left;
  padding: 8px 9px; margin-bottom: 2px; cursor: pointer;
}
.sys-rail-btn:hover { background: rgba(255,255,255,.07); color: #fff; }
.sys-rail-btn.active { background: rgba(255,255,255,.1); color: #fff; border-left-color: #7fa3cc; font-weight: 600; }
.sys-rail-ico { font-size: 14px; width: 16px; text-align: center; flex: none; }
.sys-rail-lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sys-time { margin-top: auto; padding: 12px 8px 4px; border-top: 1px solid rgba(255,255,255,.12); }
.sys-time-label { font-size: 10.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: #8fa4b8; margin-bottom: 6px; }
.day-chip {
  display: inline-block; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; color: #fff; margin-bottom: 8px;
}
.rail-note { font-size: 10.5px; color: #8fa4b8; margin-top: 7px; line-height: 1.45; }
.sys-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.sys-view-wrap { flex: 1; overflow-y: auto; padding: 14px 18px 20px; }
.sys-main-head { font-size: 12px; color: var(--m-text-2); margin-bottom: 10px; line-height: 1.45; }

/* --- document header: TYPE + id + status badge --- */
.doc-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--m-card); border: 1px solid var(--m-border); border-radius: 6px;
  padding: 10px 14px; margin-bottom: 10px;
}
.doc-type { font-size: 16px; font-weight: 800; color: var(--m-text); }
.doc-id { font-size: 12px; font-weight: 500; color: var(--m-text-2); margin-left: 8px; }

/* --- status badges (green / amber / red / neutral) --- */
.badge {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  border-radius: 999px; padding: 2.5px 8px; border: 1px solid transparent; white-space: nowrap;
}
.badge.ok { color: #2e7d40; background: #e8f5ea; border-color: #bfdcc6; }
.badge.warn { color: #9a6a1b; background: #fdf3e3; border-color: #e5c89a; }
.badge.bad { color: #fff; background: var(--m-red); border-color: var(--m-red); }
.badge.info { color: var(--m-text-2); background: #eef1f4; border-color: #d6d8d9; }

/* --- status dots (data tables) --- */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; }
.dot.ok { background: var(--m-green); }
.dot.warn { background: var(--m-amber); }
.dot.bad { background: var(--m-red); }
.dot.info { background: #9aa5b1; }

/* --- Page Navigation rail (token 15) --- */
.page-nav { display: flex; gap: 2px; border-bottom: 1px solid var(--m-border); margin-bottom: 12px; }
.page-nav button {
  border: 0; background: transparent; border-bottom: 2px solid transparent;
  font-size: 12.5px; font-weight: 600; color: var(--m-text-2); padding: 8px 12px; cursor: pointer;
}
.page-nav button:hover { color: var(--m-text); background: #f4f7fa; }
.page-nav button.active { color: var(--m-primary); border-bottom-color: var(--m-primary); }

/* --- app-tile launcher (token 4) --- */
.m-tile-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.m-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  background: var(--m-card); border: 1px solid var(--m-border); border-radius: 6px;
  padding: 12px 14px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--m-text);
}
.m-tile:hover { border-color: var(--m-primary); background: var(--m-blue-lt); }
.m-tile-ico { font-size: 19px; color: var(--m-primary); line-height: 1; }
.m-tile-lbl { line-height: 1.3; }

/* --- KPI tiles (token 6) --- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.kpi-card { background: var(--m-card); border: 1px solid var(--m-border); border-radius: 6px; padding: 10px 12px; }
.kpi-label { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--m-text-2); margin-bottom: 5px; }
.kpi-value { font-size: 21px; font-weight: 800; color: var(--m-primary); line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 11px; color: var(--m-text-2); margin-top: 4px; line-height: 1.4; }
.score-big { font-size: 30px; }

/* --- dashboard 2-col sections --- */
.dash-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dash-grid2.ob-2col { margin-bottom: 12px; }
.dash-section { background: var(--m-card); border: 1px solid var(--m-border); border-radius: 6px; padding: 12px 14px; margin-bottom: 10px; }
.dash-grid2 .dash-section { margin-bottom: 0; }
.dash-section h4 { margin: 0 0 8px; font-size: 12.5px; font-weight: 700; color: var(--m-text); text-transform: uppercase; letter-spacing: .4px; }
.pend-row { font-size: 12.5px; padding: 5px 0; border-bottom: 1px solid #edf0f3; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pend-row:last-child { border-bottom: 0; }
.ladder-mini-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; padding: 4px 0; border-bottom: 1px solid #edf0f3; }
.ladder-mini-row:last-child { border-bottom: 0; }
.ladder-mini-row.row-late { color: var(--m-red); }

/* --- the L1/L2/L3 bar chart (token 12) --- */
.m-chart {
  display: flex; align-items: flex-end; gap: 18px; height: 130px;
  border-bottom: 1px solid var(--m-border); padding: 0 10px; margin-bottom: 8px;
}
.m-chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.m-chart-bar {
  width: 70%; max-width: 74px; border: 1px solid #b8d2e8; background: var(--m-blue-lt);
  border-radius: 4px 4px 0 0; overflow: hidden; display: flex; align-items: flex-end;
}
.m-chart-fill { width: 100%; background: var(--m-primary); transition: height .25s ease; }
.m-chart-col:last-child .m-chart-fill { background: var(--m-green); }
.m-chart-lbl { font-size: 11px; font-weight: 700; color: var(--m-text); margin-top: 5px; }
.m-chart-amt { font-size: 11px; color: var(--m-text-2); margin-top: 1px; }

/* --- data tables (token 7) --- */
.m-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.m-table th {
  font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--m-text-2);
  text-align: left; background: var(--m-strip); border-bottom: 1px solid var(--m-border);
  padding: 7px 9px;
}
.m-table td { border-bottom: 1px solid #e4e7ea; padding: 7px 9px; vertical-align: top; line-height: 1.45; color: var(--m-text); }
.m-table th.num, .m-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
/* P3: red negative amounts in the JV ledger (the deobligation rows) */
.neg { color: var(--m-red); }
.m-table tr:hover td { background: var(--m-blue-lt); }

/* --- the funds-control ladder (Status of Funds lines, token 7 + bars) --- */
.ladder-row { border: 1px solid var(--m-border); border-radius: 6px; padding: 12px 14px; background: var(--m-card); margin-bottom: 10px; }
.ladder-row:last-child { margin-bottom: 0; }
.ladder-row.l3 { border-color: #a9c6de; background: var(--m-blue-lt); }
.ladder-name { font-size: 13.5px; font-weight: 700; color: var(--m-text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.ladder-nums { font-size: 12.5px; color: var(--m-text-2); margin-bottom: 8px; }
.ladder-bar { height: 8px; border-radius: 999px; background: #e4e9ef; overflow: hidden; }
.ladder-bar-fill { height: 100%; background: var(--m-primary); border-radius: 999px; transition: width .25s ease; }
.ladder-row.l3 .ladder-bar-fill { background: var(--m-green); }

/* --- the Momentum donut: Allocated / Total / Projected Remaining (token 11) --- */
.donut-wrap { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.donut { width: 74px; height: 74px; flex: none; }
.donut-bg { fill: none; stroke: #dde5ee; stroke-width: 6; }
.donut-fg { fill: none; stroke: var(--m-primary); stroke-width: 6; stroke-linecap: round; transition: stroke-dasharray .25s ease; }
.donut-legend { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--m-text-2); }

/* --- card (token 5) --- */
.m-card { background: var(--m-card); border: 1px solid var(--m-border); border-radius: 6px; margin-bottom: 12px; overflow: hidden; }
.m-card-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px; font-weight: 700; color: var(--m-text);
  padding: 10px 14px; border-bottom: 1px solid var(--m-border); background: #fafbfc;
}
.m-card-body { padding: 12px 14px; }
.m-more { margin-left: auto; color: var(--m-text-2); font-size: 14px; }

/* --- vertical workflow stepper (token 9) --- */
.m-wfst { display: flex; flex-direction: column; }
.wfst-step { display: flex; gap: 10px; position: relative; padding-bottom: 14px; }
.wfst-step:not(:last-child)::before {
  content: ""; position: absolute; left: 9px; top: 20px; bottom: 0; width: 2px; background: #d6d8d9;
}
.wfst-step.done:not(:last-child)::before { background: var(--m-green); }
.wfst-box {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid #9aa5b1; background: #fff; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff;
}
.wfst-step.done .wfst-box { background: var(--m-green); border-color: var(--m-green); }
.wfst-step.done .wfst-box::after { content: "✓"; }
.wfst-step.doing .wfst-box { border-color: var(--m-amber); }
.wfst-step.doing .wfst-box::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--m-amber); }
.wfst-step.blocked .wfst-box { background: var(--m-red); border-color: var(--m-red); }
.wfst-step.blocked .wfst-box::after { content: "✕"; }
.wfst-txt { min-width: 0; }
.wfst-name { font-size: 12px; font-weight: 700; letter-spacing: .3px; color: var(--m-text); line-height: 1.4; }
.wfst-sub { font-size: 11px; color: var(--m-text-2); margin-top: 2px; line-height: 1.4; }

/* --- horizontal Activity Progress stepper (token 8) --- */
.m-steph { display: inline-flex; align-items: center; gap: 0; }
.steph-step { display: flex; flex-direction: column; align-items: center; gap: 3px; position: relative; padding: 0 6px; }
.steph-step:not(:first-child)::before {
  content: ""; position: absolute; top: 7px; right: 50%; width: 100%; height: 2px; background: #d6d8d9; z-index: 0;
}
.steph-step.done:not(:first-child)::before, .steph-step.doing:not(:first-child)::before { background: var(--m-green); }
.steph-step.blocked:not(:first-child)::before { background: var(--m-red); }
.steph-dot {
  width: 15px; height: 15px; border-radius: 50%; border: 2px solid #9aa5b1; background: #fff; z-index: 1;
  display: flex; align-items: center; justify-content: center; font-size: 8px; font-weight: 800; color: #fff;
}
.steph-step.done .steph-dot { background: var(--m-green); border-color: var(--m-green); }
.steph-step.done .steph-dot::after { content: "✓"; }
.steph-step.doing .steph-dot { border-color: var(--m-amber); background: var(--m-amber); }
.steph-step.blocked .steph-dot { background: var(--m-red); border-color: var(--m-red); }
.steph-step.blocked .steph-dot::after { content: "✕"; }
.steph-lbl { font-size: 10px; font-weight: 600; color: var(--m-text-2); white-space: nowrap; }
.steph-step.done .steph-lbl { color: var(--m-green); }
.steph-step.blocked .steph-lbl { color: var(--m-red); }

/* --- document toolbar (token 14) --- */
.m-toolbar {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  background: var(--m-card); border: 1px solid var(--m-border); border-radius: 6px;
  padding: 5px 8px; margin-bottom: 12px;
}
.m-tool-btn {
  border: 0; background: transparent; font-size: 12px; font-weight: 600; color: var(--m-text);
  padding: 6px 10px; border-radius: 4px; cursor: pointer; white-space: nowrap;
}
.m-tool-btn:hover { background: #eef2f6; }
.m-tool-btn.primary-tool { color: var(--m-primary); background: var(--m-blue-lt); }
.m-tool-btn.primary-tool:hover { background: #dcebf7; }
.m-tool-sep { width: 1px; height: 20px; background: var(--m-border); margin: 0 4px; }
.m-tool-more { position: relative; }
.m-tool-more[hidden] { display: none; }

/* --- funding progress bar (token 10) --- */
.m-funding { background: var(--m-card); border: 1px solid var(--m-border); border-radius: 6px; padding: 10px 14px; margin-bottom: 12px; }
.m-funding-lbl { font-size: 12px; color: var(--m-text); margin-bottom: 7px; line-height: 1.45; }
.m-funding-track { height: 8px; border-radius: 999px; background: #e4e9ef; overflow: hidden; }
.m-funding-fill { height: 100%; background: var(--m-primary); border-radius: 999px; transition: width .25s ease; }

/* --- detail form panel (token 13) --- */
.m-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.m-field { min-width: 0; }
.m-lbl { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--m-text-2); margin-bottom: 3px; }
.m-val { font-size: 13px; color: var(--m-text); line-height: 1.4; word-break: break-word; }

/* --- cards / callouts / refusals / comments (P1 content, Momentum colors) --- */
.card { background: var(--m-card); border: 1px solid var(--m-border); border-radius: 6px; padding: 14px 16px; margin-bottom: 12px; }
.card.rejection { border-color: #e3b6b8; background: #fdf6f6; }
.card.ok-card { border-color: #bfdcc6; background: #f3faf5; }
.card-head { font-size: 14px; font-weight: 700; color: var(--m-text); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.callout {
  background: var(--m-blue-lt); border-left: 3px solid var(--m-primary); border-radius: 4px;
  padding: 9px 12px; font-size: 12.5px; color: var(--m-text); line-height: 1.55; margin-bottom: 10px;
}
.callout .k { display: block; margin-bottom: 3px; font-weight: 700; color: var(--m-navy); }
.callout.ok { border-left-color: var(--m-green); background: #eff8f1; }
.callout.ok .k { color: #2e7d40; }
.refusal {
  background: #fdf6f6; border-left: 3px solid var(--m-red); border-radius: 4px;
  padding: 10px 12px; font-size: 12.5px; color: var(--m-text); line-height: 1.55; margin-bottom: 10px;
}
.refusal .k { display: block; margin-bottom: 3px; font-weight: 700; color: var(--m-red); }
.comment-card {
  background: #fff; border: 1px solid var(--m-border); border-radius: 6px;
  padding: 10px 12px; font-size: 12.5px; color: var(--m-text); line-height: 1.6; margin-top: 8px;
}

/* --- buttons --- */
.btn {
  font-size: 13px; font-weight: 600; padding: 8px 14px; border: 0; border-radius: 6px;
  background: var(--m-primary); color: #fff; cursor: pointer;
}
.btn:hover { background: #2a6a8f; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--m-primary); }
.btn.ghost { background: #fff; color: var(--m-primary); border: 1px solid var(--m-border); }
.btn.ghost:hover { background: var(--m-blue-lt); border-color: var(--m-primary); }
.btn.sm { font-size: 12px; padding: 5px 10px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }

/* --- the workpaper table (token 7 + actions) --- */
.wf-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 4px 0 8px; }
.wf-table th {
  font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--m-text-2);
  text-align: left; background: var(--m-strip); border: 1px solid var(--m-border); padding: 7px 9px;
}
.wf-table td { border: 1px solid #e4e7ea; padding: 7px 9px; vertical-align: top; line-height: 1.45; color: var(--m-text); }
.wf-table td.num, .wf-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.wf-table tr.totals td { background: #f4f7fa; font-weight: 700; }
.wf-table tr.row-held td { background: #fdf6ec; }
.wf-table tr.row-rejected td { background: #fbedee; }
.wf-table tr.row-accepted td { background: #eff8f1; }
.wf-table tr.row-late td { background: #fbedee; }
.wf-table .actions { white-space: nowrap; }
.wf-table tbody tr { cursor: pointer; }
.wf-table tbody tr:hover td { background: var(--m-blue-lt); }

/* --- the approvals worklist (token 7 + token 8) --- */
.sub-card { background: var(--m-card); border: 1px solid var(--m-border); border-radius: 6px; padding: 12px 14px; margin-bottom: 10px; }
.sub-card:last-child { margin-bottom: 0; }
.sub-card.sub-ok { border-left: 3px solid var(--m-green); }
.sub-card.sub-rejected { border-left: 3px solid var(--m-red); }
.sub-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sub-id { font-size: 13px; font-weight: 700; color: var(--m-primary); }
.sub-steps { margin: 8px 0 4px; }
.sub-title { font-size: 13px; font-weight: 600; margin: 5px 0 3px; }
.sub-chain { font-size: 12px; color: var(--m-text-2); }
.sub-note { margin-top: 4px; }

/* --- corrections --- */
.correct-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid #edf0f3; flex-wrap: wrap; }
.correct-row:last-child { border-bottom: 0; }

/* --- line detail (S2 treatment: donut + attribute form) --- */
.line-detail-grid { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; }
.line-donut { display: flex; }

/* --- debrief (token 5/6/7) --- */
.score-body { }
.score-kpis { margin-bottom: 10px; }
.gate-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.gate-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--m-card); border: 1px solid var(--m-border); border-radius: 6px;
  padding: 9px 12px; font-size: 12.5px; color: var(--m-text);
}
.gate-row.gate-pass { border-left: 3px solid var(--m-green); }
.gate-row.gate-fail { border-left: 3px solid var(--m-red); }
.gate-row b { color: var(--m-text); }

/* --- the about (in-rail) --- */
.about-sys { background: var(--m-card); border: 1px solid var(--m-border); border-radius: 6px; padding: 16px 18px; }
.about-sys h3 { margin: 0 0 6px; font-size: 14px; color: var(--m-navy); }
.about-sys section { margin-bottom: 16px; }
.about-sys p { margin: 6px 0; font-size: 13px; line-height: 1.6; color: var(--m-text); }
.about-sys ul, .about-sys ol { margin: 6px 0; padding-left: 20px; font-size: 13px; line-height: 1.6; color: var(--m-text); }
.about-sys li { margin-bottom: 8px; }
.about-sys a { color: var(--m-primary); }
.about-sys code { font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, Menlo, monospace; font-size: 11.5px; background: var(--m-bg); padding: 1px 5px; border-radius: 4px; }

/* --- boot guard error banner (always on top, both surfaces) --- */
#boot-error {
  position: absolute; inset: auto 12px 56px 12px; z-index: 99;
  background: #fdf0f0; border: 1px solid var(--bad); border-radius: 8px;
  color: var(--bad); padding: 10px 14px; font-size: 13px; line-height: 1.5;
}
#boot-error[hidden] { display: none; }

/* --- login screen boot status (self-diagnosing line) --- */
.boot-status {
  margin-top: 14px; font-size: 11.5px; color: var(--muted);
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, Menlo, monospace;
  border-top: 1px solid var(--line); padding-top: 8px;
}
