  :root {
    --bg: #f1f4f7;
    --panel: #ffffff;
    --panel-2: #f1f4f7;
    --border: #d8dee5;
    --fg: #1f2937;
    --muted: #6b7280;
    --good: #16a34a;
    --bad: #ef4444;
    --accent: #16a34a;
    --accent-dim: #dcfce7;
    --warn: #a16207;
    --warn-dim: #fef3c7;
    --bad-dim: #fee2e2;
  }
  * { box-sizing: border-box; }
  body { margin: 0; font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--fg); }
  header { padding: 0.9rem 1.25rem; background: var(--panel); border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
  h1 { margin: 0; font-size: 1.1rem; font-weight: 600; }
  nav { display: flex; gap: 0.5rem; }
  nav a { color: var(--muted); text-decoration: none; font-size: 0.9rem; padding: 0.25rem 0.6rem; border-radius: 6px; }
  nav a.active { color: var(--accent); background: var(--accent-dim); font-weight: 600; }

  .sub-nav { display: flex; gap: 0.25rem; padding: 0.55rem 1.25rem 0; border-bottom: 1px solid var(--border); background: var(--panel); }
  .sub-nav a { color: var(--muted); text-decoration: none; font-size: 0.88rem; padding: 0.5rem 0.85rem; border-radius: 8px 8px 0 0; border: 1px solid transparent; border-bottom: none; margin-bottom: -1px; }
  .sub-nav a:hover { color: var(--fg); }
  .sub-nav a.active { color: var(--accent); background: var(--bg); border-color: var(--border); font-weight: 600; }

  form { display: flex; gap: 0.5rem; align-items: center; }
  label { color: var(--muted); font-size: 0.85rem; }
  input[type=date] { background: var(--panel-2); color: var(--fg); border: 1px solid var(--border); border-radius: 6px; padding: 0.4rem 0.55rem; font: inherit; }
  button { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-dim); border-radius: 6px; padding: 0.4rem 0.8rem; font: inherit; cursor: pointer; font-weight: 600; }

  main { padding: 1rem 1.25rem 1.25rem; }

  .kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.75rem; }
  .kpi { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.1rem; }
  .kpi .label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; }
  .kpi .val { font-size: 2.4rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--good); margin-top: 0.25rem; line-height: 1.05; }

  .panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.1rem; margin-top: 0.9rem; position: relative; }
  .panel .people-count {
    position: absolute;
    top: 0.85rem;
    right: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--panel-2);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 999px;
  }
  .panel .people-count::before {
    content: "";
    width: 11px;
    height: 11px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/><circle cx='9' cy='7' r='4'/><path d='M22 21v-2a4 4 0 0 0-3-3.87'/><path d='M16 3.13a4 4 0 0 1 0 7.75'/></svg>") center/contain no-repeat;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/><circle cx='9' cy='7' r='4'/><path d='M22 21v-2a4 4 0 0 0-3-3.87'/><path d='M16 3.13a4 4 0 0 1 0 7.75'/></svg>") center/contain no-repeat;
  }
  .panel h3 { margin: 0 0 0.75rem; font-size: 0.95rem; font-weight: 600; }
  .panel .sub { font-size: 0.7rem; color: var(--muted); margin-left: 0.4rem; font-weight: 400; }

  .bar-row { display: grid; grid-template-columns: 9rem 1fr 5.5rem; align-items: center; gap: 0.75rem; padding: 0.35rem 0; }
  .bar-row .name { font-size: 0.88rem; display: flex; flex-direction: column; line-height: 1.15; }
  .name-primary  { font-weight: 500; }
  .name-secondary{ color: var(--muted); font-size: 0.78em; }
  .name-secondary em { font-style: italic; }
  .bar-row .val  { font-size: 0.92rem; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
  .bar-row .val .pct { color: var(--muted); font-weight: 400; font-size: 0.85em; margin-left: 0.1em; }
  .bar-track { height: 22px; background: var(--panel-2); border-radius: 4px; overflow: hidden; position: relative; }
  .bar-fill  { height: 100%; background: var(--good); border-radius: 4px; }

  .stacked-track { height: 22px; display: flex; border-radius: 4px; overflow: hidden; background: var(--panel-2); }
  .stacked-track .good { background: var(--good); height: 100%; }
  .stacked-track .bad  { background: var(--bad);  height: 100%; }

  .empty-state { color: var(--muted); font-style: italic; padding: 0.5rem 0; font-size: 0.9rem; }
  .empty-state a { color: var(--accent); }
  .footer { color: var(--muted); font-size: 0.75rem; margin-top: 1.5rem; text-align: center; padding-bottom: 1rem; }

  /* ---- Cumulative progress widget ---- */
  .cum-progress {
    display: flex;
    flex-direction: column;
    height: 100%;
    font-size: 0.78rem;
    color: var(--fg);
  }
  .cum-progress .legend {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    justify-content: center;
    padding: 0 0 0.4rem 0;
    color: var(--muted);
    font-size: 0.72rem;
  }
  .cum-progress .legend .swatch-line {
    display: inline-block;
    width: 18px;
    height: 0;
    border-top: 1.5px solid var(--muted);
    margin-right: 4px;
    vertical-align: middle;
  }
  .cum-progress .legend .swatch-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--fg);
    margin-right: 4px;
    vertical-align: middle;
  }
  .cum-progress .plot {
    position: relative;
    flex: 1 1 auto;
    min-height: 220px;
    margin-top: 14px;
    border-bottom: 1px solid var(--border);
  }
  .cum-progress .bars {
    display: grid;
    grid-template-columns: repeat(var(--n-cols, 24), 1fr);
    gap: 2px;
    height: 100%;
    align-items: end;
  }
  .cum-progress .col {
    position: relative;
    height: 100%;
    display: flex;
    align-items: end;
  }
  .cum-progress .bar {
    width: 100%;
    background: var(--good);
    border-radius: 2px 2px 0 0;
    min-height: 1px;
    position: relative;
  }
  .cum-progress .col.miss .bar { background: var(--bad); }
  .cum-progress .col.in-progress .bar { opacity: 0.7; }
  .cum-progress .bar-label {
    position: absolute;
    top: 2px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: #fff;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    line-height: 1;
  }
  .cum-progress .target-line {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
  }
  .cum-progress .target-line svg {
    width: 100%;
    height: 100%;
    overflow: visible;
  }
  .cum-progress .target-line polyline {
    fill: none;
    stroke: var(--muted);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
  }
  .cum-progress .target-line .end-label {
    font-size: 9px;
    fill: var(--muted);
  }
  .cum-progress .x-ticks {
    display: grid;
    grid-template-columns: repeat(var(--n-cols, 24), 1fr);
    gap: 2px;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.65rem;
  }
  .cum-progress .x-ticks span {
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
  }

  /* Intermediate breakpoint: tighten padding + KPI font on 13" laptops
     (1280-1400px). */
  @media (max-width: 1400px) {
    header { padding: 0.7rem 0.9rem; }
    .sub-nav { padding-left: 0.9rem; padding-right: 0.9rem; }
    main { padding: 0.75rem 0.9rem 0.9rem; }
    .kpi { padding: 0.75rem 0.85rem; }
    .kpi .val { font-size: clamp(1.6rem, 2.6vw, 2.4rem); }
    .panel { padding: 0.75rem 0.85rem; }
    .bar-row { grid-template-columns: 8rem 1fr 5rem; gap: 0.5rem; }
  }

  /* Inline-assign popover (mirrors recycling.css). Lets a "(no assignment)"
     bar become a click-to-attribute button on the today view. */
  .no-assign-btn {
    background: var(--warn-dim); color: var(--warn);
    border: 1px solid var(--warn); border-radius: 4px;
    padding: 0 0.4rem; font: inherit; font-size: 0.7rem; font-weight: 700;
    cursor: pointer; align-self: flex-start;
  }
  .no-assign-btn:hover { background: var(--warn); color: white; }
  .assign-popover {
    background: var(--panel); color: var(--fg);
    border: 1px solid var(--border); border-radius: 8px;
    padding: 0.5rem 0.6rem; box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    z-index: 9500;
    display: inline-flex; gap: 0.4rem; align-items: center; flex-wrap: wrap;
    max-width: min(360px, 90vw);
  }
  .assign-popover .assign-pick {
    background: var(--panel-2); color: var(--fg);
    border: 1px solid var(--border); border-radius: 6px;
    padding: 0.25rem 0.4rem; font: inherit; font-size: 0.85rem;
    min-width: 10rem;
  }
  .assign-popover .assign-save {
    background: var(--accent); color: white; border: 1px solid var(--accent);
    border-radius: 6px; padding: 0.25rem 0.7rem; font: inherit; font-weight: 600; cursor: pointer;
  }
  .assign-popover .assign-save:disabled { opacity: 0.6; cursor: not-allowed; }
  .assign-popover .assign-status { font-size: 0.8rem; color: var(--accent); }
