/* Accurate Board Report — theme + app shell. Palette: Accurate navy/gold + BU tints. */
:root {
  --navy: #0A1F5C;        /* brand navy (headers, sidebar) */
  --navy-2: #1B3A7D;      /* secondary navy (table headers) */
  --gold: #FFD700;        /* brand gold (titles, accents) */
  /* Trade colors (Jeff's convention): Electrical = yellow, HVAC = green, Plumbing = blue (water) */
  --bu-electrical: #FFF2CC;
  --bu-hvac: #C6E0B4;
  --bu-plumbing: #BDD7EE;
  --office-gold: #FFE699;
  --good: #1a7f37;        /* beats budget/target */
  --bad: #c1121f;         /* misses */
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
}
/* dark (default) */
[data-theme="dark"] {
  --bg: #0b1220; --surface: #131c30; --surface-2: #1b2740; --border: #2a3854;
  --text: #e8edf6; --muted: #9fb0cc; --accent: var(--gold);
  --good: #4ade80; --bad: #f87171;
}
/* light */
[data-theme="light"] {
  --bg: #eef2f8; --surface: #ffffff; --surface-2: #f5f7fa; --border: #d6dee9;
  --text: #14233f; --muted: #5b6b86; --accent: var(--navy);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.45 "Calibri", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--text);
}
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
a { color: var(--accent); }
button { font: inherit; cursor: pointer; }

/* ── Buttons ── */
.btn { border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 8px 14px; font-weight: 600; }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-ghost { background: transparent; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  padding: 4px 12px; font-size: 13px; }
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ── Auth screen ── */
.auth { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); text-align: center; }
.auth-card h1 { font-size: 20px; margin: 8px 0 4px; }
.auth-card p { color: var(--muted); margin: 0 0 18px; }
.auth-card input { width: 100%; padding: 11px 12px; margin: 6px 0; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface-2); color: var(--text); }
.auth-card .btn { width: 100%; margin-top: 8px; }
.auth-logo { width: 64px; height: 64px; border-radius: 14px; }
.auth-logo-img { max-width: 250px; width: 100%; height: auto; display: block; margin: 0 auto 14px; }

/* ── App shell: sidebar + topbar + main ── */
.shell { display: grid; grid-template-columns: 232px 1fr; grid-template-rows: 56px 1fr;
  grid-template-areas: "side top" "side main"; height: 100vh; }
