:root {
  --concave-radius: 16px;
}

#overview .mini-grid {
  width: fit-content;
  max-width: 100%;
  margin-inline-start: auto;
  grid-template-columns: repeat(3, auto);
  gap: clamp(8px, 3vw, 14px);
  padding-top: 8px;
  text-align: end;
}

/* Without shape(), keep the v3 card silhouettes and the compact KPI row. */
@supports (clip-path: shape(from 0 0, line to 100% 0, close)) {
  #overview {
    --step-depth: 44px;
    --step-edge: clamp(88px, 29vw, 118px);
    --step-gap: 8px;
    --shoulder-edge: calc(var(--step-edge) - var(--step-gap));
  }

  #overview .hello-card {
    margin-bottom: 0;
    box-shadow: none;
  }

  #overview .hello-card::before {
    --c: var(--concave-radius);
    --notch-top: calc(100% - var(--step-depth));
    clip-path: shape(
      from 0 0,
      hline to calc(100% - 61px),
      vline to calc(52px - var(--c)),
      arc to calc(100% - 61px + var(--c)) 52px of var(--c) ccw,
      hline to 100%,
      vline to 100%,
      hline to calc(var(--step-edge) + var(--c)),
      arc to var(--step-edge) calc(100% - var(--c)) of var(--c) cw,
      vline to calc(var(--notch-top) + var(--c)),
      arc to calc(var(--step-edge) - var(--c)) var(--notch-top) of var(--c) ccw,
      hline to var(--c),
      arc to 0 calc(var(--notch-top) - var(--c)) of var(--c) cw,
      close
    );
  }

  #overview .mini-grid {
    max-width: calc(100% + 14px - var(--step-edge));
  }

  #overview .weeks-card {
    position: relative;
    isolation: isolate;
    margin-top: calc(var(--step-gap) - var(--step-depth));
    padding-top: calc(14px + var(--step-depth));
    background: none;
    border-color: transparent;
    box-shadow: none;
    pointer-events: none;
  }

  #overview .weeks-card::before,
  #overview .weeks-card::after {
    --inset: 0px;
    --outer-radius: calc(var(--r) - var(--inset));
    /* Concentric arcs keep the air gap constant through both turns. */
    --tip-radius: calc(var(--concave-radius) - var(--step-gap) - var(--inset));
    --base-radius: calc(var(--concave-radius) + var(--step-gap) + var(--inset));
    --tip-edge: calc(var(--shoulder-edge) - 2 * var(--inset));
    content: '';
    position: absolute;
    inset: calc(var(--inset) - 1px);
    z-index: -1;
    clip-path: shape(
      from 0 var(--outer-radius),
      arc to var(--outer-radius) 0 of var(--outer-radius) cw,
      hline to calc(var(--tip-edge) - var(--tip-radius)),
      arc to var(--tip-edge) var(--tip-radius) of var(--tip-radius) cw,
      vline to calc(var(--step-depth) - var(--base-radius)),
      arc to calc(var(--tip-edge) + var(--base-radius)) var(--step-depth) of var(--base-radius) ccw,
      hline to calc(100% - var(--outer-radius)),
      arc to 100% calc(var(--step-depth) + var(--outer-radius)) of var(--outer-radius) cw,
      vline to calc(100% - var(--outer-radius)),
      arc to calc(100% - var(--outer-radius)) 100% of var(--outer-radius) cw,
      hline to var(--outer-radius),
      arc to 0 calc(100% - var(--outer-radius)) of var(--outer-radius) cw,
      close
    );
  }

  #overview .weeks-card::before {
    background: linear-gradient(var(--line), var(--line)), var(--panel);
  }

  #overview .weeks-card::after {
    --inset: 1px;
    background: var(--panel);
  }

  #overview .weeks-card .card-head {
    justify-content: flex-end;
  }

  #overview .weeks-card .card-title {
    position: absolute;
    top: 14px;
    left: 14px;
  }

  #overview .weeks-card > * {
    pointer-events: auto;
  }
}
