  :root{
    /* Light theme matched to the Payroll Dashboard */
    --bg:#f2f3f1;
    --surface:#fcfcfb;
    --surface-2:#f5f5f2;
    --surface-3:#ecece8;
    --border:#e2e2dc;
    --border-strong:#c3c2b7;
    --text-primary:#0f1215;
    --text-secondary:#4e5054;
    --text-muted:#76777a;
    --muted:#76777a;
    --accent:#2a78d6;
    --accent-soft:rgba(42,120,214,0.10);
    --reliant:#2a78d6;
    --xceed:#eb6834;
    --cognitech:#1baf7a;
    --good:#1a8f3c;
    --good-soft:#e6f5e6;
    --warn:#b57900;
    --warn-soft:#fff4d6;
    --bad:#c62f2f;
    --bad-soft:#fbe7e7;
    --shadow:0 1px 2px rgba(15,18,21,.05),0 0 0 1px rgba(15,18,21,.10);
    --sidebar:#fcfcfb;
    --topbar:rgba(242,243,241,0.92);
    --row-hover:rgba(42,120,214,0.06);
    color-scheme:light;
  }
  @media (prefers-color-scheme:dark){
    :root:not([data-theme="light"]){
      --bg:#0f1011; --surface:#1a1a19; --surface-2:#222221; --surface-3:#2a2a28;
      --border:#2c2c2a; --border-strong:#3f3f3c;
      --text-primary:#f4f4f2; --text-secondary:#c3c2b7; --text-muted:#8f8e88; --muted:#8f8e88;
      --accent:#3987e5; --accent-soft:rgba(57,135,229,0.14);
      --good:#4cc44c; --good-soft:#12301a; --warn:#fab219; --warn-soft:#3a2e10; --bad:#f08a8a; --bad-soft:#3a1818;
      --shadow:0 0 0 1px rgba(255,255,255,.09);
      --sidebar:#161615; --topbar:rgba(15,16,17,0.92); --row-hover:rgba(255,255,255,0.04);
      color-scheme:dark;
    }
  }
  :root[data-theme="dark"]{
      --bg:#0f1011; --surface:#1a1a19; --surface-2:#222221; --surface-3:#2a2a28;
      --border:#2c2c2a; --border-strong:#3f3f3c;
      --text-primary:#f4f4f2; --text-secondary:#c3c2b7; --text-muted:#8f8e88; --muted:#8f8e88;
      --accent:#3987e5; --accent-soft:rgba(57,135,229,0.14);
      --good:#4cc44c; --good-soft:#12301a; --warn:#fab219; --warn-soft:#3a2e10; --bad:#f08a8a; --bad-soft:#3a1818;
      --shadow:0 0 0 1px rgba(255,255,255,.09);
      --sidebar:#161615; --topbar:rgba(15,16,17,0.92); --row-hover:rgba(255,255,255,0.04);
      color-scheme:dark;
  }

  /* ---------- needs-attention bell ---------- */
  .panel-head{display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:0;}
  .panel-head h3{flex:1 1 auto; min-width:0;}
  .attn-wrap{position:relative; flex:0 0 auto;}
  .attn-btn{all:unset; cursor:pointer; position:relative; display:inline-flex; align-items:center; justify-content:center; width:34px; height:34px; border-radius:9px; background:var(--surface-2); color:var(--text-secondary); box-shadow:var(--shadow);}
  .attn-btn:hover{color:var(--text-primary); background:var(--surface-3);}
  .attn-btn:focus-visible{outline:2px solid var(--accent); outline-offset:2px;}
  .attn-btn svg{width:18px; height:18px;}
  .attn-btn .badge{position:absolute; top:-5px; right:-5px; min-width:18px; height:18px; padding:0 5px; border-radius:9px; background:var(--warn); color:#fff; font-size:10.5px; font-weight:700; line-height:18px; text-align:center; box-sizing:border-box;}
  .attn-btn.none .badge{display:none;}
  .attn-pop{position:absolute; right:0; top:42px; z-index:30; width:min(420px, calc(100vw - 32px)); background:var(--surface); border:1px solid var(--border); border-radius:12px; box-shadow:0 12px 32px rgba(15,18,21,.16); padding:12px;}
  .attn-pop h4{margin:0 0 8px; font-size:12px; letter-spacing:.05em; text-transform:uppercase; color:var(--text-muted); display:flex; justify-content:space-between; align-items:center;}
  .attn-pop .x{all:unset; cursor:pointer; font-size:18px; line-height:1; color:var(--text-muted); padding:0 4px;}
  .attn-pop .flagline:last-child{margin-bottom:0;}
  .attn-pop .empty{font-size:12.5px; color:var(--text-muted); padding:4px 2px;}
  @media (max-width:560px){ .attn-pop{position:fixed; left:16px; right:16px; top:auto; bottom:16px; width:auto;} }
  *{box-sizing:border-box;}
  html,body{margin:0;padding:0;}
  [hidden]{display:none !important;}
  body{
    background:var(--bg);
    color:var(--text-primary);
    font-family:'Public Sans',system-ui,-apple-system,"Segoe UI",sans-serif;
    font-size:14px;
    line-height:1.5;
    -webkit-font-smoothing:antialiased;
  }
  h1,h2,h3,h4,.display{font-family:'Public Sans',system-ui,-apple-system,"Segoe UI",sans-serif;}
  .num{font-variant-numeric:tabular-nums;}
  a{color:var(--accent);}
  ::selection{background:var(--accent-soft);}

  /* ---------- layout shell ---------- */
  .app{display:flex; min-height:100%; width:100%;}
  .sidebar{
    width:232px; flex:0 0 232px;
    background:var(--sidebar);
    border-right:1px solid var(--border);
    padding:20px 14px 16px;
    position:sticky; top:0; align-self:flex-start;
    height:100vh; overflow-y:auto;
  }
  .brand{display:flex; flex-direction:column; gap:2px; padding:2px 8px 18px; border-bottom:1px solid var(--border); margin-bottom:14px;}
  .brand .mark{font-family:'Sora',sans-serif; font-weight:700; font-size:15px; letter-spacing:.02em; color:var(--text-primary);}
  .brand .sub{font-size:11px; color:var(--text-muted); letter-spacing:.03em;}
  nav.navlist{display:flex; flex-direction:column; gap:2px;}
  .navlist button{
    all:unset; cursor:pointer; display:flex; align-items:center; gap:10px;
    padding:9px 10px; border-radius:8px; font-size:12.5px; font-weight:600;
    letter-spacing:.03em; color:var(--text-secondary); text-transform:uppercase;
  }
  .navlist button .dot{width:6px;height:6px;border-radius:50%;background:var(--text-muted); flex:0 0 auto;}
  .navlist button:hover{background:var(--surface); color:var(--text-primary);}
  .navlist button.active{background:var(--accent-soft); color:var(--text-primary);}
  .navlist button.active .dot{background:var(--accent);}
  .sidebar-foot{margin-top:16px; padding-top:14px; border-top:1px solid var(--border); font-size:10.5px; color:var(--text-muted); line-height:1.6;}

  main{flex:1 1 auto; min-width:0; padding-bottom:60px;}
  .topbar{
    position:sticky; top:0; z-index:20;
    background:var(--topbar); backdrop-filter:blur(8px);
    border-bottom:1px solid var(--border);
    padding:12px 24px; display:flex; flex-wrap:wrap; gap:10px 14px; align-items:center;
  }
  .topbar .title-block{margin-right:auto;}
  .topbar h1{font-size:16px; margin:0; font-weight:700;}
  .topbar .period{font-size:11px; color:var(--text-muted);}
  .filter{display:flex; flex-direction:column; gap:3px;}
  .filter label{font-size:9.5px; text-transform:uppercase; letter-spacing:.06em; color:var(--text-muted); font-weight:600;}
  .filter select{
    background:var(--surface-2); color:var(--text-primary); border:1px solid var(--border-strong);
    border-radius:7px; padding:6px 8px; font-size:12px; font-family:inherit; min-width:118px;
  }
  .filter select:disabled{color:var(--text-secondary); opacity:.75; cursor:not-allowed;}

  .content{padding:22px 24px 10px; max-width:1440px;}
  section.page{display:none;}
  section.page.active{display:block;}

  .section-head{margin:26px 0 12px;}
  .section-head:first-child{margin-top:0;}
  .section-head h2{font-size:19px; margin:0 0 4px; font-weight:700;}
  .section-head .desc{font-size:12.5px; color:var(--text-secondary); max-width:820px;}
  .section-num{color:var(--text-muted); font-weight:600; margin-right:6px;}

  .card{background:var(--surface); border:1px solid var(--border); border-radius:12px;}
  .panel{background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:16px 18px; margin-bottom:16px;}
  .panel h3{font-size:13.5px; margin:0 0 10px; font-weight:700; display:flex; align-items:center; gap:8px;}
  .panel .panel-note{font-size:11.5px; color:var(--text-muted); margin:-4px 0 12px;}

  .grid{display:grid; gap:14px;}
  .grid-9{grid-template-columns:repeat(auto-fit,minmax(190px,1fr));}
  .grid-7{grid-template-columns:repeat(auto-fit,minmax(200px,1fr));}
  .grid-3{grid-template-columns:repeat(3,1fr);}
  .grid-2{grid-template-columns:repeat(2,1fr);}
  .grid-4{grid-template-columns:repeat(4,1fr);}
  @media(max-width:1000px){.grid-3,.grid-4{grid-template-columns:repeat(2,1fr);}}
  @media(max-width:640px){.grid-2,.grid-3,.grid-4{grid-template-columns:1fr;}}

  /* ---------- KPI tiles ---------- */
  .kpi{
    background:var(--surface); border:1px solid var(--border); border-radius:12px;
    padding:14px 16px; display:flex; flex-direction:column; gap:6px; position:relative; overflow:hidden;
  }
  .kpi .bar{position:absolute; left:0; top:0; bottom:0; width:3px;}
  .kpi.s-good .bar{background:var(--good);} .kpi.s-warn .bar{background:var(--warn);} .kpi.s-bad .bar{background:var(--bad);} .kpi.s-neutral .bar{background:var(--accent);}
  .kpi .label{font-size:10.5px; text-transform:uppercase; letter-spacing:.05em; color:var(--text-muted); font-weight:700;}
  .kpi .value{font-family:'Sora',sans-serif; font-size:23px; font-weight:700; letter-spacing:-.01em;}
  .kpi .value.bad{color:var(--bad);}
  .kpi .sub{font-size:11px; color:var(--text-secondary); display:flex; align-items:center; gap:6px;}
  .oc-kpis .kpi .sub{display:block;}
  .pill{display:inline-flex; align-items:center; gap:5px; font-size:10.5px; font-weight:700; padding:2px 8px; border-radius:99px; letter-spacing:.02em;}
  .pill .pdot{width:6px;height:6px;border-radius:50%;}
  .pill.good{background:var(--good-soft); color:var(--good);} .pill.good .pdot{background:var(--good);}
  .pill.warn{background:var(--warn-soft); color:var(--warn);} .pill.warn .pdot{background:var(--warn);}
  .pill.bad{background:var(--bad-soft); color:var(--bad);} .pill.bad .pdot{background:var(--bad);}

  .company-card{background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:16px; display:flex; flex-direction:column; gap:10px;}
  .company-card .chead{display:flex; align-items:center; justify-content:space-between;}
  .company-card .cname{display:flex; align-items:center; gap:8px; font-weight:700; font-size:13.5px;}
  .company-card .swatch{width:10px;height:10px;border-radius:3px;}
  .company-card .metrics{display:grid; grid-template-columns:1fr 1fr; gap:8px 14px;}
  .company-card .m{display:flex; flex-direction:column; gap:2px;}
  .company-card .m .k{font-size:10px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.04em;}
  .company-card .m .v{font-size:15px; font-weight:700; font-family:'Sora',sans-serif;}
  .company-card .m .v.bad{color:var(--bad);}

  /* ---------- charts ---------- */
  .chart-box{background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:14px 16px 8px;}
  .chart-box h4{margin:0 0 2px; font-size:12.5px; font-weight:700;}
  .chart-box .cnote{font-size:10.5px; color:var(--text-muted); margin-bottom:8px;}
  .chart-box canvas{max-width:100%;}
  .chart-wrap{position:relative; width:100%;}

  /* ---------- tables ---------- */
  .table-scroll{overflow-x:auto; border:1px solid var(--border); border-radius:12px;}
  table{width:100%; border-collapse:collapse; font-size:12.5px; min-width:560px;}
  thead th{
    background:var(--surface-2); color:var(--text-secondary); text-align:right; font-weight:700;
    font-size:10.5px; text-transform:uppercase; letter-spacing:.04em; padding:9px 12px; white-space:nowrap;
    border-bottom:1px solid var(--border-strong); position:sticky; top:0;
  }
  thead th:first-child, tbody td:first-child{text-align:left;}
  tbody td{padding:8px 12px; text-align:right; white-space:nowrap; border-bottom:1px solid var(--border); font-variant-numeric:tabular-nums; color:var(--text-primary);}
  tbody tr:last-child td{border-bottom:none;}
  tbody tr.total td{background:var(--surface-2); font-weight:700;}
  tbody tr:hover td{background:var(--row-hover);}
  td.neg, span.neg{color:var(--bad);}
  td.pos, span.pos{color:var(--good);}
  .tag{display:inline-block; font-size:10px; padding:1px 7px; border-radius:99px; background:var(--surface-3); color:var(--text-secondary); font-weight:600;}
  .rowlabel-co{display:inline-flex; align-items:center; gap:6px;}
  .rowlabel-co .sw{width:8px;height:8px;border-radius:2px;}

  /* ---------- misc ---------- */
  .flagline{border-left:3px solid var(--warn); background:var(--warn-soft); border-radius:0 8px 8px 0; padding:8px 12px; font-size:12px; margin-bottom:8px;}
  .flagline.bad{border-color:var(--bad); background:var(--bad-soft);}
  .callout{background:var(--surface-2); border:1px solid var(--border); border-radius:10px; padding:12px 14px; font-size:12px; color:var(--text-secondary);}
  .callout strong{color:var(--text-primary);}
  .legend-row{display:flex; flex-wrap:wrap; gap:8px 16px; font-size:11px; color:var(--text-secondary); align-items:center;}
  .legend-row .li{display:flex; align-items:center; gap:6px;}
  .legend-row .sw{width:9px;height:9px;border-radius:2px;}
  .placeholder-block{border:1.5px dashed var(--border-strong); border-radius:10px; padding:18px; text-align:center; color:var(--text-muted); font-size:12.5px;}
  .badge-dr{display:inline-block; font-size:10.5px; font-weight:700; padding:2px 9px; border-radius:99px; background:var(--surface-3); color:var(--text-muted); border:1px solid var(--border-strong);}
  .two-col{display:grid; grid-template-columns:1.1fr .9fr; gap:14px;}
  @media(max-width:900px){.two-col{grid-template-columns:1fr;}}
  .waterfall-grid{display:grid; grid-template-columns:repeat(2,1fr); gap:14px;}
  @media(max-width:900px){.waterfall-grid{grid-template-columns:1fr;}}
  .obs-grid{display:grid; gap:10px;}
  .obs-card{background:var(--surface); border:1px solid var(--border); border-left:3px solid var(--accent); border-radius:0 10px 10px 0; padding:12px 14px;}
  .obs-card .om{font-weight:700; font-size:13px; margin-bottom:2px;}
  .obs-card .ov{font-family:'Sora',sans-serif; font-weight:700; font-size:16px; margin-bottom:6px;}
  .obs-card .row{display:grid; grid-template-columns:120px 1fr; gap:6px; font-size:11.5px; color:var(--text-secondary); margin-top:3px;}
  .obs-card .row b{color:var(--text-muted); font-weight:600;}
  footer.dash-foot{padding:18px 24px 40px; color:var(--text-muted); font-size:11px; border-top:1px solid var(--border); margin-top:20px;}

  /* mobile top nav */
  .mobile-nav{display:none;}
  @media(max-width:880px){
    .sidebar{display:none;}
    .mobile-nav{
      display:flex; gap:6px; overflow-x:auto; padding:10px 14px; background:var(--sidebar);
      border-bottom:1px solid var(--border); position:sticky; top:0; z-index:30;
    }
    .mobile-nav button{all:unset; cursor:pointer; white-space:nowrap; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.03em; padding:7px 11px; border-radius:99px; background:var(--surface); color:var(--text-secondary);}
    .mobile-nav button.active{background:var(--accent-soft); color:var(--text-primary);}
    .topbar{top:44px;}
    .content{padding:16px;}
  }
  body{background:var(--bg);}

  /* ---------- data entry / "Add Month" panel ---------- */
  .de-field{display:flex; flex-direction:column; gap:4px;}
  .de-field label{font-size:10px; text-transform:uppercase; letter-spacing:.05em; color:var(--text-muted); font-weight:700;}
  .de-row{display:flex; flex-wrap:wrap; gap:12px; margin-bottom:12px;}
  input[type=text], input[type=number], input[type=month], select.de-select, textarea.de-textarea{
    background:var(--surface-2); color:var(--text-primary); border:1px solid var(--border-strong);
    border-radius:7px; padding:7px 9px; font-size:12.5px; font-family:inherit; min-width:0;
  }
  textarea.de-textarea{font-family:ui-monospace,Menlo,Consolas,monospace; font-size:11.5px; resize:vertical;}
  input[type=text]:disabled, input[type=number]:disabled, select.de-select:disabled{opacity:.55; cursor:not-allowed;}
  .btn{all:unset; cursor:pointer; display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:700;
    letter-spacing:.02em; padding:8px 14px; border-radius:8px; border:1px solid var(--border-strong); color:var(--text-primary); background:var(--surface-2);}
  .btn:hover{background:var(--surface-3);}
  .btn-primary{background:var(--accent); border-color:var(--accent); color:#fff;}
  .btn-primary:hover{background:#3a7ddb;}
  .btn-primary:disabled{opacity:.5; cursor:not-allowed;}
  .btn-ghost{background:transparent;}
  .btn-danger{color:var(--bad); border-color:rgba(198,47,47,0.4);}
  .btn-sm{padding:5px 10px; font-size:11px; border-radius:6px;}
  .line-item-row{display:grid; grid-template-columns:1.6fr 1fr auto auto auto; gap:8px; align-items:center; margin-bottom:6px;}
  @media(max-width:760px){.line-item-row{grid-template-columns:1fr 1fr;}}
  .line-item-row .chk{display:flex; align-items:center; gap:4px; font-size:10.5px; color:var(--text-muted); white-space:nowrap;}
  .de-tabs{display:flex; gap:6px; margin-bottom:14px;}
  .de-tab{all:unset; cursor:pointer; font-size:11.5px; font-weight:700; text-transform:uppercase; letter-spacing:.03em; padding:7px 13px; border-radius:99px; background:var(--surface-2); color:var(--text-secondary); border:1px solid var(--border);}
  .de-tab.active{background:var(--accent-soft); color:var(--text-primary); border-color:var(--accent);}
  .de-panel{display:none;}
  .de-panel.active{display:block;}
  .company-tabs{display:flex; gap:6px; margin-bottom:14px; flex-wrap:wrap;}
  .status-line{display:flex; align-items:center; gap:10px; padding:9px 12px; border-radius:8px; background:var(--surface-2); border:1px solid var(--border); font-size:12px; margin-bottom:6px;}
  .status-line .sw{width:8px;height:8px;border-radius:50%; flex:0 0 auto;}
  .save-msg{font-size:12px; margin-top:10px; padding:9px 12px; border-radius:8px;}
  .save-msg.ok{background:var(--good-soft); color:var(--good);}
  .save-msg.err{background:var(--bad-soft); color:var(--bad);}