.sidebar { grid-area: side; background: var(--navy); color: #cdd8ee; overflow-y: auto; padding: 12px 0; }
.sidebar .brand { color: #fff; font-weight: 700; padding: 6px 18px 14px; display: flex; gap: 10px; align-items: center; }
.sidebar nav a { display: block; padding: 9px 18px; color: #b9c6e3; text-decoration: none; font-size: 14px; border-left: 3px solid transparent; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: rgba(255,255,255,.10); color: var(--gold); border-left-color: var(--gold); font-weight: 600; }
.sidebar .nav-group { color: #7f93bb; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 14px 18px 4px; }
/* Financial tabs before the books close: grayed/italic = "not ready yet, no data". */
.sidebar nav a.nav-pending { color: #56688c; font-style: italic; }
.sidebar nav a.nav-pending:hover { color: #7d8fb3; }

.topbar { grid-area: top; display: flex; align-items: center; gap: 12px; padding: 0 18px;
  background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .spacer { flex: 1; }
.topbar select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); color: var(--text); font-weight: 600; }

.main { grid-area: main; overflow-y: auto; padding: 14px 22px 40px; }
/* deck-style page header: navy bar, gold centered title (compact to fit one screen) */
.section-title { background: var(--navy); color: var(--gold); font-size: 19px; font-weight: 700;
  text-align: center; padding: 8px 16px; border-radius: 8px; margin: 0 0 4px;
  box-shadow: var(--shadow); }
.section-sub { text-align: center; color: var(--muted); margin: 2px 0 12px; font-size: 12px; }
/* local period tabs (tech pages) */
.tabs { display: flex; gap: 8px; justify-content: center; margin: 0 0 14px; }

/* ── Cards / panels ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid.three { grid-template-columns: 1fr; } }

/* KPI tile */
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-size: 26px; font-weight: 700; }
.kpi .delta { font-size: 13px; font-weight: 600; }
.kpi .delta.up { color: var(--good); } .kpi .delta.down { color: var(--bad); }

/* ── Tables ── deck look: always on white "paper", navy headers, alternating rows ── */
.tbl-wrap { overflow-x: auto; background: #fff; border-radius: 10px; box-shadow: var(--shadow); padding: 0; }
.tbl-wrap.scroll { max-height: 80vh; overflow: auto; }  /* own scroll box so sticky headers stay pinned */
/* Spreadsheet look (mimics an embedded Google Sheet) — light gray sticky header, thin gridlines */
table.board.sheet-style { font-size: 12px; }
table.board.sheet-style thead th { background: #f1f3f4; color: #202124; font-weight: 600; border-color: #dadce0; }
table.board.sheet-style th, table.board.sheet-style td { border-color: #dadce0; padding: 4px 9px; }
table.board.sheet-style tbody tr td { background: #fff; }
table.board.sheet-style tbody tr:nth-child(even) td { background: #fafbfd; }
table.board { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; color: #14233f; }
table.board th, table.board td { padding: 5px 9px; border: 1px solid #3a3f47; text-align: center; white-space: nowrap; }
table.board tr.office-row td { background: var(--office-gold) !important; color: #14233f; }
table.board td:first-child, table.board th:first-child { text-align: left; }
table.board thead th { position: sticky; top: 0; background: var(--navy); color: #fff; cursor: pointer; user-select: none; font-weight: 600; }
table.board thead th .arrow { opacity: .55; font-size: 11px; }
table.board tbody tr:nth-child(even) td { background: #f2f3f5; }
table.board tr.total-row td { background: #b9c4d6 !important; font-weight: 700; }
/* !important so red/green always wins over the trade row-tint text color */
td.good, .val.good { color: #1a7f37 !important; font-weight: 700; }
td.bad, .val.bad { color: #c1121f !important; font-weight: 700; }
/* BU row tints (match the deck) */
tr.bu-electrical td { background: var(--bu-electrical) !important; color: #14233f; }
tr.bu-hvac td { background: var(--bu-hvac) !important; color: #14233f; }
tr.bu-plumbing td { background: var(--bu-plumbing) !important; color: #14233f; }
/* HVAC Sales banded blocks (TGL=blue, Marketed=green, Combined=gold) */
table.board tr.band-blue  td { background: #dce6f1; }
table.board tr.band-green td { background: #e2efd9; }
table.board tr.band-gold  td { background: #fff2cc; }
table.board tr.band-head.band-blue  td { background: #4472c4; color: #fff; font-weight: 700; }
table.board tr.band-head.band-green td { background: #548235; color: #fff; font-weight: 700; }
table.board tr.band-head.band-gold  td { background: #7f6000; color: #fff; font-weight: 700; }

/* Leaderboard */
.leader { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.leader .rank { font-size: 18px; width: 30px; text-align: center; }
.leader .who { font-weight: 600; }
.leader .amt { margin-left: auto; font-variant-numeric: tabular-nums; }

/* Editable note */
.note { background: var(--surface-2); border: 1px dashed var(--border); border-radius: 10px; padding: 12px; }
.note textarea { width: 100%; min-height: 90px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px; font: inherit; resize: vertical; }

/* Gate / pending screen */
.gate { display: grid; place-items: center; min-height: 100vh; text-align: center; padding: 24px; }

/* Present mode: full-screen single section */
body.present .shell { grid-template-columns: 1fr; grid-template-areas: "top" "main"; }
body.present .sidebar { display: none; }
body.present .main { padding: 40px 8vw; font-size: 18px; }
body.present .section-title { font-size: 34px; }
.present-nav { position: fixed; bottom: 18px; right: 24px;
  display: flex; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 14px; box-shadow: var(--shadow); z-index: 40; }
.present-nav select { max-width: 300px; padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 14px; cursor: pointer; text-overflow: ellipsis; }
.present-nav .pcount { color: var(--muted); font-size: 13px; white-space: nowrap; }

.footer-build { color: var(--muted); font-size: 12px; text-align: right; padding: 16px 4px 0; }
/* Build stamp under the logo (sidebar) — always visible, no scrolling to the footer. */
.brand-build { color: #8ea3c8; font-size: 11px; text-align: center; padding: 0 14px 12px; letter-spacing: .2px; }

/* ── Admin click-to-edit (value + color) ── */
.ov-edit { outline: 1px dashed #1B3A7D; outline-offset: -1px; cursor: pointer; }
.ov-edit:hover { background: rgba(27,58,125,.08); }
/* On the white-text colored KPI cards, the dark dashed outline is invisible — use a light one. */
.cc-card .ov-edit { outline-color: rgba(255,255,255,.75); }
.cc-card .ov-edit:hover { background: rgba(255,255,255,.16); }
.ov-pop { position: absolute; z-index: 80; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.22); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 230px; }
.ov-pop .ov-input { padding: 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text); font: inherit; }
.ov-pop .ov-colors { display: flex; gap: 6px; }
.ov-pop .ov-colors button { flex: 1; font-size: 13px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 5px; cursor: pointer; }
.ov-pop .ov-colors button.sel { outline: 2px solid var(--navy); font-weight: 700; }
.ov-pop .ov-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ── Target Margins: whole tab tinted in the department color, alternating shades, ── */
/* with Total Cost of Sales + Gross Profit summary rows set apart.                   */
table.board.tm-electrical tbody tr:nth-child(odd) td  { background: #FFF8E1; }
table.board.tm-electrical tbody tr:nth-child(even) td { background: #FFE9A8; }
table.board.tm-electrical tbody tr.tm-summary td      { background: #FFCA28; font-weight: 700; }
table.board.tm-plumbing  tbody tr:nth-child(odd) td   { background: #E8F1FB; }
table.board.tm-plumbing  tbody tr:nth-child(even) td  { background: #C5DCF2; }
table.board.tm-plumbing  tbody tr.tm-summary td       { background: #7FB1E0; font-weight: 700; }
table.board.tm-hvac      tbody tr:nth-child(odd) td    { background: #EDF5E4; }
table.board.tm-hvac      tbody tr:nth-child(even) td   { background: #D6E9C6; }
table.board.tm-hvac      tbody tr.tm-summary td        { background: #A9D08E; font-weight: 700; }
/* Subtotal rows in non-tinted board tables (e.g. the "All HVAC" line on Pace vs Seasonality). */
table.board:not([class*="tm-"]) tbody tr.tm-summary td { background: #EDF5E4; font-weight: 700; }

/* ── Membership Performance: flow diagram (Accurate colors) ── */
.flow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; margin: 8px 0 6px; }
.flow-box { border-radius: 14px; padding: 16px 22px; text-align: center; min-width: 158px; color: #fff; box-shadow: var(--shadow); }
.flow-box .flow-label { font-size: 13px; opacity: .92; }
.flow-box .flow-num { font-size: 34px; font-weight: 800; line-height: 1.1; }
.flow-box .flow-sub { font-size: 12px; opacity: .85; margin-top: 2px; }
.flow-mid { display: flex; flex-direction: column; gap: 10px; }
.flow-mid .flow-box { min-width: 200px; padding: 10px 18px; }
.flow-mid .flow-num { font-size: 24px; }
.flow-arrow { font-size: 30px; color: var(--muted); }
.flow-start { background: #1B3A7D; } .flow-end { background: #0A1F5C; }
.flow-up { background: #2e7d32; } .flow-net { background: #9a7d0a; } .flow-down { background: #c1121f; }

/* ── Call Center: headline stat cards ── */
.cc-card { border-radius: 12px; padding: 16px; text-align: center; color: #fff; box-shadow: var(--shadow); }
.cc-card .cc-label { font-size: 13px; opacity: .92; }
.cc-card .cc-big { font-size: 30px; font-weight: 800; line-height: 1.15; }
.cc-card .cc-sub { font-size: 12px; opacity: .85; margin-top: 4px; line-height: 1.5; }
.cc-navy { background: #0A1F5C; } .cc-blue { background: #1B3A7D; }
.cc-gold { background: #9a7d0a; } .cc-green { background: #2e7d32; } .cc-red { background: #b3261e; }
/* Each channel = a KPI card with its detail card (label | value, no table) stacked below it. */
.cc-board { grid-template-columns: repeat(auto-fit, minmax(248px, 1fr)); align-items: start; }
.cc-col { display: flex; flex-direction: column; gap: 12px; }
.cc-detail { padding: 6px 14px; }
.cc-detail .leader { padding: 7px 2px; }
.cc-detail .leader:last-child { border-bottom: none; }
/* Reconfigured layout: Inbound | (Outbound Calls Made banner → Online + Membership) | Total. */
.cc-board2 {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 1.1fr;
  gap: 14px;
  grid-template-areas:
    "inb out out tot"
    "inb onl mem tot"
    "ind ond med totd";
}
.cc-a-inb { grid-area: inb; } .cc-a-out { grid-area: out; } .cc-a-tot { grid-area: tot; }
.cc-a-onl { grid-area: onl; } .cc-a-mem { grid-area: mem; }
.cc-a-ind { grid-area: ind; } .cc-a-ond { grid-area: ond; } .cc-a-med { grid-area: med; } .cc-a-totd { grid-area: totd; }
.cc-board2 .cc-detail { align-self: start; }
/* Top row: Inbound (navy), Outbound (gold), Total (green) all share this so they're the same
   larger size and line up across the three columns. */
.cc-banner { min-height: 104px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.cc-banner .cc-label { font-size: 15px; }
.cc-banner .cc-big { font-size: 44px; }
.cc-tan { background: #8a7560; }   /* member outreach — the tan/taupe card */
@media (max-width: 1100px) { .cc-board2 { display: flex; flex-direction: column; gap: 12px; } }
/* GP dollar line + vs-budget chip on the hero cards */
.cc-card .cc-amt { font-size: 15px; font-weight: 700; opacity: 1; margin-top: 2px; }
.cc-card .cc-note { font-size: 11px; opacity: .8; margin-left: 6px; }
/* red ▼ / green ▲ vs-budget chip — solid fill so it reads on any card color */
.cc-delta { display: inline-block; font-weight: 800; font-size: 13px; padding: 2px 9px; border-radius: 999px; color: #fff; }
.cc-delta.up { background: #1a7f37; } .cc-delta.down { background: #c1121f; }
.grid.one { grid-template-columns: 1fr; }
/* Overview financial hero cards — colored by vs-BUDGET (light red below / light green above);
   the darker vs-budget chip stands out. Truth is always vs budget (a positive net that misses
   budget is still red). */
.kpi-hero { border-radius: 12px; padding: 16px; text-align: center; box-shadow: var(--shadow); border: 1px solid var(--border); background: var(--surface); }
.kpi-hero.below { background: #fdeaea; border-color: #f0c4c4; color: #7a1212; }
.kpi-hero.above { background: #e8f5ec; border-color: #c2e3cc; color: #14532d; }
.kpi-hero .cc-label { font-size: 13px; opacity: .82; }
.kpi-hero .cc-big { font-size: 30px; font-weight: 800; line-height: 1.15; }
.kpi-hero .cc-sub { font-size: 12px; margin-top: 5px; line-height: 1.7; }
.kpi-hero .cc-amt { font-size: 15px; font-weight: 700; }
.kpi-hero .cc-note { font-size: 11px; opacity: .75; margin-left: 6px; }
/* Leadership Highlight banner (Overview) — one full-width line */
.ldr-highlight { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; margin: 0 0 16px; box-shadow: var(--shadow); }
.ldr-highlight .ldr-icon { font-size: 20px; }
.ldr-highlight .ldr-head { font-weight: 800; white-space: nowrap; }
.ldr-highlight .ldr-items { color: var(--text); font-size: 14px; }
/* Overview section subheadings */
.ov-sub { font-size: 18px; font-weight: 800; color: var(--accent); margin: 22px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--gold); }
.ov-sub:first-child { margin-top: 4px; }

/* ── Leadership Summary: accented section cards with icons ── */
.ls-card { background: #fff; border: 1px solid #e2e6ee; border-radius: 14px; padding: 14px 18px; box-shadow: var(--shadow); }
.ls-head { font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ls-icon { font-size: 18px; }
.ls-list { margin: 0; padding: 0; list-style: none; }
.ls-list li { padding: 6px 0 6px 22px; position: relative; border-bottom: 1px solid #eef1f6; color: #1e2a44; }
.ls-list li:last-child { border-bottom: 0; }
.ls-list li::before { content: "›"; position: absolute; left: 6px; color: var(--muted); font-weight: 700; }
/* 2x2 larger cards with a faded icon watermark */
.ls-grid { grid-template-columns: repeat(2, 1fr) !important; }
.ls-card { position: relative; overflow: hidden; min-height: 150px; padding: 18px 22px; }
.ls-card .ls-watermark { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 110px; opacity: .4; pointer-events: none; line-height: 1; }
.ls-head { font-size: 18px; }

/* ── Action Items: centered, light-yellow striped ── */
table.board.ai-table tbody tr:nth-child(odd) td { background: #FFFBEB; }
table.board.ai-table tbody tr:nth-child(even) td { background: #FFF3C4; }

/* ── Membership Performance: flow that mirrors the board-report diagram ── */
.mflow { display: flex; align-items: stretch; justify-content: space-evenly; gap: 16px; flex-wrap: wrap; margin: 18px 0 14px; }
.mflow-card { background: #fff; border: 1px solid #d6dee9; border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; min-width: 260px; flex: 1 1 0; max-width: 340px; text-align: center; display: flex; flex-direction: column; }
.mflow-card .cap { color: #fff; font-weight: 800; padding: 14px; font-size: 18px; }
.mflow-card.start .cap { background: #1B3A7D; } .mflow-card.end .cap { background: #0A1F5C; }
.mflow-card .icon { font-size: 64px; padding: 22px 0 4px; }
.mflow-card .big { font-size: 80px; font-weight: 900; color: #0A1F5C; padding: 4px 18px 24px; line-height: 1; }
.mflow-mid { display: flex; flex-direction: column; gap: 14px; justify-content: center; flex: 0 1 280px; }
.mflow-pill { border-radius: 16px; color: #fff; padding: 14px 22px; box-shadow: var(--shadow); }
.mflow-pill .t { font-size: 15px; font-weight: 800; opacity: .97; }
.mflow-pill .v { font-size: 38px; font-weight: 900; line-height: 1.05; }
.mflow-pill .s { font-size: 14px; opacity: .92; }
.mflow-pill.new { background: #1aa3a3; } .mflow-pill.net { background: #0f9d58; } .mflow-pill.lost { background: #e0533d; }
/* Editable sub-lines inside a pill (e.g. Free memberships / Recapture under Net Change). */
.mflow-pill .mb-line { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 600; opacity: .96; margin-top: 8px; padding-top: 7px; border-top: 1px solid rgba(255,255,255,.4); }
.mflow-pill .ov-edit { outline-color: rgba(255,255,255,.75); }
.mflow-pill .ov-edit:hover { background: rgba(255,255,255,.16); }
.mflow-arrow { display: flex; align-items: center; font-size: 44px; color: #9fb0cc; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; grid-template-areas: "top" "main"; }
  .sidebar { position: fixed; z-index: 30; left: 0; top: 56px; bottom: 0; width: 232px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
}
