/* 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; }

.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)); }

/* 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; left: 50%; transform: translateX(-50%);
  display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 16px; box-shadow: var(--shadow); }

.footer-build { color: var(--muted); font-size: 12px; text-align: right; padding: 16px 4px 0; }

/* ── 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; }

/* ── 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: 2px; }
.cc-navy { background: #0A1F5C; } .cc-blue { background: #1B3A7D; }
.cc-gold { background: #9a7d0a; } .cc-green { background: #2e7d32; }

/* ── 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: 10px; bottom: -14px; font-size: 110px; opacity: .07; 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; }
.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; }
}
